Skip to content

Commit 664c0a9

Browse files
authored
Merge pull request #507 from MultinetInteractive/master
v4.1.0
2 parents 4ee01c7 + 11bb758 commit 664c0a9

8 files changed

Lines changed: 219 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
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.
44

5+
## [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)
6+
7+
8+
### Features
9+
10+
* 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)
11+
12+
13+
### Documentation
14+
15+
* **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)
16+
517
## [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)
618

719

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f225964c4ebc0fdc2db8e51049e166ae
1+
6e9d70ce9d2e8ae3adcc8c9e163fd75f

eduadmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Plugin URI: https://www.eduadmin.se
1010
* Description: EduAdmin plugin to allow visitors to book courses at your website
1111
* Tags: booking, participants, courses, events, eduadmin, lega online
12-
* Version: 4.0.0
12+
* Version: 4.1.0
1313
* GitHub Plugin URI: multinetinteractive/eduadmin-wordpress
1414
* GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress
1515
* Requires at least: 5.8

includes/edu-shortcodes.php

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,151 @@ function eduadmin_get_booking_view( $attributes ) {
207207
return $str;
208208
}
209209

210+
function eduadmin_get_programmeinfo( $attributes ) {
211+
$t = EDU()->start_timer( __METHOD__ );
212+
global $wp_query;
213+
$attributes = shortcode_atts(
214+
array(
215+
'programmeid' => null,
216+
'programmename' => null,
217+
'programmepublicname' => null,
218+
'programmeimage' => null,
219+
'programmeimagetext' => null,
220+
'courseprice' => null,
221+
'eventprice' => null,
222+
'programmedescriptionshort' => null,
223+
'programmedescription' => null,
224+
'programmegoal' => null,
225+
'programmetarget' => null,
226+
'programmeprerequisites' => null,
227+
'courseafter' => null,
228+
'programmequote' => null,
229+
'courseeventlist' => null,
230+
'showmore' => null,
231+
'courseattributeid' => null,
232+
'courseattributehasvalue' => null,
233+
'courseeventlistfiltercity' => null,
234+
'pagetitlejs' => null,
235+
'bookurl' => null,
236+
'courseinquiryurl' => null,
237+
'order' => null,
238+
'orderby' => null,
239+
'ondemand' => false,
240+
'allcourses' => false,
241+
),
242+
normalize_empty_atts( $attributes ),
243+
'eduadmin-programmeinfo'
244+
);
245+
$api_key = EDU()->get_option( 'eduadmin-api-key' );
246+
247+
$ret_str = '';
248+
249+
if ( empty( $api_key ) ) {
250+
EDU()->stop_timer( $t );
251+
252+
return 'Please complete the configuration: <a href="' . admin_url() . 'admin.php?page=eduadmin-settings">EduAdmin - Api Authentication</a>';
253+
}
254+
255+
if ( empty( $attributes['programmeid'] ) || str_replace( array(
256+
'&#8221;',
257+
'&#8243;',
258+
), '', $attributes['programmeid'] ) <= 0 ) {
259+
if ( isset( $wp_query->query_vars['edu_programme'] ) ) {
260+
$exploded_id = explode( '_', $wp_query->query_vars['edu_programme'] )[1];
261+
$programme_id = $exploded_id;
262+
} else {
263+
EDU()->stop_timer( $t );
264+
265+
return 'Missing programmeid in attributes';
266+
}
267+
} else {
268+
$programme_id = str_replace(
269+
array(
270+
'&#8221;',
271+
'&#8243;',
272+
),
273+
'',
274+
$attributes['programmeid']
275+
);
276+
}
277+
278+
if ( ! empty( $programme_id ) ) {
279+
$programme = EDUAPI()->OData->Programmes->GetItem(
280+
$programme_id,
281+
null,
282+
'ProgrammeStarts(' .
283+
'$filter=' .
284+
'HasPublicPriceName' .
285+
' and StatusId eq 1' .
286+
' and (ApplicationOpenDate le ' . date_i18n( 'c' ) . ' or ApplicationOpenDate eq null)' .
287+
' and StartDate ge ' . date_i18n( 'c' ) .
288+
';' .
289+
'$orderby=' .
290+
'StartDate' .
291+
';' .
292+
'$expand=' .
293+
'Courses($orderby=ProgrammeCourseSortIndex),Events($expand=EventDates($orderby=StartDate;$select=StartDate,EndDate;);$orderby=ProgrammeCourseSortIndex),PriceNames' .
294+
'),PriceNames'
295+
);
296+
297+
if ( isset( $programme["@error"] ) ) {
298+
EDU()->stop_timer( $t );
299+
300+
return $programme["@error"];
301+
}
302+
303+
if ( isset( $attributes['programmename'] ) ) {
304+
$ret_str .= $programme['InternaProgrammeName'];
305+
}
306+
307+
if ( isset( $attributes['programmepublicname'] ) ) {
308+
$ret_str .= $programme['ProgrammeName'];
309+
}
310+
311+
if ( isset( $attributes['programmeimage'] ) ) {
312+
$ret_str .= $programme['ImageUrl'];
313+
}
314+
315+
if ( isset( $attributes['programmeimagetext'] ) ) {
316+
$ret_str .= $programme['ImageText'];
317+
}
318+
319+
if ( isset( $attributes['programmedescriptionshort'] ) ) {
320+
$ret_str .= $programme['DescriptionShort'];
321+
}
322+
323+
if ( isset( $attributes['programmedescription'] ) ) {
324+
$ret_str .= $programme['Description'];
325+
}
326+
327+
if ( isset( $attributes['programmequote'] ) ) {
328+
$ret_str .= $programme['Quote'];
329+
}
330+
331+
if ( isset( $attributes['programmegoal'] ) ) {
332+
$ret_str .= $programme['CourseGoal'];
333+
}
334+
335+
if ( isset( $attributes['programmetarget'] ) ) {
336+
$ret_str .= $programme['TargetGroup'];
337+
}
338+
339+
if ( isset( $attributes['programmeprerequisites'] ) ) {
340+
$ret_str .= $programme['Prerequisites'];
341+
}
342+
343+
if ( isset( $attributes['courseafter'] ) ) {
344+
$ret_str .= $programme['CourseAfter'];
345+
}
346+
347+
$ret_str .= print_r( $programme, true );
348+
}
349+
350+
EDU()->stop_timer( $t );
351+
352+
return $ret_str;
353+
}
354+
210355
function eduadmin_get_detailinfo( $attributes ) {
211356
$t = EDU()->start_timer( __METHOD__ );
212357
global $wp_query;
@@ -819,4 +964,5 @@ function eduadmin_get_programme_booking( $attributes ) {
819964
add_shortcode( 'eduadmin-programme-list', 'eduadmin_get_programme_list' );
820965
add_shortcode( 'eduadmin-programme-detail', 'eduadmin_get_programme_details' );
821966
add_shortcode( 'eduadmin-programme-book', 'eduadmin_get_programme_booking' );
967+
add_shortcode( 'eduadmin-programmeinfo', 'eduadmin_get_programmeinfo' );
822968
}

new_website/docs/shortcodes.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ id: shortcodes
33
title: Shortcodes
44
sidebar_label: Shortcodes
55
---
6+
67
Here we have a complete reference guide to all shortcodes available in the plugin, with all attributes.
78

89
* * *
@@ -229,8 +230,11 @@ results from the API.
229230

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

232-
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`,
233-
and the `order`-attribute takes the values ASC or DESC.
233+
The `orderby`-attribute gives you the possibility to change what field the list should be ordered by. The available
234+
fields can be found at https://api.eduadmin.se/?page=read#operation/GetEvents
235+
or https://api.eduadmin.se/?page=read#operation/GetCourseTemplates depending on what `mode`-attribute you are using,
236+
either `event` or `course`,
237+
and the `order`-attribute takes the values ASC or DESC.
234238

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

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

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

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

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

339342
* * *
343+
344+
### `[eduadmin-programmeinfo]`
345+
346+
This shortcode is used when you want to create your own custom template [**programme view**](#eduadmin-programme-detail).
347+
348+
:::note
349+
350+
We will add more attributes to this shortcode in the future.
351+
352+
:::
353+
354+
| Attribute | Value type | Default value |
355+
|:--------------------------|:----------:|:-------------:|
356+
| programmeid | integer | _null_ |
357+
| programmename | boolean | null |
358+
| programmepublicname | boolean | null |
359+
| programmeimage | boolean | null |
360+
| programmeimagetext | boolean | null |
361+
| programmedescriptionshort | boolean | null |
362+
| programmedescription | boolean | null |
363+
| programmegoal | boolean | null |
364+
| programmetarget | boolean | null |
365+
| programmeprerequisites | boolean | null |
366+
| courseafter | boolean | null |
367+
| programmequote | boolean | null |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "eduadmin-wordpress-plugin",
33
"private": true,
4-
"version": "4.0.0",
4+
"version": "4.1.0",
55
"repository": "https://github.com/MultinetInteractive/EduAdmin-WordPress.git",
66
"author": "Chris Gårdenberg <chga@multinet.se>",
77
"license": "MIT",

readme.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# EduAdmin Booking
22
- Requires at least: 5.8
33
- Tested up to: 6.4
4-
- Stable tag: 4.0.0
4+
- Stable tag: 4.1.0
55
- Requires PHP: 7.0
66
- License: GPL3
77
- License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -40,6 +40,18 @@ If you notice that your API key doesn't work any more, you have to contact us.
4040

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

43+
### [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)
44+
45+
46+
#### Features
47+
48+
* 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)
49+
50+
51+
#### Documentation
52+
53+
* **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)
54+
4355
### [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)
4456

4557

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

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

71-
### [3.10.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.9.2...v3.10.0) (2023-09-29)
72-
73-
74-
#### Features
75-
76-
* 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)
77-
7883

7984

readme.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: mnchga
33
Tags: booking, participants, courses, events, eduadmin, lega online
44
Requires at least: 5.8
55
Tested up to: 6.4
6-
Stable tag: 4.0.0
6+
Stable tag: 4.1.0
77
Requires PHP: 7.0
88
License: GPL3
99
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -45,6 +45,18 @@ If you notice that your API key doesn't work any more, you have to contact us.
4545

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

48+
### [4.1.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.0.0...v4.1.0) (2023-11-06)
49+
50+
51+
#### Features
52+
53+
* 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)
54+
55+
56+
#### Documentation
57+
58+
* **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)
59+
4860
### [4.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.11.1...v4.0.0) (2023-10-10)
4961

5062

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

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

76-
### [3.10.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v3.9.2...v3.10.0) (2023-09-29)
77-
78-
79-
#### Features
80-
81-
* 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)
82-
8388

8489

0 commit comments

Comments
 (0)