| Línea 25... | Línea 25... | 
          
            | 25 | require_once($CFG->libdir . '/gradelib.php');
 | 25 | require_once($CFG->libdir . '/gradelib.php');
 | 
          
            | 26 | require_once($CFG->dirroot . '/grade/export/lib.php');
 | 26 | require_once($CFG->dirroot . '/grade/export/lib.php');
 | 
          
            | Línea 27... | Línea 27... | 
          
            | 27 |  
 | 27 |  
 | 
          
            | 28 | use \core_grades\output\action_bar;
 | 28 | use \core_grades\output\action_bar;
 | 
          
            | - |   | 29 | use \core_grades\output\general_action_bar;
 | 
          
            | Línea 29... | Línea 30... | 
          
            | 29 | use \core_grades\output\general_action_bar;
 | 30 | use \core\output\single_select;
 | 
          
            | 30 |  
 | 31 |  
 | 
          
            | 31 | /**
 | 32 | /**
 | 
          
            | 32 |  * This class iterates over all users that are graded in a course.
 | 33 |  * This class iterates over all users that are graded in a course.
 | 
          
            | Línea 410... | Línea 411... | 
          
            | 410 |  * @param int    $userid   id of the currently selected user (or 'all' if they are all selected)
 | 411 |  * @param int    $userid   id of the currently selected user (or 'all' if they are all selected)
 | 
          
            | 411 |  * @param int    $groupid id of requested group, 0 means all
 | 412 |  * @param int    $groupid id of requested group, 0 means all
 | 
          
            | 412 |  * @param int    $includeall bool include all option
 | 413 |  * @param int    $includeall bool include all option
 | 
          
            | 413 |  * @param bool   $return If true, will return the HTML, otherwise, will print directly
 | 414 |  * @param bool   $return If true, will return the HTML, otherwise, will print directly
 | 
          
            | 414 |  * @return null
 | 415 |  * @return null
 | 
          
            | - |   | 416 |  * @todo Final deprecation on Moodle 6.0. See MDL-84680.
 | 
          
            | 415 |  */
 | 417 |  */
 | 
          
            | - |   | 418 | #[\core\attribute\deprecated('grade_get_graded_users_select()', since: '5.0', mdl: 'MDL-84673')]
 | 
          
            | 416 | function print_graded_users_selector($course, $actionpage, $userid=0, $groupid=0, $includeall=true, $return=false) {
 | 419 | function print_graded_users_selector($course, $actionpage, $userid=0, $groupid=0, $includeall=true, $return=false) {
 | 
          
            | - |   | 420 |     \core\deprecation::emit_deprecation(__FUNCTION__);
 | 
          
            | 417 |     global $CFG, $USER, $OUTPUT;
 | 421 |     global $OUTPUT;
 | 
          
            | 418 |     return $OUTPUT->render(grade_get_graded_users_select(substr($actionpage, 0, strpos($actionpage, '/')), $course, $userid, $groupid, $includeall));
 | 422 |     return $OUTPUT->render(grade_get_graded_users_select(substr($actionpage, 0, strpos($actionpage, '/')), $course, $userid, $groupid, $includeall));
 | 
          
            | 419 | }
 | 423 | }
 | 
          
            | Línea -... | Línea 424... | 
          
            | - |   | 424 |  
 | 
          
            | - |   | 425 | /**
 | 
          
            | - |   | 426 |  * Return a selection popup form of the graded users in a course.
 | 
          
            | - |   | 427 |  *
 | 
          
            | - |   | 428 |  * @param string $report name of the report
 | 
          
            | - |   | 429 |  * @param int    $course id of the course
 | 
          
            | - |   | 430 |  * @param int    $userid id of the currently selected user (or 'all' if they are all selected)
 | 
          
            | - |   | 431 |  * @param int    $groupid id of requested group, 0 means all
 | 
          
            | - |   | 432 |  * @param bool   $includeall bool include all option
 | 
          
            | - |   | 433 |  * @return single_select
 | 
          
            | 420 |  
 | 434 |  */
 | 
          
            | 421 | function grade_get_graded_users_select($report, $course, $userid, $groupid, $includeall) {
 | 435 | function grade_get_graded_users_select($report, $course, $userid, $groupid, $includeall) {
 | 
          
            | Línea 422... | Línea 436... | 
          
            | 422 |     global $USER, $CFG;
 | 436 |     global $USER, $CFG;
 | 
          
            | 423 |  
 | 437 |  
 | 
          
            | Línea 990... | Línea 1004... | 
          
            | 990 |         $output = $renderer->user_heading($user, $courseid, $showuserbuttons);
 | 1004 |         $output = $renderer->user_heading($user, $courseid, $showuserbuttons);
 | 
          
            | 991 |     } else if (!empty($heading)) {
 | 1005 |     } else if (!empty($heading)) {
 | 
          
            | 992 |         $output = $OUTPUT->heading($heading);
 | 1006 |         $output = $OUTPUT->heading($heading);
 | 
          
            | 993 |     }
 | 1007 |     }
 | 
          
            | Línea -... | Línea 1008... | 
          
            | - |   | 1008 |  
 | 
          
            | - |   | 1009 |     // If any grade penalty plugins are enabled, notify the user that grade penalties will not be applied to imported grades.
 | 
          
            | - |   | 1010 |     if ($active_type === 'import') {
 | 
          
            | - |   | 1011 |         foreach (core_plugin_manager::instance()->get_plugins_of_type('gradepenalty') as $plugin) {
 | 
          
            | - |   | 1012 |             if ($plugin->is_enabled()) {
 | 
          
            | - |   | 1013 |                 $output .= $OUTPUT->notification(
 | 
          
            | - |   | 1014 |                     get_string('gradepenalties', 'gradeimport_csv'),
 | 
          
            | - |   | 1015 |                     \core\output\notification::NOTIFY_INFO,
 | 
          
            | - |   | 1016 |                     false,
 | 
          
            | - |   | 1017 |                 );
 | 
          
            | - |   | 1018 |                 break;
 | 
          
            | - |   | 1019 |             }
 | 
          
            | - |   | 1020 |         }
 | 
          
            | - |   | 1021 |     }
 | 
          
            | 994 |  
 | 1022 |  
 | 
          
            | 995 |     if ($return) {
 | 1023 |     if ($return) {
 | 
          
            | 996 |         $returnval .= $output;
 | 1024 |         $returnval .= $output;
 | 
          
            | 997 |     } else {
 | 1025 |     } else {
 | 
          
            | 998 |         echo $output;
 | 1026 |         echo $output;
 | 
          
            | Línea 1432... | Línea 1460... | 
          
            | 1432 |      * 1D array of grade items only
 | 1460 |      * 1D array of grade items only
 | 
          
            | 1433 |      */
 | 1461 |      */
 | 
          
            | 1434 |     public $items;
 | 1462 |     public $items;
 | 
          
            | Línea 1435... | Línea 1463... | 
          
            | 1435 |  
 | 1463 |  
 | 
          
            | 1436 |     /**
 | - |   | 
          
            | 1437 |      * Returns icon of element
 | - |   | 
          
            | 1438 |      *
 | - |   | 
          
            | 1439 |      * @param array &$element An array representing an element in the grade_tree
 | - |   | 
          
            | 1440 |      * @param bool  $spacerifnone return spacer if no icon found
 | - |   | 
          
            | 1441 |      *
 | - |   | 
          
            | 1442 |      * @return string icon or spacer
 | 1464 |     /**
 | 
          
            | 1443 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_icon()}
 | - |   | 
          
            | 1444 |      * @todo MDL-79907 This will be deleted in Moodle 4.8.
 | 1465 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_icon()}
 | 
          
            | 1445 |      */
 | - |   | 
          
            | 1446 |     public function get_element_icon(&$element, $spacerifnone=false) {
 | 1466 |      */
 | 
          
            | 1447 |         debugging('The function get_element_icon() is deprecated, please use grade_helper::get_element_icon() instead.',
 | 1467 |     #[\core\attribute\deprecated('grade_helper::get_element_icon', since: '4.4', mdl: 'MDL-77326', final: true)]
 | 
          
            | 1448 |             DEBUG_DEVELOPER);
 | 1468 |     public function get_element_icon(): void {
 | 
          
            | 1449 |         return grade_helper::get_element_icon($element, $spacerifnone);
 | 1469 |         \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
 | 
          
            | Línea 1450... | Línea 1470... | 
          
            | 1450 |     }
 | 1470 |     }
 | 
          
            | 1451 |  
 | - |   | 
          
            | 1452 |     /**
 | - |   | 
          
            | 1453 |      * Returns the string that describes the type of the element.
 | - |   | 
          
            | 1454 |      *
 | - |   | 
          
            | 1455 |      * @param array $element An array representing an element in the grade_tree
 | 1471 |  
 | 
          
            | 1456 |      * @return string The string that describes the type of the grade element
 | - |   | 
          
            | 1457 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_type_string()}
 | 1472 |     /**
 | 
          
            | 1458 |      * @todo MDL-79907 This will be deleted in Moodle 4.8.
 | 1473 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_type_string()}
 | 
          
            | 1459 |      */
 | 1474 |      */
 | 
          
            | 1460 |     public function get_element_type_string(array $element): string {
 | - |   | 
          
            | 1461 |         debugging('The function get_element_type_string() is deprecated,' .
 | - |   | 
          
            | 1462 |             ' please use grade_helper::get_element_type_string() instead.',
 | 1475 |     #[\core\attribute\deprecated('grade_helper::get_element_type_string', since: '4.4', mdl: 'MDL-77326', final: true)]
 | 
          
            | 1463 |             DEBUG_DEVELOPER);
 | 1476 |     public function get_element_type_string(): void {
 | 
          
            | Línea 1464... | Línea 1477... | 
          
            | 1464 |         return grade_helper::get_element_type_string($element);
 | 1477 |         \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
 | 
          
            | 1465 |     }
 | - |   | 
          
            | 1466 |  
 | - |   | 
          
            | 1467 |     /**
 | - |   | 
          
            | 1468 |      * Returns name of element optionally with icon and link
 | - |   | 
          
            | 1469 |      *
 | - |   | 
          
            | 1470 |      * @param array &$element An array representing an element in the grade_tree
 | - |   | 
          
            | 1471 |      * @param bool  $withlink Whether or not this header has a link
 | - |   | 
          
            | 1472 |      * @param bool  $icon Whether or not to display an icon with this header
 | - |   | 
          
            | 1473 |      * @param bool  $spacerifnone return spacer if no icon found
 | - |   | 
          
            | 1474 |      * @param bool  $withdescription Show description if defined by this item.
 | - |   | 
          
            | 1475 |      * @param bool  $fulltotal If the item is a category total, returns $categoryname."total"
 | - |   | 
          
            | 1476 |      *                         instead of "Category total" or "Course total"
 | - |   | 
          
            | 1477 |      * @param moodle_url|null $sortlink Link to sort column.
 | 1478 |     }
 | 
          
            | 1478 |      *
 | - |   | 
          
            | 1479 |      * @return string header
 | 1479 |  
 | 
          
            | 1480 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_header()}
 | 1480 |     /**
 | 
          
            | 1481 |      * @todo MDL-79907 This will be deleted in Moodle 4.8.
 | - |   | 
          
            | 1482 |      */
 | 1481 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_element_header()}
 | 
          
            | 1483 |     public function get_element_header(array &$element, bool $withlink = false, bool $icon = true,
 | - |   | 
          
            | 1484 |             bool $spacerifnone = false, bool $withdescription = false, bool $fulltotal = false,
 | - |   | 
          
            | 1485 |             ?moodle_url $sortlink = null) {
 | 1482 |      */
 | 
          
            | 1486 |         debugging('The function get_element_header() is deprecated, please use grade_helper::get_element_header() instead.',
 | - |   | 
          
            | 1487 |             DEBUG_DEVELOPER);
 | 1483 |     #[\core\attribute\deprecated('grade_helper::get_element_header', since: '4.4', mdl: 'MDL-77326', final: true)]
 | 
          
            | Línea 1488... | Línea 1484... | 
          
            | 1488 |         return grade_helper::get_element_header($element, $withlink, $icon, $spacerifnone, $withdescription,
 | 1484 |     public function get_element_header(): void {
 | 
          
            | 1489 |             $fulltotal, $sortlink);
 | 1485 |         \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
 | 
          
            | 1490 |     }
 | - |   | 
          
            | 1491 |  
 | 1486 |     }
 | 
          
            | - |   | 1487 |  
 | 
          
            | 1492 |     /**
 | 1488 |     /**
 | 
          
            | 1493 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_activity_link()}
 | - |   | 
          
            | 1494 |      * @todo MDL-79907 This will be deleted in Moodle 4.8.
 | - |   | 
          
            | 1495 |      */
 | 1489 |      * @deprecated since Moodle 4.4 - please use {@see grade_helper::get_activity_link()}
 | 
          
            | 1496 |     private function get_activity_link($element) {
 | 1490 |      */
 | 
          
            | Línea 1497... | Línea 1491... | 
          
            | 1497 |         debugging('The function get_activity_link() is deprecated, please use grade_helper::get_activity_link() instead.',
 | 1491 |     #[\core\attribute\deprecated('grade_helper::get_activity_link', since: '4.4', mdl: 'MDL-77326', final: true)]
 | 
          
            | 1498 |             DEBUG_DEVELOPER);
 | 1492 |     private function get_activity_link(): void {
 | 
          
            | 1499 |         return grade_helper::get_activity_link($element);
 | 1493 |         \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
 | 
          
            | Línea 1619... | Línea 1613... | 
          
            | 1619 |         }
 | 1613 |         }
 | 
          
            | Línea 1620... | Línea 1614... | 
          
            | 1620 |  
 | 1614 |  
 | 
          
            | 1621 |         if ($menuitems) {
 | 1615 |         if ($menuitems) {
 | 
          
            | 1622 |             $menu = new action_menu($menuitems);
 | 1616 |             $menu = new action_menu($menuitems);
 | 
          
            | 1623 |             $icon = $OUTPUT->pix_icon('i/moremenu', get_string('actions'));
 | 1617 |             $icon = $OUTPUT->pix_icon('i/moremenu', get_string('actions'));
 | 
          
            | 1624 |             $extraclasses = 'btn btn-link btn-icon icon-size-3 d-flex align-items-center justify-content-center no-caret';
 | 1618 |             $extraclasses = 'btn btn-link btn-icon d-flex no-caret';
 | 
          
            | 1625 |             $menu->set_menu_trigger($icon, $extraclasses);
 | 1619 |             $menu->set_menu_trigger($icon, $extraclasses);
 | 
          
            | Línea 1626... | Línea 1620... | 
          
            | 1626 |             $menu->set_menu_left();
 | 1620 |             $menu->set_menu_left();
 | 
          
            | 1627 |  
 | 1621 |  
 | 
          
            | Línea 2781... | Línea 2775... | 
          
            | 2781 |         global $USER, $CFG, $COURSE, $DB;
 | 2775 |         global $USER, $CFG, $COURSE, $DB;
 | 
          
            | Línea 2782... | Línea 2776... | 
          
            | 2782 |  
 | 2776 |  
 | 
          
            | 2783 |         $this->courseid   = $courseid;
 | 2777 |         $this->courseid   = $courseid;
 | 
          
            | 2784 |         $this->levels     = array();
 | 2778 |         $this->levels     = array();
 | 
          
            | - |   | 2779 |         $this->context    = context_course::instance($courseid);
 | 
          
            | Línea 2785... | Línea 2780... | 
          
            | 2785 |         $this->context    = context_course::instance($courseid);
 | 2780 |         $this->items      = [];
 | 
          
            | 2786 |  
 | 2781 |  
 | 
          
            | 2787 |         if (!empty($COURSE->id) && $COURSE->id == $this->courseid) {
 | 2782 |         if (!empty($COURSE->id) && $COURSE->id == $this->courseid) {
 | 
          
            | 2788 |             $course = $COURSE;
 | 2783 |             $course = $COURSE;
 | 
          
            | Línea 3416... | Línea 3411... | 
          
            | 3416 |      * @var array
 | 3411 |      * @var array
 | 
          
            | 3417 |      */
 | 3412 |      */
 | 
          
            | 3418 |     protected static $aggregationstrings = null;
 | 3413 |     protected static $aggregationstrings = null;
 | 
          
            | Línea 3419... | Línea 3414... | 
          
            | 3419 |  
 | 3414 |  
 | 
          
            | 3420 |     /**
 | - |   | 
          
            | 3421 |      * Cached grade tree plugin strings
 | - |   | 
          
            | 3422 |      * @var array
 | - |   | 
          
            | 3423 |      */
 | - |   | 
          
            | 3424 |     protected static $langstrings = [];
 | - |   | 
          
            | 3425 |  
 | - |   | 
          
            | 3426 |     /**
 | - |   | 
          
            | 3427 |      * First checks the cached language strings, then returns match if found, or uses get_string()
 | - |   | 
          
            | 3428 |      * to get it from the DB, caches it then returns it.
 | - |   | 
          
            | 3429 |      *
 | 3415 |     /**
 | 
          
            | 3430 |      * @deprecated since 4.3
 | - |   | 
          
            | 3431 |      * @todo MDL-78780 This will be deleted in Moodle 4.7.
 | - |   | 
          
            | 3432 |      * @param string $strcode
 | - |   | 
          
            | 3433 |      * @param string|null $section Optional language section
 | - |   | 
          
            | 3434 |      * @return string
 | 3416 |      * @deprecated since 4.3
 | 
          
            | 3435 |      */
 | 3417 |      */
 | 
          
            | 3436 |     public static function get_lang_string(string $strcode, ?string $section = null): string {
 | - |   | 
          
            | 3437 |         debugging('grade_helper::get_lang_string() is deprecated, please use' .
 | - |   | 
          
            | 3438 |             ' get_string() instead.', DEBUG_DEVELOPER);
 | - |   | 
          
            | 3439 |  
 | 3418 |     #[\core\attribute\deprecated('get_string', since: '4.3', mdl: 'MDL-78561', final: true)]
 | 
          
            | 3440 |         if (empty(self::$langstrings[$strcode])) {
 | 3419 |     public static function get_lang_string(): void {
 | 
          
            | 3441 |             self::$langstrings[$strcode] = get_string($strcode, $section);
 | - |   | 
          
            | 3442 |         }
 | - |   | 
          
            | 3443 |         return self::$langstrings[$strcode];
 | 3420 |         \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
 | 
          
            | Línea 3444... | Línea 3421... | 
          
            | 3444 |     }
 | 3421 |     }
 | 
          
            | 3445 |  
 | 3422 |  
 | 
          
            | 3446 |     /**
 | 3423 |     /**
 |