2009-09-25 04:02:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the User section Moodle
|
|
|
|
*
|
|
|
|
* @copyright 1999 Martin Dougiamas http://dougiamas.com
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
* @package user
|
|
|
|
*/
|
2008-07-28 08:24:55 +00:00
|
|
|
|
|
|
|
require_once(dirname(dirname(__FILE__)) . '/config.php');
|
|
|
|
require_once($CFG->dirroot . '/repository/lib.php');
|
|
|
|
|
|
|
|
$config = optional_param('config', 0, PARAM_INT);
|
|
|
|
$course = optional_param('course', SITEID, PARAM_INT);
|
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$url = new moodle_url('/user/repository.php', array('course'=>$course));
|
2009-09-25 04:02:46 +00:00
|
|
|
if ($config !== 0) {
|
|
|
|
$url->param('config', $config);
|
|
|
|
}
|
|
|
|
$PAGE->set_url($url);
|
|
|
|
|
2008-07-28 08:24:55 +00:00
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$course))) {
|
|
|
|
print_error('invalidcourseid');
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = $USER;
|
|
|
|
$baseurl = $CFG->wwwroot . '/user/repository.php';
|
|
|
|
$namestr = get_string('name');
|
|
|
|
$fullname = fullname($user);
|
|
|
|
$strrepos = get_string('repositories', 'repository');
|
|
|
|
$configstr = get_string('manageuserrepository', 'repository');
|
|
|
|
$pluginstr = get_string('plugin', 'repository');
|
|
|
|
|
|
|
|
require_login($course, false);
|
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$link = new moodle_url('/user/view.php', array('id'=>$user->id));
|
2009-09-04 03:12:01 +00:00
|
|
|
$PAGE->navbar->add($fullname, $link);
|
2009-09-02 08:36:16 +00:00
|
|
|
$PAGE->navbar->add($strrepos);
|
|
|
|
$PAGE->set_title("$course->fullname: $fullname: $strrepos");
|
|
|
|
$PAGE->set_heading($course->fullname);
|
2008-07-28 08:24:55 +00:00
|
|
|
|
2009-09-02 08:36:16 +00:00
|
|
|
echo $OUTPUT->header();
|
2008-07-28 08:24:55 +00:00
|
|
|
|
|
|
|
$currenttab = 'repositories';
|
|
|
|
include('tabs.php');
|
|
|
|
|
2009-08-06 08:15:05 +00:00
|
|
|
echo $OUTPUT->heading($configstr);
|
2009-08-18 05:19:25 +00:00
|
|
|
echo $OUTPUT->box_start();
|
2008-07-28 08:24:55 +00:00
|
|
|
|
2009-11-06 09:07:46 +00:00
|
|
|
$params = array();
|
|
|
|
$params['context'] = array($COURSE->context);
|
|
|
|
$params['currentcontext'] = $PAGE->context;
|
|
|
|
$params['userid'] = $USER->id;
|
|
|
|
if (!$instances = repository::get_instances($params)) {
|
2008-07-28 08:24:55 +00:00
|
|
|
print_error('noinstances', 'repository', $CFG->wwwroot . '/user/view.php');
|
|
|
|
}
|
|
|
|
|
2009-08-20 08:50:22 +00:00
|
|
|
$table = new html_table();
|
2008-07-28 08:24:55 +00:00
|
|
|
$table->head = array($namestr, $pluginstr, '');
|
|
|
|
$table->data = array();
|
|
|
|
|
|
|
|
foreach ($instances as $i) {
|
2008-08-13 04:09:13 +00:00
|
|
|
$path = '/repository/'.$i->type.'/settings.php';
|
2008-07-28 08:24:55 +00:00
|
|
|
$settings = file_exists($CFG->dirroot.$path);
|
2008-11-26 07:03:10 +00:00
|
|
|
$table->data[] = array($i->name, $i->type,
|
2008-07-28 08:24:55 +00:00
|
|
|
$settings ? '<a href="'.$CFG->wwwroot.$path.'">'
|
|
|
|
.get_string('settings', 'repository').'</a>' : '');
|
|
|
|
}
|
|
|
|
|
2010-03-20 22:15:54 +00:00
|
|
|
echo html_writer::table($table);
|
2009-08-06 14:08:20 +00:00
|
|
|
echo $OUTPUT->footer();
|
2008-07-28 08:24:55 +00:00
|
|
|
|
2009-11-04 08:11:02 +00:00
|
|
|
|