diff --git a/course/externallib.php b/course/externallib.php index 73370acc2db..802cfd2fee5 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -2654,6 +2654,8 @@ class core_course_external extends external_api { /** * Returns description of method parameters * + * @deprecated since 3.3 + * * @return external_function_parameters * @since Moodle 3.2 */ @@ -2668,6 +2670,8 @@ class core_course_external extends external_api { /** * Return activities overview for the given courses. * + * @deprecated since 3.3 + * * @param array $courseids a list of course ids * @return array of warnings and the activities overview * @since Moodle 3.2 @@ -2725,6 +2729,8 @@ class core_course_external extends external_api { /** * Returns description of method result value * + * @deprecated since 3.3 + * * @return external_description * @since Moodle 3.2 */ @@ -2751,6 +2757,15 @@ class core_course_external extends external_api { ); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_activities_overview_is_deprecated() { + return true; + } + /** * Returns description of method parameters * diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php index 9616ca2bf15..83f56997cf4 100644 --- a/course/tests/externallib_test.php +++ b/course/tests/externallib_test.php @@ -1823,6 +1823,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase { $courses = array($course1->id , $course2->id); $result = core_course_external::get_activities_overview($courses); + $this->assertDebuggingCalledCount(8); $result = external_api::clean_returnvalue(core_course_external::get_activities_overview_returns(), $result); // There should be one entry for course1, and no others. diff --git a/lib/db/services.php b/lib/db/services.php index 5ff30cdef28..7db4633dadd 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -330,7 +330,8 @@ $functions = array( 'classname' => 'core_course_external', 'methodname' => 'get_activities_overview', 'classpath' => 'course/externallib.php', - 'description' => 'Return activities overview for the given courses.', + 'description' => '** DEPRECATED ** Please do not call this function any more. + Return activities overview for the given courses.', 'type' => 'read', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), ), diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 1f7edcfdb01..afacc0b0cb7 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -68,6 +68,7 @@ information provided here is intended especially for developers. * New adhoc task refresh_mod_calendar_events_task that updates existing calendar events of modules. * New 'priority' column for the event table to determine which event to show in case of events with user and group overrides. * Webservices core_course_search_courses and core_course_get_courses_by_field will always return the sortorder field. +* core_course_external::get_activities_overview has been deprecated. Please do not call this function any more. === 3.2 === diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 7852c4024b9..6fefd9efdf6 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -484,14 +484,17 @@ function assign_page_type_list($pagetype, $parentcontext, $currentcontext) { * Print an overview of all assignments * for the courses. * + * @deprecated since 3.3 + * * @param mixed $courses The list of courses to print the overview for * @param array $htmlarray The array of html to return - * * @return true */ function assign_print_overview($courses, &$htmlarray) { global $CFG, $DB; + debugging('The function assign_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (empty($courses) || !is_array($courses) || count($courses) == 0) { return true; } @@ -624,6 +627,8 @@ function assign_print_overview($courses, &$htmlarray) { * This api generates html to be displayed to students in print overview section, related to their submission status of the given * assignment. * + * @deprecated since 3.3 + * * @param array $mysubmissions list of submissions of current user indexed by assignment id. * @param string $sqlassignmentids sql clause used to filter open assignments. * @param array $assignmentidparams sql params used to filter open assignments. @@ -636,6 +641,8 @@ function assign_get_mysubmission_details_for_print_overview(&$mysubmissions, $sq $assignment) { global $USER, $DB; + debugging('The function assign_get_mysubmission_details_for_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if ($assignment->nosubmissions) { // Offline assignment. No need to display alerts for offline assignments. return false; @@ -710,6 +717,8 @@ function assign_get_mysubmission_details_for_print_overview(&$mysubmissions, $sq * This api generates html to be displayed to teachers in print overview section, related to the grading status of the given * assignment's submissions. * + * @deprecated since 3.3 + * * @param array $unmarkedsubmissions list of submissions of that are currently unmarked indexed by assignment id. * @param string $sqlassignmentids sql clause used to filter open assignments. * @param array $assignmentidparams sql params used to filter open assignments. @@ -722,6 +731,9 @@ function assign_get_mysubmission_details_for_print_overview(&$mysubmissions, $sq function assign_get_grade_details_for_print_overview(&$unmarkedsubmissions, $sqlassignmentids, $assignmentidparams, $assignment, $context) { global $DB; + + debugging('The function assign_get_grade_details_for_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (!isset($unmarkedsubmissions)) { // Build up and array of unmarked submissions indexed by assignment id/ userid // for use where the user has grading rights on assignment. diff --git a/mod/assign/tests/lib_test.php b/mod/assign/tests/lib_test.php index 7ef88c2885f..a67160203c5 100644 --- a/mod/assign/tests/lib_test.php +++ b/mod/assign/tests/lib_test.php @@ -125,6 +125,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $this->setUser($this->students[0]); $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(1, count($overview)); $this->assertRegExp('/.*Assignment 4.*/', $overview[$this->course->id]['assign']); // No valid submission. $this->assertNotRegExp('/.*Assignment 1.*/', $overview[$this->course->id]['assign']); // Has valid submission. @@ -135,11 +136,13 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(0, count($overview)); $this->setUser($this->teachers[0]); $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(1, count($overview)); // Submissions without a grade. $this->assertRegExp('/.*Assignment 4.*/', $overview[$this->course->id]['assign']); @@ -148,6 +151,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $this->setUser($this->editingteachers[0]); $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(1, count($overview)); // Submissions without a grade. $this->assertRegExp('/.*Assignment 4.*/', $overview[$this->course->id]['assign']); @@ -167,6 +171,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(1, count($overview)); // Now assignment 4 should not show up. $this->assertNotRegExp('/.*Assignment 4.*/', $overview[$this->course->id]['assign']); @@ -175,6 +180,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $this->setUser($this->editingteachers[0]); $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(3); $this->assertEquals(1, count($overview)); // Now assignment 4 should not show up. $this->assertNotRegExp('/.*Assignment 4.*/', $overview[$this->course->id]['assign']); @@ -186,6 +192,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase { $this->setUser($this->students[0]); $overview = array(); assign_print_overview($courses, $overview); + $this->assertDebuggingCalledCount(4); $this->assertEquals(0, count($overview)); } diff --git a/mod/chat/lib.php b/mod/chat/lib.php index cedafaa93c6..7b9e3795e81 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -1119,6 +1119,8 @@ function chat_get_post_actions() { } /** + * @deprecated since 3.3 + * * @global object * @global object * @param array $courses @@ -1127,6 +1129,8 @@ function chat_get_post_actions() { function chat_print_overview($courses, &$htmlarray) { global $USER, $CFG; + debugging('The function chat_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); } diff --git a/mod/choice/lib.php b/mod/choice/lib.php index d3020dbf8f5..30cb2f5360d 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -918,6 +918,9 @@ function choice_page_type_list($pagetype, $parentcontext, $currentcontext) { * Prints choice name, due date and attempt information on * choice activities that have a deadline that has not already passed * and it is available for completing. + * + * @deprecated since 3.3 + * * @uses CONTEXT_MODULE * @param array $courses An array of course objects to get choice instances from. * @param array $htmlarray Store overview output array( course ID => 'choice' => HTML output ) @@ -925,6 +928,8 @@ function choice_page_type_list($pagetype, $parentcontext, $currentcontext) { function choice_print_overview($courses, &$htmlarray) { global $USER, $DB, $OUTPUT; + debugging('The function choice_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (empty($courses) || !is_array($courses) || count($courses) == 0) { return; } diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 8c5ec559005..e26deede178 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1323,12 +1323,16 @@ function forum_user_complete($course, $user, $mod, $forum) { /** * Filters the forum discussions according to groups membership and config. * + * @deprecated since 3.3 + * * @since Moodle 2.8, 2.7.1, 2.6.4 * @param array $discussions Discussions with new posts array * @return array Forums with the number of new posts */ function forum_filter_user_groups_discussions($discussions) { + debugging('The function forum_filter_user_groups_discussions() is now deprecated.', DEBUG_DEVELOPER); + // Group the remaining discussions posts by their forumid. $filteredforums = array(); @@ -1384,6 +1388,8 @@ function forum_is_user_group_discussion(cm_info $cm, $discussiongroupid) { } /** + * @deprecated since 3.3 + * * @global object * @global object * @global object @@ -1393,6 +1399,8 @@ function forum_is_user_group_discussion(cm_info $cm, $discussiongroupid) { function forum_print_overview($courses,&$htmlarray) { global $USER, $CFG, $DB, $SESSION; + debugging('The function forum_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); } diff --git a/mod/forum/tests/lib_test.php b/mod/forum/tests/lib_test.php index 72c1526059a..88eccabd7c7 100644 --- a/mod/forum/tests/lib_test.php +++ b/mod/forum/tests/lib_test.php @@ -2448,6 +2448,7 @@ class mod_forum_lib_testcase extends advanced_testcase { } $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); // There should be one entry for course1, and no others. $this->assertCount(1, $results); @@ -2499,6 +2500,7 @@ class mod_forum_lib_testcase extends advanced_testcase { $this->setUser($viewer1->id); $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); // There should be one entry for course1. $this->assertCount(1, $results); @@ -2510,6 +2512,7 @@ class mod_forum_lib_testcase extends advanced_testcase { $this->setUser($viewer2->id); $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); // There should be one entry for course1. $this->assertCount(0, $results); @@ -2555,6 +2558,7 @@ class mod_forum_lib_testcase extends advanced_testcase { $this->setUser($viewer->id); $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); if ($hasresult) { // There should be one entry for course1. @@ -2620,6 +2624,7 @@ class mod_forum_lib_testcase extends advanced_testcase { $this->setUser($viewer1->id); $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); if ($hasresult) { // There should be one entry for course1. @@ -2636,6 +2641,7 @@ class mod_forum_lib_testcase extends advanced_testcase { $this->setUser($viewer2->id); $results = array(); forum_print_overview($courses, $results); + $this->assertDebuggingCalledCount(2); // There should be one entry for course1. $this->assertCount(0, $results); diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 8f7526e9ed1..687db47d738 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -527,6 +527,8 @@ function lesson_user_complete($course, $user, $mod, $lesson) { * lessons that have a deadline that has not already passed * and it is available for taking. * + * @deprecated since 3.3 + * * @global object * @global stdClass * @global object @@ -538,6 +540,8 @@ function lesson_user_complete($course, $user, $mod, $lesson) { function lesson_print_overview($courses, &$htmlarray) { global $USER, $CFG, $DB, $OUTPUT; + debugging('The function lesson_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (!$lessons = get_all_instances_in_courses('lesson', $courses)) { return; } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index b91c369719e..c644febdef0 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1543,11 +1543,17 @@ function quiz_reset_userdata($data) { /** * Prints quiz summaries on MyMoodle Page + * + * @deprecated since 3.3 + * * @param arry $courses * @param array $htmlarray */ function quiz_print_overview($courses, &$htmlarray) { global $USER, $CFG; + + debugging('The function quiz_print_overview() is now deprecated.', DEBUG_DEVELOPER); + // These next 6 Lines are constant in all modules (just change module name). if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index b5a5bd09ccf..d4ff57ee15a 100644 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -1088,6 +1088,8 @@ function scorm_debug_log_remove($type, $scoid) { /** * writes overview info for course_overview block - displays upcoming scorm objects that have a due date * + * @deprecated since 3.3 + * * @param object $type - type of log(aicc,scorm12,scorm13) used as prefix for filename * @param array $htmlarray * @return mixed @@ -1095,6 +1097,8 @@ function scorm_debug_log_remove($type, $scoid) { function scorm_print_overview($courses, &$htmlarray) { global $USER, $CFG; + debugging('The function scorm_print_overview() is now deprecated.', DEBUG_DEVELOPER); + if (empty($courses) || !is_array($courses) || count($courses) == 0) { return array(); }