Skip to content

Commit

Permalink
Fixed the kickstart issues and supported for the Moodle-4.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithy1anand committed Nov 24, 2023
1 parent 35222e2 commit 09fc029
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
database: 'mariadb'
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_403_STABLE'
database: 'mariadb'
- php: '8.1'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: 'mariadb'
Expand Down
4 changes: 4 additions & 0 deletions classes/course_importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion classes/observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function format_kickstart_changeconfig($event) {
$data = $event->get_data();
$plugin = $data['other']['plugin'];
$name = isset($data['other']['name']) ? $data['other']['name'] : '';
if (preg_match("/^format_/", $plugin) && $name == 'disabled') {
if (preg_match("/^format_/", $plugin ?? '') && $name == 'disabled') {
$templates = isset($CFG->kickstart_templates) ? explode(",", $CFG->kickstart_templates) : [];
$disable = ($data['other']['value'] == 1) ? true : false;
$format = substr($plugin, 7);
Expand Down
3 changes: 2 additions & 1 deletion classes/output/course_template_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()) {
Expand Down
20 changes: 20 additions & 0 deletions classes/template_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
*/
class template_table extends \table_sql {

/**
* @var int
*/
public $totaltemplates;

/**
* @var int
*/
public $cnt;

/**
* Setup table.
*
Expand Down Expand Up @@ -77,6 +87,16 @@ public function __construct() {
$this->define_headers($headers);
}

/**
* Generate title.
*
* @param \stdClass $data
* @return mixed
*/
public function col_title($data) {
return format_string($data->title);
}

/**
* Generate tag list.
*
Expand Down
5 changes: 5 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion templates/import_course_list.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{{#courses}}
<div class="card mb-2 text-muted">
<div class="card-body">
<h5 class="card-title">{{fullname}}</h5>
<h5 class="card-title">{{{fullname}}}</h5>
<a href="#" class="btn btn-dark disabled pull-right">{{#str}}importcourse, format_kickstart{{/str}}</a>
<a href="#" class="btn btn-outline-dark disabled pull-right mr-2">{{#str}}gotocourse, format_kickstart{{/str}}</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2023071201; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2023112300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022041900; // Requires this Moodle version.
$plugin->release = 'Version 1.3';
$plugin->component = 'format_kickstart'; // Full name of the plugin (used for diagnostics).
$plugin->supported = [400, 402];
$plugin->supported = [40, 403];
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 09fc029

Please sign in to comment.