Merge branch 'w50_MDL-27364_m23_recaptchahttps' of git://github.com/skodak/moodle
authorAparup Banerjee <aparup@moodle.com>
Fri, 9 Dec 2011 03:07:20 +0000 (11:07 +0800)
committerAparup Banerjee <aparup@moodle.com>
Fri, 9 Dec 2011 03:07:20 +0000 (11:07 +0800)
97 files changed:
admin/roles/admins.php
admin/roles/lib.php
admin/settings/security.php
admin/tool/customlang/db/upgrade.php
auth/manual/db/upgrade.php
auth/mnet/db/upgrade.php
blocks/community/db/upgrade.php
blocks/html/db/upgrade.php
blocks/login/block_login.php
blocks/navigation/db/upgrade.php
blocks/settings/db/upgrade.php
enrol/authorize/db/upgrade.php
enrol/database/db/upgrade.php
enrol/database/lib.php
enrol/flatfile/db/upgrade.php
enrol/guest/db/upgrade.php [new file with mode: 0644]
enrol/guest/lib.php
enrol/guest/version.php
enrol/imsenterprise/db/upgrade.php
enrol/imsenterprise/lib.php
enrol/mnet/db/upgrade.php
enrol/paypal/db/upgrade.php
filter/mediaplugin/db/upgrade.php
filter/tex/db/upgrade.php
grade/grading/form/rubric/db/upgrade.php
grade/report/user/index.php
index.php
lang/en/admin.php
lang/en/question.php
lang/en/role.php
lib/datalib.php
lib/db/upgrade.php
lib/filestorage/file_storage.php
lib/formslib.php
lib/javascript-static.js
lib/navigationlib.php
lib/outputrenderers.php
login/index_form.html
message/output/email/db/upgrade.php
message/output/email/message_output_email.php
message/output/jabber/db/upgrade.php
message/output/popup/db/upgrade.php
mod/assignment/db/upgrade.php
mod/assignment/lib.php
mod/chat/db/upgrade.php
mod/choice/db/upgrade.php
mod/choice/mod_form.php
mod/data/db/upgrade.php
mod/data/field/picture/field.class.php
mod/feedback/db/upgrade.php
mod/folder/db/upgrade.php
mod/forum/db/upgrade.php
mod/forum/discuss.php
mod/forum/lang/en/forum.php
mod/glossary/db/upgrade.php
mod/imscp/db/upgrade.php
mod/label/db/upgrade.php
mod/lesson/db/upgrade.php
mod/lti/db/upgrade.php
mod/page/db/upgrade.php
mod/quiz/db/upgrade.php
mod/quiz/editlib.php
mod/quiz/lang/en/quiz.php
mod/quiz/report/attemptsreport.php
mod/quiz/report/overview/db/upgrade.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/overview/report.php
mod/quiz/report/responses/report.php
mod/quiz/report/responses/responses_table.php
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/report.php
mod/resource/db/upgrade.php
mod/scorm/datamodels/scorm_13.js.php
mod/scorm/db/upgrade.php
mod/scorm/loadSCO.php
mod/scorm/report/basic/report.php
mod/scorm/report/interactions/report.php
mod/survey/db/upgrade.php
mod/url/db/upgrade.php
mod/wiki/db/upgrade.php
mod/workshop/db/upgrade.php
mod/workshop/form/accumulative/db/upgrade.php
mod/workshop/form/comments/db/upgrade.php
mod/workshop/form/numerrors/db/upgrade.php
mod/workshop/form/rubric/db/upgrade.php
question/editlib.php
question/type/calculated/db/upgrade.php
question/type/essay/db/upgrade.php
question/type/match/db/upgrade.php
question/type/multianswer/db/upgrade.php
question/type/multichoice/db/upgrade.php
question/type/numerical/db/upgrade.php
question/upgrade.php
tag/coursetags_edit.php
theme/formal_white/db/upgrade.php
user/profile/field/checkbox/field.class.php
webservice/rest/locallib.php

index 450d432..1f5a8fe 100644 (file)
@@ -67,6 +67,26 @@ if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
         }
     }
 
+} else if (optional_param('main', false, PARAM_BOOL) and confirm_sesskey()) {
+    if ($newmain = $admisselector->get_selected_users()) {
+        $newmain = reset($newmain);
+        $newmain = $newmain->id;
+        $admins = array();
+        foreach(explode(',', $CFG->siteadmins) as $admin) {
+            $admin = (int)$admin;
+            if ($admin) {
+                $admins[$admin] = $admin;
+            }
+        }
+
+        if (isset($admins[$newmain])) {
+            unset($admins[$newmain]);
+            array_unshift($admins, $newmain);
+            set_config('siteadmins', implode(',', $admins));
+            redirect($PAGE->url);
+        }
+    }
+
 } else if ($confirmadd and confirm_sesskey()) {
     $admins = array();
     foreach(explode(',', $CFG->siteadmins) as $admin) {
@@ -115,6 +135,7 @@ echo $OUTPUT->header();
         <p class="arrow_button">
             <input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
             <input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').'&nbsp;'.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
+            <input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'role'); ?>" title="<?php print_string('mainadminset', 'role'); ?>" />
         </p>
       </td>
       <td id='potentialcell'>
index b09ed4f..68a3c8b 100644 (file)
@@ -1584,13 +1584,31 @@ class admins_existing_selector extends user_selector_base {
             return array();
         }
 
-        if ($search) {
-            $groupname = get_string('extusersmatching', 'role', $search);
-        } else {
-            $groupname = get_string('extusers', 'role');
+        $mainadmin = array();
+        $adminids = explode(',', $CFG->siteadmins);
+        foreach ($adminids as $id) {
+            if (isset($availableusers[$id])) {
+                $mainadmin = array($id=>$availableusers[$id]);
+                unset($availableusers[$id]);
+                break;
+            }
         }
 
-        return array($groupname => $availableusers);
+        $result = array();
+        if ($mainadmin) {
+            $result[get_string('mainadmin', 'role')] = $mainadmin;
+        }
+
+        if ($availableusers) {
+            if ($search) {
+                $groupname = get_string('extusersmatching', 'role', $search);
+            } else {
+                $groupname = get_string('extusers', 'role');
+            }
+            $result[$groupname] = $availableusers;
+        }
+
+        return $result;
     }
 
     protected function get_options() {
index de44e51..382f3f2 100644 (file)
@@ -81,6 +81,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('allowframembedding', get_string('allowframembedding', 'admin'), get_string('allowframembedding_help', 'admin'), 0));
+    $temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', get_string('loginpasswordautocomplete', 'admin'), get_string('loginpasswordautocomplete_help', 'admin'), 0));
     $ADMIN->add('security', $temp);
 
 
index b0516b1..72792f4 100644 (file)
@@ -29,7 +29,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
 
     $dbman = $DB->get_manager();
 
-
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
 
     return true;
 }
