Skip to content

Commit

Permalink
Merge pull request #507 from MultinetInteractive/master
Browse files Browse the repository at this point in the history
v4.1.0
  • Loading branch information
itssimple authored Nov 6, 2023
2 parents 4ee01c7 + 11bb758 commit 664c0a9
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 23 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)


### Features

* Added shortcode [eduadmin-programmeinfo] with limited attributes ([b51a1b1](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/b51a1b102282dd7a23cd96aa9e459f4b116f3af0)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)


### Documentation

* **Shortcodes:** Added info about the new shortcode ([4fe4b80](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/4fe4b8015c095841a75cfd5348ece89bfb90944a)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)

## [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)


Expand Down
2 changes: 1 addition & 1 deletion PLUGIN-CHECKSUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f225964c4ebc0fdc2db8e51049e166ae
6e9d70ce9d2e8ae3adcc8c9e163fd75f
2 changes: 1 addition & 1 deletion eduadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin URI: https://www.eduadmin.se
* Description: EduAdmin plugin to allow visitors to book courses at your website
* Tags: booking, participants, courses, events, eduadmin, lega online
* Version: 4.0.0
* Version: 4.1.0
* GitHub Plugin URI: multinetinteractive/eduadmin-wordpress
* GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress
* Requires at least: 5.8
Expand Down
146 changes: 146 additions & 0 deletions includes/edu-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,151 @@ function eduadmin_get_booking_view( $attributes ) {
return $str;
}

function eduadmin_get_programmeinfo( $attributes ) {
$t = EDU()->start_timer( __METHOD__ );
global $wp_query;
$attributes = shortcode_atts(
array(
'programmeid' => null,
'programmename' => null,
'programmepublicname' => null,
'programmeimage' => null,
'programmeimagetext' => null,
'courseprice' => null,
'eventprice' => null,
'programmedescriptionshort' => null,
'programmedescription' => null,
'programmegoal' => null,
'programmetarget' => null,
'programmeprerequisites' => null,
'courseafter' => null,
'programmequote' => null,
'courseeventlist' => null,
'showmore' => null,
'courseattributeid' => null,
'courseattributehasvalue' => null,
'courseeventlistfiltercity' => null,
'pagetitlejs' => null,
'bookurl' => null,
'courseinquiryurl' => null,
'order' => null,
'orderby' => null,
'ondemand' => false,
'allcourses' => false,
),
normalize_empty_atts( $attributes ),
'eduadmin-programmeinfo'
);
$api_key = EDU()->get_option( 'eduadmin-api-key' );

$ret_str = '';

if ( empty( $api_key ) ) {
EDU()->stop_timer( $t );

return 'Please complete the configuration: <a href="' . admin_url() . 'admin.php?page=eduadmin-settings">EduAdmin - Api Authentication</a>';
}

if ( empty( $attributes['programmeid'] ) || str_replace( array(
'&#8221;',
'&#8243;',
), '', $attributes['programmeid'] ) <= 0 ) {
if ( isset( $wp_query->query_vars['edu_programme'] ) ) {
$exploded_id = explode( '_', $wp_query->query_vars['edu_programme'] )[1];
$programme_id = $exploded_id;
} else {
EDU()->stop_timer( $t );

return 'Missing programmeid in attributes';
}
} else {
$programme_id = str_replace(
array(
'&#8221;',
'&#8243;',
),
'',
$attributes['programmeid']
);
}

if ( ! empty( $programme_id ) ) {
$programme = EDUAPI()->OData->Programmes->GetItem(
$programme_id,
null,
'ProgrammeStarts(' .
'$filter=' .
'HasPublicPriceName' .
' and StatusId eq 1' .
' and (ApplicationOpenDate le ' . date_i18n( 'c' ) . ' or ApplicationOpenDate eq null)' .
' and StartDate ge ' . date_i18n( 'c' ) .
';' .
'$orderby=' .
'StartDate' .
';' .
'$expand=' .
'Courses($orderby=ProgrammeCourseSortIndex),Events($expand=EventDates($orderby=StartDate;$select=StartDate,EndDate;);$orderby=ProgrammeCourseSortIndex),PriceNames' .
'),PriceNames'
);

if ( isset( $programme["@error"] ) ) {
EDU()->stop_timer( $t );

return $programme["@error"];
}

if ( isset( $attributes['programmename'] ) ) {
$ret_str .= $programme['InternaProgrammeName'];
}

if ( isset( $attributes['programmepublicname'] ) ) {
$ret_str .= $programme['ProgrammeName'];
}

if ( isset( $attributes['programmeimage'] ) ) {
$ret_str .= $programme['ImageUrl'];
}

if ( isset( $attributes['programmeimagetext'] ) ) {
$ret_str .= $programme['ImageText'];
}

if ( isset( $attributes['programmedescriptionshort'] ) ) {
$ret_str .= $programme['DescriptionShort'];
}

if ( isset( $attributes['programmedescription'] ) ) {
$ret_str .= $programme['Description'];
}

if ( isset( $attributes['programmequote'] ) ) {
$ret_str .= $programme['Quote'];
}

if ( isset( $attributes['programmegoal'] ) ) {
$ret_str .= $programme['CourseGoal'];
}

if ( isset( $attributes['programmetarget'] ) ) {
$ret_str .= $programme['TargetGroup'];
}

if ( isset( $attributes['programmeprerequisites'] ) ) {
$ret_str .= $programme['Prerequisites'];
}

if ( isset( $attributes['courseafter'] ) ) {
$ret_str .= $programme['CourseAfter'];
}

$ret_str .= print_r( $programme, true );
}

EDU()->stop_timer( $t );

return $ret_str;
}

