Merge branch 'w04_MDL-26035_20_installtest' of git://github.com/skodak/moodle
authorSam Hemelryk <sam@moodle.com>
Mon, 24 Jan 2011 07:05:55 +0000 (15:05 +0800)
committerSam Hemelryk <sam@moodle.com>
Mon, 24 Jan 2011 07:05:55 +0000 (15:05 +0800)
35 files changed:
admin/settings/users.php
blocks/course_summary/block_course_summary.php
blocks/html/block_html.php
blocks/online_users/block_online_users.php
blog/locallib.php
calendar/lib.php
course/resources.php
enrol/category/locallib.php
enrol/database/lib.php
group/members.php
group/overview.php
lang/en/admin.php
lib/grade/grade_outcome.php
lib/grade/grade_scale.php
mnet/service/enrol/index.php
mnet/service/enrol/lang/en/mnetservice_enrol.php
mnet/service/enrol/locallib.php
mod/assignment/type/online/assignment.class.php
mod/feedback/item/label/lib.php
mod/forum/lib.php
mod/glossary/lib.php
mod/glossary/showentry_ajax.php
mod/label/lib.php
mod/lesson/locallib.php
mod/quiz/index.php
mod/quiz/locallib.php
mod/quiz/report/reportlib.php
mod/scorm/report.php
mod/wiki/locallib.php
mod/workshop/locallib.php
question/format/gift/format.php
question/format/gift/simpletest/testgiftformat.php
question/type/multianswer/questiontype.php
user/index.php
user/view.php

index 01ef71c..1e94aa5 100644 (file)
@@ -107,7 +107,7 @@ if ($hassiteconfig
 
         if (!during_initial_install()) {
             $temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
-                          get_string('configcreatornewroleid', 'admin'), $defaultteacherid, $creatornewroles));
+                          get_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
         }
 
         $temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
