Merge branch 'w13_MDL-26951_21_archetypes' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 28 Mar 2011 17:38:48 +0000 (19:38 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 28 Mar 2011 17:38:48 +0000 (19:38 +0200)
103 files changed:
admin/environment.xml
admin/langimport.php
admin/settings/language.php
admin/uploaduser.php
admin/uploaduserlib.php
auth/email/lang/en/auth_email.php
auth/ldap/auth.php
auth/ldap/lang/en/auth_ldap.php
backup/moodle2/restore_plagiarism_plugin.class.php
config-dist.php
course/lib.php
enrol/authorize/db/access.php
enrol/category/db/access.php
enrol/cohort/db/access.php
enrol/guest/db/access.php
enrol/ldap/db/access.php
enrol/manual/db/access.php
enrol/meta/db/access.php
enrol/paypal/db/access.php
enrol/self/db/access.php
enrol/yui/rolemanager/rolemanager.js
index.php
lang/en/admin.php
lang/en/auth.php
lang/en/error.php
lib/db/services.php
lib/modinfolib.php
lib/moodlelib.php
lib/pagelib.php
lib/setuplib.php
lib/tablelib.php
lib/upgradelib.php
message/lib.php
message/output/jabber/message_output_jabber.php
mod/forum/lib.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/responses/responses_table.php
mod/quiz/report/statistics/statistics_question_table.php
mod/quiz/report/statistics/statistics_table.php
mod/wiki/lock.php
mod/wiki/pagelib.php
mod/wiki/renderer.php
repository/dropbox/lib.php
repository/dropbox/locallib.php
repository/filepicker.js
theme/anomaly/layout/general.php
theme/anomaly/layout/report.php
theme/arialist/layout/frontpage.php
theme/arialist/layout/general.php
theme/arialist/layout/report.php
theme/base/layout/embedded.php
theme/base/layout/frontpage.php
theme/base/layout/general.php
theme/base/layout/report.php
theme/binarius/layout/frontpage.php
theme/binarius/layout/general.php
theme/binarius/layout/report.php
theme/boxxie/layout/embedded.php
theme/boxxie/layout/frontpage.php
theme/boxxie/layout/general.php
theme/brick/layout/frontpage.php
theme/brick/layout/general.php
theme/canvas/layout/embedded.php
theme/canvas/layout/frontpage.php
theme/canvas/layout/general.php
theme/canvas/layout/report.php
theme/formal_white/config.php
theme/formal_white/layout/embedded.php
theme/formal_white/layout/frontpage.php
theme/formal_white/layout/general.php
theme/formfactor/layout/embedded.php
theme/formfactor/layout/frontpage.php
theme/formfactor/layout/general.php
theme/fusion/layout/frontpage.php
theme/fusion/layout/general.php
theme/leatherbound/layout/frontpage.php
theme/leatherbound/layout/general.php
theme/leatherbound/layout/report.php
theme/magazine/config.php
theme/magazine/layout/embedded.php
theme/magazine/layout/frontpage.php
theme/magazine/layout/general.php
theme/nimble/layout/frontpage.php
theme/nimble/layout/general.php
theme/nonzero/layout/frontpage.php
theme/nonzero/layout/general.php
theme/overlay/layout/frontpage.php
theme/overlay/layout/general.php
theme/serenity/layout/embedded.php
theme/serenity/layout/frontpage.php
theme/serenity/layout/general.php
theme/sky_high/layout/frontpage.php
theme/sky_high/layout/general.php
theme/sky_high/layout/report.php
theme/splash/layout/general.php
theme/splash/layout/report.php
theme/standardold/layout/embedded.php
theme/standardold/layout/frontpage.php
theme/standardold/layout/general.php
user/edit.php
user/editlib.php
user/emailupdate.php
version.php

index 614fe68..25d3c13 100644 (file)
       </CUSTOM_CHECK>
     </CUSTOM_CHECKS>
   </MOODLE>
+  <MOODLE version="2.1" requires="1.9">
+    <UNICODE level="required">
+      <FEEDBACK>
+        <ON_ERROR message="unicoderequired" />
+      </FEEDBACK>
+    </UNICODE>
+    <DATABASE level="required">
+      <VENDOR name="mysql" version="5.0.25">
+        <FEEDBACK>
+          <ON_ERROR message="mysql416required" />
+        </FEEDBACK>
+      </VENDOR>
+      <VENDOR name="postgres" version="8.3" />
+      <VENDOR name="mssql" version="9.0" />
+      <VENDOR name="odbc_mssql" version="9.0" />
+      <VENDOR name="mssql_n" version="9.0" />
+      <VENDOR name="oracle" version="10.2" />
+      <VENDOR name="sqlite" version="2.0" />
+    </DATABASE>
+    <PHP version="5.3.2" level="required">
+    </PHP>
+    <PHP_EXTENSIONS>
+      <PHP_EXTENSION name="iconv" level="required">
+        <FEEDBACK>
+          <ON_CHECK message="iconvrequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="mbstring" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="mbstringrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="curl" level="required">
+        <FEEDBACK>
+          <ON_CHECK message="curlrequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="openssl" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="opensslrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="tokenizer" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="tokenizerrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="xmlrpc" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="xmlrpcrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="soap" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="soaprecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="ctype" level="required">
+        <FEEDBACK>
+          <ON_ERROR message="ctyperequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="zip" level="required">
+        <FEEDBACK>
+          <ON_ERROR message="ziprequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="gd" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="gdrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="simplexml" level="required">
+        <FEEDBACK>
+          <ON_CHECK message="simplexmlrequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="spl" level="required">
+        <FEEDBACK>
+          <ON_CHECK message="splrequired" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="pcre" level="required">
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="dom" level="required">
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="xml" level="required">
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="intl" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="intlrecommended" />
+        </FEEDBACK>
+      </PHP_EXTENSION>
+      <PHP_EXTENSION name="json" level="required">
+      </PHP_EXTENSION>
+    </PHP_EXTENSIONS>
+    <PHP_SETTINGS>
+      <PHP_SETTING name="memory_limit" value="40M" level="required">
+        <FEEDBACK>
+          <ON_ERROR message="settingmemorylimit" />
+        </FEEDBACK>
+      </PHP_SETTING>
+      <PHP_SETTING name="safe_mode" value="0" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="settingsafemode" />
+        </FEEDBACK>
+      </PHP_SETTING>
+      <PHP_SETTING name="file_uploads" value="1" level="optional">
+        <FEEDBACK>
+          <ON_CHECK message="settingfileuploads" />
+        </FEEDBACK>
+      </PHP_SETTING>
+    </PHP_SETTINGS>
+  </MOODLE>
 </COMPATIBILITY_MATRIX>
index 5d6497e..3ebb9de 100644 (file)
@@ -53,11 +53,6 @@ define('INSTALLATION_OF_SELECTED_LANG', 2);
 define('DELETION_OF_SELECTED_LANG', 4);
 define('UPDATE_ALL_LANG', 5);
 
-//reset and diagnose lang cache permissions
-remove_dir($CFG->dataroot.'/cache/languages');
-if (file_exists($CFG->dataroot.'/cache/languages')) {
-    print_error('cannotdeletelangcache', 'error');
-}
 get_string_manager()->reset_caches();
 
 $notice_ok    = array();
index ebed93f..3633bfb 100644 (file)
@@ -10,7 +10,7 @@ if ($hassiteconfig) {
     $temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
     $temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
     $temp->add(new admin_setting_langlist());
-    $temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
+    $temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('langcache_desc', 'admin'), 1));
     $temp->add(new admin_setting_configcheckbox('langstringcache', get_string('langstringcache', 'admin'), get_string('configlangstringcache', 'admin'), 1));
     $temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
     $temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
