moodle/user/repository.php

58 lines
1.7 KiB
PHP
Raw Normal View History

2008-07-28 08:24:55 +00:00
<?php //$Id$
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);
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);
$link = new moodle_url($CFG->wwwroot . '/user/view.php', array('id'=>$user->id));
$PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_SETTING, $link);
$PAGE->navbar->add($strrepos);
$PAGE->set_title("$course->fullname: $fullname: $strrepos");
$PAGE->set_heading($course->fullname);
2008-07-28 08:24:55 +00:00
echo $OUTPUT->header();
2008-07-28 08:24:55 +00:00
$currenttab = 'repositories';
include('tabs.php');
echo $OUTPUT->heading($configstr);
echo $OUTPUT->box_start();
2008-07-28 08:24:55 +00:00
if (!$instances = repository::get_instances($COURSE->context, $USER->id)) {
2008-07-28 08:24:55 +00:00
print_error('noinstances', 'repository', $CFG->wwwroot . '/user/view.php');
}
$table = new html_table();
2008-07-28 08:24:55 +00:00
$table->head = array($namestr, $pluginstr, '');
$table->data = array();
foreach ($instances as $i) {
$path = '/repository/'.$i->type.'/settings.php';
2008-07-28 08:24:55 +00:00
$settings = file_exists($CFG->dirroot.$path);
$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>' : '');
}
echo $OUTPUT->table($table);
echo $OUTPUT->footer();
2008-07-28 08:24:55 +00:00
?>