function eduadmin_get_detailinfo( $attributes ) {
$t = EDU()->start_timer( __METHOD__ );
global $wp_query;
Expand Down Expand Up @@ -819,4 +964,5 @@ function eduadmin_get_programme_booking( $attributes ) {
add_shortcode( 'eduadmin-programme-list', 'eduadmin_get_programme_list' );
add_shortcode( 'eduadmin-programme-detail', 'eduadmin_get_programme_details' );
add_shortcode( 'eduadmin-programme-book', 'eduadmin_get_programme_booking' );
add_shortcode( 'eduadmin-programmeinfo', 'eduadmin_get_programmeinfo' );
}
36 changes: 32 additions & 4 deletions new_website/docs/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: shortcodes
title: Shortcodes
sidebar_label: Shortcodes
---

Here we have a complete reference guide to all shortcodes available in the plugin, with all attributes.

* * *
Expand Down Expand Up @@ -229,8 +230,11 @@ results from the API.

You can set the `mode`-attribute to either `event` or `course`, to make the list show events or course templates.

The `orderby`-attribute gives you the possibility to change what field the list should be ordered by. The available fields can be found at https://api.eduadmin.se/?page=read#operation/GetEvents or https://api.eduadmin.se/?page=read#operation/GetCourseTemplates depending on what `mode`-attribute you are using, either `event` or `course`,
and the `order`-attribute takes the values ASC or DESC.
The `orderby`-attribute gives you the possibility to change what field the list should be ordered by. The available
fields can be found at https://api.eduadmin.se/?page=read#operation/GetEvents
or https://api.eduadmin.se/?page=read#operation/GetCourseTemplates depending on what `mode`-attribute you are using,
either `event` or `course`,
and the `order`-attribute takes the values ASC or DESC.

`showsearch` will force the search bar to be visible.

Expand Down Expand Up @@ -327,8 +331,7 @@ And if you want to create a specific page for a programme, you can also use the

### `[eduadmin-programme-list]`

As with the normal list view, this view lists the available programmes you have created in [**
EduAdmin**](https://www.eduadmin.se).
As with the normal list view, this view lists the available programmes you have created in [**EduAdmin**](https://www.eduadmin.se).

| Attribute | Value type | Default value |
|:----------|:----------:|:-------------:|
Expand All @@ -337,3 +340,28 @@ EduAdmin**](https://www.eduadmin.se).
And if you want to filter this list, you can apply the `category`-attribute.

* * *

### `[eduadmin-programmeinfo]`

This shortcode is used when you want to create your own custom template [**programme view**](#eduadmin-programme-detail).

:::note

We will add more attributes to this shortcode in the future.

:::

| Attribute | Value type | Default value |
|:--------------------------|:----------:|:-------------:|
| programmeid | integer | _null_ |
| programmename | boolean | null |
| programmepublicname | boolean | null |
| programmeimage | boolean | null |
| programmeimagetext | boolean | null |
| programmedescriptionshort | boolean | null |
| programmedescription | boolean | null |
| programmegoal | boolean | null |
| programmetarget | boolean | null |
| programmeprerequisites | boolean | null |
| courseafter | boolean | null |
| programmequote | boolean | null |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eduadmin-wordpress-plugin",
"private": true,
"version": "4.0.0",
"version": "4.1.0",
"repository": "https://github.com/MultinetInteractive/EduAdmin-WordPress.git",
"author": "Chris Gårdenberg <[email protected]>",
"license": "MIT",
Expand Down
21 changes: 13 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# EduAdmin Booking
- Requires at least: 5.8
- Tested up to: 6.4
- Stable tag: 4.0.0
- Stable tag: 4.1.0
- Requires PHP: 7.0
- License: GPL3
- License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
Expand Down Expand Up @@ -40,6 +40,18 @@ If you notice that your API key doesn't work any more, you have to contact us.

The full changelog available on [GitHub](https://github.com/MultinetInteractive/EduAdmin-WordPress/blob/production/CHANGELOG.md)

### [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)


#### Features

* Added shortcode [eduadmin-programmeinfo] with limited attributes ([b51a1b1](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/b51a1b102282dd7a23cd96aa9e459f4b116f3af0)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)


#### Documentation

* **Shortcodes:** Added info about the new shortcode ([4fe4b80](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/4fe4b8015c095841a75cfd5348ece89bfb90944a)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)

### [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)


Expand Down Expand Up @@ -68,12 +80,5 @@ were not working in the correct way.

* List number of free spots on programme list ([38529a8](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/38529a86da27169961bb53597a0f6069c4721d1c))

### [3.10.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.9.2...v3.10.0) (2023-09-29)


#### Features

* Programme starts now show number of spots left (according to settings) ([0117df4](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/0117df408a557998bd04d467720e51cef331612a)), closes [#498](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/498)



21 changes: 13 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: mnchga
Tags: booking, participants, courses, events, eduadmin, lega online
Requires at least: 5.8
Tested up to: 6.4
Stable tag: 4.0.0
Stable tag: 4.1.0
Requires PHP: 7.0
License: GPL3
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
Expand Down Expand Up @@ -45,6 +45,18 @@ If you notice that your API key doesn't work any more, you have to contact us.

The full changelog available on [GitHub](https://github.com/MultinetInteractive/EduAdmin-WordPress/blob/production/CHANGELOG.md)

### [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)


#### Features

* Added shortcode [eduadmin-programmeinfo] with limited attributes ([b51a1b1](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/b51a1b102282dd7a23cd96aa9e459f4b116f3af0)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)


#### Documentation

* **Shortcodes:** Added info about the new shortcode ([4fe4b80](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/4fe4b8015c095841a75cfd5348ece89bfb90944a)), closes [#506](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/506)

### [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)


Expand Down Expand Up @@ -73,12 +85,5 @@ were not working in the correct way.

* List number of free spots on programme list ([38529a8](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/38529a86da27169961bb53597a0f6069c4721d1c))

### [3.10.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.9.2...v3.10.0) (2023-09-29)


#### Features

* Programme starts now show number of spots left (according to settings) ([0117df4](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/0117df408a557998bd04d467720e51cef331612a)), closes [#498](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/498)



0 comments on commit 664c0a9

Please sign in to comment.