index 1861a5d..0e16638 100644 (file)
@@ -307,6 +307,9 @@ if ($formdata = $mform2->is_cancelled()) {
                 // process templates
                 $user->$field = uu_process_template($formdata->$field, $user);
                 $formdefaults[$field] = true;
+                if (in_array($field, $upt->columns)) {
+                    $upt->track($field, s($user->$field), 'normal');
+                }
             }
         }
         foreach ($PRF_FIELDS as $field) {
@@ -614,7 +617,13 @@ if ($formdata = $mform2->is_cancelled()) {
 
             $isinternalauth = $auth->is_internal();
 
-            if ($DB->record_exists('user', array('email'=>$user->email))) {
+            if (empty($user->email)) {
+                $upt->track('email', get_string('invalidemail'), 'error');
+                $upt->track('status', $strusernotaddederror, 'error');
+                $userserrors++;
+                continue;
+
+            } else if ($DB->record_exists('user', array('email'=>$user->email))) {
                 if ($noemailduplicates) {
                     $upt->track('email', $stremailduplicate, 'error');
                     $upt->track('status', $strusernotaddederror, 'error');
@@ -898,11 +907,13 @@ while ($linenum <= $previewrows and $fields = $cir->next()) {
         $rowcols['status'][] = get_string('missingusername');
     }
 
-    if (!validate_email($rowcols['email'])) {
-        $rowcols['status'][] = get_string('invalidemail');
-    }
-    if ($DB->record_exists('user', array('email'=>$rowcols['email']))) {
-        $rowcols['status'][] = $stremailduplicate;
+    if (isset($rowcols['email'])) {
+        if (!validate_email($rowcols['email'])) {
+            $rowcols['status'][] = get_string('invalidemail');
+        }
+        if ($DB->record_exists('user', array('email'=>$rowcols['email']))) {
+            $rowcols['status'][] = $stremailduplicate;
+        }
     }
     $rowcols['status'] = implode('<br />', $rowcols['status']);
     $data[] = $rowcols;
index 7df9290..d36bccc 100644 (file)
@@ -248,33 +248,48 @@ function uu_process_template($template, $user) {
 
     if (is_null($result)) {
         return $template; //error during regex processing??
+    }
+
+    if (is_array($template)) {
+        $template['text'] = $result;
+        return $t;
     } else {
-        if (array($template)) {
-            $template['text'] = $t;
-            return $t;
-        } else {
-            return $t;
-        }
+        return $result;
     }
 }
 
 /**
  * Internal callback function.
  */
-function uu_process_template_callback($block, $username, $firstname, $lastname) {
+function uu_process_template_callback($username, $firstname, $lastname, $block) {
     $textlib = textlib_get_instance();
-    $repl = $block[0];
 
     switch ($block[3]) {
-        case 'u': $repl = $username; break;
-        case 'f': $repl = $firstname; break;
-        case 'l': $repl = $lastname; break;
+        case 'u':
+            $repl = $username;
+            break;
+        case 'f':
+            $repl = $firstname;
+            break;
+        case 'l':
+            $repl = $lastname;
+            break;
+        default:
+            return $block[0];
     }
+
     switch ($block[1]) {
-        case '+': $repl = $textlib->strtoupper($repl); break;
-        case '-': $repl = $textlib->strtolower($repl); break;
-        case '~': $repl = $textlib->strtotitle($repl); break;
+        case '+':
+            $repl = $textlib->strtoupper($repl);
+            break;
+        case '-':
+            $repl = $textlib->strtolower($repl);
+            break;
+        case '~':
+            $repl = $textlib->strtotitle($repl);
+            break;
     }
+
     if (!empty($block[2])) {
         $repl = $textlib->substr($repl, 0 , $block[2]);
     }
index 7e7df48..00a0463 100644 (file)
  */
 
 $string['auth_emaildescription'] = 'Email confirmation is the default authentication method.  When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address.  This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.';
-$string['auth_emailchangecancel'] = 'Cancel email change';
-$string['auth_emailchangepending'] = 'Change pending. Open the link sent to you at {$a->preference_newemail}.';
 $string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
-$string['auth_emailnoinsert'] = 'Could not add your record to the database!';
-$string['auth_emailnowexists'] = 'The email address you tried to assign to your profile has been assigned to someone else since your original request. Your request for change of email address is hereby cancelled, but you may try again with a different address.';
 $string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://recaptcha.net/learnmore.html for more details. <br /><em>PHP cURL extension is required.</em>';
 $string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
 $string['auth_emailsettings'] = 'Settings';
-$string['auth_emailupdate'] = 'Email address update';
-$string['auth_emailupdatemessage'] = 'Dear {$a->fullname},
-
-You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
-
-{$a->url}';
-$string['auth_emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
-$string['auth_emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
-$string['auth_changingemailaddress'] = 'You have requested a change of email address, from {$a->oldemail} to {$a->newemail}. For security reasons, we are sending you an email message at the new address to confirm that it belongs to you. Your email address will be updated as soon as you open the URL sent to you in that message.';
-$string['auth_invalidnewemailkey'] = 'Error: if you are trying to confirm a change of email address, you may have made a mistake in copying the URL we sent you by email. Please copy the address and try again.';
-$string['auth_outofnewemailupdateattempts'] = 'You have run out of allowed attempts to update your email address. Your update request has been cancelled.';
 $string['pluginname'] = 'Email-based self-registration';
index d9cd436..1fd3909 100644 (file)
@@ -502,7 +502,7 @@ class auth_plugin_ldap extends auth_plugin_base {
         events_trigger('user_created', $user);
 
         if (! send_confirmation_email($user)) {
-            print_error('auth_emailnoemail', 'auth_email');
+            print_error('noemail', 'auth_ldap');
         }
 
         if ($notify) {
index 7962513..bbb0ddb 100644 (file)
@@ -114,6 +114,7 @@ $string['morethanoneuser'] = 'Strange! More than one user record found in ldap.
 $string['needbcmath'] = 'You need the BCMath extension to use grace logins with Active Directory';
 $string['needmbstring'] = 'You need the mbstring extension to change passwords in Active Directory';
 $string['nodnforusername'] = 'Error in user_update_password(). No DN for: {$a->username}';
+$string['noemail'] = 'Tried to send you an email but failed!';
 $string['notcalledfromserver'] = 'Should not be called from the web server!';
 $string['noupdatestobedone'] = "No updates to be done\n";
 $string['nouserentriestoremove'] = "No user entries to be removed\n";
index 238ebc1..039d117 100644 (file)
@@ -41,6 +41,6 @@ abstract class restore_plagiarism_plugin extends restore_plugin {
         if (!array_key_exists($this->pluginname, $enabledplugins)) {
             return;
         }
-        parent::define_plugin_structure($connectionpoint);
+        return parent::define_plugin_structure($connectionpoint);
     }
 }
index 7fc91bf..e5952af 100644 (file)
@@ -357,6 +357,13 @@ $CFG->admin = 'admin';
 //
 //     $CFG->langcacheroot = '/var/www/moodle/htdocs/altcache/lang';
 //
+// If $CFG->langcache is enabled (which should always be in production
+// environment), Moodle stores the list of available languages in a cache file.
+// By default, the file $CFG->dataroot/languages is used. You may wish to
+// specify an alternative location of this cache file.
+//
+//     $CFG->langmenucachefile = '/var/www/moodle/htdocs/altcache/languages';
+//
 // Site default language can be set via standard administration interface. If you
 // want to have initial error messages for eventual database connection problems
 // localized too, you have to set your language code here.
index 889dd45..377a275 100644 (file)
@@ -1707,7 +1707,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
                             $extraclass = '';
                         }
                         echo "
-<form class='togglecompletion$extraclass' method='post' action='togglecompletion.php'><div>
+<form class='togglecompletion$extraclass' method='post' action='".$CFG->wwwroot."/course/togglecompletion.php'><div>
 <input type='hidden' name='id' value='{$mod->id}' />
 <input type='hidden' name='sesskey' value='".sesskey()."' />
 <input type='hidden' name='completionstate' value='$newstate' />
@@ -1880,56 +1880,6 @@ function get_category_or_system_context($categoryid) {
     }
 }
 
-/**
- * Rebuilds the cached list of course activities stored in the database
- * @param int $courseid - id of course to rebuild, empty means all
- * @param boolean $clearonly - only clear the modinfo fields, gets rebuild automatically on the fly
- */
-function rebuild_course_cache($courseid=0, $clearonly=false) {
-    global $COURSE, $DB, $OUTPUT;
-
-    // Destroy navigation caches
-    navigation_cache::destroy_volatile_caches();
-
-    if ($clearonly) {
-        if (empty($courseid)) {
-            $courseselect = array();
-        } else {
-            $courseselect = array('id'=>$courseid);
-        }
-        $DB->set_field('course', 'modinfo', null, $courseselect);
-        // update cached global COURSE too ;-)
-        if ($courseid == $COURSE->id or empty($courseid)) {
-            $COURSE->modinfo = null;
-        }
-        // reset the fast modinfo cache
-        $reset = 'reset';
-        get_fast_modinfo($reset);
-        return;
-    }
-
-    if ($courseid) {
-        $select = array('id'=>$courseid);
-    } else {
-        $select = array();
-        @set_time_limit(0);  // this could take a while!   MDL-10954
-    }
-
-    $rs = $DB->get_recordset("course", $select,'','id,fullname');
-    foreach ($rs as $course) {
-        $modinfo = serialize(get_array_of_activities($course->id));
-        $DB->set_field("course", "modinfo", $modinfo, array("id"=>$course->id));
-        // update cached global COURSE too ;-)
-        if ($course->id == $COURSE->id) {
-            $COURSE->modinfo = $modinfo;
-        }
-    }
-    $rs->close();
-    // reset the fast modinfo cache
-    $reset = 'reset';
-    get_fast_modinfo($reset);
-}
-
 /**
  * Gets the child categories of a given courses category. Uses a static cache
  * to make repeat calls efficient.
index 38a7409..c04804b 100644 (file)
@@ -5,7 +5,7 @@ $capabilities = array(
     'enrol/authorize:config' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
@@ -13,7 +13,7 @@ $capabilities = array(
     'enrol/authorize:manage' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -22,7 +22,7 @@ $capabilities = array(
     'enrol/authorize:unenrol' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
@@ -30,7 +30,7 @@ $capabilities = array(
     'enrol/authorize:unenrolself' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
         )
     ),
 
index 945af28..d18e55a 100644 (file)
@@ -33,7 +33,7 @@ $capabilities = array(
     'enrol/category:synchronised' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_SYSTEM,
-        'legacy' => array(
+        'archetypes' => array(
         )
     ),
 );
index 36735ef..4530353 100644 (file)
@@ -32,7 +32,7 @@ $capabilities = array(
 
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'editingteacher' => CAP_ALLOW,
             'manager' => CAP_ALLOW,
         )
index a1feaf9..2fa37e6 100644 (file)
@@ -31,7 +31,7 @@ $capabilities = array(
     'enrol/guest:config' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
index 1963af6..8eb1aa6 100644 (file)
@@ -31,7 +31,7 @@ $capabilities = array(
     'enrol/ldap:manage' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
index 11460e8..4658fc7 100644 (file)
@@ -31,7 +31,7 @@ $capabilities = array(
     'enrol/manual:config' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
@@ -39,7 +39,7 @@ $capabilities = array(
     'enrol/manual:enrol' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -48,7 +48,7 @@ $capabilities = array(
     'enrol/manual:manage' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -57,7 +57,7 @@ $capabilities = array(
     'enrol/manual:unenrol' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -66,7 +66,7 @@ $capabilities = array(
     'enrol/manual:unenrolself' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
         )
     ),
 
index 45b9cc8..6215c50 100644 (file)
@@ -30,7 +30,7 @@ $capabilities = array(
     'enrol/meta:config' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -40,7 +40,7 @@ $capabilities = array(
     'enrol/meta:selectaslinked' => array(
         'captype' => 'read',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
index c6db98c..c474d92 100644 (file)
@@ -31,7 +31,7 @@ $capabilities = array(
     'enrol/paypal:config' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
@@ -39,7 +39,7 @@ $capabilities = array(
     'enrol/paypal:manage' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
             'editingteacher' => CAP_ALLOW,
         )
@@ -48,7 +48,7 @@ $capabilities = array(
     'enrol/paypal:unenrol' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'manager' => CAP_ALLOW,
         )
     ),
@@ -56,7 +56,7 @@ $capabilities = array(
     'enrol/paypal:unenrolself' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
         )
     ),
 
index 32bc34a..54fa9d8 100644 (file)
@@ -32,7 +32,7 @@ $capabilities = array(
 
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'editingteacher' => CAP_ALLOW,
             'manager' => CAP_ALLOW,
         )
@@ -42,7 +42,7 @@ $capabilities = array(
 
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'editingteacher' => CAP_ALLOW,
             'manager' => CAP_ALLOW,
         )
@@ -51,7 +51,7 @@ $capabilities = array(
     'enrol/self:unenrolself' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'student' => CAP_ALLOW,
         )
     ),
@@ -59,7 +59,7 @@ $capabilities = array(
     'enrol/self:unenrol' => array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
-        'legacy' => array(
+        'archetypes' => array(
             'editingteacher' => CAP_ALLOW,
             'manager' => CAP_ALLOW,
         )
index 0ddb73e..4455b41 100644 (file)
@@ -391,7 +391,7 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
             }
             var node = null;
             for (var i in this.roles) {
-                if (node = this.get('contentNode').one('#add_assignable_role_'+i)) {
+                if (node = this.get('contentNode').one('#add_assignable_role_'+this.roles[i])) {
                     node.removeAttribute('disabled');
                 }
             }
index 7c3472d..e943f43 100644 (file)
--- a/index.php
+++ b/index.php
@@ -88,6 +88,9 @@
     $PAGE->set_heading($SITE->fullname);
     echo $OUTPUT->header();
 
+    //TODO: remove this notice once admins know they need to switch CVS and git branches, the reason is once we start changing DB there will not be any way back!
+    echo $OUTPUT->box('WARNING: this site is using 2.1dev codebase, please make sure this is is not a production server!!!', 'errorbox');
+
 /// Print Section
     if ($SITE->numsections > 0) {
 
index 915cb7a..7c67ea9 100644 (file)
@@ -246,7 +246,6 @@ $string['configjabberpassword'] = 'The password to use when connecting to the Ja
 $string['configjabberport'] = 'The port to use when connecting to the Jabber server';
 $string['configkeeptagnamecase'] = 'Check this if you want tag names to keep the original casing as entered by users who created them';
 $string['configlang'] = 'Choose a default language for the whole site. Users can override this setting using the language menu or the setting in their personal profile.';
-$string['configlangcache'] = 'Cache the language menu. Saves a lot of memory and processing power. If you enable this, the menu takes a few minutes to update after you have added or removed languages.';
 $string['configlangstringcache'] = 'Caches all the language strings into compiled files in the data directory.  If you are translating Moodle or changing strings in the Moodle source code then you may want to switch this off.  Otherwise leave it on to see performance benefits.';
 $string['configlangdir'] = 'Most languages are printed left-to-right, but some, like Arabic and Hebrew, are printed right-to-left.';
 $string['configlanglist'] = 'Leave this blank to allow users to choose from any language you have in this installation of Moodle.  However, you can shorten the language menu by entering a comma-separated list of language codes that you want.  For example:  en,es_es,fr,it';
@@ -632,6 +631,7 @@ $string['jabberport'] = 'Jabber port';
 $string['keeptagnamecase'] = 'Keep tag name casing';
 $string['lang'] = 'Default language';
 $string['langcache'] = 'Cache language menu';
+$string['langcache_desc'] = 'Cache the language menu. If enabled, the list of available translations is cached. The cache is automatically refreshed when you install or delete a language pack via the in-built language packs management tool. If you install a new language pack manually, you have to use Purge all caches feature to refresh the cached list.';
 $string['langedit'] = 'Language editing';
 $string['langimport'] = 'Language import utility';
 $string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level.';
index 072dc59..5e68e8e 100644 (file)
@@ -60,6 +60,17 @@ $string['auth_user_creation'] = 'New (anonymous) users can create user accounts
 $string['auth_usernameexists'] = 'Selected username already exists. Please choose a new one.';
 $string['auto_add_remote_users'] = 'Auto add remote users';
 $string['createpasswordifneeded'] = 'Create password if needed';
+$string['emailchangecancel'] = 'Cancel email change';
+$string['emailchangepending'] = 'Change pending. Open the link sent to you at {$a->preference_newemail}.';
+$string['emailnowexists'] = 'The email address you tried to assign to your profile has been assigned to someone else since your original request. Your request for change of email address is hereby cancelled, but you may try again with a different address.';
+$string['emailupdate'] = 'Email address update';
+$string['emailupdatemessage'] = 'Dear {$a->fullname},
+
+You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
+
+{$a->url}';
+$string['emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
+$string['emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
 $string['enterthenumbersyouhear'] = 'Enter the numbers you hear';
 $string['enterthewordsabove'] = 'Enter the words above';
 $string['errormaxconsecutiveidentchars'] = 'Passwords must have at most {$a} consecutive identical characters.';
index cc945cf..2c72968 100644 (file)
@@ -61,7 +61,6 @@ $string['cannotdeletecourse'] = 'You do not have the permission to delete this c
 $string['cannotdeletecustomfield'] = 'Error deleting custom field data';
 $string['cannotdeletedir'] = 'Cannot delete ({$a})';
 $string['cannotdeletefile'] = 'Cannot delete this file';
-$string['cannotdeletelangcache'] = 'Language cache cannot be deleted, please fix permissions in dataroot/cache/languages!';
 $string['cannotdeleterole'] = 'It cannot be deleted, because {$a}';
 $string['cannotdeleterolewithid'] = 'Could not delete role with ID {$a}';
 $string['cannotdeletethisrole'] = 'You cannot delete this role because it is used by the system, or because it is the last role with administrator capabilities.';
index a33b75e..57bd7a2 100644 (file)
@@ -126,7 +126,7 @@ $functions = array(
         'classpath'   => 'user/externallib.php',
         'description' => 'Get users by id.',
         'type'        => 'read',
-        'capabilities'=> 'moodle/user:viewdetails',
+        'capabilities'=> 'moodle/user:viewalldetails',
     ),
 
     'moodle_user_delete_users' => array(
index 722eec1..f9994fe 100644 (file)
@@ -1080,6 +1080,58 @@ function get_fast_modinfo(&$course, $userid=0) {
     return $cache[$course->id];
 }
 
+/**
+ * Rebuilds the cached list of course activities stored in the database
+ * @param int $courseid - id of course to rebuild, empty means all
+ * @param boolean $clearonly - only clear the modinfo fields, gets rebuild automatically on the fly
+ */
+function rebuild_course_cache($courseid=0, $clearonly=false) {
+    global $COURSE, $DB, $CFG;
+
+    // Destroy navigation caches
+    navigation_cache::destroy_volatile_caches();
+
+    if ($clearonly) {
+        if (empty($courseid)) {
+            $courseselect = array();
+        } else {
+            $courseselect = array('id'=>$courseid);
+        }
+        $DB->set_field('course', 'modinfo', null, $courseselect);
+        // update cached global COURSE too ;-)
+        if ($courseid == $COURSE->id or empty($courseid)) {
+            $COURSE->modinfo = null;
+        }
+        // reset the fast modinfo cache
+        $reset = 'reset';
+        get_fast_modinfo($reset);
+        return;
+    }
+
+    require_once("$CFG->dirroot/course/lib.php");
+
+    if ($courseid) {
+        $select = array('id'=>$courseid);
+    } else {
+        $select = array();
+        @set_time_limit(0);  // this could take a while!   MDL-10954
+    }
+
+    $rs = $DB->get_recordset("course", $select,'','id,fullname');
+    foreach ($rs as $course) {
+        $modinfo = serialize(get_array_of_activities($course->id));
+        $DB->set_field("course", "modinfo", $modinfo, array("id"=>$course->id));
+        // update cached global COURSE too ;-)
+        if ($course->id == $COURSE->id) {
+            $COURSE->modinfo = $modinfo;
+        }
+    }
+    $rs->close();
+    // reset the fast modinfo cache
+    $reset = 'reset';
+    get_fast_modinfo($reset);
+}
+
 
 /**
  * Class that is the return value for the _get_coursemodule_info module API function.
index e6fc710..ca2cd07 100644 (file)
@@ -5484,17 +5484,28 @@ function get_string_manager($forcereload=false) {
     }
     if ($singleton === null) {
         if (empty($CFG->early_install_lang)) {
+
             if (empty($CFG->langcacheroot)) {
                 $langcacheroot = $CFG->dataroot . '/cache/lang';
             } else {
                 $langcacheroot = $CFG->langcacheroot;
             }
+
             if (empty($CFG->langlist)) {
                  $translist = array();
             } else {
                 $translist = explode(',', $CFG->langlist);
             }
-            $singleton = new core_string_manager($CFG->langotherroot, $CFG->langlocalroot, $langcacheroot, !empty($CFG->langstringcache), $translist);
+
+            if (empty($CFG->langmenucachefile)) {
+                $langmenucache = $CFG->dataroot . '/cache/languages';
+            } else {
+                $langmenucache = $CFG->langmenucachefile;
+            }
+
+            $singleton = new core_string_manager($CFG->langotherroot, $CFG->langlocalroot, $langcacheroot,
+                                                 !empty($CFG->langstringcache), $translist, $langmenucache);
+
         } else {
             $singleton = new install_string_manager();
         }
@@ -5624,22 +5635,26 @@ class core_string_manager implements string_manager {
     protected $usediskcache;
     /* @var array limit list of translations */
     protected $translist;
+    /** @var string location of a file that caches the list of available translations */
+    protected $menucache;
 
     /**
-     * Crate new instance of string manager
+     * Create new instance of string manager
      *
      * @param string $otherroot location of downlaoded lang packs - usually $CFG->dataroot/lang
      * @param string $localroot usually the same as $otherroot
      * @param string $cacheroot usually lang dir in cache folder
      * @param bool $usediskcache use disk cache
      * @param array $translist limit list of visible translations
+     * @param string $menucache the location of a file that caches the list of available translations
      */
-    public function __construct($otherroot, $localroot, $cacheroot, $usediskcache, $translist) {
+    public function __construct($otherroot, $localroot, $cacheroot, $usediskcache, $translist, $menucache) {
         $this->otherroot    = $otherroot;
         $this->localroot    = $localroot;
         $this->cacheroot    = $cacheroot;
         $this->usediskcache = $usediskcache;
         $this->translist    = $translist;
+        $this->menucache    = $menucache;
     }
 
     /**
@@ -6007,15 +6022,13 @@ class core_string_manager implements string_manager {
      * @return boot true if exists
      */
     public function translation_exists($lang, $includeall = true) {
-        global $CFG;
 
         if (strpos($lang, '_local') !== false) {
             // _local packs are not real translations
             return false;
         }
-        if (!$includeall and !empty($CFG->langlist)) {
-            $enabled = explode(',', $CFG->langlist);
-            if (!in_array($lang, $enabled)) {
+        if (!$includeall and !empty($this->translist)) {
+            if (!in_array($lang, $this->translist)) {
                 return false;
             }
         }
@@ -6036,7 +6049,30 @@ class core_string_manager implements string_manager {
 
         $languages = array();
 
-        //TODO: add some translist cache stored in normal cache dir
+        if ($CFG->langcache and is_readable($this->menucache)) {
+            // try to re-use the cached list of all available languages
+            $cachedlist = json_decode(file_get_contents($this->menucache), true);
+
+            if (is_array($cachedlist) and !empty($cachedlist)) {
+                // the cache file is restored correctly
+
+                if (!$returnall and !empty($this->translist)) {
+                    // return just enabled translations
+                    foreach ($cachedlist as $langcode => $langname) {
+                        if (in_array($langcode, $this->translist)) {
+                            $languages[$langcode] = $langname;
+                        }
+                    }
+                    return $languages;
+
+                } else {
+                    // return all translations
+                    return $cachedlist;
+                }
+            }
+        }
+
+        // the cached list of languages is not available, let us populate the list
 
         if (!$returnall and !empty($this->translist)) {
             // return only some translations
@@ -6080,6 +6116,12 @@ class core_string_manager implements string_manager {
                 }
                 unset($string);
             }
+
+            if ($CFG->langcache and !empty($this->menucache)) {
+                // cache the list so that it can be used next time
+                textlib_get_instance()->asort($languages);
+                file_put_contents($this->menucache, json_encode($languages));
+            }
         }
 
         textlib_get_instance()->asort($languages);
@@ -6111,8 +6153,16 @@ class core_string_manager implements string_manager {
         global $CFG;
         require_once("$CFG->libdir/filelib.php");
 
+        // clear the on-disk disk with aggregated string files
         fulldelete($this->cacheroot);
+
+        // clear the in-memory cache of loaded strings
         $this->cache = array();
+
+        // clear the cache containing the list of available translations
+        // and re-populate it again
+        fulldelete($this->menucache);
+        $this->get_list_of_translations(true);
     }
 }
 
@@ -9112,7 +9162,7 @@ WHERE m.useridto = :userid AND p.name='popup'";
                 $smallmessage = get_string('unreadnewnotification', 'message');
             }
             if (!empty($smallmessage)) {
-                $strmessages .= '<div id="usermessage">'.$smallmessage.'</div>';
+                $strmessages .= '<div id="usermessage">'.s($smallmessage).'</div>';
             }
         }
 
index 7764aba..2fef3af 100644 (file)
@@ -762,6 +762,8 @@ class moodle_page {
                 // fine - no change needed
             } else if ($this->_context->contextlevel == CONTEXT_SYSTEM or $this->_context->contextlevel == CONTEXT_COURSE) {
                 // hmm - not ideal, but it might produce too many warnings due to the design of require_login
+            } else if ($this->_context->contextlevel == CONTEXT_MODULE and $this->_context->id == get_parent_contextid($context)) {
+                // hmm - most probably somebody did require_login() and after that set the block context
             } else {
                 // we do not want devs to do weird switching of context levels on the fly,
                 // because we might have used the context already such as in text filter in page title
@@ -803,8 +805,12 @@ class moodle_page {
             $cm = $modinfo->get_cm($cm->id);
         }
         $this->_cm = $cm;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-        $this->set_context($context); // the content of page MUST match the cm, this prints warning if there is any problem
+
+        // unfortunately the context setting is a mess, let's try to work around some common block problems and show some debug messages
+        if (empty($this->_context) or $this->_context->contextlevel != CONTEXT_BLOCK) {
+            $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+            $this->set_context($context);
+        }
 
         if ($module) {
             $this->set_activity_record($module);
index c4b07ee..1056db4 100644 (file)
@@ -691,7 +691,6 @@ function initialise_fullme() {
     $FULLSCRIPT = $hostandport . $rurl['path'];
     $FULLME = $hostandport . $rurl['fullpath'];
     $ME = $rurl['fullpath'];
-    $rurl['path'] = $rurl['fullpath'];
 }
 
 /**
@@ -776,6 +775,11 @@ function setup_get_remote_url() {
      } else {
         throw new moodle_exception('unsupportedwebserver', 'error', '', $_SERVER['SERVER_SOFTWARE']);
     }
+
+    // sanitize the url a bit more, the encoding style may be different in vars above
+    $rurl['fullpath'] = str_replace('"', '%22', $rurl['fullpath']);
+    $rurl['fullpath'] = str_replace('\'', '%27', $rurl['fullpath']);
+
     return $rurl;
 }
 
index 975b418..e3d905d 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+
 defined('MOODLE_INTERNAL') || die();
 
-/** TABLE_VAR_SORT = 1 */
+/**#@+
+ * These constants relate to the table's handling of URL parameters.
+ */
 define('TABLE_VAR_SORT',   1);
-/** TABLE_VAR_HIDE = 2 */
 define('TABLE_VAR_HIDE',   2);
-/** TABLE_VAR_SHOW = 3 */
 define('TABLE_VAR_SHOW',   3);
-/** TABLE_VAR_IFIRST = 4 */
 define('TABLE_VAR_IFIRST', 4);
-/** TABLE_VAR_ILAST = 5 */
 define('TABLE_VAR_ILAST',  5);
-/** TABLE_VAR_PAGE = 6 */
 define('TABLE_VAR_PAGE',   6);
+/**#@-*/
+
+/**#@+
+ * Constants that indicate whether the paging bar for the table
+ * appears above or below the table.
+ */
+define('TABLE_P_TOP',    1);
+define('TABLE_P_BOTTOM', 2);
+/**#@-*/
 
-/** TABLE_P_TOP = 1 */
-define('TABLE_P_TOP',   1);
-/** TABLE_P_BOTTOM = 2 */
-define('TABLE_P_BOTTOM',  2);
 
 /**
  * @package   moodlecore
@@ -79,7 +82,6 @@ class flexible_table {
      */
     var $showdownloadbuttonsat= array(TABLE_P_TOP);
 
-
     /**
      * @var string Key of field returned by db query that is the id field of the
      * user table or equivalent.
@@ -94,7 +96,7 @@ class flexible_table {
     var $download  = '';
 
     /**
-     * @var boolean whether data is downloadable from table. Determines whether
+     * @var bool whether data is downloadable from table. Determines whether
      * to display download buttons. Set by method downloadable().
      */
     var $downloadable = false;
@@ -106,7 +108,7 @@ class flexible_table {
     var $defaultdownloadformat  = 'csv';
 
     /**
-     * @var boolean Has start output been called yet?
+     * @var bool Has start output been called yet?
      */
     var $started_output = false;
 
@@ -114,21 +116,32 @@ class flexible_table {
 
     /**
      * Constructor
-     * @param int $uniqueid
-     * @todo Document properly
+     * @param int $uniqueid all tables have to have a unique id, this is used
+     *      as a key when storing table properties like sort order in the session.
      */
-    function flexible_table($uniqueid) {
+    function __construct($uniqueid) {
         $this->uniqueid = $uniqueid;
         $this->request  = array(
-            TABLE_VAR_SORT    => 'tsort',
-            TABLE_VAR_HIDE    => 'thide',
-            TABLE_VAR_SHOW    => 'tshow',
-            TABLE_VAR_IFIRST  => 'tifirst',
-            TABLE_VAR_ILAST   => 'tilast',
-            TABLE_VAR_PAGE    => 'page'
+            TABLE_VAR_SORT   => 'tsort',
+            TABLE_VAR_HIDE   => 'thide',
+            TABLE_VAR_SHOW   => 'tshow',
+            TABLE_VAR_IFIRST => 'tifirst',
+            TABLE_VAR_ILAST  => 'tilast',
+            TABLE_VAR_PAGE   => 'page',
         );
     }
 
+    /**
+     * Backwards-compatible constructor, so that legacy code subclassing
+     * flexible_table does not break.
+     * @deprecated since Moodle 2.0. Will be removed in Moodle 2.1.
+     */
+    function flexible_table($uniqueid) {
+        debugging('Please update your code to user PHP5-style parent::__construct(...), ' .
+                'not parent::flexible_table(...).');
+        $this->__construct($uniqueid);
+    }
+
     /**
      * Call this to pass the download type. Use :
      *         $download = optional_param('download', '', PARAM_ALPHA);
@@ -142,8 +155,8 @@ class flexible_table {
      * @param string $sheettitle title for downloaded data.
      * @return string download type.  One of csv, tsv, xhtml, ods, etc
      */
-    function is_downloading($download = null, $filename='', $sheettitle=''){
-        if ($download!==null){
+    function is_downloading($download = null, $filename='', $sheettitle='') {
+        if ($download!==null) {
             $this->sheettitle = $sheettitle;
             $this->is_downloadable(true);
             $this->download = $download;
@@ -153,33 +166,37 @@ class flexible_table {
         return $this->download;
     }
 
-    function export_class_instance(&$exportclass=null){
-        if (!is_null($exportclass)){
+    /**
+     * Get, and optionally set, the export class.
+     * @param $exportclass (optional) if passed, set the table to use this export class.
+     * @return table_default_export_format_parent the export class in use (after any set).
+     */
+    function export_class_instance($exportclass = null) {
+        if (!is_null($exportclass)) {
             $this->started_output = true;
-            $this->exportclass =& $exportclass;
-            $this->exportclass->table =& $this;
-        } elseif (is_null($this->exportclass) && !empty($this->download)){
+            $this->exportclass = $exportclass;
+            $this->exportclass->table = $this;
+        } else if (is_null($this->exportclass) && !empty($this->download)) {
             $classname = 'table_'.$this->download.'_export_format';
             $this->exportclass = new $classname($this);
-            if (!$this->exportclass->document_started()){
+            if (!$this->exportclass->document_started()) {
                 $this->exportclass->start_document($this->filename);
             }
         }
         return $this->exportclass;
     }
 
-
     /**
      * Probably don't need to call this directly. Calling is_downloading with a
      * param automatically sets table as downloadable.
      *
-     * @param boolean $downloadable optional param to set whether data from
+     * @param bool $downloadable optional param to set whether data from
      * table is downloadable. If ommitted this function can be used to get
      * current state of table.
-     * @return boolean whether table data is set to be downloadable.
+     * @return bool whether table data is set to be downloadable.
      */
-    function is_downloadable($downloadable = null){
-        if ($downloadable !== null){
+    function is_downloadable($downloadable = null) {
+        if ($downloadable !== null) {
             $this->downloadable = $downloadable;
         }
         return $this->downloadable;
@@ -190,11 +207,10 @@ class flexible_table {
      * @param array $showat array of postions in which to show download buttons.
      * Containing TABLE_P_TOP and/or TABLE_P_BOTTOM
      */
-    function show_download_buttons_at($showat){
+    function show_download_buttons_at($showat) {
         $this->showdownloadbuttonsat = $showat;
     }
 
-
     /**
      * Sets the is_sortable variable to the given boolean, sort_default_column to
      * the given string, and the sort_default_order to the given integer.
@@ -222,7 +238,7 @@ class flexible_table {
      * @param string column name, null means table
      * @return bool
      */
-    function is_sortable($column=null) {
+    function is_sortable($column = null) {
         if (empty($column)) {
             return $this->is_sortable;
         }
@@ -231,6 +247,7 @@ class flexible_table {
         }
         return !in_array($column, $this->column_nosort);
     }
+
     /**
      * Sets the is_collapsible variable to the given boolean.
      * @param bool $bool
@@ -278,8 +295,8 @@ class flexible_table {
      * @return void
      */
     function set_control_variables($variables) {
-        foreach($variables as $what => $variable) {
-            if(isset($this->request[$what])) {
+        foreach ($variables as $what => $variable) {
+            if (isset($this->request[$what])) {
                 $this->request[$what] = $variable;
             }
         }
@@ -302,63 +319,57 @@ class flexible_table {
      * For example, in the quiz overview report, the fullname column is set to be suppressed, so
      * that when one student has made multiple attempts, their name is only printed in the row
      * for their first attempt.
-     * @param integer $column the index of a column.
+     * @param int $column the index of a column.
      */
     function column_suppress($column) {
-        if(isset($this->column_suppress[$column])) {
+        if (isset($this->column_suppress[$column])) {
             $this->column_suppress[$column] = true;
         }
     }
 
     /**
      * Sets the given $column index to the given $classname in $this->column_class.
-     * @param integer $column
+     * @param int $column
      * @param string $classname
      * @return void
      */
     function column_class($column, $classname) {
-        if(isset($this->column_class[$column])) {
+        if (isset($this->column_class[$column])) {
             $this->column_class[$column] = ' '.$classname; // This space needed so that classnames don't run together in the HTML
         }
     }
 
     /**
      * Sets the given $column index and $property index to the given $value in $this->column_style.
-     * @param integer $column
+     * @param int $column
      * @param string $property
      * @param mixed $value
      * @return void
      */
     function column_style($column, $property, $value) {
-        if(isset($this->column_style[$column])) {
+        if (isset($this->column_style[$column])) {
             $this->column_style[$column][$property] = $value;
         }
     }
 
     /**
      * Sets all columns' $propertys to the given $value in $this->column_style.
-     * @param integer $property
+     * @param int $property
      * @param string $value
      * @return void
      */
     function column_style_all($property, $value) {
-        foreach(array_keys($this->columns) as $column) {
+        foreach (array_keys($this->columns) as $column) {
             $this->column_style[$column][$property] = $value;
         }
     }
 
     /**
-     * Sets $this->reseturl to the given $url, and $this->baseurl to the given $url plus ? or &amp;
-     * @param string $url the url with params needed to call up this page
+     * Sets $this->baseurl.
+     * @param moodle_url|string $url the url with params needed to call up this page
      */
     function define_baseurl($url) {
-        $this->reseturl = $url;
-        if(!strpos($url, '?')) {
-            $this->baseurl = $url.'?';
-        }
-        else {
-            $this->baseurl = $url.'&amp;';
-        }
+        $this->baseurl = new moodle_url($url);
     }
 
     /**
@@ -371,7 +382,7 @@ class flexible_table {
         $this->column_class = array();
         $colnum = 0;
 
-        foreach($columns as $column) {
+        foreach ($columns as $column) {
             $this->columns[$column]         = $colnum++;
             $this->column_style[$column]    = array();
             $this->column_class[$column]    = '';
@@ -387,9 +398,6 @@ class flexible_table {
         $this->headers = $headers;
     }
 
-
-
-
     /**
      * Must be called after table is defined. Use methods above first. Cannot
      * use functions below till after calling this method.
@@ -398,7 +406,7 @@ class flexible_table {
     function setup() {
         global $SESSION, $CFG;
 
-        if(empty($this->columns) || empty($this->uniqueid)) {
+        if (empty($this->columns) || empty($this->uniqueid)) {
             return false;
         }
 
@@ -406,7 +414,7 @@ class flexible_table {
             $SESSION->flextable = array();
         }
 
-        if(!isset($SESSION->flextable[$this->uniqueid])) {
+        if (!isset($SESSION->flextable[$this->uniqueid])) {
             $SESSION->flextable[$this->uniqueid] = new stdClass;
             $SESSION->flextable[$this->uniqueid]->uniqueid = $this->uniqueid;
             $SESSION->flextable[$this->uniqueid]->collapse = array();
@@ -417,119 +425,72 @@ class flexible_table {
 
         $this->sess = &$SESSION->flextable[$this->uniqueid];
 
-        if(!empty($_GET[$this->request[TABLE_VAR_SHOW]]) && isset($this->columns[$_GET[$this->request[TABLE_VAR_SHOW]]])) {
-            // Show this column
-            $this->sess->collapse[$_GET[$this->request[TABLE_VAR_SHOW]]] = false;
-        }
-        else if(!empty($_GET[$this->request[TABLE_VAR_HIDE]]) && isset($this->columns[$_GET[$this->request[TABLE_VAR_HIDE]]])) {
-            // Hide this column
-            $this->sess->collapse[$_GET[$this->request[TABLE_VAR_HIDE]]] = true;
-            if(array_key_exists($_GET[$this->request[TABLE_VAR_HIDE]], $this->sess->sortby)) {
-                unset($this->sess->sortby[$_GET[$this->request[TABLE_VAR_HIDE]]]);
+        if (($showcol = optional_param($this->request[TABLE_VAR_SHOW], '', PARAM_ALPHANUMEXT)) &&
+                isset($this->columns[$showcol])) {
+            $this->sess->collapse[$showcol] = false;
+
+        } else if (($hidecol = optional_param($this->request[TABLE_VAR_SHOW], '', PARAM_ALPHANUMEXT)) &&
+                isset($this->columns[$hidecol])) {
+            $this->sess->collapse[$hidecol] = true;
+            if (array_key_exists($hidecol, $this->sess->sortby)) {
+                unset($this->sess->sortby[$hidecol]);
             }
         }
 
         // Now, update the column attributes for collapsed columns
-        foreach(array_keys($this->columns) as $column) {
-            if(!empty($this->sess->collapse[$column])) {
+        foreach (array_keys($this->columns) as $column) {
+            if (!empty($this->sess->collapse[$column])) {
                 $this->column_style[$column]['width'] = '10px';
             }
         }
 
-        if(
-            !empty($_GET[$this->request[TABLE_VAR_SORT]]) && $this->is_sortable($_GET[$this->request[TABLE_VAR_SORT]]) &&
-            (isset($this->columns[$_GET[$this->request[TABLE_VAR_SORT]]]) ||
-                (($_GET[$this->request[TABLE_VAR_SORT]] == 'firstname' || $_GET[$this->request[TABLE_VAR_SORT]] == 'lastname') && isset($this->columns['fullname']))
-            ))
-        {
-            if(empty($this->sess->collapse[$_GET[$this->request[TABLE_VAR_SORT]]])) {
-                if(array_key_exists($_GET[$this->request[TABLE_VAR_SORT]], $this->sess->sortby)) {
-                    // This key already exists somewhere. Change its sortorder and bring it to the top.
-                    $sortorder = $this->sess->sortby[$_GET[$this->request[TABLE_VAR_SORT]]] == SORT_ASC ? SORT_DESC : SORT_ASC;
-                    unset($this->sess->sortby[$_GET[$this->request[TABLE_VAR_SORT]]]);
-                    $this->sess->sortby = array_merge(array($_GET[$this->request[TABLE_VAR_SORT]] => $sortorder), $this->sess->sortby);
-                }
-                else {
-                    // Key doesn't exist, so just add it to the beginning of the array, ascending order
-                    $this->sess->sortby = array_merge(array($_GET[$this->request[TABLE_VAR_SORT]] => SORT_ASC), $this->sess->sortby);
-                }
-                // Finally, make sure that no more than $this->maxsortkeys are present into the array
-                if(!empty($this->maxsortkeys) && ($sortkeys = count($this->sess->sortby)) > $this->maxsortkeys) {
-                    while($sortkeys-- > $this->maxsortkeys) {
-                        array_pop($this->sess->sortby);
-                    }
-                }
+        if (($sortcol = optional_param($this->request[TABLE_VAR_SORT], '', PARAM_ALPHANUMEXT)) &&
+                $this->is_sortable($sortcol) && empty($this->sess->collapse[$sortcol]) &&
+                (isset($this->columns[$sortcol]) || in_array($sortcol, array('firstname', 'lastname')) && isset($this->columns['fullname']))) {
+
+            if (array_key_exists($sortcol, $this->sess->sortby)) {
+                // This key already exists somewhere. Change its sortorder and bring it to the top.
+                $sortorder = $this->sess->sortby[$sortcol] == SORT_ASC ? SORT_DESC : SORT_ASC;
+                unset($this->sess->sortby[$sortcol]);
+                $this->sess->sortby = array_merge(array($sortcol => $sortorder), $this->sess->sortby);
+            } else {
+                // Key doesn't exist, so just add it to the beginning of the array, ascending order
+                $this->sess->sortby = array_merge(array($sortcol => SORT_ASC), $this->sess->sortby);
             }
+
+            // Finally, make sure that no more than $this->maxsortkeys are present into the array
+            $this->sess->sortby = array_slice($this->sess->sortby, 0, $this->maxsortkeys);
         }
 
         // If we didn't sort just now, then use the default sort order if one is defined and the column exists
-        if(empty($this->sess->sortby) && !empty($this->sort_default_column))  {
+        if (empty($this->sess->sortby) && !empty($this->sort_default_column))  {
             $this->sess->sortby = array ($this->sort_default_column => ($this->sort_default_order == SORT_DESC ? SORT_DESC : SORT_ASC));
         }
 
-        if(isset($_GET[$this->request[TABLE_VAR_ILAST]])) {
-            if(empty($_GET[$this->request[TABLE_VAR_ILAST]]) || is_numeric(strpos(get_string('alphabet', 'langconfig'), $_GET[$this->request[TABLE_VAR_ILAST]]))) {
-                $this->sess->i_last = $_GET[$this->request[TABLE_VAR_ILAST]];
-            }
+        $ilast = optional_param($this->request[TABLE_VAR_ILAST], null, PARAM_RAW);
+        if (!is_null($ilast) && ($ilast ==='' || strpos(get_string('alphabet', 'langconfig'), $ilast) !== false)) {
+            $this->sess->i_last = $ilast;
         }
 
-        if(isset($_GET[$this->request[TABLE_VAR_IFIRST]])) {
-            if(empty($_GET[$this->request[TABLE_VAR_IFIRST]]) || is_numeric(strpos(get_string('alphabet', 'langconfig'), $_GET[$this->request[TABLE_VAR_IFIRST]]))) {
-                $this->sess->i_first = $_GET[$this->request[TABLE_VAR_IFIRST]];
-            }
+        $ifirst = optional_param($this->request[TABLE_VAR_IFIRST], null, PARAM_RAW);
+        if (!is_null($ifirst) && ($ifirst === '' || strpos(get_string('alphabet', 'langconfig'), $ifirst) !== false)) {
+            $this->sess->i_first = $ifirst;
         }
 
-        if(empty($this->baseurl)) {
-            $getcopy  = $_GET;
-            unset($getcopy[$this->request[TABLE_VAR_SHOW]]);
-            unset($getcopy[$this->request[TABLE_VAR_HIDE]]);
-            unset($getcopy[$this->request[TABLE_VAR_SORT]]);
-            unset($getcopy[$this->request[TABLE_VAR_IFIRST]]);
-            unset($getcopy[$this->request[TABLE_VAR_ILAST]]);
-            unset($getcopy[$this->request[TABLE_VAR_PAGE]]);
-
-            $strippedurl = strip_querystring(qualified_me());
-
-            if(!empty($getcopy)) {
-                $first = false;
-                $querystring = '';
-                foreach($getcopy as $var => $val) {
-                    if(!$first) {
-                        $first = true;
-                        $querystring .= '?'.$var.'='.$val;
-                    }
-                    else {
-                        $querystring .= '&amp;'.$var.'='.$val;
-                    }
-                }
-                $this->reseturl =  $strippedurl.$querystring;
-                $querystring .= '&amp;';
-            }
-            else {
-                $this->reseturl =  $strippedurl;
-                $querystring = '?';
-            }
-
-            $this->baseurl = strip_querystring(qualified_me()) . $querystring;
-        }
-
-        // If it's "the first time" we 've been here, forget the previous initials filters
-        if(qualified_me() == $this->reseturl) {
-            $this->sess->i_first = '';
-            $this->sess->i_last  = '';
+        if (empty($this->baseurl)) {
+            debugging('You should set baseurl when using flexible_table.');
+            global $PAGE;
+            $this->baseurl = $PAGE->url;
         }
 
         $this->currpage = optional_param($this->request[TABLE_VAR_PAGE], 0, PARAM_INT);
         $this->setup = true;
 
-    /// Always introduce the "flexible" class for the table if not specified
-    /// No attributes, add flexible class
+        // Always introduce the "flexible" class for the table if not specified
         if (empty($this->attributes)) {
             $this->attributes['class'] = 'flexible';
-    /// No classes, add flexible class
         } else if (!isset($this->attributes['class'])) {
             $this->attributes['class'] = 'flexible';
-    /// No flexible class in passed classes, add flexible class
         } else if (!in_array('flexible', explode(' ', $this->attributes['class']))) {
             $this->attributes['class'] = trim('flexible ' . $this->attributes['class']);
         }
@@ -542,7 +503,7 @@ class flexible_table {
      */
     public static function get_sort_for_table($uniqueid) {
         global $SESSION;
-        if(empty($SESSION->flextable[$uniqueid])) {
+        if (empty($SESSION->flextable[$uniqueid])) {
            return '';
         }
 
@@ -562,7 +523,7 @@ class flexible_table {
     public static function construct_order_by($cols) {
         $bits = array();
 
-        foreach($cols as $column => $order) {
+        foreach ($cols as $column => $order) {
             if ($order == SORT_ASC) {
                 $bits[] = $column . ' ASC';
             } else {
@@ -593,31 +554,43 @@ class flexible_table {
             return array();
         }
 
+        foreach ($this->sess->sortby as $column => $notused) {
+            if (isset($this->columns[$column])) {
+                continue; // This column is OK.
+            }
+            if (in_array($column, array('firstname', 'lastname')) &&
+                    isset($this->columns['fullname'])) {
+                continue; // This column is OK.
+            }
+            // This column is not OK.
+            unset($this->sess->sortby[$column]);
+        }
+
         return $this->sess->sortby;
     }
 
     /**
-     * @return integer the offset for LIMIT clause of SQL
+     * @return int the offset for LIMIT clause of SQL
      */
     function get_page_start() {
-        if(!$this->use_pages) {
+        if (!$this->use_pages) {
             return '';
         }
         return $this->currpage * $this->pagesize;
     }
 
     /**
-     * @return integer the pagesize for LIMIT clause of SQL
+     * @return int the pagesize for LIMIT clause of SQL
      */
     function get_page_size() {
-        if(!$this->use_pages) {
+        if (!$this->use_pages) {
             return '';
         }
         return $this->pagesize;
     }
 
     /**
-     * @return array - sql where, params array
+     * @return string sql to add to where statement.
      */
     function get_sql_where() {
         global $DB;
@@ -652,7 +625,7 @@ class flexible_table {
      * @param $rowwithkeys array
      * @param string $classname CSS class name to add to this row's tr tag.
      */
-    function add_data_keyed($rowwithkeys, $classname = ''){
+    function add_data_keyed($rowwithkeys, $classname = '') {
         $this->add_data($this->get_row_from_keyed($rowwithkeys), $classname);
     }
 
@@ -660,7 +633,7 @@ class flexible_table {
      * Add a seperator line to table.
      */
     function add_separator() {
-        if(!$this->setup) {
+        if (!$this->setup) {
             return false;
         }
         $this->add_data(NULL);
@@ -675,17 +648,17 @@ class flexible_table {
      *
      * @param array $row a numerically keyed row of data to add to the table.
      * @param string $classname CSS class name to add to this row's tr tag.
-     * @return boolean success.
+     * @return bool success.
      */
     function add_data($row, $classname = '') {
-        if(!$this->setup) {
+        if (!$this->setup) {
             return false;
         }
-        if (!$this->started_output){
+        if (!$this->started_output) {
             $this->start_output();
         }
-        if ($this->exportclass!==null){
-            if ($row === null){
+        if ($this->exportclass!==null) {
+            if ($row === null) {
                 $this->exportclass->add_seperator();
             } else {
                 $this->exportclass->add_data($row);
@@ -696,20 +669,18 @@ class flexible_table {
         return true;
     }
 
-
-
     /**
      * You should call this to finish outputting the table data after adding
      * data to the table with add_data or add_data_keyed.
      *
      */
-    function finish_output($closeexportclassdoc = true){
-        if ($this->exportclass!==null){
+    function finish_output($closeexportclassdoc = true) {
+        if ($this->exportclass!==null) {
             $this->exportclass->finish_table();
-            if ($closeexportclassdoc){
+            if ($closeexportclassdoc) {
                 $this->exportclass->finish_document();
             }
-        }else{
+        } else {
             $this->finish_html();
         }
     }
@@ -719,7 +690,7 @@ class flexible_table {
      * for example. Called only when there is data to display and not
      * downloading.
      */
-    function wrap_html_start(){
+    function wrap_html_start() {
     }
 
     /**
@@ -727,24 +698,23 @@ class flexible_table {
      * for example. Called only when there is data to display and not
      * downloading.
      */
-    function wrap_html_finish(){
+    function wrap_html_finish() {
     }
 
-
     /**
      *
      * @param array $row row of data from db used to make one row of the table.
      * @return array one row for the table, added using add_data_keyed method.
      */
-    function format_row($row){
+    function format_row($row) {
         $formattedrow = array();
-        foreach (array_keys($this->columns) as $column){
+        foreach (array_keys($this->columns) as $column) {
             $colmethodname = 'col_'.$column;
-            if (method_exists($this, $colmethodname)){
+            if (method_exists($this, $colmethodname)) {
                 $formattedcolumn = $this->$colmethodname($row);
             } else {
                 $formattedcolumn = $this->other_cols($column, $row);
-                if ($formattedcolumn===NULL){
+                if ($formattedcolumn===NULL) {
                     $formattedcolumn = $row->$column;
                 }
             }
@@ -761,17 +731,16 @@ class flexible_table {
      * field for the user id.
      *
      */
-    function col_fullname($row){
+    function col_fullname($row) {
         global $COURSE, $CFG;
 
-        if (!$this->download){
-            if ($COURSE->id == SITEID) {
-                return '<a href="'.$CFG->wwwroot.'/user/profile.php?id='.$row->{$this->useridfield}.  '">'.
-                        fullname($row).'</a>';
-            } else {
-                return '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$row->{$this->useridfield}.
-                        '&amp;course='.$COURSE->id.'">'.fullname($row).'</a>';
+        if (!$this->download) {
+            $profileurl = new moodle_url('/user/profile.php', array('id' => $row->{$this->useridfield}));
+            if ($COURSE->id != SITEID) {
+                $profileurl->param('course', $COURSE->id);
             }
+            return html_writer::link($profileurl, fullname($row));
+
         } else {
             return fullname($row);
         }
@@ -781,11 +750,10 @@ class flexible_table {
      * You can override this method in a child class. See the description of
      * build_table which calls this method.
      */
-    function other_cols($column, $row){
+    function other_cols($column, $row) {
         return NULL;
     }
 
-
     /**
      * Used from col_* functions when text is to be displayed. Does the
      * right thing - either converts text to html or strips any html tags
@@ -793,16 +761,16 @@ class flexible_table {
      * are the same as format_text function in weblib.php but some default
      * options are changed.
      */
-    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL){
-        if (!$this->is_downloading()){
-            if (is_null($options)){
+    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
+        if (!$this->is_downloading()) {
+            if (is_null($options)) {
                 $options = new stdClass;
             }
             //some sensible defaults
-            if (!isset($options->para)){
+            if (!isset($options->para)) {
                 $options->para = false;
             }
-            if (!isset($options->newlines)){
+            if (!isset($options->newlines)) {
                 $options->newlines = false;
             }
             if (!isset($options->smiley)) {
@@ -822,7 +790,7 @@ class flexible_table {
      * @deprecated 1.9.2 - Jun 2, 2008
      */
     function print_html() {
-        if(!$this->setup) {
+        if (!$this->setup) {
             return false;
         }
         $this->finish_html();
@@ -833,7 +801,7 @@ class flexible_table {
      * @return string initial of first name we are currently filtering by
      */
     function get_initial_first() {
-        if(!$this->use_initials) {
+        if (!$this->use_initials) {
             return NULL;
         }
 
@@ -845,64 +813,74 @@ class flexible_table {
      * @return string initial of last name we are currently filtering by
      */
     function get_initial_last() {
-        if(!$this->use_initials) {
+        if (!$this->use_initials) {
             return NULL;
         }
 
         return $this->sess->i_last;
     }
 
+    /**
+     * Helper function, used by {@link print_initials_bar()} to output one initial bar.
+     * @param array $alpha of letters in the alphabet.
+     * @param string $current the currently selected letter.
+     * @param string $class class name to add to this initial bar.
+     * @param string $title the name to put in front of this initial bar.
+     * @param string $urlvar URL parameter name for this initial.
+     */
+    protected function print_one_initials_bar($alpha, $current, $class, $title, $urlvar) {
+        echo html_writer::start_tag('div', array('class' => 'initialbar ' . $class)) .
+                $title . ' : ';
+        if ($current) {
+            echo html_writer::link($this->baseurl->out(false, array($urlvar => '')), get_string('all'));
+        } else {
+            echo html_writer::tag('strong', get_string('all'));
+        }
+
+        foreach ($alpha as $letter) {
+            if ($letter === $current) {
+                echo html_writer::tag('strong', $letter);
+            } else {
+                echo html_writer::link($this->baseurl->out(false, array($urlvar => $letter)), $letter);
+            }
+        }
+
+        echo html_writer::end_tag('div');
+    }
+
     /**
      * This function is not part of the public api.
      */
-    function print_initials_bar(){
-        if ((!empty($this->sess->i_last) || !empty($this->sess->i_first) || $this->use_initials)
+    function print_initials_bar() {
+        if ((!empty($this->sess->i_last) || !empty($this->sess->i_first) ||$this->use_initials)
                     && isset($this->columns['fullname'])) {
 
-            $strall = get_string('all');
             $alpha  = explode(',', get_string('alphabet', 'langconfig'));
 
             // Bar of first initials
-
-            echo '<div class="initialbar firstinitial">'.get_string('firstname').' : ';
-            if(!empty($this->sess->i_first)) {
-                echo '<a href="'.$this->baseurl.$this->request[TABLE_VAR_IFIRST].'=">'.$strall.'</a>';
+            if (!empty($this->sess->i_first)) {
+                $ifirst = $this->sess->i_first;
             } else {
-                echo '<strong>'.$strall.'</strong>';
+                $ifirst = '';
             }
-            foreach ($alpha as $letter) {
-                if (isset($this->sess->i_first) && $letter == $this->sess->i_first) {
-                    echo ' <strong>'.$letter.'</strong>';
-                } else {
-                    echo ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_IFIRST].'='.$letter.'">'.$letter.'</a>';
-                }
-            }
-            echo '</div>';
+            $this->print_one_initials_bar($alpha, $ifirst, 'firstinitial',
+                    get_string('firstname'), $this->request[TABLE_VAR_IFIRST]);
 
             // Bar of last initials
-
-            echo '<div class="initialbar lastinitial">'.get_string('lastname').' : ';
-            if(!empty($this->sess->i_last)) {
-                echo '<a href="'.$this->baseurl.$this->request[TABLE_VAR_ILAST].'=">'.$strall.'</a>';
+            if (!empty($this->sess->i_last)) {
+                $ilast = $this->sess->i_last;
             } else {
-                echo '<strong>'.$strall.'</strong>';
-            }
-            foreach ($alpha as $letter) {
-                if (isset($this->sess->i_last) && $letter == $this->sess->i_last) {
-                    echo ' <strong>'.$letter.'</strong>';
-                } else {
-                    echo ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_ILAST].'='.$letter.'">'.$letter.'</a>';
-                }
+                $ilast = '';
             }
-            echo '</div>';
-
+            $this->print_one_initials_bar($alpha, $ilast, 'lastinitial',
+                    get_string('lastname'), $this->request[TABLE_VAR_ILAST]);
         }
     }
 
     /**
      * This function is not part of the public api.
      */
-    function print_nothing_to_display(){
+    function print_nothing_to_display() {
         global $OUTPUT;
         $this->print_initials_bar();
 
@@ -912,13 +890,13 @@ class flexible_table {
     /**
      * This function is not part of the public api.
      */
-    function get_row_from_keyed($rowwithkeys){
-        if (is_object($rowwithkeys)){
+    function get_row_from_keyed($rowwithkeys) {
+        if (is_object($rowwithkeys)) {
             $rowwithkeys = (array)$rowwithkeys;
         }
         $row = array();
-        foreach (array_keys($this->columns) as $column){
-            if (isset($rowwithkeys[$column])){
+        foreach (array_keys($this->columns) as $column) {
+            if (isset($rowwithkeys[$column])) {
                 $row [] = $rowwithkeys[$column];
             } else {
                 $row[] ='';
@@ -929,12 +907,12 @@ class flexible_table {
     /**
      * This function is not part of the public api.
      */
-    function get_download_menu(){
+    function get_download_menu() {
         $allclasses= get_declared_classes();
         $exportclasses = array();
-        foreach ($allclasses as $class){
+        foreach ($allclasses as $class) {
             $matches = array();
-            if (preg_match('/^table\_([a-z]+)\_export\_format$/', $class, $matches)){
+            if (preg_match('/^table\_([a-z]+)\_export\_format$/', $class, $matches)) {
                 $type = $matches[1];
                 $exportclasses[$type]= get_string("download$type", 'table');
             }
@@ -945,9 +923,8 @@ class flexible_table {
     /**
      * This function is not part of the public api.
      */
-    function download_buttons(){
-        global $OUTPUT;
-        if ($this->is_downloadable() && !$this->is_downloading()){
+    function download_buttons() {
+        if ($this->is_downloadable() && !$this->is_downloading()) {
             $downloadoptions = $this->get_download_menu();
             $html = '<form action="'. $this->baseurl .'" method="post">';
             $html .= '<div class="mdl-align">';
@@ -966,9 +943,9 @@ class flexible_table {
      * needed when you start adding data to the table.
      *
      */
-    function start_output(){
+    function start_output() {
         $this->started_output = true;
-        if ($this->exportclass!==null){
+        if ($this->exportclass!==null) {
             $this->exportclass->start_table($this->sheettitle);
             $this->exportclass->output_headers($this->headers);
         } else {
@@ -990,53 +967,62 @@ class flexible_table {
             $rowclasses[] = $classname;
         }
 
-        echo '<tr class="' . implode(' ', $rowclasses) . '">';
+        echo html_writer::start_tag('tr', array('class', implode(' ', $rowclasses)));
 
         // If we have a separator, print it
         if ($row === NULL) {
             $colcount = count($this->columns);
-            echo '<td colspan="'.$colcount.'"><div class="tabledivider"></div></td>';
+            echo html_writer::tag('td', html_writer::tag('div', '',
+                    array('class' => 'tabledivider')), array('colspan' => $colcount));
+
         } else {
             $colbyindex = array_flip($this->columns);
             foreach ($row as $index => $data) {
                 $column = $colbyindex[$index];
-                echo '<td class="cell c'.$index.$this->column_class[$column].'"'.$this->make_styles_string($this->column_style[$column]).'>';
+
                 if (empty($this->sess->collapse[$column])) {
                     if ($this->column_suppress[$column] && $suppress_lastrow !== NULL && $suppress_lastrow[$index] === $data) {
-                        echo '&nbsp;';
+                        $content = '&nbsp;';
                     } else {
-                        echo $data;
+                        $content = $data;
                     }
                 } else {
-                    echo '&nbsp;';
+                    $content = '&nbsp;';
                 }
-                echo '</td>';
+
+                echo html_writer::tag('td', $content, array(
+                        'class' => 'cell c' . $index . $this->column_class[$column],
+                        'style' => $this->make_styles_string($this->column_style[$column])));
             }
         }
 
-        echo '</tr>';
+        echo html_writer::end_tag('tr');
 
         $suppress_enabled = array_sum($this->column_suppress);
         if ($suppress_enabled) {
             $suppress_lastrow = $row;
         }
     }
+
     /**
      * This function is not part of the public api.
      */
-    function finish_html(){
+    function finish_html() {
         global $OUTPUT;
         if (!$this->started_output) {
             //no data has been added to the table.
             $this->print_nothing_to_display();
+
         } else {
-            echo '</table>';
+            echo html_writer::end_tag('table');
             echo html_writer::end_tag('div');
             $this->wrap_html_finish();
+
             // Paging bar
             if(in_array(TABLE_P_BOTTOM, $this->showdownloadbuttonsat)) {
                 echo $this->download_buttons();
             }
+
             if($this->use_pages) {
                 $pagingbar = new paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
                 $pagingbar->pagevar = $this->request[TABLE_VAR_PAGE];
@@ -1044,65 +1030,61 @@ class flexible_table {
             }
         }
     }
+
+    /**
+     * Generate the HTML for the collapse/uncollapse icon. This is a helper method
+     * used by {@link print_headers()}.
+     * @param string $column the column name, index into various names.
+     * @param int $index numerical index of the column.
+     * @return string HTML fragment.
+     */
+    protected function show_hide_link($column, $index) {
+        global $OUTPUT;
+        // Some headers contain <br /> tags, do not include in title, hence the
+        // strip tags.
+
+        if (!empty($this->sess->collapse[$column])) {
+            return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_SHOW] => $column)),
+                    html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/switch_plus'), 'alt' => get_string('show'))),
+                    array('title' => get_string('show') . ' ' . strip_tags($this->headers[$index])));
+
+        } else if ($this->headers[$index] !== NULL) {
+            return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_HIDE] => $column)),
+                    html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/switch_minus'), 'alt' => get_string('hide'))),
+                    array('title' => get_string('hide') . ' ' . strip_tags($this->headers[$index])));
+        }
+    }
+
     /**
      * This function is not part of the public api.
      */
-    function print_headers(){
+    function print_headers() {
         global $CFG, $OUTPUT;
 
-        echo '<tr>';
-        foreach($this->columns as $column => $index) {
-            $icon_hide = '';
-            $icon_sort = '';
+        echo html_writer::start_tag('tr');
+        foreach ($this->columns as $column => $index) {
 
-            if($this->is_collapsible) {
-                if(!empty($this->sess->collapse[$column])) {
-                    // some headers contain < br/> tags, do not include in title
-                    $icon_hide = ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_SHOW].'='.$column.'"><img src="'.$OUTPUT->pix_url('t/switch_plus') . '" title="'.get_string('show').' '.strip_tags($this->headers[$index]).'" alt="'.get_string('show').'" /></a>';
-                }
-                else if($this->headers[$index] !== NULL) {
-                    // some headers contain < br/> tags, do not include in title
-                    $icon_hide = ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_HIDE].'='.$column.'"><img src="'.$OUTPUT->pix_url('t/switch_minus') . '" title="'.get_string('hide').' '.strip_tags($this->headers[$index]).'" alt="'.get_string('hide').'" /></a>';
-                }
+            $icon_hide = '';
+            if ($this->is_collapsible) {
+                $icon_hide = $this->show_hide_link($column, $index);
             }
 
             $primary_sort_column = '';
             $primary_sort_order  = '';
-            if(reset($this->sess->sortby)) {
+            if (reset($this->sess->sortby)) {
                 $primary_sort_column = key($this->sess->sortby);
                 $primary_sort_order  = current($this->sess->sortby);
             }
 
-            switch($column) {
+            switch ($column) {
 
                 case 'fullname':
-                if($this->is_sortable($column)) {
-                    $icon_sort_first = $icon_sort_last = '';
-                    if($primary_sort_column == 'firstname') {
-                        $lsortorder = get_string('asc');
-                        if($primary_sort_order == SORT_ASC) {
-                            $icon_sort_first = ' <img src="'.$OUTPUT->pix_url('t/down') . '" alt="'.get_string('asc').'" />';
-                            $fsortorder = get_string('asc');
-                        }
-                        else {
-                            $icon_sort_first = ' <img src="'.$OUTPUT->pix_url('t/up') . '" alt="'.get_string('desc').'" />';
-                            $fsortorder = get_string('desc');
-                        }
-                    }
-                    else if($primary_sort_column == 'lastname') {
-                        $fsortorder = get_string('asc');
-                        if($primary_sort_order == SORT_ASC) {
-                            $icon_sort_last = ' <img src="'.$OUTPUT->pix_url('t/down') . '" alt="'.get_string('asc').'" />';
-                            $lsortorder = get_string('asc');
-                        }
-                        else {
-                            $icon_sort_last = ' <img src="'.$OUTPUT->pix_url('t/up') . '" alt="'.get_string('desc').'" />';
-                            $lsortorder = get_string('desc');
-                        }
-                    } else {
-                        $fsortorder = get_string('asc');
-                        $lsortorder = get_string('asc');
-                    }
+                if ($this->is_sortable($column)) {
+                    $firstnamesortlink = $this->sort_link(get_string('firstname'),
+                            'firstname', $primary_sort_column === 'firstname', $primary_sort_order);
+
+                    $lastnamesortlink = $this->sort_link(get_string('lastname'),
+                            'lastname', $primary_sort_column === 'lastname', $primary_sort_order);
 
                     $override = new stdClass();
                     $override->firstname = 'firstname';
@@ -1112,11 +1094,9 @@ class flexible_table {
                     if (($CFG->fullnamedisplay == 'firstname lastname') or
                         ($CFG->fullnamedisplay == 'firstname') or
                         ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
-                        $this->headers[$index] = '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=firstname">'.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).'</a> '.$icon_sort_first.' / '.
-                                                 '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=lastname">'.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).'</a> '.$icon_sort_last;
+                        $this->headers[$index] = $firstnamesortlink . ' / ' . $lastnamesortlink;
                     } else {
-                        $this->headers[$index] = '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=lastname">'.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).'</a> '.$icon_sort_last.' / '.
-                                                 '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=firstname">'.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).'</a> '.$icon_sort_first;
+                        $this->headers[$index] = $lastnamesortlink . ' / ' . $firstnamesortlink;
                     }
                 }
                 break;
@@ -1126,115 +1106,138 @@ class flexible_table {
                 break;
 
                 default:
-                if($this->is_sortable($column)) {
-                    if($primary_sort_column == $column) {
-                        if($primary_sort_order == SORT_ASC) {
-                            $icon_sort = ' <img src="'.$OUTPUT->pix_url('t/down') . '" alt="'.get_string('asc').'" />';
-                            $localsortorder = get_string('asc');
-                        }
-                        else {
-                            $icon_sort = ' <img src="'.$OUTPUT->pix_url('t/up') . '" alt="'.get_string('desc').'" />';
-                            $localsortorder = get_string('desc');
-                        }
-                    } else {
-                        $localsortorder = get_string('asc');
-                    }
-                    $this->headers[$index] = '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'='.$column.'">'.$this->headers[$index].get_accesshide(get_string('sortby').' '.$this->headers[$index].' '.$localsortorder).'</a>';
+                if ($this->is_sortable($column)) {
+                    $this->headers[$index] = $this->sort_link($this->headers[$index],
+                            $column, $primary_sort_column == $column, $primary_sort_order);
                 }
             }
 
-            if($this->headers[$index] === NULL) {
-                echo '<th class="header c'.$index.$this->column_class[$column].'" scope="col">&nbsp;</th>';
-            }
-            else if(!empty($this->sess->collapse[$column])) {
-                echo '<th class="header c'.$index.$this->column_class[$column].'" scope="col">'.$icon_hide.'</th>';
-            }
-            else {
-                // took out nowrap for accessibility, might need replacement
-                if (!is_array($this->column_style[$column])) {
-                    // $usestyles = array('white-space:nowrap');
-                    $usestyles = '';
-                 } else {
-                    // $usestyles = $this->column_style[$column]+array('white-space'=>'nowrap');
-                    $usestyles = $this->column_style[$column];
-                 }
-                echo '<th class="header c'.$index.$this->column_class[$column].'" '.$this->make_styles_string($usestyles).' scope="col">'.$this->headers[$index].$icon_sort.'<div class="commands">'.$icon_hide.'</div></th>';
+            $attributes = array(
+                'class' => 'header c' . $index . $this->column_class[$column],
+                'scope' => 'col',
+            );
+            if ($this->headers[$index] === NULL) {
+                $content = '&nbsp;';
+            } else if (!empty($this->sess->collapse[$column])) {
+                $content = $icon_hide;
+            } else {
+                if (is_array($this->column_style[$column])) {
+                    $attributes['style'] = $this->make_styles_string($this->column_style[$column]);
+                }
+                $content = $this->headers[$index] . html_writer::tag('div',
+                        $icon_hide, array('class' => 'commands'));
             }
+            echo html_writer::tag('th', $content, $attributes);
+        }
+
+        echo html_writer::end_tag('tr');
+    }
+
+    /**
+     * Generate the HTML for the sort icon. This is a helper method used by {@link sort_link()}.
+     * @param bool $isprimary whether an icon is needed (it is only needed for the primary sort column.)
+     * @param int $order SORT_ASC or SORT_DESC
+     * @return string HTML fragment.
+     */
+    protected function sort_icon($isprimary, $order) {
+        global $OUTPUT;
+
+        if (!$isprimary) {
+            return '';
+        }
+
+        if ($order == SORT_ASC) {
+            return html_writer::empty_tag('img',
+                    array('src' => $OUTPUT->pix_url('t/down'), 'alt' => get_string('asc')));
+        } else {
+            return html_writer::empty_tag('img',
+                    array('src' => $OUTPUT->pix_url('t/up'), 'alt' => get_string('desc')));
+        }
+    }
 
+    /**
+     * Generate the correct tool tip for changing the sort order. This is a
+     * helper method used by {@link sort_link()}.
+     * @param bool $isprimary whether the is column is the current primary sort column.
+     * @param int $order SORT_ASC or SORT_DESC
+     * @return string the correct title.
+     */
+    protected function sort_order_name($isprimary, $order) {
+        if ($isprimary && $order != SORT_ASC) {
+            return get_string('desc');
+        } else {
+            return get_string('asc');
         }
-        echo '</tr>';
+    }
+
+    /**
+     * Generate the HTML for the sort link. This is a helper method used by {@link print_headers()}.
+     * @param string $text the text for the link.
+     * @param string $column the column name, may be a fake column like 'firstname' or a real one.
+     * @param bool $isprimary whether the is column is the current primary sort column.
+     * @param int $order SORT_ASC or SORT_DESC
+     * @return string HTML fragment.
+     */
+    protected function sort_link($text, $column, $isprimary, $order) {
+        return html_writer::link($this->baseurl->out(false,
+                array($this->request[TABLE_VAR_SORT] => $column)),
+                $text . get_accesshide(get_string('sortby') . ' ' .
+                $text . ' ' . $this->sort_order_name($isprimary, $order))) . ' ' .
+                $this->sort_icon($isprimary, $order);
     }
 
     /**
      * This function is not part of the public api.
      */
-    function start_html(){
+    function start_html() {
         global $OUTPUT;
         // Do we need to print initial bars?
         $this->print_initials_bar();
 
         // Paging bar
-        if($this->use_pages) {
+        if ($this->use_pages) {
             $pagingbar = new paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
             $pagingbar->pagevar = $this->request[TABLE_VAR_PAGE];
             echo $OUTPUT->render($pagingbar);
         }
 
-        if(in_array(TABLE_P_TOP, $this->showdownloadbuttonsat)) {
+        if (in_array(TABLE_P_TOP, $this->showdownloadbuttonsat)) {
             echo $this->download_buttons();
         }
 
         $this->wrap_html_start();
         // Start of main data table
 
-        echo html_writer::start_tag('div', array('class'=>'no-overflow'));
-        echo '<table'.$this->make_attributes_string($this->attributes).'>';
+        echo html_writer::start_tag('div', array('class' => 'no-overflow'));
+        echo html_writer::start_tag('table', $this->attributes);
 
     }
 
     /**
      * This function is not part of the public api.
-     * @todo Document
-     * @return type?
+     * @param array $styles CSS-property => value
+     * @return string values suitably to go in a style="" attribute in HTML.
      */
-    function make_styles_string(&$styles) {
-        if(empty($styles)) {
-            return '';
+    function make_styles_string($styles) {
+        if (empty($styles)) {
+            return null;
         }
 
-        $string = ' style="';
+        $string = '';
         foreach($styles as $property => $value) {
-            $string .= $property.':'.$value.';';
+            $string .= $property . ':' . $value . ';';
         }
-        $string .= '"';
-        return $string;
-    }
-
-    /**
-     * This function is not part of the public api.
-     * @todo Document
-     * @return type?
-     */
-    function make_attributes_string(&$attributes) {
-        if(empty($attributes)) {
-            return '';
-        }
-
-        $string = ' ';
-        foreach($attributes as $attr => $value) {
-            $string .= ($attr.'="'.$value.'" ');
-        }
-
         return $string;
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_sql extends flexible_table{
+class table_sql extends flexible_table {
 
     public $countsql = NULL;
     public $countparams = NULL;
@@ -1248,41 +1251,60 @@ class table_sql extends flexible_table{
     public $rawdata = NULL;
 
     /**
-     * @var boolean Overriding default for this.
+     * @var bool Overriding default for this.
      */
     public $is_sortable    = true;
     /**
-     * @var boolean Overriding default for this.
+     * @var bool Overriding default for this.
      */
     public $is_collapsible = true;
 
-
     /**
      * @param string $uniqueid a string identifying this table.Used as a key in
      *                          session  vars.
      */
-    function table_sql($uniqueid){
-        parent::flexible_table($uniqueid);
+    function __construct($uniqueid) {
+        parent::__construct($uniqueid);
         // some sensible defaults
         $this->set_attribute('cellspacing', '0');
         $this->set_attribute('class', 'generaltable generalbox');
     }
 
+    /**
+     * Backwards-compatible constructor, so that legacy code subclassing
+     * table_sql does not break.
+     * @deprecated since Moodle 2.0. Will be removed in Moodle 2.1.
+     */
+    function table_sql($uniqueid) {
+        debugging('Please update your code to user PHP5-style parent::__construct(...), ' .
+                'not parent::table_sql(...).');
+        $this->__construct($uniqueid);
+    }
+
     /**
      * Take the data returned from the db_query and go through all the rows
      * processing each col using either col_{columnname} method or other_cols
      * method or if other_cols returns NULL then put the data straight into the
      * table.
      */
-    function build_table(){
-        if ($this->rawdata){
-            foreach($this->rawdata as $row){
+    function build_table() {
+        if ($this->rawdata) {
+            foreach ($this->rawdata as $row) {
                 $formattedrow = $this->format_row($row);
-                $this->add_data_keyed($formattedrow);
+                $this->add_data_keyed($formattedrow,
+                        $this->get_row_class($row));
             }
         }
     }
 
+    /**
+     * Get any extra classes names to add to this row in the HTML.
+     * @param $row array the data for this row.
+     * @return string added to the class="" attribute of the tr.
+     */
+    function get_row_class($row) {
+        return '';
+    }
 
     /**
      * This is only needed if you want to use different sql to count rows.
@@ -1293,7 +1315,7 @@ class table_sql extends flexible_table{
      * We need to count rows returned by the db seperately to the query itself
      * as we need to know how many pages of data we have to display.
      */
-    function set_count_sql($sql, array $params = NULL){
+    function set_count_sql($sql, array $params = NULL) {
         $this->countsql = $sql;
         $this->countparams = $params;
     }
@@ -1304,7 +1326,7 @@ class table_sql extends flexible_table{
      * Of course you can use sub-queries, JOINS etc. by putting them in the
      * appropriate clause of the query.
      */
-    function set_sql($fields, $from, $where, array $params = NULL){
+    function set_sql($fields, $from, $where, array $params = NULL) {
         $this->sql = new stdClass();
         $this->sql->fields = $fields;
         $this->sql->from = $from;
@@ -1315,14 +1337,14 @@ class table_sql extends flexible_table{
     /**
      * Query the db. Store results in the table object for use by build_table.
      *
-     * @param integer $pagesize size of page for paginated displayed table.
-     * @param boolean $useinitialsbar do you want to use the initials bar. Bar
+     * @param int $pagesize size of page for paginated displayed table.
+     * @param bool $useinitialsbar do you want to use the initials bar. Bar
      * will only be used if there is a fullname column defined for the table.
      */
-    function query_db($pagesize, $useinitialsbar=true){
+    function query_db($pagesize, $useinitialsbar=true) {
         global $DB;
         if (!$this->is_downloading()) {
-            if ($this->countsql === NULL){
+            if ($this->countsql === NULL) {
                 $this->countsql = 'SELECT COUNT(1) FROM '.$this->sql->from.' WHERE '.$this->sql->where;
             }
             if ($useinitialsbar && !$this->is_downloading()) {
@@ -1348,8 +1370,15 @@ class table_sql extends flexible_table{
 
         // Fetch the attempts
         $sort = $this->get_sql_sort();
-        $sort = $sort?" ORDER BY {$sort}":'';
-        $sql = "SELECT {$this->sql->fields} FROM {$this->sql->from} WHERE {$this->sql->where}{$sort}";
+        if ($sort) {
+            $sort = "ORDER BY $sort";
+        }
+        $sql = "SELECT
+                {$this->sql->fields}
+                FROM {$this->sql->from}
+                WHERE {$this->sql->where}
+                {$sort}";
+
         if (!$this->is_downloading()) {
             $this->rawdata = $DB->get_records_sql($sql, $this->sql->params, $this->get_page_start(), $this->get_page_size());
         } else {
@@ -1357,14 +1386,13 @@ class table_sql extends flexible_table{
         }
     }
 
-
     /**
      * Convenience method to call a number of methods for you to display the
      * table.
      */
-    function out($pagesize, $useinitialsbar, $downloadhelpbutton=''){
+    function out($pagesize, $useinitialsbar, $downloadhelpbutton='') {
         global $DB;
-        if (!$this->columns){
+        if (!$this->columns) {
             $onerow = $DB->get_record_sql("SELECT {$this->sql->fields} FROM {$this->sql->from} WHERE {$this->sql->where}", $this->sql->params);
             //if columns is not set then define columns as the keys of the rows returned
             //from the db.
@@ -1378,12 +1406,13 @@ class table_sql extends flexible_table{
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_default_export_format_parent{
+class table_default_export_format_parent {
     /**
      * @var flexible_table or child class reference pointing to table class
      * object from which to export data.
@@ -1391,25 +1420,27 @@ class table_default_export_format_parent{
     var $table;
 
     /**
-     * @var boolean output started. Keeps track of whether any output has been
+     * @var bool output started. Keeps track of whether any output has been
      * started yet.
      */
     var $documentstarted = false;
-    function table_default_export_format_parent(&$table){
+    function table_default_export_format_parent(&$table) {
         $this->table =& $table;
     }
 
-    function set_table(&$table){
+    function set_table(&$table) {
         $this->table =& $table;
     }
 
     function add_data($row) {
         return false;
     }
+
     function add_seperator() {
         return false;
     }
-    function document_started(){
+
+    function document_started() {
         return $this->documentstarted;
     }
     /**
@@ -1417,19 +1448,20 @@ class table_default_export_format_parent{
      * the text as safe HTML or as plain text dependent on what is appropriate
      * for the download format. The default removes all tags.
      */
-    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL){
+    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
         //use some whitespace to indicate where there was some line spacing.
         $text = str_replace(array('</p>', "\n", "\r"), '   ', $text);
         return strip_tags($text);
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_spreadsheet_export_format_parent extends table_default_export_format_parent{
+class table_spreadsheet_export_format_parent extends table_default_export_format_parent {
     var $rownum;
     var $workbook;
     var $worksheet;
@@ -1450,9 +1482,10 @@ class table_spreadsheet_export_format_parent extends table_default_export_format
     /**
      * This method will be overridden in the child class.
      */
-    function define_workbook(){
+    function define_workbook() {
     }
-    function start_document($filename){
+
+    function start_document($filename) {
         $filename = $filename.'.'.$this->fileextension;
         $this->define_workbook();
         // format types
@@ -1465,11 +1498,13 @@ class table_spreadsheet_export_format_parent extends table_default_export_format
         $this->workbook->send($filename);
         $this->documentstarted = true;
     }
-    function start_table($sheettitle){
+
+    function start_table($sheettitle) {
         $this->worksheet =& $this->workbook->add_worksheet($sheettitle);
         $this->rownum=0;
     }
-    function output_headers($headers){
+
+    function output_headers($headers) {
         $colnum = 0;
         foreach ($headers as $item) {
             $this->worksheet->write($this->rownum,$colnum,$item,$this->formatheaders);
@@ -1477,37 +1512,41 @@ class table_spreadsheet_export_format_parent extends table_default_export_format
         }
         $this->rownum++;
     }
-    function add_data($row){
+
+    function add_data($row) {
         $colnum = 0;
-        foreach($row as $item){
+        foreach ($row as $item) {
             $this->worksheet->write($this->rownum,$colnum,$item,$this->formatnormal);
             $colnum++;
         }
         $this->rownum++;
         return true;
     }
+
     function add_seperator() {
         $this->rownum++;
         return true;
     }
 
-    function finish_table(){
+    function finish_table() {
     }
-    function finish_document(){
+
+    function finish_document() {
         $this->workbook->close();
         exit;
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_excel_export_format extends table_spreadsheet_export_format_parent{
+class table_excel_export_format extends table_spreadsheet_export_format_parent {
     var $fileextension = 'xls';
 
-    function define_workbook(){
+    function define_workbook() {
         global $CFG;
         require_once("$CFG->libdir/excellib.class.php");
         // Creating a workbook
@@ -1516,14 +1555,15 @@ class table_excel_export_format extends table_spreadsheet_export_format_parent{
 
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_ods_export_format extends table_spreadsheet_export_format_parent{
+class table_ods_export_format extends table_spreadsheet_export_format_parent {
     var $fileextension = 'ods';
-    function define_workbook(){
+    function define_workbook() {
         global $CFG;
         require_once("$CFG->libdir/odslib.class.php");
         // Creating a workbook
@@ -1531,6 +1571,7 @@ class table_ods_export_format extends table_spreadsheet_export_format_parent{
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
@@ -1585,35 +1626,38 @@ class table_text_export_format_parent extends table_default_export_format_parent
     }
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_tsv_export_format extends table_text_export_format_parent{
+class table_tsv_export_format extends table_text_export_format_parent {
     protected $seperator = "\t";
     protected $mimetype = 'text/tab-separated-values';
     protected $ext = '.txt';
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_csv_export_format extends table_text_export_format_parent{
+class table_csv_export_format extends table_text_export_format_parent {
     protected $seperator = ",";
     protected $mimetype = 'text/csv';
     protected $ext = '.csv';
 }
 
+
 /**
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class table_xhtml_export_format extends table_default_export_format_parent{
-    function start_document($filename){
+class table_xhtml_export_format extends table_default_export_format_parent {
+    function start_document($filename) {
         header("Content-Type: application/download\n");
         header("Content-Disposition: attachment; filename=\"$filename.html\"");
         header("Expires: 0");
@@ -1666,7 +1710,7 @@ table {
     margin:auto;
 }
 
-h1, h2{
+h1, h2 {
     text-align:center;
 }
 .bold {
@@ -1675,8 +1719,6 @@ font-weight:bold;
 .mdl-align {
     text-align:center;
 }
-
-
 /*]]>*/</style>
 <title>$filename</title>
 </head>
@@ -1684,41 +1726,46 @@ font-weight:bold;
 EOF;
         $this->documentstarted = true;
     }
-    function start_table($sheettitle){
+
+    function start_table($sheettitle) {
         $this->table->sortable(false);
         $this->table->collapsible(false);
         echo "<h2>{$sheettitle}</h2>";
         $this->table->start_html();
     }
 
-
-    function output_headers($headers){
+    function output_headers($headers) {
         $this->table->print_headers();
     }
-    function add_data($row){
+
+    function add_data($row) {
         $this->table->print_row($row);
         return true;
     }
+
     function add_seperator() {
         $this->table->print_row(NULL);
         return true;
     }
-    function finish_table(){
+
+    function finish_table() {
         $this->table->finish_html();
     }
-    function finish_document(){
+
+    function finish_document() {
         echo "</body>\n</html>";
         exit;
     }
-    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL){
-        if (is_null($options)){
+
+    function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
+        if (is_null($options)) {
             $options = new stdClass;
         }
         //some sensible defaults
-        if (!isset($options->para)){
+        if (!isset($options->para)) {
             $options->para = false;
         }
-        if (!isset($options->newlines)){
+        if (!isset($options->newlines)) {
             $options->newlines = false;
         }
         if (!isset($options->smiley)) {
index 53c8727..e0ba25c 100644 (file)
@@ -1290,7 +1290,6 @@ function upgrade_language_pack($lang='') {
         $status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
 
         if ($status == COMPONENT_INSTALLED) {
-            remove_dir($CFG->dataroot.'/cache/languages');
             if ($parentlang = get_parent_language($lang)) {
                 if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
                     $cd->install();
index e034c41..280542a 100644 (file)
@@ -1879,9 +1879,9 @@ function message_format_message($message, $format='', $keywords='', $class='othe
 
     //if supplied display small messages as fullmessage may contain boilerplate text that shouldnt appear in the messaging UI
     if (!empty($message->smallmessage)) {
-        $messagetext = format_text($message->smallmessage, FORMAT_MOODLE, $options);
+        $messagetext = format_text(s($message->smallmessage), FORMAT_MOODLE, $options);
     } else {
-        $messagetext = format_text($message->fullmessage, $message->fullmessageformat, $options);
+        $messagetext = format_text(s($message->fullmessage), $message->fullmessageformat, $options);
     }
 
     $messagetext .= message_format_contexturl($message);
@@ -1945,7 +1945,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
     }
 
     $eventdata->fullmessageformat = $format;
-    $eventdata->smallmessage     = strip_tags($message);//strip just in case there are is any html that would break the popup notification
+    $eventdata->smallmessage     = $message;//store the message unfiltered. Clean up on output.
 
     $s = new stdClass();
     $s->sitename = $SITE->shortname;
index 945d790..8969277 100644 (file)
@@ -59,6 +59,7 @@ class message_output_jabber extends message_output {
             }
             $jabberaddress = $jabberaddresses[$eventdata->userto->id];
 
+            //calling s() on smallmessage causes Jabber to display things like &lt; Jabber != a browser
             $jabbermessage = fullname($eventdata->userfrom).': '.$eventdata->smallmessage;
 
             if (!empty($eventdata->contexturl)) {
index 2417a6f..a2ef362 100644 (file)
@@ -1291,10 +1291,10 @@ function forum_print_overview($courses,&$htmlarray) {
         if ($count > 0 || $thisunread > 0) {
             $str .= '<div class="overview forum"><div class="name">'.$strforum.': <a title="'.$strforum.'" href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id.'">'.
                 $forum->name.'</a></div>';
-            $str .= '<div class="info">';
-            $str .= $count.' '.$strnumpostssince;
+            $str .= '<div class="info"><span class="postsincelogin">';
+            $str .= $count.' '.$strnumpostssince."</span>";
             if (!empty($showunread)) {
-                $str .= '<br />'.$thisunread .' '.$strnumunread;
+                $str .= '<div class="unreadposts">'.$thisunread .' '.$strnumunread.'</div>';
             }
             $str .= '</div></div>';
         }
index 0cbbfec..3dabcf5 100644 (file)
@@ -11,7 +11,7 @@ class quiz_report_overview_table extends table_sql {
 
     function quiz_report_overview_table($quiz , $qmsubselect, $groupstudents,
                 $students, $detailedmarks, $questions, $candelete, $reporturl, $displayoptions, $context){
-        parent::table_sql('mod-quiz-report-overview-report');
+        parent::__construct('mod-quiz-report-overview-report');
         $this->quiz = $quiz;
         $this->qmsubselect = $qmsubselect;
         $this->groupstudents = $groupstudents;
index f7a906d..12a05bb 100644 (file)
@@ -10,7 +10,7 @@ class quiz_report_responses_table extends table_sql {
 
     function quiz_report_responses_table($quiz , $qmsubselect, $groupstudents,
                 $students, $questions, $candelete, $reporturl, $displayoptions, $context){
-        parent::table_sql('mod-quiz-report-responses-report');
+        parent::__construct('mod-quiz-report-responses-report');
         $this->quiz = $quiz;
         $this->qmsubselect = $qmsubselect;
         $this->groupstudents = $groupstudents;
index c9674bc..2781142 100644 (file)
@@ -8,7 +8,7 @@ class quiz_report_statistics_question_table extends flexible_table {
     var $question;
 
     function quiz_report_statistics_question_table($qid){
-        parent::flexible_table('mod-quiz-report-statistics-question-table'.$qid);
+        parent::__construct('mod-quiz-report-statistics-question-table'.$qid);
     }
 
     /**
index 508da38..fafc27c 100644 (file)
@@ -6,7 +6,7 @@ class quiz_report_statistics_table extends flexible_table {
     var $quiz;
 
     function quiz_report_statistics_table(){
-        parent::flexible_table('mod-quiz-report-statistics-report');
+        parent::__construct('mod-quiz-report-statistics-report');
     }
 
     /**
index 214ca89..fd2d99b 100644 (file)
@@ -66,7 +66,7 @@ if (!empty($section) && !$sectioncontent = wiki_get_section_page($page, $section
     print_error('invalidsection', 'wiki');
 }
 
-require_course_login($course->id);
+require_course_login($course->id, false, $cm);
 
 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 require_capability('mod/wiki:editpage', $context);
index f49545e..2d1597c 100644 (file)
@@ -64,6 +64,11 @@ abstract class page_wiki {
      */
     protected $gid;
 
+    /**
+     * @var object module context object
+     */
+    protected $modcontext;
+
     /**
      * @var int Current user ID
      */
@@ -92,6 +97,7 @@ abstract class page_wiki {
     function __construct($wiki, $subwiki, $cm) {
         global $PAGE, $CFG;
         $this->subwiki = $subwiki;
+        $this->modcontext = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
 
         // initialise wiki renderer
         $this->wikioutput = $PAGE->get_renderer('mod_wiki');
@@ -291,11 +297,10 @@ class page_wiki_view extends page_wiki {
     function print_content() {
         global $PAGE, $CFG;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
         if (wiki_user_can_view($this->subwiki)) {
 
             if (!empty($this->page)) {
-                wiki_print_page_content($this->page, $context, $this->subwiki->id);
+                wiki_print_page_content($this->page, $this->modcontext, $this->subwiki->id);
                 $wiki = $PAGE->activityrecord;
             } else {
                 print_string('nocontent', 'wiki');
@@ -398,7 +403,6 @@ class page_wiki_edit extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
         if (wiki_user_can_edit($this->subwiki)) {
             $this->print_edit();
         } else {
@@ -519,9 +523,6 @@ class page_wiki_edit extends page_wiki {
             }
         }
 
-        $cm = $PAGE->cm;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
         $url = $CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $this->page->id;
         if (!empty($this->section)) {
             $url .= "&section=" . $this->section;
@@ -537,16 +538,16 @@ class page_wiki_edit extends page_wiki {
         switch ($format) {
         case 'html':
             $data->newcontentformat = FORMAT_HTML;
-            $data = file_prepare_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $context, 'mod_wiki', 'attachments', $this->subwiki->id);
+            $data = file_prepare_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $this->modcontext, 'mod_wiki', 'attachments', $this->subwiki->id);
             break;
         default:
             //$draftitemid = file_get_submitted_draft_itemid('attachments');
-            //file_prepare_draft_area($draftitemid, $context->id, 'mod_wiki', 'attachments', $this->subwiki->id);
+            //file_prepare_draft_area($draftitemid, $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);
             //$data->attachments = $draftitemid;
             }
 
         if ($version->contentformat != 'html') {
-            $params['contextid'] = $context->id;
+            $params['contextid'] = $this->modcontext->id;
             $params['component'] = 'mod_wiki';
             $params['filearea'] = 'attachments';
             $params['fileitemid'] = $this->subwiki->id;
@@ -560,7 +561,7 @@ class page_wiki_edit extends page_wiki {
 
         if ($formdata = $form->get_data()) {
             if ($format != 'html') {
-                $errors = $this->process_uploads($context);
+                $errors = $this->process_uploads($this->modcontext);
                 if (!empty($errors)) {
                     $contenterror = "";
                     foreach ($errors as $e) {
@@ -610,21 +611,19 @@ class page_wiki_comments extends page_wiki {
     }
 
     function print_content() {
-        global $CFG, $OUTPUT, $USER, $PAGE, $COURSE;
+        global $CFG, $OUTPUT, $USER, $PAGE;
         require_once($CFG->dirroot . '/mod/wiki/locallib.php');
 
         $page = $this->page;
         $subwiki = $this->subwiki;
         $wiki = $PAGE->activityrecord;
-        $cm = $PAGE->cm;
-        $course = $COURSE;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+        list($context, $course, $cm) = get_context_info_array($this->modcontext->id);
 
-        require_capability('mod/wiki:viewcomment', $context, NULL, true, 'noviewcommentpermission', 'wiki');
+        require_capability('mod/wiki:viewcomment', $this->modcontext, NULL, true, 'noviewcommentpermission', 'wiki');
 
-        $comments = wiki_get_comments($context->id, $page->id);
+        $comments = wiki_get_comments($this->modcontext->id, $page->id);
 
-        if (has_capability('mod/wiki:editcomment', $context)) {
+        if (has_capability('mod/wiki:editcomment', $this->modcontext)) {
             echo '<div class="midpad"><a href="' . $CFG->wwwroot . '/mod/wiki/editcomments.php?action=add&amp;pageid=' . $page->id . '">' . get_string('addcomment', 'wiki') . '</a></div>';
         }
 
@@ -676,11 +675,11 @@ class page_wiki_comments extends page_wiki {
             $t->data = array($row1, $row2);
 
             $actionicons = false;
-            if ((has_capability('mod/wiki:managecomment', $context))) {
+            if ((has_capability('mod/wiki:managecomment', $this->modcontext))) {
                 $urledit = new moodle_url('/mod/wiki/editcomments.php', array('commentid' => $comment->id, 'pageid' => $page->id, 'action' => 'edit'));
                 $urldelet = new moodle_url('/mod/wiki/instancecomments.php', array('commentid' => $comment->id, 'pageid' => $page->id, 'action' => 'delete'));
                 $actionicons = true;
-            } else if ((has_capability('mod/wiki:editcomment', $context)) and ($USER->id == $user->id)) {
+            } else if ((has_capability('mod/wiki:editcomment', $this->modcontext)) and ($USER->id == $user->id)) {
                 $urledit = new moodle_url('/mod/wiki/editcomments.php', array('commentid' => $comment->id, 'pageid' => $page->id, 'action' => 'edit'));
                 $urldelet = new moodle_url('/mod/wiki/instancecomments.php', array('commentid' => $comment->id, 'pageid' => $page->id, 'action' => 'delete'));
                 $actionicons = true;
@@ -738,8 +737,7 @@ class page_wiki_editcomment extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:editcomment', $context, NULL, true, 'noeditcommentpermission', 'wiki');
+        require_capability('mod/wiki:editcomment', $this->modcontext, NULL, true, 'noeditcommentpermission', 'wiki');
 
         if ($this->action == 'add') {
             $this->add_comment_form();
@@ -848,10 +846,9 @@ class page_wiki_search extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
-        echo $this->wikioutput->search_result($this->search_result);
+        echo $this->wikioutput->search_result($this->search_result, $this->subwiki);
     }
 }
 
@@ -928,10 +925,8 @@ class page_wiki_create extends page_wiki {
     function print_content($pagetitle = '') {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-
         // @TODO: Change this to has_capability and show an alternative interface.
-        require_capability('mod/wiki:createpage', $context, NULL, true, 'nocreatepermission', 'wiki');
+        require_capability('mod/wiki:createpage', $this->modcontext, NULL, true, 'nocreatepermission', 'wiki');
         $data = new stdClass();
         if (!empty($pagetitle)) {
             $data->pagetitle = $pagetitle;
@@ -980,8 +975,7 @@ class page_wiki_preview extends page_wiki_edit {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:editpage', $context, NULL, true, 'noeditpermission', 'wiki');
+        require_capability('mod/wiki:editpage', $this->modcontext, NULL, true, 'noeditpermission', 'wiki');
 
         $this->print_preview();
     }
@@ -1017,7 +1011,6 @@ class page_wiki_preview extends page_wiki_edit {
         $version = wiki_get_current_version($this->page->id);
         $format = $version->contentformat;
         $content = $version->content;
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
 
         $url = $CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $this->page->id;
         if (!empty($this->section)) {
@@ -1026,7 +1019,7 @@ class page_wiki_preview extends page_wiki_edit {
         $params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $this->format, 'version' => $this->versionnumber);
 
         if ($this->format != 'html') {
-            $params['contextid'] = $context->id;
+            $params['contextid'] = $this->modcontext->id;
             $params['component'] = 'mod_wiki';
             $params['filearea'] = 'attachments';
             $params['fileitemid'] = $this->page->id;
@@ -1086,8 +1079,7 @@ class page_wiki_diff extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
         $this->print_diff_content();
     }
@@ -1118,12 +1110,9 @@ class page_wiki_diff extends page_wiki {
     /**
      * Given two versions of a page, prints a page displaying the differences between them.
      *
-     * @uses $CFG
-     *
-     * @param int $pageid The page id whose versions will be displayed.
-     * @param int $cm The course id, needed to print user images.
-     * @param int $compare The first version number to be compared.
-     * @param int $comparewith The second version number to be compared.
+     * @global object $CFG
+     * @global object $OUTPUT
+     * @global object $PAGE
      */
     private function print_diff_content() {
         global $CFG, $OUTPUT, $PAGE;
@@ -1132,12 +1121,13 @@ class page_wiki_diff extends page_wiki {
         $total = wiki_count_wiki_page_versions($pageid) - 1;
 
         $oldversion = wiki_get_wiki_page_version($pageid, $this->compare);
+
         $newversion = wiki_get_wiki_page_version($pageid, $this->comparewith);
 
         if ($oldversion && $newversion) {
 
-            $oldtext = format_text($oldversion->content);
-            $newtext = format_text($newversion->content);
+            $oldtext = format_text(file_rewrite_pluginfile_urls($oldversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id));
+            $newtext = format_text(file_rewrite_pluginfile_urls($newversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id));
             list($diff1, $diff2) = ouwiki_diff_html($oldtext, $newtext);
             $oldversion->diff = $diff1;
             $oldversion->user = wiki_get_user_info($oldversion->userid);
@@ -1196,8 +1186,7 @@ class page_wiki_history extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
         $this->print_history_content();
     }
@@ -1225,16 +1214,9 @@ class page_wiki_history extends page_wiki {
     /**
      * Prints the history for a given wiki page
      *
-     * @uses $CFG
-     *
-     * @param int      $pageid The page id whose history should be displayed.
-     * @param int      $cm The course id, needed to print user images.
-     * @param wikipage $wikipage
-     * @param int      $allversion This tells how results should be displayed.
-     *     If $allversion == 0 : Only $rowsperpage will be displayed at a time, and $paging is the page being displayed.
-     *     If $allversion != 0 : All versions will be printed in a single table.
-     * @param int      $paging Desired page to be displayed, this is ignored if $allversion!=0.
-     * @param int      $rowsperpage How many rows to be displayed in each page, this is ignored if $allversion!=0.
+     * @global object $CFG
+     * @global object $OUTPUT
+     * @global object $PAGE
      */
     private function print_history_content() {
         global $CFG, $OUTPUT, $PAGE;
@@ -1431,8 +1413,7 @@ class page_wiki_map extends page_wiki {
     function print_content() {
         global $CFG, $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
         if ($this->view > 0) {
             //echo '<div><a href="' . $CFG->wwwroot . '/mod/wiki/map.php?pageid=' . $this->page->id . '">' . get_string('backtomapmenu', 'wiki') . '</a></div>';
@@ -1866,8 +1847,7 @@ class page_wiki_restoreversion extends page_wiki {
     function print_content() {
         global $CFG, $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:managewiki', $context, NULL, true, 'nomanagewikipermission', 'wiki');
+        require_capability('mod/wiki:managewiki', $this->modcontext, NULL, true, 'nomanagewikipermission', 'wiki');
 
         $this->print_restoreversion();
     }
@@ -1951,9 +1931,6 @@ class page_wiki_save extends page_wiki_edit {
     protected function print_save() {
         global $CFG, $USER, $OUTPUT, $PAGE;
 
-        $cm = $PAGE->cm;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
         $url = $CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $this->page->id;
         if (!empty($this->section)) {
             $url .= "&section=" . $this->section;
@@ -1962,7 +1939,7 @@ class page_wiki_save extends page_wiki_edit {
         $params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $this->format, 'version' => $this->versionnumber);
 
         if ($this->format != 'html') {
-            $params['contextid'] = $context->id;
+            $params['contextid'] = $this->modcontext->id;
             $params['component'] = 'mod_wiki';
             $params['filearea'] = 'attachments';
             $params['fileitemid'] = $this->page->id;
@@ -1974,7 +1951,7 @@ class page_wiki_save extends page_wiki_edit {
         $data = false;
         if ($data = $form->get_data()) {
             if ($this->format == 'html') {
-                $data = file_postupdate_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $context, 'mod_wiki', 'attachments', $this->subwiki->id);
+                $data = file_postupdate_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $this->modcontext, 'mod_wiki', 'attachments', $this->subwiki->id);
             }
 
             if (isset($this->section)) {
@@ -1986,7 +1963,7 @@ class page_wiki_save extends page_wiki_edit {
 
         if ($save && $data) {
             if ($this->format != 'html') {
-                $errors = $this->process_uploads($context);
+                $errors = $this->process_uploads($this->modcontext);
             }
             if (!empty($CFG->usetags)) {
                 tag_set('wiki_pages', $this->page->id, $data->tags);
@@ -2036,8 +2013,7 @@ class page_wiki_viewversion extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
         $this->print_version_view();
     }
@@ -2066,15 +2042,12 @@ class page_wiki_viewversion extends page_wiki {
     /**
      * Given an old page version, output the version content
      *
-     * @uses $CFG
-     *
-     * @param page   $page The page whose version will be displayed.
-     * @param int    $cm The course id, needed to print user images.
-     * @param int    $version The version number to be displayed.
+     * @global object $CFG
+     * @global object $OUTPUT
+     * @global object $PAGE
      */
     private function print_version_view() {
         global $CFG, $OUTPUT, $PAGE;
-        $cm = $PAGE->cm;
         $pageversion = wiki_get_version($this->version->id);
 
         if ($pageversion) {
@@ -2087,6 +2060,9 @@ class page_wiki_viewversion extends page_wiki {
             $heading .= '&nbsp;&nbsp;&rarr;&nbsp;' . $OUTPUT->user_picture(wiki_get_user_info($pageversion->userid), array('popup' => true)) . '</p>';
             print_container($heading, false, 'mdl-align wiki_modifieduser wiki_headingtime');
             $options = array('swid' => $this->subwiki->id, 'pretty_print' => true, 'pageid' => $this->page->id);
+
+            $pageversion->content = file_rewrite_pluginfile_urls($pageversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);
+
             $parseroutput = wiki_parse_content($pageversion->contentformat, $pageversion->content, $options);
             $content = print_container(format_text($parseroutput['parsed_text'], FORMAT_HTML, array('overflowdiv'=>true)), false, '', '', true);
             echo $OUTPUT->box($content, 'generalbox wiki_contentbox');
@@ -2109,8 +2085,7 @@ class page_wiki_confirmrestore extends page_wiki_save {
     function print_content() {
         global $CFG, $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:managewiki', $context, NULL, true, 'nomanagewikipermission', 'wiki');
+        require_capability('mod/wiki:managewiki', $this->modcontext, NULL, true, 'nomanagewikipermission', 'wiki');
 
         $version = wiki_get_version($this->version->id);
         if (wiki_restore_page($this->page, $version->content, $version->userid)) {
@@ -2138,8 +2113,7 @@ class page_wiki_prettyview extends page_wiki {
     function print_content() {
         global $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:viewpage', $context, NULL, true, 'noviewpagepermission', 'wiki');
+        require_capability('mod/wiki:viewpage', $this->modcontext, NULL, true, 'noviewpagepermission', 'wiki');
 
         $this->print_pretty_view();
     }
@@ -2174,22 +2148,20 @@ class page_wiki_handlecomments extends page_wiki {
     public function print_content() {
         global $CFG, $PAGE, $USER;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-
         if ($this->action == 'add') {
-            if (has_capability('mod/wiki:editcomment', $context)) {
+            if (has_capability('mod/wiki:editcomment', $this->modcontext)) {
                 $this->add_comment($this->content, $this->commentid);
             }
         } else if ($this->action == 'edit') {
             $comment = wiki_get_comment($this->commentid);
-            $edit = has_capability('mod/wiki:editcomment', $context);
+            $edit = has_capability('mod/wiki:editcomment', $this->modcontext);
             $owner = ($comment->userid == $USER->id);
             if ($owner && $edit) {
                 $this->add_comment($this->content, $this->commentid);
             }
         } else if ($this->action == 'delete') {
             $comment = wiki_get_comment($this->commentid);
-            $manage = has_capability('mod/wiki:managecomment', $context);
+            $manage = has_capability('mod/wiki:managecomment', $this->modcontext);
             $owner = ($comment->userid == $USER->id);
             if ($owner || $manage) {
                 $this->delete_comment($this->commentid);
@@ -2220,10 +2192,8 @@ class page_wiki_handlecomments extends page_wiki {
         require_once($CFG->dirroot . "/mod/wiki/locallib.php");
 
         $pageid = $this->page->id;
-        $cm = $PAGE->cm;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
-        wiki_add_comment($context, $pageid, $content, $this->format);
+        wiki_add_comment($this->modcontext, $pageid, $content, $this->format);
 
         if (!$idcomment) {
             redirect($CFG->wwwroot . '/mod/wiki/comments.php?pageid=' . $pageid, get_string('createcomment', 'wiki'), 2);
@@ -2236,11 +2206,9 @@ class page_wiki_handlecomments extends page_wiki {
     private function delete_comment($commentid) {
         global $CFG, $PAGE;
 
-        $cm = $PAGE->cm;
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
         $pageid = $this->page->id;
 
-        wiki_delete_comment($commentid, $context, $pageid);
+        wiki_delete_comment($commentid, $this->modcontext, $pageid);
     }
 
 }
@@ -2269,8 +2237,7 @@ class page_wiki_lock extends page_wiki_edit {
     public function print_content() {
         global $USER, $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:editpage', $context, NULL, true, 'noeditpermission', 'wiki');
+        require_capability('mod/wiki:editpage', $this->modcontext, NULL, true, 'noeditpermission', 'wiki');
 
         wiki_set_lock($this->page->id, $USER->id, $this->section);
     }
@@ -2287,8 +2254,7 @@ class page_wiki_overridelocks extends page_wiki_edit {
     function print_content() {
         global $CFG, $PAGE;
 
-        $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
-        require_capability('mod/wiki:overridelock', $context, NULL, true, 'nooverridelockpermission', 'wiki');
+        require_capability('mod/wiki:overridelock', $this->modcontext, NULL, true, 'nooverridelockpermission', 'wiki');
 
         wiki_delete_locks($this->page->id, null, $this->section, true, true);
 
index b8197de..515860b 100644 (file)
@@ -52,7 +52,7 @@ class mod_wiki_renderer extends plugin_renderer_base {
         return $this->output->container($this->output->render($select), 'wiki_index');
     }
 
-    public function search_result($records) {
+    public function search_result($records, $subwiki) {
         global $CFG, $PAGE;
         $table = new html_table();
         $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
@@ -63,7 +63,7 @@ class mod_wiki_renderer extends plugin_renderer_base {
             $table->head = array('title' => format_string($page->title) . ' (' . html_writer::link($CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $page->id, get_string('view', 'wiki')) . ')');
             $table->align = array('title' => 'left');
             $table->width = '100%';
-            $table->data = array(array(file_rewrite_pluginfile_urls(format_text($page->cachedcontent, FORMAT_HTML), 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $page->id)));
+            $table->data = array(array(file_rewrite_pluginfile_urls(format_text($page->cachedcontent, FORMAT_HTML), 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $subwiki->id)));
             $table->colclasses = array('wikisearchresults');
             $html .= html_writer::table($table);
         }
index f7d7e88..68c8b9b 100644 (file)
  * repository_dropbox class
  * This plugin is used to access user's dropbox files
  *
- * TODO:
- * Dropbox has problems to process filepath with spaces, tried to use
- * urlencode filepath, still doesn't work
- * http://code.google.com/p/dropbox-php/ has the same problem
- *
  * @since 2.0
  * @package    repository
  * @subpackage dropbox
@@ -130,18 +125,19 @@ class repository_dropbox extends repository {
         } else {
             $path = file_correct_filepath($path);
         }
+        $encoded_path = str_replace("%2F", "/", rawurlencode($path));
 
         $list = array();
         $list['list'] = array();
         $list['manage'] = false;
         $list['dynload'] = true;
         $list['nosearch'] = true;
-        // process breacrumb trail
+        // process breadcrumb trail
         $list['path'] = array(
             array('name'=>get_string('dropbox', 'repository_dropbox'), 'path'=>'/')
         );
 
-        $result = $this->dropbox->get_listing($path, $this->access_key, $this->access_secret);
+        $result = $this->dropbox->get_listing($encoded_path, $this->access_key, $this->access_secret);
 
         if (!is_object($result) || empty($result)) {
             return $list;
index 3622893..21adb82 100644 (file)
@@ -70,7 +70,8 @@ class dropbox extends oauth_helper {
         $basename = $info['basename'];
         $filepath = $dirname . rawurlencode($basename);
         if ($dirname != '/') {
-            $filepath = $dirname . '/' . rawurlencode($basename);
+            $filepath = $dirname . '/' . $basename;
+            $filepath = str_replace("%2F", "/", rawurlencode($filepath));
         }
 
         $url = $this->dropbox_content_api.'/files/'.$this->mode.$filepath;
index 90f872e..1be291a 100644 (file)
@@ -248,14 +248,21 @@ M.core_filepicker.init = function(Y, options) {
                 tmpNode.isLeaf = true;
             }
         },
-        view_files: function() {
-            this.viewbar.set('disabled', false);
-            if (this.viewmode == 1) {
+        view_files: function(page) {
+            var p= page?page:null;
+            if (this.active_repo.issearchresult) {
+                // list view is desiged to display treeview
+                // it is not working well with search result
                 this.view_as_icons();
-            } else if (this.viewmode ==2) {
-                this.view_as_list();
             } else {
-                this.view_as_icons();
+                this.viewbar.set('disabled', false);
+                if (this.viewmode == 1) {
+                    this.view_as_icons();
+                } else if (this.viewmode == 2) {
+                    this.view_as_list(p);
+                } else {
+                    this.view_as_icons();
+                }
             }
         },
         treeview_dynload: function(node, cb) {
@@ -280,15 +287,29 @@ M.core_filepicker.init = function(Y, options) {
                 }
             }, false);
         },
-        view_as_list: function() {
+        view_as_list: function(p) {
             var scope = this;
+            var page = null;
+            if (!p) {
+                if (scope.active_repo.page) {
+                    page = scope.active_repo.page;
+                }
+            } else {
+                page = p;
+            }
             scope.request({
                 action:'list',
                 client_id: scope.options.client_id,
                 repository_id: scope.active_repo.id,
                 path:'',
-                page:'',
+                page:page,
                 callback: function(id, obj, args) {
+                    scope.parse_repository_options(obj);
+                    if (obj.login) {
+                        scope.viewbar.set('disabled', true);
+                        scope.print_login(obj);
+                        return;
+                    }
                     var client_id = scope.options.client_id;
                     var dynload = scope.active_repo.dynload;
                     var list = obj.list;
@@ -299,14 +320,14 @@ M.core_filepicker.init = function(Y, options) {
                     scope.print_header();
 
                     var html = '<div class="fp-tree-panel" id="treeview-'+client_id+'">';
-                    if (list.length==0) {
+                    if (list && list.length==0) {
                         html += '<div class="fp-emptylist mdl-align">' +M.str.repository.nofilesavailable+'</div>';
                     }
                     html += '</div>';
 
                     var tree = Y.Node.create(html);
                     Y.one(panel_id).appendChild(tree);
-                    if (list.length==0) {
+                    if (!list || list.length==0) {
                         return;
                     }
 
@@ -342,7 +363,7 @@ M.core_filepicker.init = function(Y, options) {
             this.print_header();
 
             var html = '<div class="fp-grid-panel" id="fp-grid-panel-'+client_id+'">';
-            if (list.length==0) {
+            if (list && list.length==0) {
                 html += '<div class="fp-emptylist mdl-align">' +M.str.repository.nofilesavailable+'</div>';
             }
             html += '</div>';
@@ -646,7 +667,7 @@ M.core_filepicker.init = function(Y, options) {
 
             var scope = this;
             // adding buttons
-            var view_icons = {label: M.str.repository.iconview, value: 't',
+            var view_icons = {label: M.str.repository.iconview, value: 't', 'checked': true,
                 onclick: {
                     fn: function(){
                         scope.view_as_icons();
@@ -1307,12 +1328,16 @@ M.core_filepicker.init = function(Y, options) {
                                         callback: function(id, o, args) {
                                             o.issearchresult = true;
                                             scope.parse_repository_options(o);
-                                            scope.view_files();
+                                            scope.view_files(result[1]);
                                         }
                                 }, true);
 
                             } else {
-                                scope.list(args);
+                                if (scope.viewmode == 2) {
+                                    scope.view_as_list(result[1]);
+                                } else {
+                                    scope.list(args);
+                                }
                             }
                         });
                     });
index 048f3b6..9048711 100644 (file)
@@ -25,7 +25,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 290643c..53c368a 100644 (file)
@@ -19,7 +19,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 15dd2e0..4a5156a 100644 (file)
@@ -24,7 +24,7 @@ if (!empty($PAGE->theme->settings->tagline)) {
 } else {
     $tagline = '<!-- There was no custom tagline set -->';
 }
-if (!empty($PAGE->theme->settings->logo)) { 
+if (!empty($PAGE->theme->settings->logo)) {
     $logourl = $PAGE->theme->settings->logo;
 }
 
@@ -33,11 +33,11 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <?php if ($hascustommenu) { ?>
@@ -70,7 +70,7 @@ echo $OUTPUT->doctype() ?>
                 </div>
             </div>
         </div>
-        
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -79,7 +79,7 @@ echo $OUTPUT->doctype() ?>
             <div id="page-content">
                 <div id="region-main-box">
                     <div id="region-post-box">
-            
+
                         <div id="region-main-wrap">
                             <div id="region-main">
                                 <div class="region-content">
@@ -87,7 +87,7 @@ echo $OUTPUT->doctype() ?>
                                 </div>
                             </div>
                         </div>
-                
+
                         <?php if ($hassidepost) { ?>
                         <div id="region-post" class="block-region">
                             <div class="region-content">
index 141aa59..802ef55 100644 (file)
@@ -27,7 +27,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <?php if ($hascustommenu) { ?>
@@ -77,7 +77,7 @@ echo $OUTPUT->doctype() ?>
             <div id="page-content">
                 <div id="region-main-box">
                     <div id="region-post-box">
-            
+
                         <div id="region-main-wrap">
                             <div id="region-main">
                                 <div class="region-content">
@@ -85,7 +85,7 @@ echo $OUTPUT->doctype() ?>
                                 </div>
                             </div>
                         </div>
-                
+
                         <?php if ($hassidepost) { ?>
                         <div id="region-post" class="block-region">
                             <div class="region-content">
@@ -93,7 +93,7 @@ echo $OUTPUT->doctype() ?>
                             </div>
                         </div>
                         <?php } ?>
-                
+
                     </div>
                 </div>
             </div>
index 2ddb330..f254a5c 100644 (file)
@@ -27,7 +27,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <?php if ($hascustommenu) { ?>
index 5d22202..a5dd741 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index bd2774d..31faa98 100644 (file)
@@ -25,10 +25,10 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -49,7 +49,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -57,7 +57,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre" class="block-region">
                     <div class="region-content">
@@ -65,7 +65,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post" class="block-region">
                     <div class="region-content">
@@ -73,7 +73,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
index 2d13385..26f27fc 100644 (file)
@@ -32,7 +32,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 <div id="page">
 <?php if ($hasheading || $hasnavbar) { ?>
@@ -64,7 +64,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -72,7 +72,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre" class="block-region">
                     <div class="region-content">
@@ -80,7 +80,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post" class="block-region">
                     <div class="region-content">
index 7b2196f..8afd061 100644 (file)
@@ -26,7 +26,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 <div id="page">
 <?php if ($hasheading || $hasnavbar) { ?>
index b5402c9..ab19302 100644 (file)
@@ -25,11 +25,11 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -54,7 +54,7 @@ echo $OUTPUT->doctype() ?>
                 <?php } ?>
             </div>
         </div>
-        
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -63,7 +63,7 @@ echo $OUTPUT->doctype() ?>
             <div id="page-content">
                 <div id="region-main-box">
                     <div id="region-post-box">
-            
+
                         <div id="region-main-wrap">
                             <div id="region-main">
                                 <div class="region-content">
@@ -71,7 +71,7 @@ echo $OUTPUT->doctype() ?>
                                 </div>
                             </div>
                         </div>
-                
+
                         <?php if ($hassidepost) { ?>
                         <div id="region-post" class="block-region">
                             <div class="region-content">
@@ -86,7 +86,7 @@ echo $OUTPUT->doctype() ?>
             <div class="myclear"></div>
 
         </div>
-       
+
 
 <!-- END OF CONTENT -->
     <div class="myclear"></div>
index 2395d0a..e601ed0 100644 (file)
@@ -28,7 +28,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -77,7 +77,7 @@ echo $OUTPUT->doctype() ?>
             <div id="page-content">
                 <div id="region-main-box">
                     <div id="region-post-box">
-            
+
                         <div id="region-main-wrap">
                             <div id="region-main">
                                 <div class="region-content">
@@ -85,7 +85,7 @@ echo $OUTPUT->doctype() ?>
                                 </div>
                             </div>
                         </div>
-                
+
                         <?php if ($hassidepost) { ?>
                         <div id="region-post" class="block-region">
                             <div class="region-content">
@@ -93,7 +93,7 @@ echo $OUTPUT->doctype() ?>
                             </div>
                         </div>
                         <?php } ?>
-                
+
                     </div>
                 </div>
             </div>
index a67f792..3225a5d 100644 (file)
@@ -28,7 +28,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 7ce5456..41e141f 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page-wrapper" class="embedded">
index 822be30..98288f1 100644 (file)
@@ -29,8 +29,8 @@ echo $OUTPUT->doctype() ?>
   <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
   <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
@@ -38,7 +38,7 @@ echo $OUTPUT->doctype() ?>
 
 <div id="page-wrapper">
   <div id="page" class="clearfix">
-    
+
     <div id="page-header" class="clearfix">
       <?php if ($PAGE->heading) { ?>
         <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
@@ -56,11 +56,11 @@ echo $OUTPUT->doctype() ?>
     </div>
 
 <?php } ?>
-      
+
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -68,7 +68,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre">
                     <div class="region-content">
@@ -76,7 +76,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post">
                     <div class="region-content">
@@ -84,29 +84,29 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
-    
+
     <div class="clearfix"></div>
 <?php if ($hasfooter) { ?>
-  
+
     <div id="page-footer" class="clearfix">
       <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
       <?php echo $OUTPUT->login_info(); ?>
     </div>
-    
-    
+
+
 <?php }
 
 if ($hasheading || $hasnavbar) { ?>
-  
+
        <div class="myclear"></div>
   </div> <!-- END #page -->
-  
+
 </div> <!-- END #page-wrapper -->
-       
+
 <?php } ?>
 
 <div id="page-footer-bottom">
@@ -116,7 +116,7 @@ if ($hasheading || $hasnavbar) { ?>
   echo $OUTPUT->standard_footer_html();
 } ?>
 
-</div>     
+</div>
 
 <?php echo $OUTPUT->standard_end_of_body_html() ?>
 </body>
index eaab94d..495135c 100644 (file)
@@ -29,8 +29,8 @@ echo $OUTPUT->doctype() ?>
   <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
   <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
@@ -38,7 +38,7 @@ echo $OUTPUT->doctype() ?>
 
 <div id="page-wrapper">
   <div id="page" class="clearfix">
-    
+
     <div id="page-header" class="clearfix">
       <?php if ($PAGE->heading) { ?>
         <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
@@ -56,20 +56,20 @@ echo $OUTPUT->doctype() ?>
     </div>
 
  <div class="myclear"></div>
-      
+
       <?php if ($hasnavbar) { ?>
         <div class="navbar clearfix">
           <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
           <div class="navbutton"> <?php echo $PAGE->button; ?></div>
         </div>
       <?php } ?>
-  
+
 <?php } ?>
-      
+
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -77,7 +77,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre">
                     <div class="region-content">
@@ -85,7 +85,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post">
                     <div class="region-content">
@@ -93,14 +93,14 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
-    
+
     <div class="myclear"></div>
 <?php if ($hasfooter) { ?>
-  
+
     <div id="page-footer" class="clearfix">
       <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
       <?php echo $OUTPUT->login_info(); ?>
@@ -111,7 +111,7 @@ echo $OUTPUT->doctype() ?>
 if ($hasheading || $hasnavbar) { ?>
    <div class="myclear"></div>
   </div> <!-- END #page -->
+
 </div> <!-- END #page-wrapper -->
 
 <?php } ?>
@@ -122,11 +122,11 @@ if ($hasheading || $hasnavbar) { ?>
 
   echo $OUTPUT->home_link();
   echo $OUTPUT->standard_footer_html();
-  
+
 } ?>
 
-</div>     
-     
+</div>
+
 
 <?php echo $OUTPUT->standard_end_of_body_html() ?>
 </body>
index 9bedc9a..279b82c 100644 (file)
@@ -25,7 +25,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <!-- START OF HEADER -->
@@ -41,9 +41,9 @@ echo $OUTPUT->doctype() ?>
                                <a href="<?php echo $CFG->wwwroot; ?>" title="Home"><?php echo $PAGE->heading ?></a>
                        </div>
                <?php } ?>
-               
+
                <div id="loggedinas">
-                       <?php if ($hasheading) { 
+                       <?php if ($hasheading) {
                        echo $OUTPUT->lang_menu();
                        echo $OUTPUT->login_info();
                        echo $PAGE->headingmenu;
@@ -51,13 +51,13 @@ echo $OUTPUT->doctype() ?>
                </div>
 
                <div id="headerbottom">
-               
+
                        <div id="menu">
                                <?php if ($hascustommenu) { ?>
                                        <div id="custommenu"><?php echo $custommenu; ?></div>
                                <?php } ?>
                        </div>
-                       
+
                </div>
 
        </div>
@@ -78,26 +78,26 @@ echo $OUTPUT->doctype() ?>
                        <div id="page-content">
                        <div id="region-main-box">
                                <div id="region-post-box">
-            
+
                                <div id="region-main-wrap">
                                <div id="region-main">
                                        <div class="region-content">
-                                                                   
+
                                        <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
                                                </div>
                                        </div>
                                </div>
-                
+
                                        <?php if ($hassidepost) { ?>
                                <div id="region-post" class="block-region">
                                        <div class="region-content">
-                               
+
                                        <?php echo $OUTPUT->blocks_for_region('side-post') ?>
-                                    
+
                                        </div>
                                        </div>
                                <?php } ?>
-                
+
                        </div>
                        </div>
                        </div>
@@ -105,7 +105,7 @@ echo $OUTPUT->doctype() ?>
 
 <!-- END OF CONTENT -->
 
-       
+
                </div>
        </div>
 </div>
index 319758e..43ea28d 100644 (file)
@@ -26,19 +26,19 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <!-- START OF HEADER -->
 
 <div id="headerwrap">
        <div id="header">
-       
+
                <?php if (!empty($PAGE->theme->settings->logo)) { ?>
-               
+
                        <div id="logo">
                        </div>
-               
+
                <?php } else { ?>
 
                        <div id="nologo">
@@ -46,9 +46,9 @@ echo $OUTPUT->doctype() ?>
                        </div>
 
                <?php } ?>
-               
+
                        <div id="loggedinas">
-                       <?php if ($hasheading) { 
+                       <?php if ($hasheading) {
                echo $OUTPUT->lang_menu();
                echo $OUTPUT->login_info();
                echo $PAGE->headingmenu;
@@ -56,7 +56,7 @@ echo $OUTPUT->doctype() ?>
                        </div>
 
                <div id="headerbottom">
-                       
+
                        <div id="menu">
                                <?php if ($hascustommenu) { ?>
                                        <div id="custommenu"><?php echo $custommenu; ?></div>
@@ -67,7 +67,7 @@ echo $OUTPUT->doctype() ?>
                                <h1><?php echo $PAGE->heading ?></h1>
                        </div>
                <?php } ?>
-               
+
                </div>
 
        </div>
@@ -87,11 +87,11 @@ echo $OUTPUT->doctype() ?>
                        <div id="page-content">
                        <div id="region-main-box">
                                <div id="region-post-box">
-            
+
                                <div id="region-main-wrap">
                                <div id="region-main">
                                        <div class="region-content">
-                                         
+
                                             <?php if ($hasnavbar) { ?>
                                                                        <div class="navbar">
                                                                                <div class="wrapper">
@@ -99,29 +99,29 @@ echo $OUTPUT->doctype() ?>
                                                                                </div>
                                                                        </div>
                                                                        <?php } ?>
-                           
+
                                        <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
-                                               
+
                                                </div>
                                        </div>
                                </div>
-                
+
                                        <?php if ($hassidepost) { ?>
-    
+
                                <div id="region-post" class="block-region">
                                        <div class="region-content">
-    
+
                                                <?php if ($hasnavbutton) { ?>
                                                                <div class="navbutton"><?php echo $PAGE->button; ?></div>
                                                <?php } ?>
-    
+
                                        <?php echo $OUTPUT->blocks_for_region('side-post') ?>
-                                    
+
                                        </div>
                                        </div>
-                         
+
                                <?php } ?>
-                
+
                        </div>
                        </div>
                        </div>
@@ -129,7 +129,7 @@ echo $OUTPUT->doctype() ?>
 
 <!-- END OF CONTENT -->
 
-       
+
                </div>
        </div>
 </div>
index 5d22202..a5dd741 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index bf4ae45..812300c 100644 (file)
@@ -20,10 +20,10 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -31,7 +31,7 @@ echo $OUTPUT->doctype() ?>
 <!-- START OF HEADER -->
 
        <div id="wrapper" class="clearfix">
-   
+
        <div id="page-header">
                        <div id="page-header-wrapper" class="clearfix">
                        <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
@@ -40,13 +40,13 @@ echo $OUTPUT->doctype() ?>
                            echo $OUTPUT->login_info();
                        echo $OUTPUT->lang_menu();
                                    echo $PAGE->headingmenu;
-                               ?>          
+                               ?>
                        </div>
                </div>
            </div>
-        
+
         <div class="clearer"></div> <!-- temporarily added on 06/25/10 -->
-        
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -55,7 +55,7 @@ echo $OUTPUT->doctype() ?>
                <div id="page-content">
                    <div id="region-main-box">
                    <div id="region-post-box">
-            
+
                            <div id="region-main-wrap">
                            <div id="region-main">
                                    <div class="region-content">
@@ -63,7 +63,7 @@ echo $OUTPUT->doctype() ?>
                                        </div>
                                    </div>
                            </div>
-                
+
                                <?php if ($hassidepre) { ?>
                            <div id="region-pre">
                                    <div class="region-content">
@@ -71,7 +71,7 @@ echo $OUTPUT->doctype() ?>
                                    </div>
                            </div>
                                <?php } ?>
-                
+
                                <?php if ($hassidepost) { ?>
                            <div id="region-post">
                                    <div class="region-content">
@@ -79,7 +79,7 @@ echo $OUTPUT->doctype() ?>
                                    </div>
                                </div>
                            <?php } ?>
-                
+
                            </div>
                    </div>
                    </div>
index 532cc2e..4ffc0f6 100644 (file)
@@ -22,7 +22,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -66,7 +66,7 @@ echo $OUTPUT->doctype() ?>
             <div id="page-content">
                 <div id="region-main-box">
                     <div id="region-post-box">
-            
+
                         <div id="region-main-wrap">
                             <div id="region-main">
                                 <div class="region-content">
@@ -74,7 +74,7 @@ echo $OUTPUT->doctype() ?>
                                 </div>
                             </div>
                         </div>
-                
+
                         <?php if ($hassidepre) { ?>
                         <div id="region-pre">
                             <div class="region-content">
@@ -82,7 +82,7 @@ echo $OUTPUT->doctype() ?>
                             </div>
                         </div>
                         <?php } ?>
-                
+
                         <?php if ($hassidepost) { ?>
                         <div id="region-post">
                             <div class="region-content">
@@ -90,7 +90,7 @@ echo $OUTPUT->doctype() ?>
                             </div>
                         </div>
                         <?php } ?>
-                
+
                     </div>
                 </div>
             </div>
index 49d6789..7549a24 100644 (file)
@@ -22,7 +22,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -62,7 +62,7 @@ echo $OUTPUT->doctype() ?>
 
 <!-- START OF CONTENT -->
 
-        
+
             <div id="page-content-wrapper" class="clearfix">
                 <div id="page-content">
                     <div id="report-main-content">
index e55ffa1..2e71288 100644 (file)
@@ -143,7 +143,7 @@ $THEME->layouts = array(
     ),
     // Pages that appear in pop-up windows - no navigation, no blocks, no header.
     'popup' => array(
-        'file' => 'embedded.php',
+        'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true),
     ),
index 7aca05a..1fc9be8 100644 (file)
@@ -8,7 +8,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html(); ?>
 
     <div id="page-content">
index 08d632d..69eb7d4 100644 (file)
@@ -47,7 +47,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
     <?php echo $OUTPUT->standard_top_of_body_html();
 
 if ($hasframe) { ?>
index b220756..d93c7d0 100644 (file)
@@ -47,7 +47,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
     <?php echo $OUTPUT->standard_top_of_body_html();
 
 if ($hasframe) { ?>
index 5d22202..a5dd741 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 58c87cf..b416319 100644 (file)
@@ -20,16 +20,16 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
 
 <!-- START OF HEADER -->
-   
+
     <div id="page-header" class="clearfix">
                <div id="page-header-wrapper">
                <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
@@ -38,11 +38,11 @@ echo $OUTPUT->doctype() ?>
                            echo $OUTPUT->login_info();
                        echo $OUTPUT->lang_menu();
                            echo $PAGE->headingmenu;
-                       ?>          
+                       ?>
                </div>
            </div>
     </div>
-    
+
     <?php if ($hascustommenu) { ?>
       <div id="custommenu"><?php echo $custommenu; ?></div>
     <?php } else { ?>
@@ -50,7 +50,7 @@ echo $OUTPUT->doctype() ?>
         <li>&nbsp;</li>
       </ul>
        <?php } ?>
-         
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -59,7 +59,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -67,7 +67,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre">
                     <div class="region-content">
@@ -75,7 +75,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post">
                     <div class="region-content">
@@ -83,7 +83,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
index a0e71f9..57c57ba 100644 (file)
@@ -25,7 +25,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -34,7 +34,7 @@ echo $OUTPUT->doctype() ?>
 
     <div id="page-header" class="clearfix">
                <div id="page-header-wrapper">
-               
+
                <?php if ($hasheading) { ?>
                        <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
                    <div class="headermenu">
@@ -46,12 +46,12 @@ echo $OUTPUT->doctype() ?>
                                echo $PAGE->headingmenu
                                ?>
                        </div>
-               <?php } ?>        
-               
+               <?php } ?>
+
            </div>
     </div>
 
-    <?php if ($hasheading) { ?>        
+    <?php if ($hasheading) { ?>
       <?php if ($hascustommenu) { ?>
         <div id="custommenu"><?php echo $custommenu; ?></div>
       <?php } else { ?>
@@ -60,14 +60,14 @@ echo $OUTPUT->doctype() ?>
         </ul>
       <?php } ?>
        <?php } ?>
-    
+
     <?php if ($hasnavbar) { ?>
            <div class="navbar clearfix">
            <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
             <div class="navbutton"> <?php echo $PAGE->button; ?></div>
         </div>
     <?php } ?>
-    
+
 <?php } ?>
 <!-- END OF HEADER -->
 
@@ -75,7 +75,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -83,7 +83,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre">
                     <div class="region-content">
@@ -91,7 +91,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post">
                     <div class="region-content">
@@ -99,7 +99,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
index 4657c2e..d403f80 100644 (file)
@@ -37,11 +37,11 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -69,12 +69,12 @@ echo $OUTPUT->doctype() ?>
                                        <?php } else { ?>
                                                <div id="custommenu" style="line-height:1em;">&nbsp;</div> <!-- temporary until I find a better fix -->
                                        <?php } ?>
-                               
+
                        </div>
 
                </div>
            </div>
-        
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -83,22 +83,22 @@ echo $OUTPUT->doctype() ?>
                    <div id="page-content">
                    <div id="region-main-box">
                            <div id="region-post-box">
-            
+
                            <div id="region-main-wrap">
                                    <div id="region-main">
                                    <div class="region-content">
-                                                                       
+
                                                                        <div id="region-header">
                                                                    <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
                                                                    <p class="tagline"><?php echo $tagline ?></p>
                                                                </div>
-                                                           
+
                                            <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
-                                      
+
                                        </div>
                                </div>
                                </div>
-                
+
                        <?php if ($hassidepost) { ?>
                            <div id="region-post" class="block-region">
                                <div id="region-post-wrap-1">
@@ -110,8 +110,8 @@ echo $OUTPUT->doctype() ?>
                                        </div>
                                </div>
                            <?php } ?>
-                           
-                       </div>    
+
+                       </div>
                    </div>
                </div>
        </div>
@@ -135,8 +135,8 @@ echo $OUTPUT->doctype() ?>
        </div>
 
 <!-- END OF FOOTER -->
-               
-       
+
+
 </div> <!-- END #page -->
 
 <?php echo $OUTPUT->standard_end_of_body_html() ?>
index 27f1c76..e2ba6ef 100644 (file)
@@ -35,7 +35,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -51,15 +51,15 @@ echo $OUTPUT->doctype() ?>
 
                        <div id="page-header" class="inside">
                                        <div id="page-header-wrapper" class="wrapper clearfix">
-                       
+
                                        <?php if ($hasheading) { ?>
                                            <div id="headermenus" class="clearfix">
                                                                <div class="headermenu">
                                                                <?php if (!empty($PAGE->layout_options['langmenu'])) {
                                                                echo $OUTPUT->lang_menu();
                                                        }
-                                                       echo $OUTPUT->login_info();     
-                                                       echo $PAGE->headingmenu 
+                                                       echo $OUTPUT->login_info();
+                                                       echo $PAGE->headingmenu
                                                            ?>
                                                        </div>
                                                    <?php if ($hascustommenu) { ?>
@@ -69,7 +69,7 @@ echo $OUTPUT->doctype() ?>
                                                                <?php } ?>
                                            </div>
                                    <?php } ?>
-                   
+
                                </div>
                                </div>
 
@@ -84,7 +84,7 @@ echo $OUTPUT->doctype() ?>
                    <div id="page-content">
                    <div id="region-main-box">
                            <div id="region-post-box">
-            
+
                            <div id="region-main-wrap">
                            <div id="region-main">
                                    <div class="region-content">
@@ -105,12 +105,12 @@ echo $OUTPUT->doctype() ?>
                                                                            </div>
                                                                    </div>
                                                                <?php } ?>
-                                   
+
                                    <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
                                        </div>
                                </div>
                            </div>
-                
+
                                <?php if ($hassidepost) { ?>
                            <div id="region-post" class="block-region">
                                <div id="region-post-wrap-1">
@@ -122,7 +122,7 @@ echo $OUTPUT->doctype() ?>
                                        </div>
                                </div>
                            <?php } ?>
-                
+
                    </div>
                    </div>
                </div>
@@ -136,9 +136,9 @@ echo $OUTPUT->doctype() ?>
                </div>
        </div>
 
-               
+
        <?php } ?>
-       
+
 <!-- START OF FOOTER -->
 
        <?php if ($hasfooter) { ?>
@@ -152,7 +152,7 @@ echo $OUTPUT->doctype() ?>
                        ?>
                    </div>
            <?php } ?>
-           
+
 </div>
 <?php echo $OUTPUT->standard_end_of_body_html() ?>
 </body>
index b492b8f..5506126 100644 (file)
@@ -29,11 +29,11 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -47,11 +47,11 @@ echo $OUTPUT->doctype() ?>
                            echo $OUTPUT->login_info();
                        echo $OUTPUT->lang_menu();
                            echo $PAGE->headingmenu;
-                       ?>          
+                       ?>
                </div>
            </div>
     </div>
-        
+
 <!-- END OF HEADER -->
 
 <?php if ($hascustommenu) { ?>
@@ -68,7 +68,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -76,7 +76,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre" class="block-region">
                     <div class="region-content">
@@ -84,7 +84,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post" class="block-region">
                     <div class="region-content">
@@ -92,7 +92,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
index 74d01c1..b6d3957 100644 (file)
@@ -28,7 +28,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -47,7 +47,7 @@ echo $OUTPUT->doctype() ?>
             <?php } ?>
         </div>
     </div>
-    
+
 <?php if ($hascustommenu) { ?>
 <div id="custommenuwrap"><div id="custommenu"><?php echo $custommenu; ?></div></div>
 <?php } ?>
@@ -67,7 +67,7 @@ echo $OUTPUT->doctype() ?>
     <div id="page-content">
         <div id="region-main-box">
             <div id="region-post-box">
-            
+
                 <div id="region-main-wrap">
                     <div id="region-main">
                         <div class="region-content">
@@ -75,7 +75,7 @@ echo $OUTPUT->doctype() ?>
                         </div>
                     </div>
                 </div>
-                
+
                 <?php if ($hassidepre) { ?>
                 <div id="region-pre" class="block-region">
                     <div class="region-content">
@@ -83,7 +83,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
                 <?php if ($hassidepost) { ?>
                 <div id="region-post" class="block-region">
                     <div class="region-content">
@@ -91,7 +91,7 @@ echo $OUTPUT->doctype() ?>
                     </div>
                 </div>
                 <?php } ?>
-                
+
             </div>
         </div>
     </div>
index e959c80..7f70c21 100644 (file)
@@ -28,7 +28,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 9d64097..ce7de8d 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+defined('MOODLE_INTERNAL') || die();
+
 $THEME->name = 'magazine';
 
 ////////////////////////////////////////////////////
@@ -95,7 +97,7 @@ $THEME->layouts = array(
         'options' => array('langmenu'=>true),
     ),
     'popup' => array(
-        'file' => 'embedded.php',
+        'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true),
     ),
index fa4e8ed..c4825c5 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
index 1633067..46e56b8 100644 (file)
@@ -29,7 +29,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -38,17 +38,17 @@ echo $OUTPUT->doctype() ?>
        <div id="header-wrap">
                <div id="header-container">
                        <div id="headerinner">
-                       
+
                                <div id="headleft">
                                </div>
                                <div id="headright">
-                               <?php if ($hasheading) { 
+                               <?php if ($hasheading) {
                        echo $OUTPUT->lang_menu();
                        echo $OUTPUT->login_info();
                        echo $PAGE->headingmenu;
                } ?>
                                </div>
-                       
+
                        </div>
                </div>
        </div>
@@ -63,8 +63,8 @@ echo $OUTPUT->doctype() ?>
                                </div>
                        </div>
                <?php } else { ?>
-                       
-                       
+
+
                        <div id="nologo" <?php if(!$hascustommenu) {echo "class='nomenu'";} ?>>
                                <a href="<?php echo $CFG->wwwroot; ?>" title="Home"><?php echo $PAGE->heading ?></a>
                        </div>
@@ -92,90 +92,90 @@ echo $OUTPUT->doctype() ?>
                <div id="outercontainer">
                        <div id="container">
                                <div id="innercontainer">
-       
+
                                        <div id="jcontrols_button">
                                                <div class="jcontrolsleft">
                                                <?php if ($hasnavbar) { ?>
                                                <div class="navbar clearfix">
                                                <div class="breadcrumb"> <?php echo $OUTPUT->navbar();  ?></div>
-            
+
                                                </div>
                                        <?php } ?>
                                                </div>
-       
+
                                                <div class="jcontrolsright">
-                                               <?php if ($hasnavbar) { 
-                                                       echo $PAGE->button; 
+                                               <?php if ($hasnavbar) {
+                                                       echo $PAGE->button;
                                                } ?>
                                                </div>
                                        </div>
-       
+
        <!-- start OF moodle CONTENT -->
                                <div id="page-content">
                                <div id="region-main-box">
                                <div id="region-post-box">
-            
+
                                                <div id="region-main-wrap">
                                                <div id="region-main">
                                                        <div class="region-content">
-         
+
                                                <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
                                                        </div>
                                                </div>
                                                </div>
-                
+
                        <?php if ($hassidepre) { ?>
                                <div id="region-pre" class="block-region">
                        <div class="region-content">
-                   
-        
+
+
                                <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
                        </div>
                        </div>
                        <?php } ?>
-                
+
                        <?php if ($hassidepost) { ?>
                        <div id="region-post" class="block-region">
                        <div class="region-content">
-                   
+
                                <?php echo $OUTPUT->blocks_for_region('side-post') ?>
                        </div>
                        </div>
                        <?php } ?>
-                
+
                                </div>
                                </div>
                                 </div>
-    <!-- END OF CONTENT --> 
-      
+    <!-- END OF CONTENT -->
+
                         <div id="jcontrols_bottom">
                        </div>
-       
+
        <!-- Containers end div above clears both -->
                                </div>
                        </div>
-               </div>  
+               </div>
        </div>
 
 <!-- START OF FOOTER -->
        <div id="footer-wrap">
                <div id="footer-container">
                        <div id="footer">
-               
-                        <?php if ($hasfooter) { 
+
+                        <?php if ($hasfooter) {
                                echo "<div class='johndocsleft'>";
                        echo $OUTPUT->login_info();
                                echo $OUTPUT->home_link();
                        echo $OUTPUT->standard_footer_html();
                        echo "</div>";
                                } ?>
-         
+
                        <?php if ($hasfooter) { ?>
                        <div class="johndocs">
                                <?php echo page_doc_link(get_string('moodledocslink')) ?>
                                </div>
                        <?php } ?>
-        
+
                        </div>
                </div>
        </div>
index 9b2bae8..dfad02a 100644 (file)
@@ -29,7 +29,7 @@ echo $OUTPUT->doctype() ?>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -38,20 +38,20 @@ echo $OUTPUT->doctype() ?>
        <div id="header-wrap">
                <div id="header-container">
                        <div id="headerinner">
-                       
+
                                <div id="headleft">
-                                       <?php if ($hasheading && !empty($PAGE->theme->settings->logo)) { 
+                                       <?php if ($hasheading && !empty($PAGE->theme->settings->logo)) {
                                        echo $PAGE->heading;
                                        } ?>
                                </div>
                                <div id="headright">
-                               <?php if ($hasheading) { 
+                               <?php if ($hasheading) {
                        echo $OUTPUT->lang_menu();
                        echo $OUTPUT->login_info();
                        echo $PAGE->headingmenu;
                } ?>
                                </div>
-                       
+
                        </div>
                </div>
        </div>
@@ -93,90 +93,90 @@ echo $OUTPUT->doctype() ?>
                <div id="outercontainer">
                        <div id="container">
                                <div id="innercontainer">
-       
+
                                        <div id="jcontrols_button">
                                                <div class="jcontrolsleft">
                                                <?php if ($hasnavbar) { ?>
                                                <div class="navbar clearfix">
                                                <div class="breadcrumb"> <?php echo $OUTPUT->navbar();  ?></div>
-            
+
                                                </div>
                                        <?php } ?>
                                                </div>
-       
+
                                                <div class="jcontrolsright">
-                                               <?php if ($hasnavbar) { 
-                                                       echo $PAGE->button; 
+                                               <?php if ($hasnavbar) {
+                                                       echo $PAGE->button;
                                                } ?>
                                                </div>
                                        </div>
-       
+
        <!-- start OF moodle CONTENT -->
                                <div id="page-content">
                                <div id="region-main-box">
                                <div id="region-post-box">
-            
+
                                                <div id="region-main-wrap">
                                                <div id="region-main">
                                                        <div class="region-content">
-         
+
                                                <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
                                                        </div>
                                                </div>
                                                </div>
-                
+
                        <?php if ($hassidepre) { ?>
                                <div id="region-pre" class="block-region">
                        <div class="region-content">
-                   
-        
+
+
                                <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
                        </div>
                        </div>
                        <?php } ?>
-                
+
                        <?php if ($hassidepost) { ?>
                        <div id="region-post" class="block-region">
                        <div class="region-content">
-                   
+
                                <?php echo $OUTPUT->blocks_for_region('side-post') ?>
                        </div>
                        </div>
                        <?php } ?>
-                
+
                                </div>
                                </div>
                                 </div>
-    <!-- END OF CONTENT --> 
-      
+    <!-- END OF CONTENT -->
+
                         <div id="jcontrols_bottom">
                        </div>
-       
+
        <!-- Containers end div above clears both -->
                                </div>
                        </div>
-               </div>  
+               </div>
        </div>
 
 <!-- START OF FOOTER -->
        <div id="footer-wrap">
                <div id="footer-container">
                        <div id="footer">
-               
-                        <?php if ($hasfooter) { 
+
+                        <?php if ($hasfooter) {
                                echo "<div class='johndocsleft'>";
                        echo $OUTPUT->login_info();
                                echo $OUTPUT->home_link();
                        echo $OUTPUT->standard_footer_html();
                        echo "</div>";
                                } ?>
-         
+
                        <?php if ($hasfooter) { ?>
                        <div class="johndocs">
                                <?php echo page_doc_link(get_string('moodledocslink')) ?>
                                </div>
                        <?php } ?>
-        
+
                        </div>
                </div>
        </div>
index ca987b1..f57e7d5 100644 (file)
@@ -37,11 +37,11 @@ echo $OUTPUT->doctype() ?>
 <head>
     <title><?php echo $PAGE->title ?></title>
     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
-    <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" />
+    <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -71,12 +71,12 @@ echo $OUTPUT->doctype() ?>
                                        echo $OUTPUT->lang_menu();
                                    ?>
                                </div>
-                               
+
                        </div>
 
                </div>
            </div>
-        
+
 <!-- END OF HEADER -->
 
 <!-- START OF CONTENT -->
@@ -85,22 +85,22 @@ echo $OUTPUT->doctype() ?>
                    <div id="page-content">
                    <div id="region-main-box">
                            <div id="region-post-box">
-            
+
                            <div id="region-main-wrap">
                                    <div id="region-main">
                                    <div class="region-content">
-                                                                       
+
                                                                        <div id="region-header" class="clearfix">
                                                                    <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
                                                                    <p class="tagline"><?php echo $tagline ?></p>
                                                                </div>
-                                                           
+
                                            <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
-                                      
+
                                        </div>
                                </div>
                                </div>
-                
+
                        <?php if ($hassidepost) { ?>
                            <div id="region-post" class="block-region">
                                <div id="region-post-wrap-1">
@@ -112,8 +112,8 @@ echo $OUTPUT->doctype() ?>
                                        </div>
                                </div>
                            <?php } ?>
-                           
-                       </div>    
+
+                       </div>
                    </div>
                </div>
        </div>
@@ -137,8 +137,8 @@ echo $OUTPUT->doctype() ?>
        </div>
 
 <!-- END OF FOOTER -->
-               
-       
+
+
 </div> <!-- END #page -->
 
 <?php echo $OUTPUT->standard_end_of_body_html() ?>
index 7cb973b..cae203a 100644 (file)
@@ -35,7 +35,7 @@ echo $OUTPUT->doctype() ?>
     <?php echo $OUTPUT->standard_head_html() ?>
 </head>
 
-<body id="<?php echo $PAGE->bodyid ?>" class="<?php echo $PAGE->bodyclasses.' '.join(' ', $bodyclasses) ?>">
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
 <?php echo $OUTPUT->standard_top_of_body_html() ?>
 
 <div id="page">
@@ -51,7 +51,7 @@ echo $OUTPUT->doctype() ?>
 
                        <div id="page-header" class="inside">
                                        <div id="page-header-wrapper" class="wrapper clearfix">
-                       
+
                                        <?php if ($hasheading) { ?>
                                            <div id="headermenus" class="shrinkwrapper clearfix">
                                                    <?php if ($hascustommenu) { ?>
@@ -64,13 +64,13 @@ echo $OUTPUT->doctype() ?>
                                                                <?php if (!empty($PAGE->layout_options['langmenu'])) {