Skip to content

Commit

Permalink
PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Apr 3, 2024
1 parent d3f7614 commit fd6bf7d
Show file tree
Hide file tree
Showing 35 changed files with 388 additions and 239 deletions.
13 changes: 4 additions & 9 deletions backup/moodle2/restore_format_topcoll_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2012-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/course/format/topcoll/lib.php');
Expand Down Expand Up @@ -87,7 +85,7 @@ public function process_topcoll($data) {
$data->courseid = $this->task->get_courseid();

if (!($course = $DB->get_record('course', ['id' => $data->courseid]))) {
print_error('invalidcourseid', 'error');
throw new moodle_exception(get_string('invalidcourseid', 'error'));
} // From /course/view.php.
$courseformat = course_get_format($course);

Expand All @@ -109,9 +107,6 @@ public function process_topcoll($data) {
// No need to annotate anything here.
}

protected function after_execute_structure() {
}

/**
* Executed after course restore is complete
*
Expand Down
8 changes: 3 additions & 5 deletions classes/activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2020-onwards G J Barnard in respect to modifications of Adaptable activity related functions,
* see below.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
Expand Down
10 changes: 4 additions & 6 deletions classes/activity_meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2020-onwards G J Barnard in respect to modifications of Adaptable activity related meta data,
* @copyright © 2020-onwards G J Barnard in respect to modifications of Adaptable activity related functions,
* see below.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
Expand Down
8 changes: 3 additions & 5 deletions classes/admin_setting_information.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2022-onwards G J Barnard based upon work done by Marina Glancy.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll;
Expand Down
8 changes: 3 additions & 5 deletions classes/admin_setting_markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2022-onwards G J Barnard based upon work done by Marina Glancy.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll;
Expand Down
14 changes: 6 additions & 8 deletions classes/observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @category event
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2017-onwards G J Barnard based upon work done by Marina Glancy.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @copyright © 2022-onwards G J Barnard based upon work done by Marina Glancy.
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();
Expand All @@ -50,7 +47,8 @@ class format_topcoll_observer {
*/
public static function course_content_deleted(\core\event\course_content_deleted $event) {
global $DB;
$DB->delete_records("user_preferences", ["name" => \format_topcoll\togglelib::TOPCOLL_TOGGLE.'_' . $event->objectid]); // This is the $courseid.
$DB->delete_records("user_preferences",
["name" => \format_topcoll\togglelib::TOPCOLL_TOGGLE.'_' . $event->objectid]); // This is the $courseid.
}

/* Events observed for the purpose of the activty functionality.
Expand Down
7 changes: 3 additions & 4 deletions classes/output/courseformat/content/cm.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
* Contains the default activity list from a section.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright © 2022-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content;
Expand Down
11 changes: 8 additions & 3 deletions classes/output/courseformat/content/section/cmitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
* Contains the default section controls output class.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2022-onwards G J Barnard in respect to modifications of core code.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content\section;
Expand All @@ -35,6 +34,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cmitem extends \core_courseformat\output\local\content\section\cmitem {
/**
* Get the name of the template to use for this templatable.
*
* @param \renderer_base $renderer The renderer requesting the template name
* @return string
*/
public function get_template_name(\renderer_base $renderer): string {
return 'format_topcoll/local/content/section/cmitem';
}
Expand Down
17 changes: 11 additions & 6 deletions classes/output/courseformat/content/section/cmlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
* Contains the default section controls output class.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2022-onwards G J Barnard in respect to modifications of core code.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content\section;
Expand All @@ -31,10 +30,16 @@
* Class to render a section activity list.
*
* @package format_topcoll
* @copyright &copy; 2022-onwards G J Barnard.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright &copy; 2022-onwards G J Barnard.
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cmlist extends \core_courseformat\output\local\content\section\cmlist {
/**
* Get the name of the template to use for this templatable.
*
* @param \renderer_base $renderer The renderer requesting the template name
* @return string
*/
public function get_template_name(\renderer_base $renderer): string {
return 'format_topcoll/local/content/section/cmlist';
}
Expand Down
7 changes: 3 additions & 4 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
* Contains the default section controls output class.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2021-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content\section;
Expand Down
5 changes: 2 additions & 3 deletions classes/output/courseformat/content/sectionnavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
* Contains the default section controls output class.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2023-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content;
Expand Down
6 changes: 2 additions & 4 deletions classes/output/courseformat/content/sectionselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
/**
* Collapsed Topics
*
* Contains the default section controls output class.
* Contains the default section selector.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2023-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output\courseformat\content;
Expand Down
36 changes: 30 additions & 6 deletions classes/output/format_renderer_migration_toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
* Note: 'courseformat' property is set in the using class constructor.
*
* @package format_topcoll
* @version See the value of '$plugin->version' in version.php.
* @copyright &copy; 2021-onwards G J Barnard in respect to modifications of core code.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @link http://docs.moodle.org/en/Collapsed_Topics_course_format
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_topcoll\output;

/**
* Migration trait.
*/
trait format_renderer_migration_toolbox {
/**
* Generate a summary of the activities in a section
Expand Down Expand Up @@ -68,7 +69,7 @@ protected function section_activity_summary($section, $course, $mods) {
* @return string
*/
public function section_availability($section) {
// TODO: Update to a template!
// Todo: Update to a template!
$widgetclass = $this->courseformat->get_output_classname('content\\section\\availability');
$widget = new $widgetclass($this->courseformat, $section);
return $this->render($widget);
Expand All @@ -92,17 +93,40 @@ protected function format_summary_text($section) {
return $summary->format_summary_text();
}

/**
* Section course module list.
*
* @param stdClass $section The course_section entry from DB
* @return string HTML to output.
*/
protected function course_section_cmlist($section) {
$cmlistclass = $this->courseformat->get_output_classname('content\\section\\cmlist');
return $this->render(new $cmlistclass($this->courseformat, $section));
}

/**
* Section navigation links.
*
* @return string HTML to output.
*/
protected function section_nav_links() {
$sectionnavigationclass = $this->courseformat->get_output_classname('content\\sectionnavigation');
$sectionnavigation = new $sectionnavigationclass($this->courseformat, $this->courseformat->get_sectionnum());
return $this->render($sectionnavigation);
}

/**
* Generate the html for the 'Jump to' menu on a single section page.
*
* This element is now a core_courseformat\output\content\section output component and it is displayed using
* mustache templates instead of a renderer method.
*
* @param stdClass $course The course entry from DB
* @param array $sections The course_sections entries from the DB
* @param int $displaysection the current displayed section number.
*
* @return string HTML to output.
*/
protected function section_nav_selection($course, $sections, $displaysection) {
$sectionnavigationclass = $this->courseformat->get_output_classname('content\\sectionnavigation');
$sectionnavigation = new $sectionnavigationclass($this->courseformat, $displaysection);
Expand Down
Loading

0 comments on commit fd6bf7d

Please sign in to comment.