Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 20... Línea 20...
20
 * @package   core_backup
20
 * @package   core_backup
21
 * @copyright 2010 Sam Hemelryk
21
 * @copyright 2010 Sam Hemelryk
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
23
 */
Línea -... Línea 24...
-
 
24
 
-
 
25
use core_course\output\activity_icon;
-
 
26
use core\output\local\properties\iconsize;
24
 
27
 
Línea 25... Línea 28...
25
defined('MOODLE_INTERNAL') || die;
28
defined('MOODLE_INTERNAL') || die;
26
 
29
 
27
global $CFG;
30
global $CFG;
Línea 201... Línea 204...
201
                        $table->align = array('left', 'left', 'center');
204
                        $table->align = array('left', 'left', 'center');
202
                        $table->attributes = array('class' => 'activitytable generaltable');
205
                        $table->attributes = array('class' => 'activitytable generaltable');
203
                        $table->data = array();
206
                        $table->data = array();
204
                    }
207
                    }
205
                    $name = get_string('pluginname', $activity->modulename);
208
                    $name = get_string('pluginname', $activity->modulename);
206
                    $icon = new image_icon('monologo', '', $activity->modulename, ['class' => 'iconlarge icon-pre']);
209
                    $icon = activity_icon::from_modname($activity->modulename)
-
 
210
                        ->set_icon_size(iconsize::SIZE4)
207
                    $table->data[] = array(
211
                        ->set_colourize(false);
-
 
212
 
-
 
213
                    $content = $this->output->container(
208
                        $this->output->render($icon).$name,
214
                        contents: $this->output->render($icon) . $name,
-
 
215
                        classes: 'd-flex align-items-center',
-
 
216
                    );
-
 
217
 
-
 
218
                    $table->data[] = [
-
 
219
                        $content,
209
                        format_string($activity->title),
220
                        format_string($activity->title),
210
                        ($activity->settings[$activitykey.'_userinfo']) ? $yestick : $notick,
221
                        ($activity->settings[$activitykey.'_userinfo']) ? $yestick : $notick,
211
                    );
222
                    ];
212
                }
223
                }
213
                if (!empty($table)) {
224
                if (!empty($table)) {
214
                    $html .= $this->backup_detail_pair(get_string('sectionactivities', 'backup'), html_writer::table($table));
225
                    $html .= $this->backup_detail_pair(get_string('sectionactivities', 'backup'), html_writer::table($table));
215
                }
226
                }
Línea 276... Línea 287...
276
     * @param restore_category_search $categories
287
     * @param restore_category_search $categories
277
     * @param restore_course_search $courses
288
     * @param restore_course_search $courses
278
     * @param int $currentcourse
289
     * @param int $currentcourse
279
     * @return string
290
     * @return string
280
     */
291
     */
