Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 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/>. 16 17 /** 18 * This file is part of the User section Moodle 19 * 20 * @copyright 1999 Martin Dougiamas http://dougiamas.com 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 * @package core_user 23 */ 24 25 require_once(__DIR__ . '/../config.php'); 26 require_once($CFG->dirroot . '/repository/lib.php'); 27 28 $config = optional_param('config', 0, PARAM_INT); 29 $course = optional_param('course', SITEID, PARAM_INT); 30 31 $url = new moodle_url('/user/repository.php', array('course' => $course)); 32 if ($config !== 0) { 33 $url->param('config', $config); 34 } 35 $PAGE->set_url($url); 36 37 $course = $DB->get_record("course", array("id" => $course), '*', MUST_EXIST); 38 39 $user = $USER; 40 $baseurl = $CFG->wwwroot . '/user/repository.php'; 41 $namestr = get_string('name'); 42 $fullname = fullname($user); 43 $strrepos = get_string('repositories', 'repository'); 44 $configstr = get_string('manageuserrepository', 'repository'); 45 $pluginstr = get_string('plugin', 'repository'); 46 47 require_login($course, false); 48 $coursecontext = context_course::instance($course->id, MUST_EXIST); 49 50 $link = new moodle_url('/user/view.php', array('id' => $user->id)); 51 $PAGE->navbar->add($fullname, $link); 52 $PAGE->navbar->add($strrepos); 53 $PAGE->set_title("$course->fullname: $fullname: $strrepos"); 54 $PAGE->set_heading($course->fullname); 55 56 echo $OUTPUT->header(); 57 58 echo $OUTPUT->heading($configstr); 59 echo $OUTPUT->box_start(); 60 61 $params = array(); 62 $params['context'] = [$coursecontext]; 63 $params['currentcontext'] = $PAGE->context; 64 $params['userid'] = $USER->id; 65 if (!$instances = repository::get_instances($params)) { 66 throw new \moodle_exception('noinstances', 'repository', $CFG->wwwroot . '/user/view.php'); 67 } 68 69 $table = new html_table(); 70 $table->head = array($namestr, $pluginstr, ''); 71 $table->data = array(); 72 73 foreach ($instances as $i) { 74 $path = '/repository/'.$i->type.'/settings.php'; 75 $settings = file_exists($CFG->dirroot.$path); 76 $table->data[] = array($i->name, $i->type, 77 $settings ? '<a href="'.$CFG->wwwroot.$path.'">' 78 .get_string('settings', 'repository').'</a>' : ''); 79 } 80 81 echo html_writer::table($table); 82 echo $OUTPUT->footer(); 83 84
title
Description
Body
title
Description
Body
title
Description
Body
title
Body