diff --git a/classes/associationservice.php b/classes/associationservice.php index 7ed9568..71dec09 100644 --- a/classes/associationservice.php +++ b/classes/associationservice.php @@ -134,8 +134,8 @@ class associationservice extends \external_api { /** * Get last access time of user to any of the courses in the studyplan - * @param $userid ID of user - * @param $studyplanid ID of studyplan + * @param int $userid ID of user + * @param int $studyplanid ID of studyplan */ public static function user_lastaccess($userid, $studyplanid=null) { global $DB; @@ -224,8 +224,7 @@ class associationservice extends \external_api { /** * Search users for match * @param string $like String to match user firstname/lastname with - * @param null $excludeid Do not include these users - * @param int $contextid Context to search (default system) + * @param int $studyplanid Id of studyplan to search for * @return array */ public static function find_user($like, $studyplanid) { @@ -807,7 +806,7 @@ class associationservice extends \external_api { public static function find_coach_parameters(): \external_function_parameters { return new \external_function_parameters( [ 'like' => new \external_value(PARAM_TEXT, 'search text'), - 'studyplan_id' => new \external_value(PARAM_INT, 'studyplan id to associate for', VALUE_OPTIONAL), + 'studyplan_id' => new \external_value(PARAM_INT, 'studyplan id to associate for'), ] ); } @@ -821,8 +820,7 @@ class associationservice extends \external_api { /** * Search users for match * @param string $like String to match user firstname/lastname with - * @param null $excludeid Do not include coaches connected to this studyplan id - * @param int $contextid Context to search (default system) + * @param int $studyplanid Id of studyplan to search for * @return array */ public static function find_coach($like, $studyplanid) { diff --git a/classes/badgeinfo.php b/classes/badgeinfo.php index 190e8e8..61b45ee 100644 --- a/classes/badgeinfo.php +++ b/classes/badgeinfo.php @@ -119,7 +119,6 @@ class badgeinfo { /** * Webservice model for editor info - * @param int[] $studentlist List of user id's to use for checking issueing progress within a study plan * @return array Webservice data model */ public function simple_model() { @@ -395,7 +394,7 @@ class badgeinfo { /** * Gets the module instance from the database and returns it. * If no module instance exists this function returns false. - * + * @param int $cmid Course module id * @return stdClass|bool */ private static function get_mod_instance($cmid) { @@ -416,7 +415,7 @@ class badgeinfo { /** * Gets role name. * If no such role exists this function returns null. - * + * @param int $rid Role id * @return string|null */ private static function get_role_name($rid) { @@ -431,10 +430,9 @@ class badgeinfo { } /** - * [Description for get_award_subcriteria] - * - * @param award_criteria $crit - * + * Get subcriteria info for awarding a badge for a user + * @param award_criteria $crit The criteria to build info for + * @param int|null $userid Optional userid to check subcriteria completion for * @return array * */ @@ -872,18 +870,15 @@ class badgeinfo { } /** - * [Description for find_page_related_badges] - * - * @param studyplanpage $page - * @param mixed $search="" - * @param mixed $active=false - * @param mixed $includecoursebadges=true - * + * Find badges related to a page + * @param studyplanpage $page Page to search for/in + * @param mixed $search Search string to use + * @param mixed $active Include only active badges + * @param mixed $includecoursebadges Include course badges * @return array of badgeinfo * */ public static function find_page_related_badges(studyplanpage $page, $search="", $active=false, $includecoursebadges=true) { - $badgeids = []; foreach (studyline::find_page_children($page) as $line) { foreach (studyitem::find_studyline_children($line) as $item) { diff --git a/classes/cascadecohortsync.php b/classes/cascadecohortsync.php index 1b5d09e..fdb2d7d 100644 --- a/classes/cascadecohortsync.php +++ b/classes/cascadecohortsync.php @@ -107,7 +107,7 @@ class cascadecohortsync { /** * Find all cohort sync instances for a specific course - * @param int courseid + * @param int $courseid Id of course to search for */ private function list_cohortsyncs($courseid) { global $DB; @@ -131,7 +131,7 @@ class cascadecohortsync { /** * Remove this studyplan reference from cohort sync - * @param object $enrollinstance + * @param object $enrolinstance Enrol instance to unlink or update */ private function unlink_cohortsync($enrolinstance) { // So it may or may not need to be removed. @@ -183,6 +183,7 @@ class cascadecohortsync { /** * Enroll all cohorts associated to the studyplan in the courses linked to the specified study line + * @param studyline $line Studyline to sync enrolment for */ public function syncline(studyline $line) { global $DB; diff --git a/classes/cascadeusersync.php b/classes/cascadeusersync.php index 47a157b..0c1d8a7 100644 --- a/classes/cascadeusersync.php +++ b/classes/cascadeusersync.php @@ -85,6 +85,7 @@ class cascadeusersync { /** * Enroll all cohorts associated to the studyplan in the courses linked to the specified study line + * @param studyline $line Studyline to sync enrolment for */ public function syncline(studyline $line) { // Find the courses that need to be synced to the associated cohorts. @@ -106,8 +107,8 @@ class cascadeusersync { } /** Enrol a list of users into a specific course - * - * + * @param int $courseid Id of the course + * @param array $userids List of userids to enrol */ private function perform_enrol($courseid, $userids) { global $DB; diff --git a/classes/contextinfo.php b/classes/contextinfo.php index bdc932d..fef86a1 100644 --- a/classes/contextinfo.php +++ b/classes/contextinfo.php @@ -71,7 +71,7 @@ class contextinfo { /** * Return context path names - * @param $short Use short names of contexts in path + * @param bool $short Use short names of contexts in path * @return array of context path names */ public function path($short=false) { @@ -88,7 +88,7 @@ class contextinfo { /** * Return full context path name - * @param $short Use short names of contexts in path + * @param bool $short Use short names of contexts in path * @return string Concatenated string of paths */ public function pathstr($short=false) { diff --git a/classes/corecompletioninfo.php b/classes/corecompletioninfo.php index 69679ee..884f33c 100644 --- a/classes/corecompletioninfo.php +++ b/classes/corecompletioninfo.php @@ -617,7 +617,7 @@ class corecompletioninfo { /** * Get the overall grade for this course - * @param int $userid ID of user to retrieve grade for + * @param int $grade The grade object to format * @return stdClass|null object containing 'grade' and optional 'feedback' attribute */ private function format_course_grade($grade) { diff --git a/classes/coursecompetencyinfo.php b/classes/coursecompetencyinfo.php index 4ba74d6..da37764 100644 --- a/classes/coursecompetencyinfo.php +++ b/classes/coursecompetencyinfo.php @@ -56,6 +56,7 @@ class coursecompetencyinfo { /** * Construct new object for a given course * @param \stdClass $course Course database record + * @param studyitem $studyitem Studyitem the course is linked in */ public function __construct($course, $studyitem) { global $DB; @@ -95,7 +96,7 @@ class coursecompetencyinfo { /** * Generic competency info structure for individual competency stats - * @param $recurse True if child competencies may be included + * @param bool $recurse True if child competencies may be included */ public static function competencyinfo_structure($recurse=true): \external_description { $struct = [ @@ -156,7 +157,8 @@ class coursecompetencyinfo { /** * Create basic competency information model from competency - * @param Object $competency + * @param object $competency The competency to model + * @param int|null $userid Optional userid to include completion data for */ private function competencyinfo_model($competency, $userid=null): array { $displayfield = get_config("local_treestudyplan", "competency_displayname"); @@ -614,7 +616,8 @@ class coursecompetencyinfo { } /** - * Check if this gradable item is marked required in the studyitem + * Check if this competency is marked required in the studyitem + * @param object $competency The competency to check * @return bool */ public function is_required($competency) { diff --git a/classes/courseinfo.php b/classes/courseinfo.php index 2d75ab6..f633529 100644 --- a/classes/courseinfo.php +++ b/classes/courseinfo.php @@ -303,7 +303,6 @@ class courseinfo { /** * Webservice model for editor info - * @param studyitem $studyitem Specify a specific study item to check gradable selections for. Leave empty to use default * @return array Webservice data model */ public function editor_model() { @@ -497,7 +496,7 @@ class courseinfo { /** * Webservice model for basic info - * @param $includeteachervisible Include custom fiel + * @param bool $includeteachervisible Set to true if in teacher mode, so fields set to visible as teacher will show * @return array Webservice data model */ public function extrafields_model($includeteachervisible=false) { @@ -555,6 +554,8 @@ class courseinfo { /** * Determine value and type of an extra field for this course + * @param string $fieldname The name if the extra field + * @param bool $includeteachervisible Set to true if in teacher mode, so fields set to visible as teacher will show * @return array [value, type] of the field for this */ protected function extrafields_value($fieldname, $includeteachervisible=false) { diff --git a/classes/courseservice.php b/classes/courseservice.php index 53e1efa..73d92cf 100644 --- a/classes/courseservice.php +++ b/classes/courseservice.php @@ -54,6 +54,7 @@ class courseservice extends \external_api { * Most of the work is offloaded to an SQL query in the interest of speed, * but moodle functions are used to double check access permissions. * @param int $userid Id of the user + * @param string $capability Capability the user must posess in the category to include it in the list. * @return array of core_course_category */ public static function user_tops($userid=null, $capability='moodle/category:viewcourselist') { @@ -143,6 +144,7 @@ class courseservice extends \external_api { * Find the top-most child categories for a given category that are visible. * * @param int $parentid The category to search for + * @param int $userid The id of the user to determine visibility for * @return array of \core_course_category */ private static function get_first_visible_children($parentid, $userid) { @@ -239,7 +241,7 @@ class courseservice extends \external_api { /** * Get a category map, and optionally specify a root category to search for * User's top category will be used if none specified - * @param int $rootid Optional starting category for the map + * @param int $studyplanid Optional id of the studyplan to whose context to limit the search to (if so configures) * @return array */ public static function map_categories($studyplanid = 0) { @@ -352,7 +354,6 @@ class courseservice extends \external_api { /** * List all user visible categories the current user has a given capability for. * @param mixed $capability - * @param core_course_category|null $parent * @return array */ public static function categories_by_capability($capability) { diff --git a/classes/debug.php b/classes/debug.php index 927f843..094aeb2 100644 --- a/classes/debug.php +++ b/classes/debug.php @@ -29,8 +29,8 @@ use JsonException; class debug { /** * Dump an object in json format to debug log - * @param $object Object to dump - * @param $filename File to write to + * @param mixed $object Object to dump + * @param string $filename File to write to * @return any The object */ public static function &dump(&$object, $filename="/tmp/debug.log") { @@ -52,12 +52,10 @@ class debug { return $object; } - - /** - * Write text to debug log - * @param $object Object to dump - * @param $filename File to write to + * Write text to debug log file + * @param string $text Text to write + * @param string $filename File to write to * @return any The object */ public static function write($text, $filename="/tmp/debug.log") { @@ -70,18 +68,5 @@ class debug { fclose($f); } } - /** - * Write nothing to the file. (Used to satisfy the code checker) - * @param $filename File to write to - * @return any The object - */ - public static function void($filename="/tmp/debug.log") { - try { - $f = fopen($filename, "a+"); - } catch (\Exception $x) { - $f = null; - } finally { - fclose($f); - } - } + } diff --git a/classes/form/formbase.php b/classes/form/formbase.php index 44517fe..45e7d44 100644 --- a/classes/form/formbase.php +++ b/classes/form/formbase.php @@ -58,7 +58,7 @@ abstract class formbase extends \moodleform { * Generate form data from parameters * Also validate parameters and access permissions here * - * @param object $customdata The parameters for form initialization + * @param object $customdata The form customdata built on form initialization in self::init_customdata(...) * @return array Form data based on parameters */ abstract public function init_formdata(object $customdata); @@ -67,9 +67,9 @@ abstract class formbase extends \moodleform { * Validate security access for this form based on the provided parameters * Return true if validation passes, false or throw an exception if it does not. * - * @param object $params The parameters for form initialization + * @param object $customdata The form customdata built on form initialization * @return bool True if security validation passes. - * @throws \moodle_exception if access denied for a specific reason. + * @throws \moodle_exception if access denied for a specific reason in self::init_customdata(...) */ public static function check_security(object $customdata) { return true; diff --git a/classes/local/helpers/webservicehelper.php b/classes/local/helpers/webservicehelper.php index 8fdf072..d56c359 100644 --- a/classes/local/helpers/webservicehelper.php +++ b/classes/local/helpers/webservicehelper.php @@ -61,6 +61,7 @@ class webservicehelper { /** * Test if the current user has a certain capability in any of the categories they have access to * @param string $capability The capability to scan for in the categories + * @param int|null $userid Userid to use in check (Use current user if null or empty) * @return boolean */ public static function has_capability_in_any_category($capability, $userid=null ) { diff --git a/classes/local/randomimage.php b/classes/local/randomimage.php index 4736107..6085a3e 100644 --- a/classes/local/randomimage.php +++ b/classes/local/randomimage.php @@ -60,7 +60,7 @@ class randomimage { /** * Various available styles for arcs - * @var Arary + * @var array */ const ARC_STYLES = [ IMG_ARC_PIE, @@ -72,10 +72,10 @@ class randomimage { /** * Create a random polygon with number of points between 0 & $maxpts * @param \GdImage $im The image reource - * @param integer $maxpts Max number of point to use + * @param int $maxpts Max number of point to use * @return void */ - private function random_polygon($im, Int $maxpts = 20) { + private function random_polygon($im, int $maxpts = 20) { $color = imagecolorallocatealpha($im, ...$this->random_color_alpha()); $numpoints = \random_int(3, $maxpts); $pts = $this->random_pts($numpoints); diff --git a/classes/premium.php b/classes/premium.php index ebe00a2..82713fd 100644 --- a/classes/premium.php +++ b/classes/premium.php @@ -299,6 +299,7 @@ Klc5I28bGbvxIV5pnL6ZSjHEDp2WreM8HB0XFJwU+Q== /** * Check if the current site matches the provided key + * @param string $key Website pattern to match against */ private static function website_match($key) { global $CFG; @@ -463,6 +464,7 @@ Klc5I28bGbvxIV5pnL6ZSjHEDp2WreM8HB0XFJwU+Q== /** * Throw an error if premium status is not enabled + * @param string $message Message translation key to use in exception */ public static function require_premium($message="premiumfeature:warning") { if (! self::enabled()) { diff --git a/classes/reportservice.php b/classes/reportservice.php index 786b2fb..3d028e7 100644 --- a/classes/reportservice.php +++ b/classes/reportservice.php @@ -151,10 +151,10 @@ class reportservice extends \external_api { /** * Webservice function get_report data - * @param int $pageid - * @param int $userid - * @param int|null $firsteperiod - * @param int|null $lastperiod + * @param int $pageid Id of the studyplan page to build the report for + * @param int $userid ID ofthe user to gather the report for + * @param int|null $firstperiod First period of the page to include in the report (first of page if left empty) + * @param int|null $lastperiod Last period of the page to include in the report (last of page if left empty) */ public static function get_report_data($pageid, $userid, $firstperiod=null, $lastperiod=null) { $page = studyplanpage::find_by_id($pageid); diff --git a/classes/studentstudyplanservice.php b/classes/studentstudyplanservice.php index c84fa5f..5c66829 100644 --- a/classes/studentstudyplanservice.php +++ b/classes/studentstudyplanservice.php @@ -461,7 +461,7 @@ class studentstudyplanservice extends \external_api { /** * Get studyplanpage for current user - * @param int $pagid ID of specific studyplan page + * @param int $pageid ID of specific studyplan page * @return array */ public static function get_own_page($pageid) { @@ -505,8 +505,7 @@ class studentstudyplanservice extends \external_api { } /** - * Get all or one studyplan the current user is teaching in - * @param int $id Optional specific id of studyplan + * Get all studyplans the current user is teaching in * @return array */ public static function list_teaching_studyplans() { @@ -546,8 +545,7 @@ class studentstudyplanservice extends \external_api { } /** - * Get all or one studyplan the current user is teaching in - * @param int $id Optional specific id of studyplan + * Get all studyplans the current user is coaching * @return array */ public static function list_coaching_studyplans() { @@ -641,14 +639,12 @@ class studentstudyplanservice extends \external_api { } /** - * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * Get one studyplan page if the current user is teaching in it + * @param int $pageid ID of studyplan to retrieve * @return array + * @throws moodle_exception if current user is not teaching in this studyplan */ public static function get_teaching_page($pageid) { - global $USER; - $userid = $USER->id; - \external_api::validate_context(\context_system::instance()); $page = studyplanpage::find_by_id($pageid); $studyplan = $page->studyplan(); @@ -684,7 +680,7 @@ class studentstudyplanservice extends \external_api { /** * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * @param int $id ID of studyplan to retrieve * @return array */ public static function line_enrol_self($id) { diff --git a/classes/studyline.php b/classes/studyline.php index 9db0896..af43b85 100644 --- a/classes/studyline.php +++ b/classes/studyline.php @@ -191,7 +191,7 @@ class studyline { /** * Whether the current user can enrol a specific user in this line - * @param int|null $user ID or user object for user or null + * @param int|null $userid ID of user to check for. Checks current user if left empty or null */ public function can_enrol($userid=null): bool { global $USER; @@ -797,8 +797,8 @@ class studyline { } /** - * Duplicate this studyplan page - * @param studyplan $newstudyplan Studyplan to copy the line into + * Duplicate this studyline into another page + * @param studyplanpage $newpage Studyplan page to copy the line into * @param array $translation Mapping array of old item ids to new item ids for connection matching * @param bool $bare Set to true to skip copying contents */ diff --git a/classes/studyplan.php b/classes/studyplan.php index 925360d..d571f51 100644 --- a/classes/studyplan.php +++ b/classes/studyplan.php @@ -287,6 +287,7 @@ class studyplan { /** * Webservice model for basic info + * @param int|null $userid Optional id of user, so progress/teaching info for user can be included * @return array Webservice data model */ public function simple_model($userid=null) { @@ -918,6 +919,9 @@ class studyplan { * Duplicate this studyplan * @param string $name New fullname of studyplan * @param string $shortname New shortname of studyplan + * @param int $contextid Id of context for new plan + * @param string|null $idnumber New idnumber (duplicate old one if left empty) + * @param string|null $newstartdate If provided, all dates in the copy will be shifted so this is the start date of the new studyplan */ public function duplicate($name, $shortname, $contextid, $idnumber=null, $newstartdate = null): self { // First duplicate the studyplan structure. @@ -1053,9 +1057,8 @@ class studyplan { /** * Import previously exported files into the file storage - * @param string $area Name of the file area to import * @param mixed $importfiles List of files to import from string in the format exported in export_model() - * + * @param string $area Name of the file area to import */ public function import_files($importfiles, $area) { $fs = get_file_storage(); diff --git a/classes/studyplanpage.php b/classes/studyplanpage.php index 9b700cf..fea9c03 100644 --- a/classes/studyplanpage.php +++ b/classes/studyplanpage.php @@ -127,6 +127,7 @@ class studyplanpage { /** * End date + * @param bool $farahead Return a date 100 years in the future if end date is not set. Returns null otherwise * @return \DateTime|null */ public function enddate($farahead = true) { @@ -492,6 +493,7 @@ class studyplanpage { /** * Duplicate this studyplan page * @param studyplan $newstudyplan Studyplan to copy the page into + * @param \DateInterval|null $timeoffset Amount if time to shift the dates for the new page */ public function duplicate(studyplan $newstudyplan, $timeoffset = null): self { if ($timeoffset == null) { @@ -750,9 +752,8 @@ class studyplanpage { /** * Import previously exported files into the file storage - * @param string $area Name of the file area to export * @param mixed $importfiles List of files to import from string in the format exported in export_model() - * + * @param string $area Name of the file area to export */ public function import_files($importfiles, $area) { $fs = get_file_storage(); diff --git a/classes/studyplanservice.php b/classes/studyplanservice.php index 7c6c19e..769f706 100644 --- a/classes/studyplanservice.php +++ b/classes/studyplanservice.php @@ -384,11 +384,13 @@ class studyplanservice extends \external_api { /** * Add a new study line - * @param mixed $pageid - * @param mixed $name - * @param mixed $shortname - * @param mixed $color - * @param mixed $sequence + * @param mixed $pageid Id of the page to put it in + * @param mixed $name Name of the line + * @param mixed $shortname Shortname of the line + * @param mixed $color Color of the line + * @param mixed $sequence Order for new line + * @param int|null $enrollable New enrollable setting (From studyline::ENROLLABLE_...) + * @param array|null $enrolroles New list of roles that can enrol a student * @return array */ public static function add_studyline($pageid, $name, $shortname, $color, $sequence, $enrollable=null, $enrolroles=null) { @@ -447,11 +449,13 @@ class studyplanservice extends \external_api { /** * Edit studyline parameters - * @param mixed $id - * @param mixed $name - * @param mixed $shortname - * @param mixed $color - * @return [type] + * @param mixed $id Id of the line + * @param mixed $name New name of the line + * @param mixed $shortname New shortname of the line + * @param mixed $color New color of the line + * @param int|null $enrollable New enrollable setting (From studyline::ENROLLABLE_...) + * @param array|null $enrolroles New list of roles that can enrol a student + * @return array */ public static function edit_studyline($id, $name, $shortname, $color, $enrollable=null, $enrolroles=null) { $o = studyline::find_by_id($id); @@ -936,7 +940,7 @@ class studyplanservice extends \external_api { ****************************/ /** - * Parameter description for webservice function list_badges + * Parameter description for webservice function search_badges */ public static function search_badges_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -946,14 +950,16 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function list_badges + * Return value description for webservice function search_badges */ public static function search_badges_returns(): \external_description { return new \external_multiple_structure(badgeinfo::editor_structure()); } /** - * List all available badges to drag into a studyplan page + * List all available site badges to drag into a studyplan page + * @param string $search Search string to use + * @param bool $active Only include active badges * @return array */ public static function search_badges($search, $active=false) { @@ -970,7 +976,7 @@ class studyplanservice extends \external_api { } /** - * Parameter description for webservice function list_badges + * Parameter description for webservice function search_related_badges */ public static function search_related_badges_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -982,7 +988,7 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function list_badges + * Return value description for webservice function search_related_badges */ public static function search_related_badges_returns(): \external_description { return new \external_multiple_structure(badgeinfo::editor_structure()); @@ -990,6 +996,10 @@ class studyplanservice extends \external_api { /** * List all available badges to drag into a studyplan page + * @param int $pageid ID of the studyplan page to limit search to + * @param string $search Search string to use + * @param bool $active Only include active badges + * @param bool $includecoursebadges Also include course badges in the search * @return array */ public static function search_related_badges($pageid, $search="", $active=false, $includecoursebadges=true) { @@ -1090,7 +1100,7 @@ class studyplanservice extends \external_api { /** * Mark a competency as required for course completion - * @param mixed $gradeid Id of gradable + * @param mixed $competencyid Id of gradable * @param mixed $itemid Id of study item * @param bool $required Mark grade as required or not * @return array Success/Fail model @@ -1403,7 +1413,7 @@ class studyplanservice extends \external_api { } /** - * Parameter description for webservice function export_studylines + * Parameter description for webservice function export_page */ public static function export_page_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -1413,15 +1423,15 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function export_studylines + * Return value description for webservice function export_page */ public static function export_page_returns(): \external_description { return studyplanpage::export_structure(); } /** - * Export studylines for a studyplan - * @param mixed $studyplanid Id of the studyplan to export the studylines for + * Export studylines for a studyplan page + * @param mixed $pageid Id of the studyplan page to export the studylines for * @param string $format Export format [csv, json (default)] * @return array */ @@ -1540,8 +1550,8 @@ class studyplanservice extends \external_api { } /** - * Import studylines into existing studtplan - * @param int $studyplanid ID of studyplan to import to + * Import studylines into existing studtplan page + * @param int $pageid ID of studyplan page to import to * @param string $content Content of file * @param string $format Format of file * @return array Success/fail model @@ -1855,7 +1865,7 @@ class studyplanservice extends \external_api { ************************/ /** - * Parameter description for webservice function delete_studyplan + * Parameter description for webservice function bulk_course_timing */ public static function bulk_course_timing_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -1864,16 +1874,15 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function delete_studyplan + * Return value description for webservice function bulk_course_timing */ public static function bulk_course_timing_returns(): \external_description { return success::structure(); } /** - * Delete a studyplan - * @param mixed $id Id of the studyplan - * @param bool $force Force deletion, even though studyplan is not empty + * Update course timing for all courses in a studyplan page + * @param mixed $pageid Id of the studyplan page * @return array Succes/fail model */ public static function bulk_course_timing($pageid) { @@ -1955,7 +1964,7 @@ class studyplanservice extends \external_api { ************************/ /** - * Parameter description for webservice function delete_studyplan + * Parameter description for webservice function list_roles */ public static function list_roles_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -1964,7 +1973,7 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function delete_studyplan + * Return value description for webservice function list_roles */ public static function list_roles_returns(): \external_description { return new \external_multiple_structure(new \external_single_structure([ @@ -1974,10 +1983,9 @@ class studyplanservice extends \external_api { } /** - * Delete a studyplan - * @param mixed $id Id of the studyplan - * @param bool $force Force deletion, even though studyplan is not empty - * @return array Succes/fail model + * List available roles + * @param mixed $studyplanid id of the studyplan to list the roles for + * @return array List of roles */ public static function list_roles($studyplanid) { global $DB; @@ -2012,6 +2020,7 @@ class studyplanservice extends \external_api { /** * Enrol status structure including user info + * @param int $required VALUE_OPTIONAL or VALUE_REQUIRED */ public static function student_enrol_status_structure($required = VALUE_REQUIRED) { return new \external_single_structure([ @@ -2035,7 +2044,7 @@ class studyplanservice extends \external_api { } /** - * Parameter description for webservice function get_teaching_page + * Parameter description for webservice function line_enrol_students */ public static function line_enrol_students_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -2045,15 +2054,16 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function get_teaching_page + * Return value description for webservice function line_enrol_students */ public static function line_enrol_students_returns(): \external_description { return new \external_multiple_structure(self::student_enrol_status_structure()); } /** - * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * Enrol users in a study line + * @param int $id ID of the studyline to enrol in + * @param array $users ID's of users to enrol * @return array */ public static function line_enrol_students($id, $users) { @@ -2090,7 +2100,7 @@ class studyplanservice extends \external_api { ***************************/ /** - * Parameter description for webservice function get_teaching_page + * Parameter description for webservice function line_unenrol_students */ public static function line_unenrol_students_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -2100,15 +2110,16 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function get_teaching_page + * Return value description for webservice function line_unenrol_students */ public static function line_unenrol_students_returns(): \external_description { return new \external_multiple_structure(self::student_enrol_status_structure()); } /** - * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * Unenrol users from a study line + * @param int $id ID of the studyline to unenrol from + * @param array $users ID's of users to unenroll * @return array */ public static function line_unenrol_students($id, $users) { @@ -2141,7 +2152,7 @@ class studyplanservice extends \external_api { ***************************/ /** - * Parameter description for webservice function get_teaching_page + * Parameter description for webservice function list_line_enrolled_students */ public static function list_line_enrolled_students_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -2150,7 +2161,7 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function get_teaching_page + * Return value description for webservice function list_line_enrolled_students */ public static function list_line_enrolled_students_returns(): \external_description { return new \external_single_structure([ @@ -2160,8 +2171,8 @@ class studyplanservice extends \external_api { } /** - * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * List all students enrolled in a specific enrollable study line + * @param int $id ID of studyline to retrieve * @return array */ public static function list_line_enrolled_students($id) { @@ -2188,7 +2199,7 @@ class studyplanservice extends \external_api { ***************************/ /** - * Parameter description for webservice function get_teaching_page + * Parameter description for webservice function count_templates */ public static function count_templates_parameters(): \external_function_parameters { return new \external_function_parameters( [ @@ -2196,15 +2207,14 @@ class studyplanservice extends \external_api { } /** - * Return value description for webservice function get_teaching_page + * Return value description for webservice function count_templates */ public static function count_templates_returns(): \external_description { return new \external_value(PARAM_INT, "True if the requesting user can unenrol students"); } /** - * Get all or one studyplan the current user is teaching in - * @param int $studyplanid ID of studyplan to retrieve + * Count the number of templates available * @return array */ public static function count_templates() { diff --git a/classes/success.php b/classes/success.php index 9f2c72b..ec35fe0 100644 --- a/classes/success.php +++ b/classes/success.php @@ -40,7 +40,6 @@ class success { /** * Create new successful result with optional message - * @param string $msg Message to add to result * @param array|object $data Custom data to pass to receiver */ public static function success($data=[]): self { diff --git a/classes/task/autocohortsync.php b/classes/task/autocohortsync.php index adc342f..0d8d3b4 100644 --- a/classes/task/autocohortsync.php +++ b/classes/task/autocohortsync.php @@ -74,6 +74,7 @@ class autocohortsync extends \core\task\scheduled_task { /** * Perform immediate syncronization on a single studyplan. + * @param studyplan $studyplan Relevant study plan */ public static function syncplan(studyplan $studyplan) { $enroller = new cascadecohortsync($studyplan); @@ -88,6 +89,7 @@ class autocohortsync extends \core\task\scheduled_task { /** * Perform immediate syncronization on a single studyline. + * @param studyline $line Relevant study line */ public static function syncline(studyline $line) { $plan = $line->studyplan(); diff --git a/classes/teachingfinder.php b/classes/teachingfinder.php index 8e0fe34..8dde73b 100644 --- a/classes/teachingfinder.php +++ b/classes/teachingfinder.php @@ -59,6 +59,7 @@ class teachingfinder { * Check if a user is teaching in a specific studyplan * (Does not update the cache if results are 0) * @param studyplan $plan Studyplan to check + * @param int $userid UserId to check for * @return bool If teaching in this plan */ public static function is_teaching_studyplan(studyplan $plan, $userid) { @@ -70,8 +71,8 @@ class teachingfinder { /** * Check if a user is teaching courses in any studyplan * (Does not update the cache if results are 0) - * @param studyplan $plan Studyplan to check - * @return bool If teaching in this plan + * @param int $userid UserId to check for + * @return bool If teaching in any plan */ public static function is_teaching($userid) { global $DB; @@ -93,8 +94,7 @@ class teachingfinder { /** * Check if current user is teaching courses in any studyplan * (Does not update the cache if results are 0) - * @param studyplan $plan Studyplan to check - * @return bool If teaching in this plan + * @return bool If teaching in any studyplan */ public static function am_teaching() { global $USER;