281
    public function course_selector(moodle_url $nextstageurl, $wholecourse = true, restore_category_search $categories = null,
292
    public function course_selector(moodle_url $nextstageurl, $wholecourse = true, ?restore_category_search $categories = null,
282
                                    restore_course_search $courses = null, $currentcourse = null) {
293
                                    ?restore_course_search $courses = null, $currentcourse = null) {
283
        global $CFG;
294
        global $CFG;
284
        require_once($CFG->dirroot.'/course/lib.php');
295
        require_once($CFG->dirroot.'/course/lib.php');
Línea 285... Línea 296...
285
 
296
 
286
        // These variables are used to check if the form using this function was submitted.
297
        // These variables are used to check if the form using this function was submitted.
Línea 393... Línea 404...
393
     *
404
     *
394
     * @param moodle_url $nextstageurl
405
     * @param moodle_url $nextstageurl
395
     * @param import_course_search $courses
406
     * @param import_course_search $courses
396
     * @return string
407
     * @return string
397
     */
408
     */
398
    public function import_course_selector(moodle_url $nextstageurl, import_course_search $courses = null) {
409
    public function import_course_selector(moodle_url $nextstageurl, ?import_course_search $courses = null) {
399
        $html  = html_writer::start_tag('div', array('class' => 'import-course-selector backup-restore'));
410
        $html  = html_writer::start_tag('div', array('class' => 'import-course-selector backup-restore'));
400
        $html .= html_writer::start_tag('form', array('method' => 'post', 'action' => $nextstageurl->out_omit_querystring()));
411
        $html .= html_writer::start_tag('form', array('method' => 'post', 'action' => $nextstageurl->out_omit_querystring()));
401
        foreach ($nextstageurl->params() as $key => $value) {
412
        foreach ($nextstageurl->params() as $key => $value) {
402
            $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
413
            $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
403
        }
414
        }
Línea 427... Línea 438...
427
    protected function backup_detail_pair($label, $value) {
438
    protected function backup_detail_pair($label, $value) {
428
        static $count = 0;
439
        static $count = 0;
429
        $count ++;
440
        $count ++;
430
        $html  = html_writer::start_tag('div', ['class' => 'detail-pair', 'role' => 'row']);
441
        $html  = html_writer::start_tag('div', ['class' => 'detail-pair', 'role' => 'row']);
431
        $html .= html_writer::tag('div', $label, ['class' => 'detail-pair-label mb-2', 'role' => 'cell']);
442
        $html .= html_writer::tag('div', $label, ['class' => 'detail-pair-label mb-2', 'role' => 'cell']);
432
        $html .= html_writer::tag('div', $value, ['class' => 'detail-pair-value pl-2', 'role' => 'cell']);
443
        $html .= html_writer::tag('div', $value, ['class' => 'detail-pair-value ps-2', 'role' => 'cell']);
433
        $html .= html_writer::end_tag('div');
444
        $html .= html_writer::end_tag('div');
434
        return $html;
445
        return $html;
435
    }
446
    }
Línea 436... Línea 447...
436
 
447
 
Línea 520... Línea 531...
520
     * @return string
531
     * @return string
521
     */
532
     */
522
    public function substage_buttons($haserrors) {
533
    public function substage_buttons($haserrors) {
523
        $output  = html_writer::start_tag('div', array('continuebutton'));
534
        $output  = html_writer::start_tag('div', array('continuebutton'));
524
        if (!$haserrors) {
535
        if (!$haserrors) {
525
            $attrs = ['type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary mr-1'];
536
            $attrs = ['type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary me-1'];
526
            $output .= html_writer::empty_tag('input', $attrs);
537
            $output .= html_writer::empty_tag('input', $attrs);
527
        }
538
        }
528
        $attrs = array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel'), 'class' => 'btn btn-secondary');
539
        $attrs = array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel'), 'class' => 'btn btn-secondary');
529
        $output .= html_writer::empty_tag('input', $attrs);
540
        $output .= html_writer::empty_tag('input', $attrs);
530
        $output .= html_writer::end_tag('div');
541
        $output .= html_writer::end_tag('div');
Línea 574... Línea 585...
574
    /**
585
    /**
575
     * Print a backup files tree
586
     * Print a backup files tree
576
     * @param array $options
587
     * @param array $options
577
     * @return string
588
     * @return string
578
     */
589
     */
579
    public function backup_files_viewer(array $options = null) {
590
    public function backup_files_viewer(?array $options = null) {
580
        $files = new backup_files_viewer($options);
591
        $files = new backup_files_viewer($options);
581
        return $this->render($files);
592
        return $this->render($files);
582
    }
593
    }
Línea 583... Línea 594...
583
 
594
 
Línea 878... Línea 889...
878
            $output .= html_writer::empty_tag('input', $attrs);
889
            $output .= html_writer::empty_tag('input', $attrs);
879
            $attrs = array(
890
            $attrs = array(
880
                'type' => 'submit',
891
                'type' => 'submit',
881
                'name' => 'searchcourses',
892
                'name' => 'searchcourses',
882
                'value' => get_string('search'),
893
                'value' => get_string('search'),
883
                'class' => 'btn btn-secondary ml-1'
894
                'class' => 'btn btn-secondary ms-1'
884
            );
895
            );
885
            $output .= html_writer::empty_tag('input', $attrs);
896
            $output .= html_writer::empty_tag('input', $attrs);
886
            $output .= html_writer::end_tag('div');
897
            $output .= html_writer::end_tag('div');
Línea 887... Línea 898...
887
 
898
 
Línea 944... Línea 955...
944
        $output .= html_writer::empty_tag('input', $attrs);
955
        $output .= html_writer::empty_tag('input', $attrs);
945
        $attrs = array(
956
        $attrs = array(
946
            'type' => 'submit',
957
            'type' => 'submit',
947
            'name' => 'searchcourses',
958
            'name' => 'searchcourses',
948
            'value' => get_string('search'),
959
            'value' => get_string('search'),
949
            'class' => 'btn btn-secondary ml-1'
960
            'class' => 'btn btn-secondary ms-1'
950
        );
961
        );
951
        $output .= html_writer::empty_tag('input', $attrs);
962
        $output .= html_writer::empty_tag('input', $attrs);
952
        $output .= html_writer::end_tag('div');
963
        $output .= html_writer::end_tag('div');
Línea 953... Línea 964...
953
 
964
 
Línea 1091... Línea 1102...
1091
 
1102
 
1092
        foreach ($copies as $copy) {
1103
        foreach ($copies as $copy) {
Línea 1093... Línea 1104...
1093
            $sourceurl = new \moodle_url('/course/view.php', array('id' => $copy->sourceid));
1104
            $sourceurl = new \moodle_url('/course/view.php', array('id' => $copy->sourceid));
1094
 
1105
 
1095
            $tablerow = array(
1106
            $tablerow = array(
-
 
1107
                html_writer::link($sourceurl, format_string($copy->source, true,
1096
                html_writer::link($sourceurl, $copy->source),
1108
                    ['context' => context_course::instance($copy->sourceid)])),
1097
                $copy->destination,
1109
                format_string($copy->destination, true, ['context' => context_course::instance($copy->sourceid)]),
1098
                userdate($copy->timecreated),
1110
                userdate($copy->timecreated),
1099
                get_string($copy->operation),
1111
                get_string($copy->operation),
1100
                $this->get_status_display($copy->status, $copy->backupid, $copy->restoreid, $copy->operation)
1112
                $this->get_status_display($copy->status, $copy->backupid, $copy->restoreid, $copy->operation)
Línea 1145... Línea 1157...
1145
 
1157
 
1146
    /**
1158
    /**
1147
     * Constructor of backup_files_viewer class
1159
     * Constructor of backup_files_viewer class
1148
     * @param array $options
1160
     * @param array $options
1149
     */
1161
     */
1150
    public function __construct(array $options = null) {
1162
    public function __construct(?array $options = null) {
1151
        global $CFG, $USER;
1163
        global $CFG, $USER;
1152
        $fs = get_file_storage();
1164
        $fs = get_file_storage();
1153
        $this->currentcontext = $options['currentcontext'];
1165
        $this->currentcontext = $options['currentcontext'];
1154
        $this->filecontext    = $options['filecontext'];
1166
        $this->filecontext    = $options['filecontext'];