Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/user/repository.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00026 require_once(dirname(dirname(__FILE__)) . '/config.php');
00027 require_once($CFG->dirroot . '/repository/lib.php');
00028 
00029 $config = optional_param('config', 0, PARAM_INT);
00030 $course  = optional_param('course', SITEID, PARAM_INT);
00031 
00032 $url = new moodle_url('/user/repository.php', array('course'=>$course));
00033 if ($config !== 0) {
00034     $url->param('config', $config);
00035 }
00036 $PAGE->set_url($url);
00037 
00038 $course = $DB->get_record("course", array("id"=>$course), '*', MUST_EXIST);
00039 
00040 $user = $USER;
00041 $baseurl = $CFG->wwwroot . '/user/repository.php';
00042 $namestr = get_string('name');
00043 $fullname = fullname($user);
00044 $strrepos = get_string('repositories', 'repository');
00045 $configstr = get_string('manageuserrepository', 'repository');
00046 $pluginstr = get_string('plugin', 'repository');
00047 
00048 require_login($course, false);
00049 $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
00050 
00051 $link = new moodle_url('/user/view.php', array('id'=>$user->id));
00052 $PAGE->navbar->add($fullname, $link);
00053 $PAGE->navbar->add($strrepos);
00054 $PAGE->set_title("$course->fullname: $fullname: $strrepos");
00055 $PAGE->set_heading($course->fullname);
00056 
00057 echo $OUTPUT->header();
00058 
00059 $currenttab = 'repositories';
00060 include('tabs.php');
00061 
00062 echo $OUTPUT->heading($configstr);
00063 echo $OUTPUT->box_start();
00064 
00065 $params = array();
00066 $params['context'] = $coursecontext;
00067 $params['currentcontext'] = $PAGE->context;
00068 $params['userid']   = $USER->id;
00069 if (!$instances = repository::get_instances($params)) {
00070     print_error('noinstances', 'repository', $CFG->wwwroot . '/user/view.php');
00071 }
00072 
00073 $table = new html_table();
00074 $table->head = array($namestr, $pluginstr, '');
00075 $table->data = array();
00076 
00077 foreach ($instances as $i) {
00078     $path = '/repository/'.$i->type.'/settings.php';
00079     $settings = file_exists($CFG->dirroot.$path);
00080     $table->data[] = array($i->name, $i->type,
00081         $settings ? '<a href="'.$CFG->wwwroot.$path.'">'
00082             .get_string('settings', 'repository').'</a>' : '');
00083 }
00084 
00085 echo html_writer::table($table);
00086 echo $OUTPUT->footer();
00087 
00088 
 All Data Structures Namespaces Files Functions Variables Enumerations