diff --git a/classes/course_importer.php b/classes/course_importer.php index 2d50eff..05deb23 100644 --- a/classes/course_importer.php +++ b/classes/course_importer.php @@ -166,12 +166,16 @@ public static function import($backuptempdir, $courseid) { throw $e; } finally { // Reset some settings. + $fullname = $course->fullname; + $shortname = $course->shortname; $summary = $course->summary; $summaryformat = $course->summaryformat; $enddate = $course->enddate; $timecreated = $course->timecreated; // Reload course. $course = $DB->get_record('course', ['id' => $courseid]); + $course->fullname = $fullname; + $course->shortname = $shortname; $course->summary = $summary; $course->summaryformat = $summaryformat; $course->enddate = $enddate; diff --git a/classes/output/course_template_list.php b/classes/output/course_template_list.php index edfa27e..dd8a5d1 100644 --- a/classes/output/course_template_list.php +++ b/classes/output/course_template_list.php @@ -140,6 +140,7 @@ public function get_templates() { 'format_kickstart', 'description', $template->id), $template->descriptionformat); + $template->title = format_string($template->title); $tags = []; foreach (\core_tag_tag::get_item_tags('format_kickstart', 'format_kickstart_template', $template->id) as $tag) { $tags[] = '#' . $tag->get_display_name(false); @@ -152,7 +153,7 @@ public function get_templates() { if (!$template->courseformat) { $templatecount++; } - if ($limit > 0 && $templatecount >= $limit) { + if ($limit > 0 && $templatecount > $limit) { break; } if (format_kickstart_has_pro()) { diff --git a/classes/template_table.php b/classes/template_table.php index 98211a8..9ab74b9 100644 --- a/classes/template_table.php +++ b/classes/template_table.php @@ -37,6 +37,16 @@ */ class template_table extends \table_sql { + /** + * @var int + */ + public $totaltemplates; + + /** + * @var int + */ + public $cnt; + /** * Setup table. * @@ -77,6 +87,13 @@ public function __construct() { $this->define_headers($headers); } + /** + * Generate title. + */ + public function col_title($data) { + return format_string($data->title); + } + /** * Generate tag list. * diff --git a/styles.css b/styles.css index 49f6af4..7a79c21 100644 --- a/styles.css +++ b/styles.css @@ -130,6 +130,11 @@ body.format-kickstart .form-control .fa-search { .format-kickstart .course-content > .card .card-body { text-align: right; } +.format-kickstart .course-content > .card .card-body > .img-responsive + .card-title { + text-align: center; + float: none; + margin: 1rem 0; +} .format-kickstart .course-content > .card .card-body .card-title { text-align: left; margin-top: 5px; diff --git a/template.php b/template.php index 7c34dff..852e189 100644 --- a/template.php +++ b/template.php @@ -173,9 +173,9 @@ 'templatebackimg', $id, $templatebgoptions); $template->templatebackimg = $drafteditor; } - $template->cohortids = json_decode($template->cohortids, true); - $template->categoryids = json_decode($template->categoryids, true); - $template->roleids = json_decode($template->roleids, true); + $template->cohortids = isset($template->cohortids) ? json_decode($template->cohortids, true) : []; + $template->categoryids = isset($template->categoryids) ? json_decode($template->categoryids, true) : []; + $template->roleids = isset($template->roleids) ? json_decode($template->roleids, true) : []; } // Check the template is normal or course format. if (!$template->courseformat) { diff --git a/templates/import_course_list.mustache b/templates/import_course_list.mustache index a70c8e4..1465741 100644 --- a/templates/import_course_list.mustache +++ b/templates/import_course_list.mustache @@ -59,7 +59,7 @@ {{#courses}}
-
{{fullname}}
+
{{{fullname}}}
{{#str}}importcourse, format_kickstart{{/str}} {{#str}}gotocourse, format_kickstart{{/str}}
diff --git a/version.php b/version.php index ba1612a..4e8d2fd 100644 --- a/version.php +++ b/version.php @@ -18,15 +18,15 @@ * Version details * * @package format_kickstart - * @copyright 2023 bdecent gmbh + * @copyright 2021 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023071201; // The current plugin version (Date: YYYYMMDDXX). -$plugin->requires = 2022041900; // Requires this Moodle version. -$plugin->release = 'Version 1.3'; +$plugin->version = 2023112300; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2022030300; // Requires this Moodle version. +$plugin->release = 'Version 1.2'; $plugin->component = 'format_kickstart'; // Full name of the plugin (used for diagnostics). -$plugin->supported = [40, 402]; +$plugin->supported = [40, 40]; $plugin->maturity = MATURITY_STABLE;