index 7905822..35ed7b5 100644 (file)
@@ -14,6 +14,8 @@ class block_course_summary extends block_base {
     function get_content() {
         global $CFG, $OUTPUT;
 
+        require_once($CFG->libdir . '/filelib.php');
+
         if($this->content !== NULL) {
             return $this->content;
         }
index de484a5..cab89ac 100755 (executable)
@@ -42,6 +42,10 @@ class block_html extends block_base {
     }
 
     function get_content() {
+        global $CFG;
+
+        require_once($CFG->libdir . '/filelib.php');
+
         if ($this->content !== NULL) {
             return $this->content;
         }
index 70ddd2b..4fb8972 100644 (file)
@@ -43,8 +43,6 @@ class block_online_users extends block_base {
 
         $groupmembers = "";
         $groupselect  = "";
-        $rafrom       = "";
-        $rawhere      = "";
         $params = array();
 
         //Add this to the SQL to show only group users
@@ -78,22 +76,22 @@ class block_online_users extends block_base {
             $params = array_merge($params, $eparams);
 
             $sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
-                      FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+                      FROM {user_lastaccess} ul $groupmembers, {user} u
                       JOIN ($esqljoin) euj ON euj.id = u.id
                      WHERE ul.timeaccess > $timefrom
                            AND u.id = ul.userid
                            AND ul.courseid = :courseid
-                           $groupselect $rawhere
+                           $groupselect
                   GROUP BY $userfields
                   ORDER BY lastaccess DESC";
 
            $csql = "SELECT u.id
-                      FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+                      FROM {user_lastaccess} ul $groupmembers, {user} u
                       JOIN ($esqljoin) euj ON euj.id = u.id
                      WHERE ul.timeaccess > $timefrom
                            AND u.id = ul.userid
                            AND ul.courseid = :courseid
-                           $groupselect $rawhere
+                           $groupselect
                   GROUP BY u.id";
 
             $params['courseid'] = $this->page->course->id;
index e28cee9..52ff8c3 100644 (file)
@@ -26,6 +26,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
+require_once($CFG->libdir . '/filelib.php');
+
 /**
  * Blog_entry class. Represents an entry in a user's blog. Contains all methods for managing this entry.
  * This class does not contain any HTML-generating code. See blog_listing sub-classes for such code.
index 3b6693f..4917100 100644 (file)
@@ -1874,7 +1874,10 @@ class calendar_event {
      * @return string
      */
     protected function get_description() {
-       global $USER;
+        global $USER, $CFG;
+
+        require_once($CFG->libdir . '/filelib.php');
+
         if ($this->_description === null) {
             // Check if we have already resolved the context for this event
             if ($this->editorcontext === null) {
index 57abd08..b98ced9 100644 (file)
@@ -37,6 +37,9 @@ $allmodules = $DB->get_records('modules', array('visible'=>1));
 $modules = array();
 foreach ($allmodules as $key=>$module) {
     $modname = $module->name;
+    if ($modname === 'label') {
+        continue;
+    }
     $libfile = "$CFG->dirroot/mod/$modname/lib.php";
     if (!file_exists($libfile)) {
         continue;
index 6924eaa..060e733 100644 (file)
@@ -254,6 +254,7 @@ function enrol_category_sync_full() {
                 $plugin->delete_instance($instance);
             }
         }
+        return;
     }
 
     list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r000');
index 50f2571..818b05e 100644 (file)
@@ -74,7 +74,7 @@ class enrol_database_plugin extends enrol_plugin {
 
         $localrolefield   = $this->get_config('localrolefield');
         $localuserfield   = $this->get_config('localuserfield');
-        $localcoursefiled = $this->get_config('localcoursefield');
+        $localcoursefield = $this->get_config('localcoursefield');
 
         $unenrolaction    = $this->get_config('unenrolaction');
         $defaultrole      = $this->get_config('defaultrole');
@@ -117,7 +117,7 @@ class enrol_database_plugin extends enrol_plugin {
                         // missing course info
                         continue;
                     }
-                    if (!$course = $DB->get_record('course', array($localcoursefiled=>$fields[$coursefield]), 'id,visible')) {
+                    if (!$course = $DB->get_record('course', array($localcoursefield=>$fields[$coursefield]), 'id,visible')) {
                         continue;
                     }
                     if (!$course->visible and $ignorehidden) {
@@ -265,7 +265,7 @@ class enrol_database_plugin extends enrol_plugin {
 
         $localrolefield   = $this->get_config('localrolefield');
         $localuserfield   = $this->get_config('localuserfield');
-        $localcoursefiled = $this->get_config('localcoursefield');
+        $localcoursefield = $this->get_config('localcoursefield');
 
         $unenrolaction    = $this->get_config('unenrolaction');
         $defaultrole      = $this->get_config('defaultrole');
@@ -308,7 +308,7 @@ class enrol_database_plugin extends enrol_plugin {
 
         // first find all existing courses with enrol instance
         $existing = array();
-        $sql = "SELECT c.id, c.visible, c.$localcoursefiled AS mapping, e.id AS enrolid
+        $sql = "SELECT c.id, c.visible, c.$localcoursefield AS mapping, e.id AS enrolid
                   FROM {course} c
                   JOIN {enrol} e ON (e.courseid = c.id AND e.enrol = 'database')";
         $rs = $DB->get_recordset_sql($sql); // watch out for idnumber duplicates
@@ -321,11 +321,17 @@ class enrol_database_plugin extends enrol_plugin {
         $rs->close();
 
         // add necessary enrol instances that are not present yet
-        $sql = "SELECT c.id, c.visible, c.$localcoursefiled AS mapping
+        $params = array();
+        $localnotempty = "";
+        if ($localcoursefield !== 'id') {
+            $localnotempty =  "AND c.$localcoursefield <> :lcfe";
+            $params['lcfe'] = $DB->sql_empty();
+        }
+        $sql = "SELECT c.id, c.visible, c.$localcoursefield AS mapping
                   FROM {course} c
              LEFT JOIN {enrol} e ON (e.courseid = c.id AND e.enrol = 'database')
-                 WHERE e.id IS NULL AND c.$localcoursefiled <> ?";
-        $rs = $DB->get_recordset_sql($sql, array($DB->sql_empty()));
+                 WHERE e.id IS NULL $localnotempty";
+        $rs = $DB->get_recordset_sql($sql, $params);
         foreach ($rs as $course) {
             if (empty($course->mapping)) {
                 continue;
index c871c79..92e4f9a 100644 (file)
@@ -12,6 +12,7 @@ require_once(dirname(__FILE__) . '/../config.php');
 require_once(dirname(__FILE__) . '/lib.php');
 require_once($CFG->dirroot . '/user/selector/lib.php');
 require_once($CFG->dirroot . '/course/lib.php');
+require_once($CFG->libdir . '/filelib.php');
 
 $groupid = required_param('group', PARAM_INT);
 $cancel  = optional_param('cancel', false, PARAM_BOOL);
index 449ef14..53a5a8b 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 require_once('../config.php');
+require_once($CFG->libdir . '/filelib.php');
 
 $courseid   = required_param('id', PARAM_INT);
 $groupid    = optional_param('group', 0, PARAM_INT);
index b1d59ec..ce096ce 100644 (file)
@@ -155,7 +155,6 @@ $string['configcountry'] = 'If you set a country here, then this country will be
 $string['configcourserequestnotify'] = 'Type username of user to be notified when new course requested.';
 $string['configcourserequestnotify2'] = 'Users who will be notified when a course is requested. Only users who can approve course requests are listed here.';
 $string['configcoursesperpage'] = 'Enter the number of courses to be display per page in a course listing.';
-$string['configcreatornewroleid'] = 'This role is automatically assigned to creators in new courses they created. This role is not assigned if creator already has needed capabilities in parent context.';
 $string['configcronclionly'] = 'If this is set, then the cron script can only be run from the command line instead of via the web.  This overrides the cron password setting below.';
 $string['configcronremotepassword'] = 'This means that the cron.php script cannot be run from a web browser without supplying the password using the following form of URL:<pre>
     http://site.example.com/admin/cron.php?password=opensesame
@@ -386,6 +385,7 @@ $string['courserequestspending'] = 'Pending course requests';
 $string['courses'] = 'Courses';
 $string['coursesperpage'] = 'Courses per page';
 $string['creatornewroleid'] = 'Creators\' role in new courses';
+$string['creatornewroleid_help'] = 'If the user does not already have the permission to manage the new course, the user is automatically enrolled using this role.';
 $string['cron'] = 'Cron';
 $string['cron_help'] = 'The cron.php maintenance script assists some of Moodle\'s modules to perform tasks on a scheduled basis, such as mailing out copies of new forum posts. A mechanism is required to run the script regularly e.g. every 5 minutes.';
 $string['cron_link'] = 'admin/cron';
index 2f964e2..47e538e 100644 (file)
@@ -276,6 +276,9 @@ class grade_outcome extends grade_object {
      * @return string
      */
     public function get_description() {
+        global $CFG;
+        require_once($CFG->libdir . '/filelib.php');
+
         $options = new stdClass;
         $options->noclean = true;
         $systemcontext = get_context_instance(CONTEXT_SYSTEM);
index 390c288..d9b5fb8 100644 (file)
@@ -313,6 +313,9 @@ class grade_scale extends grade_object {
      * @return string
      */
     public function get_description() {
+        global $CFG;
+        require_once($CFG->libdir . '/filelib.php');
+
         $systemcontext = get_context_instance(CONTEXT_SYSTEM);
         $options = new stdClass;
         $options->noclean = true;
index 53e18c4..221a28f 100644 (file)
@@ -40,6 +40,14 @@ if (!$service->is_available()) {
     die();
 }
 
+$roamingusers = get_users_by_capability(get_system_context(), 'moodle/site:mnetlogintoremote', 'u.id');
+if (empty($roamingusers)) {
+    $capname = get_string('site:mnetlogintoremote', 'role');
+    $url = new moodle_url('/admin/roles/manage.php');
+    echo notice(get_string('noroamingusers', 'mnetservice_enrol', $capname), $url);
+}
+unset($roamingusers);
+
 // remote hosts that may publish remote enrolment service and we are subscribed to it
 $hosts = $service->get_remote_publishers();
 
index 461f777..c39d3c6 100644 (file)
@@ -33,6 +33,7 @@ $string['hostappname'] = 'Application';
 $string['hostname'] = 'Host name';
 $string['hosturl'] = 'Remote host URL';
 $string['nopublishers'] = 'No remote peers available.';
+$string['noroamingusers'] = 'Users require the capability \'{$a}\' in the system context to be enrolled to remote courses, however there are currently no users with this capability. Click the continue button to assign the required capability to one or more roles on your site.';
 $string['otherenrolledusers'] = 'Other enrolled users';
 $string['pluginname'] = 'Remote enrolment service';
 $string['refetch'] = 'Re-fetch up to date state from remote hosts';
index b0c260a..ffe7e6d 100644 (file)
@@ -552,6 +552,10 @@ class mnetservice_enrol_potential_users_selector extends user_selector_base {
         $systemcontext = get_system_context();
         $userids = get_users_by_capability($systemcontext, 'moodle/site:mnetlogintoremote', 'u.id');
 
+        if (empty($userids)) {
+            return array();
+        }
+
         list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid0000');
 
         list($wherecondition, $params) = $this->search_sql($search, 'u');
index c153584..54532f7 100644 (file)
@@ -2,6 +2,8 @@
 require_once($CFG->libdir.'/formslib.php');
 require_once($CFG->libdir . '/portfoliolib.php');
 require_once($CFG->dirroot . '/mod/assignment/lib.php');
+require_once($CFG->libdir . '/filelib.php');
+
 /**
  * Extend the base assignment class for assignments where you upload a single file
  *
index 5f446b9..ce9b399 100644 (file)
@@ -112,7 +112,9 @@ class feedback_item_label extends feedback_item_base {
     }
 
     function print_item($item){
-        global $DB;
+        global $DB, $CFG;
+
+        require_once($CFG->libdir . '/filelib.php');
 
         //is the item a template?
         if(!$item->feedback AND $item->template) {
index 443bd8c..8ffaaa9 100644 (file)
@@ -3110,6 +3110,8 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa
                           $footer="", $highlight="", $postisread=null, $dummyifcantsee=true, $istracked=null, $return=false) {
     global $USER, $CFG, $OUTPUT;
 
+    require_once($CFG->libdir . '/filelib.php');
+
     // String cache
     static $str;
 
index 0f58ef0..858093a 100644 (file)
@@ -821,6 +821,10 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $mode='',$hook=''
  * @return void Output is echo'd
  */
 function glossary_print_entry_default ($entry, $glossary, $cm) {
+    global $CFG;
+
+    require_once($CFG->libdir . '/filelib.php');
+
     echo '<h3>'. strip_tags($entry->concept) . ': </h3>';
 
     $definition = $entry->definition;
index 8dac644..9703a06 100644 (file)
@@ -3,6 +3,7 @@ define('AJAX_SCRIPT', true);
 
 require_once('../../config.php');
 require_once('lib.php');
+require_once($CFG->libdir . '/filelib.php');
 
 $concept  = optional_param('concept', '', PARAM_CLEAN);
 $courseid = optional_param('courseid', 0, PARAM_INT);
@@ -66,7 +67,7 @@ if ($entries) {
         $options = new stdClass();
         $options->para = false;
         $options->trusted = $entry->definitiontrust;
-        $options->context = $context; 
+        $options->context = $context;
         $entries[$key]->definition = format_text($definition, $entry->definitionformat, $options);
 
         $entries[$key]->footer = "<p style=\"text-align:right\">&raquo;&nbsp;<a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."</a></p>";
index a80a08d..1f77822 100644 (file)
@@ -181,7 +181,7 @@ function label_reset_userdata($data) {
  *
  * @return array
  */
-function lable_get_extra_capabilities() {
+function label_get_extra_capabilities() {
     return array('moodle/site:accessallgroups');
 }
 
index 0f7881c..f521330 100644 (file)
@@ -31,6 +31,7 @@ defined('MOODLE_INTERNAL') || die();
 /** Include the files that are required by this module */
 require_once($CFG->dirroot.'/course/moodleform_mod.php');
 require_once($CFG->dirroot . '/mod/lesson/lib.php');
+require_once($CFG->libdir . '/filelib.php');
 
 /** This page */
 define('LESSON_THISPAGE', 0);
index 631f95b..22e1229 100644 (file)
@@ -92,8 +92,8 @@
                 SELECT qg.quiz, qg.grade
                 FROM {quiz_grades} qg
                 JOIN {quiz} q ON q.id = qg.quiz
-                WHERE q.course = ?',
-                $course->id);
+                WHERE q.course = ? AND qg.userid = ?',
+                array($course->id, $USER->id));
     }
 
     $table = new html_table();
index db4f1f0..c11641d 100644 (file)
@@ -48,6 +48,7 @@ require_once($CFG->dirroot . '/mod/quiz/accessrules.php');
 require_once($CFG->dirroot . '/mod/quiz/attemptlib.php');
 require_once($CFG->dirroot . '/question/editlib.php');
 require_once($CFG->libdir  . '/eventslib.php');
+require_once($CFG->libdir . '/filelib.php');
 
 /// Constants ///////////////////////////////////////////////////////////////////
 
@@ -1031,7 +1032,7 @@ function quiz_send_confirmation($a) {
     $eventdata->smallmessage      = get_string('emailconfirmsmall', 'quiz', $a);
     $eventdata->contexturl        = $a->quizurl;
     $eventdata->contexturlname    = $a->quizname;
-    
+
     return message_send($eventdata);
 }
 
index 74a0ef5..b016a2a 100644 (file)
@@ -310,7 +310,10 @@ function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)
  * @return string the comment that corresponds to this grade (empty string if there is not one.
  */
 function quiz_report_feedback_for_grade($grade, $quizid, $context) {
-    global $DB;
+    global $DB, $CFG;
+
+    require_once($CFG->libdir . '/filelib.php');
+
     static $feedbackcache = array();
     if (!isset($feedbackcache[$quizid])){
         $feedbackcache[$quizid] = $DB->get_records('quiz_feedback', array('quizid' => $quizid));
index 7d30bba..9648e60 100755 (executable)
                     }
                 } else {
                     // all users who can attempt scoes and who are in the currently selected group
-                    if (!$groupstudents = get_users_by_capability($context, 'mod/scorm:savetrack','','','','',$currentgroup,'',false)){
+                    if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack','','','','',$currentgroup,'',false)){
                         echo $OUTPUT->notification(get_string('nostudentsingroup'));
                         $nostudents = true;
                         $groupstudents = array();
index 6f07795..e411f97 100644 (file)
@@ -34,6 +34,7 @@
 
 require_once($CFG->dirroot . '/mod/wiki/lib.php');
 require_once($CFG->dirroot . '/mod/wiki/parser/parser.php');
+require_once($CFG->libdir . '/filelib.php');
 
 define('WIKI_REFRESH_CACHE_TIME', 30); // @TODO: To be deleted.
 define('FORMAT_CREOLE', '37');
index c3ecbc5..0f943af 100644 (file)
@@ -33,6 +33,7 @@ defined('MOODLE_INTERNAL') || die();
 
 require_once(dirname(__FILE__).'/lib.php');     // we extend this library here
 require_once($CFG->libdir . '/gradelib.php');   // we use some rounding and comparing routines here
+require_once($CFG->libdir . '/filelib.php');
 
 /**
  * Full-featured workshop API
index 29780e8..e086691 100755 (executable)
@@ -392,7 +392,7 @@ class qformat_gift extends qformat_default {
                 list($answer, $wrongfeedback, $rightfeedback) =
                         $this->split_truefalse_comment($answertext, $question->questiontextformat);
 
-                if ($answer == "T" OR $answer == "TRUE") {
+                if ($answer['text'] == "T" OR $answer['text'] == "TRUE") {
                     $question->correctanswer = 1;
                     $question->feedbacktrue = $rightfeedback;
                     $question->feedbackfalse = $wrongfeedback;
index da66ac7..113329a 100644 (file)
@@ -659,6 +659,74 @@ FALSE#42 is the Ultimate Answer.#You gave the right answer.}";
         $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
     }
 
+    public function test_import_truefalse_true_answer1() {
+        $gift = "// name 0-11
+::2-08 TSL::TSL is blablabla.{T}";
+        $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
+
+        $importer = new qformat_gift();
+        $q = $importer->readquestion($lines);
+
+        $expectedq = (object) array(
+            'name' => '2-08 TSL',
+            'questiontext' => "TSL is blablabla.",
+            'questiontextformat' => FORMAT_MOODLE,
+            'generalfeedback' => '',
+            'generalfeedbackformat' => FORMAT_MOODLE,
+            'qtype' => 'truefalse',
+            'defaultgrade' => 1,
+            'penalty' => 1,
+            'length' => 1,
+            'correctanswer' => 1,
+            'feedbacktrue' => array(
+                'text' => '',
+                'format' => FORMAT_MOODLE,
+                'files' => array(),
+            ),
+            'feedbackfalse' => array(
+                'text' => '',
+                'format' => FORMAT_MOODLE,
+                'files' => array(),
+            ),
+        );
+
+        $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
+    }
+
+    public function test_import_truefalse_true_answer2() {
+        $gift = "// name 0-11
+::2-08 TSL::TSL is blablabla.{TRUE}";
+        $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
+
+        $importer = new qformat_gift();
+        $q = $importer->readquestion($lines);
+
+        $expectedq = (object) array(
+            'name' => '2-08 TSL',
+            'questiontext' => "TSL is blablabla.",
+            'questiontextformat' => FORMAT_MOODLE,
+            'generalfeedback' => '',
+            'generalfeedbackformat' => FORMAT_MOODLE,
+            'qtype' => 'truefalse',
+            'defaultgrade' => 1,
+            'penalty' => 1,
+            'length' => 1,
+            'correctanswer' => 1,
+            'feedbacktrue' => array(
+                'text' => '',
+                'format' => FORMAT_MOODLE,
+                'files' => array(),
+            ),
+            'feedbackfalse' => array(
+                'text' => '',
+                'format' => FORMAT_MOODLE,
+                'files' => array(),
+            ),
+        );
+
+        $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
+    }
+
     public function test_export_truefalse() {
         $qdata = (object) array(
             'id' => 666 ,
index 1c713f2..012cc43 100644 (file)
@@ -278,12 +278,6 @@ class embedded_cloze_qtype extends default_questiontype {
     function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
         global $QTYPES, $CFG, $USER, $OUTPUT, $PAGE;
 
-        static $overlibdivoutput = false;
-        if (!$overlibdivoutput) {
-            echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
-            $overlibdivoutput = true;
-        }
-
         $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
         $disabled = empty($options->readonly) ? '' : 'disabled="disabled"';
         $formatoptions = new stdClass;
index 35fff59..d94cd21 100644 (file)
@@ -4,6 +4,7 @@
 
     require_once('../config.php');
     require_once($CFG->libdir.'/tablelib.php');
+    require_once($CFG->libdir.'/filelib.php');
 
     define('USER_SMALL_CLASS', 20);   // Below this is considered small
     define('USER_LARGE_CLASS', 200);  // Above this is considered large
index d5d00ed..e70df1c 100644 (file)
@@ -26,6 +26,7 @@
 require_once("../config.php");
 require_once($CFG->dirroot.'/user/profile/lib.php');
 require_once($CFG->dirroot.'/tag/lib.php');
+require_once($CFG->libdir . '/filelib.php');
 
 $id        = optional_param('id', 0, PARAM_INT);   // user id
 $courseid  = optional_param('course', SITEID, PARAM_INT);   // course id (defaults to Site)