Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 13... Línea 13...
13
//
13
//
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
-
 
17
use core_completion\manager;
Línea 17... Línea 18...
17
use core_completion\manager;
18
use core_course\output\activity_icon;
Línea 18... Línea 19...
18
 
19
 
Línea 28... Línea 29...
28
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
30
 */
30
class core_course_bulk_activity_completion_renderer extends plugin_renderer_base {
31
class core_course_bulk_activity_completion_renderer extends plugin_renderer_base {
Línea 31... Línea 32...
31
 
32
 
32
    /**
-
 
33
     * @deprecated since Moodle 4.0
-
 
34
     */
-
 
35
    public function navigation() {
-
 
36
        throw new coding_exception(__FUNCTION__ . '() has been removed.');
-
 
37
    }
-
 
38
 
-
 
39
    /**
33
    /**
40
     * Render the bulk completion tab.
34
     * Render the bulk completion tab.
41
     *
35
     *
42
     * @param Array|stdClass $data the context data to pass to the template.
36
     * @param array|stdClass $data the context data to pass to the template.
43
     * @return bool|string
37
     * @return bool|string
44
     */
38
     */
45
    public function bulkcompletion($data) {
39
    public function bulkcompletion($data) {
46
        return parent::render_from_template('core_course/bulkactivitycompletion', $data);
40
        return parent::render_from_template('core_course/bulkactivitycompletion', $data);
Línea 60... Línea 54...
60
            // If the user can manage this module, then the activity completion form needs to be returned too, without the
54
            // If the user can manage this module, then the activity completion form needs to be returned too, without the
61
            // cancel button (so only "Save changes" button is displayed).
55
            // cancel button (so only "Save changes" button is displayed).
62
            if ($module->canmanage) {
56
            if ($module->canmanage) {
63
                // Only create the form if it's different from the one that has been sent.
57
                // Only create the form if it's different from the one that has been sent.
64
                $modform = $form;
58
                $modform = $form;
-
 
59
                $module->open = true;
65
                if (empty($form) || !in_array($module->id, array_keys($modules))) {
60
                if (empty($form) || !in_array($module->id, array_keys($modules))) {
66
                    $modform = new \core_completion_defaultedit_form(
61
                    $modform = new \core_completion_defaultedit_form(
67
                        null,
62
                        null,
68
                        [
63
                        [
69
                            'course' => $course,
64
                            'course' => $course,
Línea 72... Línea 67...
72
                            ],
67
                            ],
73
                            'displaycancel' => false,
68
                            'displaycancel' => false,
74
                            'forceuniqueid' => true,
69
                            'forceuniqueid' => true,
75
                        ],
70
                        ],
76
                    );
71
                    );
77
                    $module->modulecollapsed = true;
72
                    $module->open = false;
78
                }
73
                }
Línea -... Línea 74...
-
 
74
 
-
 
75
                $module->activityicon = activity_icon::from_modname($module->name)->export_for_template($this);
79
 
76
 
80
                $moduleform = manager::get_module_form($module->name, $course);
77
                $moduleform = manager::get_module_form($module->name, $course);
81
                if ($moduleform) {
78
                if ($moduleform) {
82
                    $module->formhtml = $modform->render();
79
                    $module->formhtml = $modform->render();
83
                } else {
80
                } else {
Línea 115... Línea 112...
115
        ];
112
        ];
116
        return parent::render_from_template('core_course/editbulkactivitycompletion', $data);
113
        return parent::render_from_template('core_course/editbulkactivitycompletion', $data);
117
    }
114
    }
Línea 118... Línea 115...
118
 
115
 
119
    /**
-
 
120
     * Renders the form for editing default completion
-
 
121
     *
-
 
122
     * @param moodleform $form
-
 
123
     * @param array $modules
-
 
124
     * @return string
116
    /**
125
     * @deprecated since Moodle 4.3 MDL-78528
-
 
126
     * @todo MDL-78711 This will be deleted in Moodle 4.7
117
     * @deprecated since Moodle 4.3 MDL-78528
127
     */
-
 
128
    public function edit_default_completion($form, $modules) {
118
     */
129
        debugging('edit_default_completion() is deprecated and will be removed.', DEBUG_DEVELOPER);
-
 
130
 
-
 
131
        ob_start();
-
 
132
        $form->display();
119
    #[\core\attribute\deprecated(null, since: '4.3', mdl: 'MDL-78528', final: true)]
133
        $formhtml = ob_get_contents();
-
 
134
        ob_end_clean();
-
 
135
 
-
 
136
        $data = (object)[
-
 
137
            'form' => $formhtml,
-
 
138
            'modules' => array_values($modules),
-
 
139
            'modulescount' => count($modules),
-
 
140
        ];
120
    public function edit_default_completion() {
141
        return parent::render_from_template('core_course/editdefaultcompletion', $data);
121
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
Línea 142... Línea 122...
142
    }
122
    }
143
 
123
 
144
    /**
124
    /**