index 2034856..21fead8 100644 (file)
@@ -48,5 +48,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 824d873..43d2791 100644 (file)
@@ -46,5 +46,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index d9b398f..8468201 100644 (file)
@@ -76,5 +76,8 @@ function xmldb_block_community_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
\ No newline at end of file
index 66e0a59..3c4ba15 100644 (file)
@@ -66,5 +66,8 @@ function xmldb_block_html_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 0fc1f94..0386888 100644 (file)
@@ -48,7 +48,12 @@ class block_login extends block_base {
             $this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';
 
             $this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>';
-            $this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
+
+            if (!empty($CFG->loginpasswordautocomplete)) {
+                $this->content->text .= '<input type="password" name="password" id="login_password" value="" autocomplete="off" /></div>';
+            } else {
+                $this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
+            }
 
             if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
                 $checked = $username ? 'checked="checked"' : '';
index 60a5dad..874fdfd 100644 (file)
@@ -75,5 +75,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
\ No newline at end of file
index 865fefc..f492536 100644 (file)
@@ -75,5 +75,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
\ No newline at end of file
index 51ff315..3b33091 100644 (file)
@@ -96,5 +96,8 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index a29c338..d140bca 100644 (file)
@@ -39,5 +39,8 @@ function xmldb_enrol_database_upgrade($oldversion) {
     }
 
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 306f8b3..33ddad4 100644 (file)
@@ -185,7 +185,7 @@ class enrol_database_plugin extends enrol_plugin {
 
             $existing = array();
             foreach ($current as $r) {
-                if (in_array($r->id, $roles)) {
+                if (in_array($r->roleid, $roles)) {
                     $existing[$r->roleid] = $r->roleid;
                 } else {
                     role_unassign($r->roleid, $user->id, $context->id, 'enrol_database', $instance->id);
index 2cb5a4c..03a5e0f 100644 (file)
@@ -62,6 +62,8 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
         upgrade_plugin_savepoint(true, 2010091400, 'enrol', 'flatfile');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
 
     return $result;
 }
diff --git a/enrol/guest/db/upgrade.php b/enrol/guest/db/upgrade.php
new file mode 100644 (file)
index 0000000..b19b5a6
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This file keeps track of upgrades to the guest enrolment plugin
+ *
+ * @package    enrol
+ * @subpackage guest
+ * @copyright  2011 Petr Skoda {@link http://skodak.org
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+function xmldb_enrol_guest_upgrade($oldversion) {
+    global $CFG, $DB, $OUTPUT;
+
+    $dbman = $DB->get_manager();
+
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
+    if ($oldversion < 2011112901) {
+        // convert all null passwords to empty strings
+        $DB->set_field('enrol', 'password', '', array('enrol'=>'guest', 'password'=>null));
+
+        upgrade_plugin_savepoint(true, 2011112901, 'enrol', 'guest');
+    }
+
+    return true;
+}
+
+
index ac4a5cf..da1d2f1 100644 (file)
@@ -327,6 +327,22 @@ class enrol_guest_plugin extends enrol_plugin {
         }
     }
 
+    /**
+     * Add new instance of enrol plugin.
+     * @param object $course
+     * @param array instance fields
+     * @return int id of new instance, null if can not be created
+     */
+    public function add_instance($course, array $fields = NULL) {
+        $fields = (array)$fields;
+
+        if (!isset($fields['password'])) {
+            $fields['password'] = '';
+        }
+
+        return parent::add_instance($course, $fields);
+    }
+
     /**
      * Add new instance of enrol plugin with default settings.
      * @param object $course
index 0f235c6..125592f 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2011112900;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version   = 2011112901;        // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2011112900;        // Requires this Moodle version
 $plugin->component = 'enrol_guest';     // Full name of the plugin (used for diagnostics)
index 36291c5..526eafa 100644 (file)
@@ -83,6 +83,9 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 2dec772..e9e90fa 100644 (file)
@@ -403,6 +403,10 @@ function process_group_tag($tagcontents) {
 
                     $courseid = $DB->insert_record('course', $course);
 
+                    // Setup default enrolment plugins
+                    $course->id = $courseid;
+                    enrol_course_updated(true, $course, null);
+
                     // Setup the blocks
                     $course = $DB->get_record('course', array('id' => $courseid));
                     blocks_add_default_course_blocks($course);
index 536eebd..df424b4 100644 (file)
@@ -39,5 +39,8 @@ function xmldb_enrol_mnet_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 61d30a1..44cd883 100644 (file)
@@ -62,5 +62,8 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 4de8809..9aee35b 100644 (file)
@@ -46,5 +46,8 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index b9f7497..33d41bd 100644 (file)
@@ -41,5 +41,8 @@ function xmldb_filter_tex_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 3afebbd..e60160d 100644 (file)
@@ -35,5 +35,8 @@ function xmldb_gradingform_rubric_upgrade($oldversion) {
 
     $dbman = $DB->get_manager();
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index a452a33..2802c9d 100644 (file)
@@ -103,7 +103,7 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
 
         if ($user_selector) {
             $renderer = $PAGE->get_renderer('gradereport_user');
-            echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, false);
+            echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, true);
         }
 
         while ($userdata = $gui->next_user()) {
index d6424a5..232abdc 100644 (file)
--- a/index.php
+++ b/index.php
@@ -58,7 +58,7 @@
         // Redirect logged-in users to My Moodle overview if required
         if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
             set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
-        } else if ($CFG->defaulthomepage == HOMEPAGE_MY && (optional_param('redirect', true, PARAM_BOOL) || !$hassiteconfig)) {
+        } else if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 1) {
             redirect($CFG->wwwroot .'/my/');
         } else if (!empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_USER) {
             $PAGE->settingsnav->get('usercurrentsettings')->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome'=>true)), navigation_node::TYPE_SETTING);
index 578d965..f648a3d 100644 (file)
@@ -613,6 +613,8 @@ $string['logguests_help'] = 'This setting enables logging of actions by guest ac
 $string['loginhttps'] = 'Use HTTPS for logins';
 $string['loginpageautofocus'] = 'Autofocus login page form';
 $string['loginpageautofocus_help'] = 'Enabling this option improves usability of the login page, but automatically focusing fields may be considered an accessibility issue.';
+$string['loginpasswordautocomplete'] = 'Prevent password autocompletion on login form.';
+$string['loginpasswordautocomplete_help'] = 'Having this off will let users save their account password in their browser. Switching this setting on will result in your site no longer following XHTML strict validation rules.';
 $string['loglifetime'] = 'Keep logs for';
 $string['longtimewarning'] = '<b>Please note that this process can take a long time.</b>';
 $string['maintenancemode'] = 'In maintenance mode';
index 947fbbc..1d82d23 100644 (file)
@@ -270,6 +270,7 @@ $string['reviewresponse'] = 'Review response';
 $string['saveflags'] = 'Save the state of the flags';
 $string['selectacategory'] = 'Select a category:';
 $string['selectaqtypefordescription'] = 'Select a question type to see its description.';
+$string['selectcategoryabove'] = 'Select a category above';
 $string['selectquestionsforbulk'] = 'Select questions for bulk actions';
 $string['shareincontext'] = 'Share in context for {$a}';
 $string['stoponerror'] = 'Stop on error';
index 2bf28cc..971722c 100644 (file)
@@ -212,6 +212,8 @@ $string['legacytype'] = 'Legacy role type';
 $string['legacy:user'] = 'LEGACY ROLE: Authenticated user';
 $string['listallroles'] = 'List all roles';
 $string['localroles'] = 'Locally assigned roles';
+$string['mainadmin'] = 'Main administrator';
+$string['mainadminset'] = 'Set main admin';
 $string['manageadmins'] = 'Manage site administrators';
 $string['manager'] = 'Manager';
 $string['managerdescription'] = 'Managers can access course and modify them, they usually do not participate in courses.';
index e888b23..0b86106 100644 (file)
@@ -49,24 +49,32 @@ define('LASTACCESS_UPDATE_SECS', 60);
 
 /**
  * Returns $user object of the main admin user
- * primary admin = admin with lowest role_assignment id among admins
  *
  * @static stdClass $mainadmin
  * @return stdClass {@link $USER} record from DB, false if not found
  */
 function get_admin() {
+    global $CFG, $DB;
+
     static $mainadmin = null;
 
-    if (!isset($mainadmin)) {
-        if (! $admins = get_admins()) {
-            return false;
+    if (isset($mainadmin)) {
+        return clone($mainadmin);
+    }
+
+    foreach (explode(',', $CFG->siteadmins) as $id) {
+        if ($user = $DB->get_record('user', array('id'=>$id, 'deleted'=>0))) {
+            $mainadmin = $user;
+            break;
         }
-        //TODO: add some admin setting for specifying of THE main admin
-        //      for now return the first assigned admin
-        $mainadmin = reset($admins);
     }
-    // we must clone this otherwise code outside can break the static var
-    return clone($mainadmin);
+
+    if ($mainadmin) {
+        return clone($mainadmin);
+    } else {
+        // this should not happen
+        return false;
+    }
 }
 
 /**
index 6b6573c..e540801 100644 (file)
@@ -6948,6 +6948,9 @@ FROM
         upgrade_main_savepoint(true, 2011111800.01);
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 9b22b01..d61e10f 100644 (file)
@@ -987,6 +987,12 @@ class file_storage {
      * @return stored_file instance
      */
     public function convert_image($file_record, $fid, $newwidth = NULL, $newheight = NULL, $keepaspectratio = true, $quality = NULL) {
+        if (!function_exists('imagecreatefromstring')) {
+            //Most likely the GD php extension isn't installed
+            //image conversion cannot succeed
+            throw new file_exception('storedfileproblem', 'imagecreatefromstring() doesnt exist. The PHP extension "GD" must be installed for image conversion.');
+        }
+
         if ($fid instanceof stored_file) {
             $fid = $fid->get_id();
         }
index 9b1ce04..ca83c7c 100644 (file)
@@ -1014,7 +1014,12 @@ abstract class moodleform {
                             $params = array_merge(array($realelementname), $params);
                             call_user_func_array(array(&$mform, 'addRule'), $params);
                             break;
-
+                        case 'type' :
+                            //Type should be set only once
+                            if (!isset($mform->_types[$elementname])) {
+                                $mform->setType($elementname, $params);
+                            }
+                            break;
                     }
                 }
             }
index 5bbc9c3..cb92452 100644 (file)
@@ -263,15 +263,28 @@ M.util.show_confirm_dialog = function(e, args) {
 
             if (target.test('a')) {
                 window.location = target.get('href');
+
             } else if ((targetancestor = target.ancestor('a')) !== null) {
                 window.location = targetancestor.get('href');
+
             } else if (target.test('input')) {
                 targetform = target.ancestor('form');
-                if (targetform && targetform.submit) {
-                    targetform.submit();
+                if (!targetform) {
+                    return;
                 }
+                if (target.get('name') && target.get('value')) {
+                    targetform.append('<input type="hidden" name="' + target.get('name') +
+                                    '" value="' + target.get('value') + '">');
+                }
+                targetform.submit();
+
+            } else if (target.get('tagName').toLowerCase() == 'form') {
+                // We cannot use target.test('form') on the previous line because of
+                // http://yuilibrary.com/projects/yui3/ticket/2531561
+                target.submit();
+
             } else if (M.cfg.developerdebug) {
-                alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A or INPUT");
+                alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, or FORM");
             }
         };
 
index 6d67cce..8645e27 100644 (file)
@@ -1240,6 +1240,16 @@ class global_navigation extends navigation_node {
                     $sections = $this->load_course_sections($course, $coursenode);
                     break;
             }
+        } else {
+            // We need to check if the user is viewing a front page module.
+            // If so then there is potentially more content to load yet for that
+            // module.
+            if ($this->page->context->contextlevel == CONTEXT_MODULE) {
+                $activitynode = $this->rootnodes['site']->get($this->page->cm->id, navigation_node::TYPE_ACTIVITY);
+                if ($activitynode) {
+                    $this->load_activity($this->page->cm, $this->page->course, $activitynode);
+                }
+            }
         }
 
         $limit = 20;
index a236aef..7288f57 100644 (file)
@@ -1469,14 +1469,13 @@ class core_renderer extends renderer_base {
             $aggregatelabel = $ratingmanager->get_aggregate_label($rating->settings->aggregationmethod);
             $aggregatestr   = $rating->get_aggregate_string();
 
-            $aggregatehtml  = html_writer::tag('span', $aggregatestr, array('id' => 'ratingaggregate'.$rating->itemid)).' ';
-            $aggregatehtml .= html_writer::start_tag('span', array('id'=>"ratingcount{$rating->itemid}"));
+            $aggregatehtml  = html_writer::tag('span', $aggregatestr, array('id' => 'ratingaggregate'.$rating->itemid, 'class' => 'ratingaggregate')).' ';
             if ($rating->count > 0) {
-                $aggregatehtml .= "({$rating->count})";
+                $countstr = "({$rating->count})";
             } else {
-                $aggregatehtml .= '-';
+                $countstr = '-';
             }
-            $aggregatehtml .= html_writer::end_tag('span').' ';
+            $aggregatehtml .= html_writer::tag('span', $countstr, array('id'=>"ratingcount{$rating->itemid}", 'class' => 'ratingcount')).' ';
 
             $ratinghtml .= html_writer::tag('span', $aggregatelabel, array('class'=>'rating-aggregate-label'));
             if ($rating->settings->permissions->viewall && $rating->settings->pluginpermissions->viewall) {
index 9d26165..e45b8e1 100644 (file)
@@ -38,7 +38,7 @@ if ($show_instructions) {
             <div class="clearer"><!-- --></div>
             <div class="form-label"><label for="password"><?php print_string("password") ?></label></div>
             <div class="form-input">
-              <input type="password" name="password" id="password" size="15" value="" />
+              <input type="password" name="password" id="password" size="15" value="" <?php if (!empty($CFG->loginpasswordautocomplete)) {echo 'autocomplete="off"';} ?> />
               <input type="submit" id="loginbtn" value="<?php print_string("login") ?>" />
             </div>
             <div class="clearer"><!-- --></div>
index caa6d35..ec64c5e 100644 (file)
@@ -50,6 +50,9 @@ function xmldb_message_email_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 5e56f1b..37efbe2 100644 (file)
@@ -83,7 +83,7 @@ class message_output_email extends message_output {
      * @param array $preferences preferences array
      */
     function process_form($form, &$preferences){
-        if (isset($form->email_email) && !empty($form->email_email)) {
+        if (isset($form->email_email)) {
             $preferences['message_processor_email_email'] = $form->email_email;
         }
     }
index 480df58..5563f66 100644 (file)
@@ -50,6 +50,9 @@ function xmldb_message_jabber_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 6cecfbc..6e6d37d 100644 (file)
@@ -50,6 +50,9 @@ function xmldb_message_popup_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 4136a76..6340d80 100644 (file)
@@ -157,6 +157,9 @@ function xmldb_assignment_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 012b3b3..a65441f 100644 (file)
@@ -1416,6 +1416,7 @@ class assignment_base {
                 $currentposition = 0;
                 foreach ($ausers as $auser) {
                     if ($currentposition == $offset && $offset < $endposition) {
+                        $rowclass = null;
                         $final_grade = $grading_info->items[0]->grades[$auser->id];
                         $grademax = $grading_info->items[0]->grademax;
                         $final_grade->formatted_grade = round($final_grade->grade,2) .' / ' . round($grademax,2);
@@ -1438,11 +1439,16 @@ class assignment_base {
                         ///attach file or print link to student answer, depending on the type of the assignment.
                         ///Refer to print_student_answer in inherited classes.
                             if ($auser->timemodified > 0) {
-                                $studentmodified = '<div id="ts'.$auser->id.'">'.$this->print_student_answer($auser->id)
-                                                 . userdate($auser->timemodified).'</div>';
+                                $studentmodifiedcontent = $this->print_student_answer($auser->id)
+                                        . userdate($auser->timemodified);
+                                if ($assignment->timedue && $auser->timemodified > $assignment->timedue) {
+                                    $studentmodifiedcontent .= assignment_display_lateness($auser->timemodified, $assignment->timedue);
+                                    $rowclass = 'late';
+                                }
                             } else {
-                                $studentmodified = '<div id="ts'.$auser->id.'">&nbsp;</div>';
+                                $studentmodifiedcontent = '&nbsp;';
                             }
+                            $studentmodified = html_writer::tag('div', $studentmodifiedcontent, array('id' => 'ts' . $auser->id));
                         ///Print grade, dropdown or text
                             if ($auser->timemarked > 0) {
                                 $teachermodified = '<div id="tt'.$auser->id.'">'.userdate($auser->timemarked).'</div>';
@@ -1561,7 +1567,7 @@ class assignment_base {
                         if ($uses_outcomes) {
                             $row[] = $outcomes;
                         }
-                        $table->add_data($row);
+                        $table->add_data($row, $rowclass);
                     }
                     $currentposition++;
                 }
index c775091..d1c8ac0 100644 (file)
@@ -103,6 +103,9 @@ function xmldb_chat_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index da14ee4..d75dc24 100644 (file)
@@ -71,6 +71,9 @@ function xmldb_choice_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 1a7ef12..afacc4a 100644 (file)
@@ -50,7 +50,6 @@ class mod_choice_mod_form extends moodleform_mod {
         $repeateloptions['limit']['default'] = 0;
         $repeateloptions['limit']['disabledif'] = array('limitanswers', 'eq', 0);
         $repeateloptions['limit']['rule'] = 'numeric';
-        $mform->setType('limit', PARAM_INT);
 
         $repeateloptions['option']['helpbutton'] = array('choiceoptions', 'choice');
         $mform->setType('option', PARAM_CLEANHTML);
index 491d30d..8983a9b 100644 (file)
@@ -341,6 +341,9 @@ function xmldb_data_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 3086c84..269e916 100644 (file)
@@ -266,6 +266,7 @@ class data_field_picture extends data_field_base {
             $fs->convert_image($file_record, $file, $this->field->param4, $this->field->param5, true);
             return true;
         } catch (Exception $e) {
+            debugging($e->getMessage());
             return false;
         }
     }
index e81cfa0..73b4520 100644 (file)
@@ -364,6 +364,9 @@ function xmldb_feedback_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index a0d64ac..8e33d6a 100644 (file)
@@ -54,5 +54,8 @@ function xmldb_folder_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 1ba8139..853a195 100644 (file)
@@ -341,6 +341,9 @@ function xmldb_forum_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 0e42828..c4c5316 100644 (file)
             print_error('cannotmovetonotexist', 'forum', $return);
         }
 
+        if ($forumto->type == 'single') {
+            print_error('cannotmovetosingleforum', 'forum', $return);
+        }
+
         if (!$cmto = get_coursemodule_from_instance('forum', $forumto->id, $course->id)) {
             print_error('cannotmovetonotfound', 'forum', $return);
         }
         if (isset($modinfo->instances['forum'])) {
             $forummenu = array();
             $sections = get_all_sections($course->id);
+            // Check forum types and eliminate simple discussions.
+            $forumcheck = $DB->get_records('forum', array('course' => $course->id),'', 'id, type');
             foreach ($modinfo->instances['forum'] as $forumcm) {
                 if (!$forumcm->uservisible || !has_capability('mod/forum:startdiscussion',
                     get_context_instance(CONTEXT_MODULE,$forumcm->id))) {
                     continue;
                 }
-
                 $section = $forumcm->sectionnum;
                 $sectionname = get_section_name($course, $sections[$section]);
                 if (empty($forummenu[$section])) {
                     $forummenu[$section] = array($sectionname => array());
                 }
-                if ($forumcm->instance != $forum->id) {
+                $forumidcompare = $forumcm->instance != $forum->id;
+                $forumtypecheck = $forumcheck[$forumcm->instance]->type !== 'single';
+                if ($forumidcompare and $forumtypecheck) {
                     $url = "/mod/forum/discuss.php?d=$discussion->id&move=$forumcm->instance&sesskey=".sesskey();
                     $forummenu[$section][$sectionname][$url] = format_string($forumcm->name);
                 }
index a23be0e..88ab2a8 100644 (file)
@@ -64,6 +64,7 @@ $string['cannotmovefromsingleforum'] = 'Cannot move discussion from a simple sin
 $string['cannotmovenotvisible'] = 'Forum not visible';
 $string['cannotmovetonotexist'] = 'You can\'t move to that forum - it doesn\'t exist!';
 $string['cannotmovetonotfound'] = 'Target forum not found in this course.';
+$string['cannotmovetosingleforum'] = 'Cannot move discussion to a simple single discussion forum';
 $string['cannotpurgecachedrss'] = 'Could not purge the cached RSS feeds for the source and/or destination forum(s) - check your file permissionsforums';
 $string['cannotremovesubscriber'] = 'Could not remove subscriber with id {$a} from this forum!';
 $string['cannotreply'] = 'You cannot reply to this post';
index 7257c67..f70627f 100644 (file)
@@ -352,6 +352,9 @@ function xmldb_glossary_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 47a4b00..06a695d 100644 (file)
@@ -34,5 +34,8 @@ function xmldb_imscp_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index fce86e5..a8d4909 100644 (file)
@@ -85,6 +85,9 @@ function xmldb_label_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 877dfaa..4e68783 100644 (file)
@@ -292,6 +292,9 @@ function xmldb_lesson_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 33aa23c..e215d03 100644 (file)
@@ -78,6 +78,9 @@ function xmldb_lti_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2011111600, 'lti');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index cec60f6..72d2497 100644 (file)
@@ -55,5 +55,8 @@ function xmldb_page_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index fecf7df..d60c06a 100644 (file)
@@ -1193,6 +1193,9 @@ function xmldb_quiz_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2011100604, 'quiz');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 0097787..920d099 100644 (file)
@@ -1165,7 +1165,7 @@ class quiz_question_bank_view extends question_bank_view {
         $this->display_category_form($this->contexts->having_one_edit_tab_cap('edit'),
                 $this->baseurl, $categoryandcontext);
         echo "<p style=\"text-align:center;\"><b>";
-        print_string('selectcategoryabove', 'quiz');
+        print_string('selectcategoryabove', 'question');
         echo "</b></p>";
         echo $OUTPUT->box_end();
     }
index df384ed..897a16d 100644 (file)
@@ -664,7 +664,6 @@ $string['scores'] = 'Scores';
 $string['select'] = 'Select';
 $string['selectall'] = 'Select all';
 $string['selectcategory'] = 'Select category';
-$string['selectcategoryabove'] = 'Select a category above';
 $string['selectedattempts'] = 'Selected attempts...';
 $string['selectnone'] = 'Deselect all';
 $string['selectquestiontype'] = '-- Select question type --';
index f26b2ec..edc4ea4 100644 (file)
@@ -360,7 +360,7 @@ abstract class quiz_attempt_report extends quiz_default_report {
                 // Ensure the attempt exists, and belongs to this quiz. If not skip.
                 continue;
             }
-            if ($allowed && !array_key_exists($attempt->userid, $allowed)) {
+            if ($allowed && !in_array($attempt->userid, $allowed)) {
                 // Ensure the attempt belongs to a student included in the report. If not skip.
                 continue;
             }
@@ -398,10 +398,10 @@ abstract class quiz_attempt_report_table extends table_sql {
     protected $groupstudents;
     protected $students;
     protected $questions;
-    protected $candelete;
+    protected $includecheckboxes;
 
     public function __construct($uniqueid, $quiz, $context, $qmsubselect, $groupstudents,
-            $students, $questions, $candelete, $reporturl, $displayoptions) {
+            $students, $questions, $includecheckboxes, $reporturl, $displayoptions) {
         parent::__construct($uniqueid);
         $this->quiz = $quiz;
         $this->context = $context;
@@ -409,7 +409,7 @@ abstract class quiz_attempt_report_table extends table_sql {
         $this->groupstudents = $groupstudents;
         $this->students = $students;
         $this->questions = $questions;
-        $this->candelete = $candelete;
+        $this->includecheckboxes = $includecheckboxes;
         $this->reporturl = $reporturl;
         $this->displayoptions = $displayoptions;
     }
@@ -690,4 +690,50 @@ abstract class quiz_attempt_report_table extends table_sql {
         $sortcolumns['quiza.id'] = SORT_ASC;
         return $sortcolumns;
     }
+
+    public function wrap_html_start() {
+        if ($this->is_downloading() || !$this->includecheckboxes) {
+            return;
+        }
+
+        $url = new moodle_url($this->reporturl, $this->displayoptions);
+        $url->param('sesskey', sesskey());
+
+        echo '<div id="tablecontainer">';
+        echo '<form id="attemptsform" method="post" action="' . $url->out_omit_querystring() . '">';
+
+        echo html_writer::input_hidden_params($url);
+        echo '<div>';
+    }
+
+    public function wrap_html_finish() {
+        if ($this->is_downloading() || !$this->includecheckboxes) {
+            return;
+        }
+
+        echo '<div id="commands">';
+        echo '<a href="javascript:select_all_in(\'DIV\', null, \'tablecontainer\');">' .
+                get_string('selectall', 'quiz') . '</a> / ';
+        echo '<a href="javascript:deselect_all_in(\'DIV\', null, \'tablecontainer\');">' .
+                get_string('selectnone', 'quiz') . '</a> ';
+        echo '&nbsp;&nbsp;';
+        $this->submit_buttons();
+        echo '</div>';
+        // Close form
+        echo '</div>';
+        echo '</form></div>';
+    }
+
+    /**
+     * Output any submit buttons required by the $this->includecheckboxes form.
+     */
+    protected function submit_buttons() {
+        global $PAGE;
+        if (has_capability('mod/quiz:deleteattempts', $this->context)) {
+            echo '<input type="submit" id="deleteattemptsbutton" name="delete" value="' .
+                    get_string('deleteselected', 'quiz_overview') . '"/>';
+            $PAGE->requires->event_handler('#deleteattemptsbutton', 'click', 'M.util.show_confirm_dialog',
+                    array('message' => get_string('deleteattemptcheck', 'quiz')));
+        }
+    }
 }
index fede5ac..e1bef7f 100644 (file)
@@ -226,5 +226,8 @@ function xmldb_quiz_overview_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 55aacb3..7efa3d8 100644 (file)
@@ -35,13 +35,12 @@ defined('MOODLE_INTERNAL') || die();
  */
 class quiz_report_overview_table extends quiz_attempt_report_table {
 
-    protected $candelete;
     protected $regradedqs = array();
 
     public function __construct($quiz, $context, $qmsubselect, $groupstudents,
-            $students, $detailedmarks, $questions, $candelete, $reporturl, $displayoptions) {
+            $students, $detailedmarks, $questions, $includecheckboxes, $reporturl, $displayoptions) {
         parent::__construct('mod-quiz-report-overview-report', $quiz , $context,
-                $qmsubselect, $groupstudents, $students, $questions, $candelete,
+                $qmsubselect, $groupstudents, $students, $questions, $includecheckboxes,
                 $reporturl, $displayoptions);
         $this->detailedmarks = $detailedmarks;
     }
@@ -147,45 +146,12 @@ class quiz_report_overview_table extends quiz_attempt_report_table {
         }
     }
 
-    public function wrap_html_start() {
-        if ($this->is_downloading() || !$this->candelete) {
-            return;
-        }
-
-        // Start form
-        $url = new moodle_url($this->reporturl, $this->displayoptions +
-                array('sesskey' => sesskey()));
-        echo '<div id="tablecontainer" class="overview-tablecontainer">';
-        echo '<form id="attemptsform" method="post" action="' .
-                $this->reporturl->out_omit_querystring() . '">';
-        echo '<div style="display: none;">';
-        echo html_writer::input_hidden_params($url);
-        echo '</div>';
-        echo '<div>';
-    }
-
-    public function wrap_html_finish() {
-        if ($this->is_downloading() || !$this->candelete) {
-            return;
-        }
-
-        // TODO add back are you sure, and convert to html_writer.
-        echo '<div id="commands">';
-        echo '<a href="javascript:select_all_in(\'DIV\', null, \'tablecontainer\');">' .
-                get_string('selectall', 'quiz') . '</a> / ';
-        echo '<a href="javascript:deselect_all_in(\'DIV\', null, \'tablecontainer\');">' .
-                get_string('selectnone', 'quiz') . '</a> ';
-        echo '&nbsp;&nbsp;';
+    protected function submit_buttons() {
         if (has_capability('mod/quiz:regrade', $this->context)) {
             echo '<input type="submit" name="regrade" value="' .
                     get_string('regradeselected', 'quiz_overview') . '"/>';
         }
-        echo '<input type="submit" name="delete" value="' .
-                get_string('deleteselected', 'quiz_overview') . '"/>';
-        echo '</div>';
-        // Close form
-        echo '</div>';
-        echo '</form></div>';
+        parent::submit_buttons();
     }
 
     public function col_sumgrades($attempt) {
index 9b518a4..e863e45 100644 (file)
@@ -106,7 +106,8 @@ class quiz_overview_report extends quiz_attempt_report {
 
         // We only want to show the checkbox to delete attempts
         // if the user has permissions and if the report mode is showing attempts.
-        $candelete = has_capability('mod/quiz:deleteattempts', $this->context)
+        $includecheckboxes = has_any_capability(
+                array('mod/quiz:regrade', 'mod/quiz:deleteattempts'), $this->context)
                 && ($attemptsmode != QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO);
 
         if ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL) {
@@ -128,7 +129,7 @@ class quiz_overview_report extends quiz_attempt_report {
         $questions = quiz_report_get_significant_questions($quiz);
 
         $table = new quiz_report_overview_table($quiz, $this->context, $qmsubselect,
-                $groupstudents, $students, $detailedmarks, $questions, $candelete,
+                $groupstudents, $students, $detailedmarks, $questions, $includecheckboxes,
                 $reporturl, $displayoptions);
         $filename = quiz_report_download_filename(get_string('overviewfilename', 'quiz_overview'),
                 $courseshortname, $quiz->name);
@@ -290,7 +291,7 @@ class quiz_overview_report extends quiz_attempt_report {
             $columns = array();
             $headers = array();
 
-            if (!$table->is_downloading() && $candelete) {
+            if (!$table->is_downloading() && $includecheckboxes) {
                 $columns[] = 'checkbox';
                 $headers[] = null;
             }
index aad7140..9f9857e 100644 (file)
@@ -105,7 +105,7 @@ class quiz_responses_report extends quiz_attempt_report {
 
         // We only want to show the checkbox to delete attempts
         // if the user has permissions and if the report mode is showing attempts.
-        $candelete = has_capability('mod/quiz:deleteattempts', $this->context)
+        $includecheckboxes = has_capability('mod/quiz:deleteattempts', $this->context)
                 && ($attemptsmode != QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO);
 
         $displayoptions = array();
@@ -124,11 +124,14 @@ class quiz_responses_report extends quiz_attempt_report {
             $allowed = array();
         }
 
-        $attemptids = optional_param_array('attemptid', array(), PARAM_INT);
-        if ($attemptids && confirm_sesskey()) {
-            require_capability('mod/quiz:deleteattempts', $this->context);
-            $this->delete_selected_attempts($quiz, $cm, $attemptids, $allowed);
-            redirect($reporturl->out(false, $displayoptions));
+        if (empty($currentgroup) || $groupstudents) {
+            if (optional_param('delete', 0, PARAM_BOOL) && confirm_sesskey()) {
+                if ($attemptids = optional_param_array('attemptid', array(), PARAM_INT)) {
+                    require_capability('mod/quiz:deleteattempts', $this->context);
+                    $this->delete_selected_attempts($quiz, $cm, $attemptids, $allowed);
+                    redirect($reporturl->out(false, $displayoptions));
+                }
+            }
         }
 
         // Load the required questions.
@@ -143,7 +146,7 @@ class quiz_responses_report extends quiz_attempt_report {
                 array('context' => $displaycoursecontext));
 
         $table = new quiz_report_responses_table($quiz, $this->context, $qmsubselect,
-                $groupstudents, $students, $questions, $candelete, $reporturl, $displayoptions);
+                $groupstudents, $students, $questions, $includecheckboxes, $reporturl, $displayoptions);
         $filename = quiz_report_download_filename(get_string('responsesfilename', 'quiz_responses'),
                 $courseshortname, $quiz->name);
         $table->is_downloading($download, $filename,
@@ -205,7 +208,7 @@ class quiz_responses_report extends quiz_attempt_report {
             $columns = array();
             $headers = array();
 
-            if (!$table->is_downloading() && $candelete) {
+            if (!$table->is_downloading() && $includecheckboxes) {
                 $columns[] = 'checkbox';
                 $headers[] = null;
             }
index c994908..cfb4633 100644 (file)
@@ -36,9 +36,9 @@ defined('MOODLE_INTERNAL') || die();
 class quiz_report_responses_table extends quiz_attempt_report_table {
 
     public function __construct($quiz, $context, $qmsubselect, $groupstudents,
-            $students, $questions, $candelete, $reporturl, $displayoptions) {
+            $students, $questions, $includecheckboxes, $reporturl, $displayoptions) {
         parent::__construct('mod-quiz-report-responses-report', $quiz, $context,
-                $qmsubselect, $groupstudents, $students, $questions, $candelete,
+                $qmsubselect, $groupstudents, $students, $questions, $includecheckboxes,
                 $reporturl, $displayoptions);
     }
 
@@ -49,43 +49,6 @@ class quiz_report_responses_table extends quiz_attempt_report_table {
         }
     }
 
-    public function wrap_html_start() {
-        global $PAGE;
-        if ($this->is_downloading() || !$this->candelete) {
-            return;
-        }
-
-        // Start form
-        $url = new moodle_url($this->reporturl, $this->displayoptions);
-        $url->param('sesskey', sesskey());
-
-        echo '<div id="tablecontainer">';
-        echo '<form id="attemptsform" method="post" action="' . $url->out_omit_querystring() . '>';
-        echo html_writer::input_hidden_params($url);
-        echo '<div>';
-        $PAGE->requires->event_handler('#attemptsform', 'submit', 'M.util.show_confirm_dialog',
-                array('message' => get_string('deleteattemptcheck', 'quiz')));
-    }
-
-    public function wrap_html_finish() {
-        if ($this->is_downloading() || !$this->candelete) {
-            return;
-        }
-
-        // TODO add back are you sure, and convert to html_writer.
-        echo '<div id="commands">';
-        echo '<a href="javascript:select_all_in(\'DIV\', null, \'tablecontainer\');">'.
-                get_string('selectall', 'quiz').'</a> / ';
-        echo '<a href="javascript:deselect_all_in(\'DIV\', null, \'tablecontainer\');">'.
-                get_string('selectnone', 'quiz').'</a> ';
-        echo '&nbsp;&nbsp;';
-        echo '<input type="submit" value="'.get_string('deleteselected', 'quiz_overview').'"/>';
-        echo '</div>';
-        // Close form
-        echo '</div>';
-        echo '</form></div>';
-    }
-
     public function col_sumgrades($attempt) {
         if (!$attempt->timefinish) {
             return '-';
index a25da3c..6ee18fd 100644 (file)
@@ -398,6 +398,9 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 4d97600..f29d220 100644 (file)
@@ -313,15 +313,22 @@ class quiz_statistics_report extends quiz_default_report {
         // Display the various bits.
         echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
         echo html_writer::table($questioninfotable);
-
-        echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat,
-                array('overflowdiv' => true)) . $actions,
-                'questiontext boxaligncenter generalbox boxwidthnormal mdl-align');
-
+        echo $this->render_question_text($question);
         echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
         echo html_writer::table($questionstatstable);
     }
 
+    /**
+     * @param object $question question data.
+     * @return string HTML of question text, ready for display.
+     */
+    protected function render_question_text($question){
+        global $OUTPUT;
+        return $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat,
+                array('overflowdiv' => true)),
+                'questiontext boxaligncenter generalbox boxwidthnormal mdl-align');
+    }
+
     /**
      * Display the response analysis for a question.
      * @param object $question the question to report on.
@@ -356,6 +363,10 @@ class quiz_statistics_report extends quiz_default_report {
 
             // Set up the table.
             $exportclass->start_table($questiontabletitle);
+
+            if ($this->table->is_downloading() == 'xhtml') {
+                echo $this->render_question_text($question);
+            }
         }
 
         $responesstats = new quiz_statistics_response_analyser($question);
index b1831a1..1a9d2be 100644 (file)
@@ -265,5 +265,8 @@ function xmldb_resource_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 9b5d487..d6e0b03 100644 (file)
@@ -177,11 +177,11 @@ function SCORMapi1_3() {
         'cmi.comments_from_lms.n.comment':{'format':CMILangString4000, 'mod':'r'},
         'cmi.comments_from_lms.n.location':{'format':CMIString250, 'mod':'r'},
         'cmi.comments_from_lms.n.timestamp':{'format':CMITime, 'mod':'r'},
-        'cmi.completion_status':{'defaultvalue':'<?php echo isset($userdata->{'cmi.completion_status'})?$userdata->{'cmi.completion_status'}:'unknown' ?>', 'format':CMICStatus, 'mod':'rw'},
-        'cmi.completion_threshold':{'defaultvalue':<?php echo isset($userdata->threshold)?'\''.$userdata->threshold.'\'':'null' ?>, 'mod':'r'},
-        'cmi.credit':{'defaultvalue':'<?php echo isset($userdata->credit)?$userdata->credit:'' ?>', 'mod':'r'},
+        'cmi.completion_status':{'defaultvalue':'<?php echo !empty($userdata->{'cmi.completion_status'})?$userdata->{'cmi.completion_status'}:'unknown' ?>', 'format':CMICStatus, 'mod':'rw'},
+        'cmi.completion_threshold':{'defaultvalue':<?php echo !empty($userdata->threshold)?'\''.$userdata->threshold.'\'':'null' ?>, 'mod':'r'},
+        'cmi.credit':{'defaultvalue':'<?php echo !empty($userdata->credit)?$userdata->credit:'' ?>', 'mod':'r'},
         'cmi.entry':{'defaultvalue':'<?php echo $userdata->entry ?>', 'mod':'r'},
-        'cmi.exit':{'defaultvalue':'<?php echo isset($userdata->{'cmi.exit'})?$userdata->{'cmi.exit'}:'' ?>', 'format':CMIExit, 'mod':'w'},
+        'cmi.exit':{'defaultvalue':'<?php echo !empty($userdata->{'cmi.exit'})?$userdata->{'cmi.exit'}:'' ?>', 'format':CMIExit, 'mod':'w'},
         'cmi.interactions._children':{'defaultvalue':interactions_children, 'mod':'r'},
         'cmi.interactions._count':{'mod':'r', 'defaultvalue':'0'},
         'cmi.interactions.n.id':{'pattern':CMIIndex, 'format':CMILongIdentifier, 'mod':'rw'},
@@ -196,7 +196,7 @@ function SCORMapi1_3() {
         'cmi.interactions.n.result':{'pattern':CMIIndex, 'format':CMIResult, 'mod':'rw'},
         'cmi.interactions.n.latency':{'pattern':CMIIndex, 'format':CMITimespan, 'mod':'rw'},
         'cmi.interactions.n.description':{'pattern':CMIIndex, 'format':CMILangString250, 'mod':'rw'},
-        'cmi.launch_data':{'defaultvalue':<?php echo isset($userdata->datafromlms)?'\''.$userdata->datafromlms.'\'':'null' ?>, 'mod':'r'},
+        'cmi.launch_data':{'defaultvalue':<?php echo !empty($userdata->datafromlms)?'\''.$userdata->datafromlms.'\'':'null' ?>, 'mod':'r'},
         'cmi.learner_id':{'defaultvalue':'<?php echo $userdata->student_id ?>', 'mod':'r'},
         'cmi.learner_name':{'defaultvalue':'<?php echo $userdata->student_name ?>', 'mod':'r'},
         'cmi.learner_preference._children':{'defaultvalue':student_preference_children, 'mod':'r'},
@@ -204,8 +204,8 @@ function SCORMapi1_3() {
         'cmi.learner_preference.language':{'defaultvalue':'', 'format':CMILang, 'mod':'rw'},
         'cmi.learner_preference.delivery_speed':{'defaultvalue':'1', 'format':CMIDecimal, 'range':speed_range, 'mod':'rw'},
         'cmi.learner_preference.audio_captioning':{'defaultvalue':'0', 'format':CMISInteger, 'range':text_range, 'mod':'rw'},
-        'cmi.location':{'defaultvalue':<?php echo isset($userdata->{'cmi.location'})?'\''.$userdata->{'cmi.location'}.'\'':'null' ?>, 'format':CMIString1000, 'mod':'rw'},
-        'cmi.max_time_allowed':{'defaultvalue':<?php echo isset($userdata->attemptAbsoluteDurationLimit)?'\''.$userdata->attemptAbsoluteDurationLimit.'\'':'null' ?>, 'mod':'r'},
+        'cmi.location':{'defaultvalue':<?php echo !empty($userdata->{'cmi.location'})?'\''.$userdata->{'cmi.location'}.'\'':'null' ?>, 'format':CMIString1000, 'mod':'rw'},
+        'cmi.max_time_allowed':{'defaultvalue':<?php echo !empty($userdata->attemptAbsoluteDurationLimit)?'\''.$userdata->attemptAbsoluteDurationLimit.'\'':'null' ?>, 'mod':'r'},
         'cmi.mode':{'defaultvalue':'<?php echo $userdata->mode ?>', 'mod':'r'},
         'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r'},
         'cmi.objectives._count':{'mod':'r', 'defaultvalue':'0'},
@@ -219,18 +219,18 @@ function SCORMapi1_3() {
         'cmi.objectives.n.completion_status':{'defaultvalue':'unknown', 'pattern':CMIIndex, 'format':CMICStatus, 'mod':'rw'},
         'cmi.objectives.n.progress_measure':{'defaultvalue':null, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
         'cmi.objectives.n.description':{'pattern':CMIIndex, 'format':CMILangString250, 'mod':'rw'},
-        'cmi.progress_measure':{'defaultvalue':<?php echo isset($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
-        'cmi.scaled_passing_score':{'defaultvalue':<?php echo isset($userdata->{'cmi.scaled_passing_score'})?'\''.$userdata->{'cmi.scaled_passing_score'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'r'},
+        'cmi.progress_measure':{'defaultvalue':<?php echo !empty($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
+        'cmi.scaled_passing_score':{'defaultvalue':<?php echo !empty($userdata->{'cmi.scaled_passing_score'})?'\''.$userdata->{'cmi.scaled_passing_score'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'r'},
         'cmi.score._children':{'defaultvalue':score_children, 'mod':'r'},
-        'cmi.score.scaled':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.scaled'})?'\''.$userdata->{'cmi.score.scaled'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'rw'},
-        'cmi.score.raw':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.raw'})?'\''.$userdata->{'cmi.score.raw'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
-        'cmi.score.min':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.min'})?'\''.$userdata->{'cmi.score.min'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
-        'cmi.score.max':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.max'})?'\''.$userdata->{'cmi.score.max'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
+        'cmi.score.scaled':{'defaultvalue':<?php echo !empty($userdata->{'cmi.score.scaled'})?'\''.$userdata->{'cmi.score.scaled'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'rw'},
+        'cmi.score.raw':{'defaultvalue':<?php echo !empty($userdata->{'cmi.score.raw'})?'\''.$userdata->{'cmi.score.raw'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
+        'cmi.score.min':{'defaultvalue':<?php echo !empty($userdata->{'cmi.score.min'})?'\''.$userdata->{'cmi.score.min'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
+        'cmi.score.max':{'defaultvalue':<?php echo !empty($userdata->{'cmi.score.max'})?'\''.$userdata->{'cmi.score.max'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
         'cmi.session_time':{'format':CMITimespan, 'mod':'w', 'defaultvalue':'PT0H0M0S'},
-        'cmi.success_status':{'defaultvalue':'<?php echo isset($userdata->{'cmi.success_status'})?$userdata->{'cmi.success_status'}:'unknown' ?>', 'format':CMISStatus, 'mod':'rw'},
-        'cmi.suspend_data':{'defaultvalue':<?php echo isset($userdata->{'cmi.suspend_data'})?'\''.$userdata->{'cmi.suspend_data'}.'\'':'null' ?>, 'format':CMIString64000, 'mod':'rw'},
-        'cmi.time_limit_action':{'defaultvalue':<?php echo isset($userdata->timelimitaction)?'\''.$userdata->timelimitaction.'\'':'null' ?>, 'mod':'r'},
-        'cmi.total_time':{'defaultvalue':'<?php echo isset($userdata->{'cmi.total_time'})?$userdata->{'cmi.total_time'}:'PT0H0M0S' ?>', 'mod':'r'},
+        'cmi.success_status':{'defaultvalue':'<?php echo !empty($userdata->{'cmi.success_status'})?$userdata->{'cmi.success_status'}:'unknown' ?>', 'format':CMISStatus, 'mod':'rw'},
+        'cmi.suspend_data':{'defaultvalue':<?php echo !empty($userdata->{'cmi.suspend_data'})?'\''.$userdata->{'cmi.suspend_data'}.'\'':'null' ?>, 'format':CMIString64000, 'mod':'rw'},
+        'cmi.time_limit_action':{'defaultvalue':<?php echo !empty($userdata->timelimitaction)?'\''.$userdata->timelimitaction.'\'':'null' ?>, 'mod':'r'},
+        'cmi.total_time':{'defaultvalue':'<?php echo !empty($userdata->{'cmi.total_time'})?$userdata->{'cmi.total_time'}:'PT0H0M0S' ?>', 'mod':'r'},
         'adl.nav.request':{'defaultvalue':'_none_', 'format':NAVEvent, 'mod':'rw'}
     };
     //
index 32396c9..c48eaeb 100644 (file)
@@ -604,6 +604,9 @@ function xmldb_scorm_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2011110502, 'scorm');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index d7988f5..ea2a6b8 100644 (file)
@@ -141,6 +141,8 @@ if (scorm_external_link($sco->launch)) {
     $result = "$CFG->wwwroot/pluginfile.php/$context->id/mod_scorm/content/$scorm->revision/$launcher";
 }
 
+add_to_log($course->id, 'scorm', 'launch', 'view.php?id='.$cm->id, $result, $cm->id);
+
 // which API are we looking for
 $LMS_api = (scorm_version_check($scorm->version, SCORM_12) || empty($scorm->version)) ? 'API' : 'API_1484_11';
 ?>
@@ -211,9 +213,5 @@ $LMS_api = (scorm_version_check($scorm->version, SCORM_12) || empty($scorm->vers
     </head>
     <body onload="doredirect();">
         <p><?php echo get_string('activitypleasewait', 'scorm');?></p>
-        <?php if (debugging('', DEBUG_DEVELOPER)) {
-                  add_to_log($course->id, 'scorm', 'launch', 'view.php?id='.$cm->id, $result, $cm->id);
-              }
-        ?>
     </body>
 </html>
index 5cd4c1b..d2f9f68 100644 (file)
@@ -36,6 +36,8 @@ class scorm_basic_report extends scorm_default_report {
         $contextmodule= get_context_instance(CONTEXT_MODULE, $cm->id);
         $action = optional_param('action', '', PARAM_ALPHA);
         $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
+        $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
+        $PAGE->set_url(new moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
 
         if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
             if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
@@ -43,19 +45,19 @@ class scorm_basic_report extends scorm_default_report {
                 echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
             }
         }
+        // find out current groups mode
+        $currentgroup = groups_get_activity_group($cm, true);
 
         // detailed report
         $mform = new mod_scorm_report_settings($PAGE->url, compact('currentgroup'));
         if ($fromform = $mform->get_data()) {
             $detailedrep = $fromform->detailedrep;
             $pagesize = $fromform->pagesize;
-            $attemptsmode = !empty($fromform->attemptsmode) ? $fromform->attemptsmode : SCORM_REPORT_ATTEMPTS_ALL_STUDENTS;
             set_user_preference('scorm_report_detailed', $detailedrep);
             set_user_preference('scorm_report_pagesize', $pagesize);
         } else {
             $detailedrep = get_user_preferences('scorm_report_detailed', false);
             $pagesize = get_user_preferences('scorm_report_pagesize', 0);
-            $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_STUDENTS_WITH, PARAM_INT);
         }
         if ($pagesize < 1) {
             $pagesize = SCORM_REPORT_DEFAULT_PAGE_SIZE;
@@ -84,7 +86,7 @@ class scorm_basic_report extends scorm_default_report {
                 $nostudents = true;
                 $allowedlist = '';
             } else {
-                $allowedlist = join(',', array_keys($students));
+                $allowedlist = array_keys($students);
             }
         } else {
             // all users who can attempt scoes and who are in the currently selected group
@@ -93,7 +95,7 @@ class scorm_basic_report extends scorm_default_report {
                 $nostudents = true;
                 $groupstudents = array();
             }
-            $allowedlist = join(',', array_keys($groupstudents));
+            $allowedlist = array_keys($groupstudents);
         }
 
         if ( !$nostudents ) {
@@ -269,7 +271,8 @@ class scorm_basic_report extends scorm_default_report {
                 header("Pragma: public");
                 echo implode("\t", $headers)." \n";
             }
-
+            $params = array();
+            list($usql, $params) = $DB->get_in_or_equal($allowedlist, SQL_PARAMS_NAMED);
                             // Construct the SQL
             $select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
             $select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
@@ -282,15 +285,15 @@ class scorm_basic_report extends scorm_default_report {
             switch ($attemptsmode) {
                 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH:
                     // Show only students with attempts
-                    $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NOT NULL';
+                    $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NOT NULL';
                     break;
                 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO:
                     // Show only students without attempts
-                    $where = ' WHERE u.id IN (' .$allowedlist. ') AND st.userid IS NULL';
+                    $where = ' WHERE u.id ' .$usql. ' AND st.userid IS NULL';
                     break;
                 case SCORM_REPORT_ATTEMPTS_ALL_STUDENTS:
                     // Show all students with or without attempts
-                    $where = ' WHERE u.id IN (' .$allowedlist. ') AND (st.userid IS NOT NULL OR st.userid IS NULL)';
+                    $where = ' WHERE u.id ' .$usql. ' AND (st.userid IS NOT NULL OR st.userid IS NULL)';
                     break;
             }
 
@@ -298,7 +301,6 @@ class scorm_basic_report extends scorm_default_report {
             $countsql .= 'COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'st.attempt').')) AS nbattempts, ';
             $countsql .= 'COUNT(DISTINCT(u.id)) AS nbusers ';
             $countsql .= $from.$where;
-            $params = array();
 
             if (!$download) {
                 $sort = $table->get_sql_sort();
@@ -321,7 +323,7 @@ class scorm_basic_report extends scorm_default_report {
                 }
 
                 if (!empty($countsql)) {
-                    $count = $DB->get_record_sql($countsql);
+                    $count = $DB->get_record_sql($countsql, $params);
                     $totalinitials = $count->nbresults;
                     if ($twhere) {
                         $countsql .= ' AND '.$twhere;
@@ -520,7 +522,7 @@ class scorm_basic_report extends scorm_default_report {
                     }
                 }
                 if (!$download) {
-                    $mform->set_data(compact('detailedrep', 'pagesize'));
+                    $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
                     $mform->display();
                 }
             } else {
index 96e1ff2..12e61ab 100644 (file)
@@ -38,6 +38,8 @@ class scorm_interactions_report extends scorm_default_report {
         $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id);
         $action = optional_param('action', '', PARAM_ALPHA);
         $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
+        $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
+        $PAGE->set_url(new moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
 
         if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
             if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
@@ -45,6 +47,8 @@ class scorm_interactions_report extends scorm_default_report {
                 echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
             }
         }
+        // find out current groups mode
+        $currentgroup = groups_get_activity_group($cm, true);
 
         // detailed report
         $mform = new mod_scorm_report_interactions_settings($PAGE->url, compact('currentgroup'));
@@ -53,14 +57,12 @@ class scorm_interactions_report extends scorm_default_report {
             $includeqtext = $fromform->qtext;
             $includeresp = $fromform->resp;
             $includeright = $fromform->right;
-            $attemptsmode = !empty($fromform->attemptsmode) ? $fromform->attemptsmode : SCORM_REPORT_ATTEMPTS_ALL_STUDENTS;
             set_user_preference('scorm_report_pagesize', $pagesize);
             set_user_preference('scorm_report_interactions_qtext', $includeqtext);
             set_user_preference('scorm_report_interactions_resp', $includeresp);
             set_user_preference('scorm_report_interactions_right', $includeright);
         } else {
             $pagesize = get_user_preferences('scorm_report_pagesize', 0);
-            $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_STUDENTS_WITH, PARAM_INT);
             $includeqtext = get_user_preferences('scorm_report_interactions_qtext', 0);
             $includeresp = get_user_preferences('scorm_report_interactions_resp', 1);
             $includeright = get_user_preferences('scorm_report_interactions_right', 0);
@@ -107,7 +109,7 @@ class scorm_interactions_report extends scorm_default_report {
                 $nostudents = true;
                 $groupstudents = array();
             }
-            $allowedlist = ($groupstudents);
+            $allowedlist = array_keys($groupstudents);
         }
         if ( !$nostudents ) {
             // Now check if asked download of data
@@ -582,7 +584,7 @@ class scorm_interactions_report extends scorm_default_report {
                     }
                 }
                 if (!$download) {
-                    $mform->set_data(compact('detailedrep', 'pagesize'));
+                    $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
                     $mform->display();
                 }
             } else {
index b9d06a2..ab5b273 100644 (file)
@@ -57,6 +57,9 @@ function xmldb_survey_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 01926f8..c636b67 100644 (file)
@@ -68,5 +68,8 @@ function xmldb_url_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2011092800, 'url');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 63a1d2f..d4c84b6 100644 (file)
@@ -373,5 +373,8 @@ function xmldb_wiki_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index abde327..3b2dd18 100644 (file)
@@ -319,5 +319,8 @@ function xmldb_workshop_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2011110400, 'workshop');
     }
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 0626d93..7a78bb9 100644 (file)
@@ -52,5 +52,8 @@ function xmldb_workshopform_accumulative_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 82402d7..42ace1c 100644 (file)
@@ -52,5 +52,8 @@ function xmldb_workshopform_comments_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 553cc73..59cc386 100644 (file)
@@ -62,5 +62,8 @@ function xmldb_workshopform_numerrors_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index ac69e2f..ea418d5 100644 (file)
@@ -63,5 +63,8 @@ function xmldb_workshopform_rubric_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 4079d48..2b541a6 100644 (file)
@@ -1198,7 +1198,7 @@ class question_bank_view {
 
     protected function print_choose_category_message($categoryandcontext) {
         echo "<p style=\"text-align:center;\"><b>";
-        print_string("selectcategoryabove", "question");
+        print_string('selectcategoryabove', 'question');
         echo "</b></p>";
     }
 
index 0605694..7d49e42 100644 (file)
@@ -230,6 +230,9 @@ function xmldb_qtype_calculated_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index e74b8ea..f5938bd 100644 (file)
@@ -90,5 +90,8 @@ function xmldb_qtype_essay_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index fa89bf3..e799034 100644 (file)
@@ -210,5 +210,8 @@ function xmldb_qtype_match_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index cc832b9..ce7a57c 100644 (file)
@@ -59,5 +59,8 @@ function xmldb_qtype_multianswer_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 22dc83a..a26790a 100644 (file)
@@ -151,5 +151,8 @@ function xmldb_qtype_multichoice_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
index 09550c6..5a3ae49 100644 (file)
@@ -237,6 +237,9 @@ function xmldb_qtype_numerical_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
 
index 7e5074b..fbedeb7 100644 (file)
@@ -40,5 +40,6 @@ defined('MOODLE_INTERNAL') || die();
 function question_fix_random_question_parents() {
     global $CFG, $DB;
     $DB->execute("UPDATE {question} SET parent = id WHERE qtype = 'random' AND parent <> id");
+
     return true;
 }
index be710fe..18d40a4 100644 (file)
@@ -41,7 +41,7 @@ if ($courseid != SITEID) {
 }
 
 // Permissions
-$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
+$sitecontext = get_context_instance(CONTEXT_SYSTEM);
 require_login($course->id);
 $canedit = has_capability('moodle/tag:create', $sitecontext);
 
index e263195..81d789d 100644 (file)
@@ -63,5 +63,8 @@ function xmldb_theme_formal_white_upgrade($oldversion) {
     // Moodle v2.1.0 release upgrade line
     // Put any upgrade step following this
 
+    // Moodle v2.2.0 release upgrade line
+    // Put any upgrade step following this
+
     return true;
 }
\ No newline at end of file
index 75c955d..29aaf3d 100644 (file)
@@ -29,7 +29,7 @@ class profile_field_checkbox extends profile_field_base {
             $checkbox->setChecked(true);
         }
         $mform->setType($this->inputname, PARAM_BOOL);
-        if ($this->is_required() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
+        if ($this->is_required() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
             $mform->addRule($this->inputname, get_string('required'), 'nonzero', null, 'client');
         }
     }
index 3fe38ea..179a85b 100644 (file)
@@ -138,9 +138,9 @@ class webservice_rest_server extends webservice_base_server {
         } else {
             $error = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
             $error .= '<EXCEPTION class="'.get_class($ex).'">'."\n";
-            $error .= '<MESSAGE>'.htmlentities($ex->getMessage(), ENT_COMPAT, 'UTF-8').'</MESSAGE>'."\n";
+            $error .= '<MESSAGE>'.htmlspecialchars($ex->getMessage(), ENT_COMPAT, 'UTF-8').'</MESSAGE>'."\n";
             if (debugging() and isset($ex->debuginfo)) {
-                $error .= '<DEBUGINFO>'.htmlentities($ex->debuginfo, ENT_COMPAT, 'UTF-8').'</DEBUGINFO>'."\n";
+                $error .= '<DEBUGINFO>'.htmlspecialchars($ex->debuginfo, ENT_COMPAT, 'UTF-8').'</DEBUGINFO>'."\n";
             }
             $error .= '</EXCEPTION>'."\n";
         }
@@ -182,7 +182,7 @@ class webservice_rest_server extends webservice_base_server {
             if (is_null($returns)) {
                 return '<VALUE null="null"/>'."\n";
             } else {
-                return '<VALUE>'.htmlentities($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
+                return '<VALUE>'.htmlspecialchars($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
             }
 
         } else if ($desc instanceof external_multiple_structure) {