if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
// first find candidate records
$sql = "SELECT id, $column FROM $fulltable WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'";
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $data) {
- $text = $data->$column;
- $id = $data->id;
- if ($i % 600 == 0) {
- echo '<br />';
- }
- if ($i % 10 == 0) {
- echo '.';
- }
- $i++;
-
- if (empty($text) or is_numeric($text)) {
- continue; // nothing to do
- }
-
- $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
- $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
-
- if (is_null($newtext)) {
- continue; // regex error
- }
-
- if ($newtext != $text) {
- $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id));
- }
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $data) {
+ $text = $data->$column;
+ $id = $data->id;
+ if ($i % 600 == 0) {
+ echo '<br />';
+ }
+ if ($i % 10 == 0) {
+ echo '.';
+ }
+ $i++;
+
+ if (empty($text) or is_numeric($text)) {
+ continue; // nothing to do
+ }
+
+ $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
+ $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
+
+ if (is_null($newtext)) {
+ continue; // regex error
+ }
+
+ if ($newtext != $text) {
+ $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id));
}
- $rs->close();
}
+ $rs->close();
}
}
}
list($sqlwhere, $params) = $ufiltering->get_sql_filter("id<>:exguest AND deleted <> 1", array('exguest'=>$CFG->siteguest));
- if ($rs = $DB->get_recordset_select('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname')) {
- foreach ($rs as $user) {
- if (!isset($SESSION->bulk_users[$user->id])) {
- $SESSION->bulk_users[$user->id] = $user->id;
- }
+ $rs = $DB->get_recordset_select('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
+ foreach ($rs as $user) {
+ if (!isset($SESSION->bulk_users[$user->id])) {
+ $SESSION->bulk_users[$user->id] = $user->id;
}
- $rs->close();
}
+ $rs->close();
}
function get_selection_data($ufiltering) {
if ($confirm and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
- foreach ($rs as $user) {
- if ($user->confirmed) {
- continue;
- }
- $auth = get_auth_plugin($user->auth);
- $result = $auth->user_confirm($user->username, $user->secret);
- if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
- echo $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname');
+ foreach ($rs as $user) {
+ if ($user->confirmed) {
+ continue;
+ }
+ $auth = get_auth_plugin($user->auth);
+ $result = $auth->user_confirm($user->username, $user->secret);
+ if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
+ echo $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
redirect($return, get_string('changessaved'));
} else {
if ($confirm and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
- unset($SESSION->bulk_users[$user->id]);
- } else {
- echo $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
+ unset($SESSION->bulk_users[$user->id]);
+ } else {
+ echo $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
session_gc(); // remove stale sessions
redirect($return, get_string('changessaved'));
$parts = array_chunk($SESSION->bulk_users, 300);
foreach ($parts as $users) {
list($in, $params) = $DB->get_in_or_equal($users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- if (!empty($changeable[$user->auth])) {
- set_user_preference('auth_forcepasswordchange', 1, $user->id);
- unset($SESSION->bulk_users[$user->id]);
- } else {
- echo $OUTPUT->notification(get_string('forcepasswordchangenot', '', fullname($user, true)));
- }
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ if (!empty($changeable[$user->auth])) {
+ set_user_preference('auth_forcepasswordchange', 1, $user->id);
+ unset($SESSION->bulk_users[$user->id]);
+ } else {
+ echo $OUTPUT->notification(get_string('forcepasswordchangenot', '', fullname($user, true)));
}
- $rs->close();
}
+ $rs->close();
}
echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
echo $OUTPUT->continue_button($return);
if ($confirm and !empty($msg) and confirm_sesskey()) {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
- if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
- foreach ($rs as $user) {
- //TODO we should probably support all text formats here or only FORMAT_MOODLE
- //For now bulk messaging is still using the html editor and its supplying html
- //so we have to use html format for it to be displayed correctly
- message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
- }
- $rs->close();
+ $rs = $DB->get_recordset_select('user', "id $in", $params);
+ foreach ($rs as $user) {
+ //TODO we should probably support all text formats here or only FORMAT_MOODLE
+ //For now bulk messaging is still using the html editor and its supplying html
+ //so we have to use html format for it to be displayed correctly
+ message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
}
+ $rs->close();
redirect($return);
}
--- /dev/null
+<?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 is an empty file which is used in order to prevent
+ * error logs in the serverlog.
+ *
+ * Sometimes developer forgets to postprocess files when saving
+ * submitted form data or forget to replace the file placeholders
+ * with the current area information.
+ *
+ * @package core
+ * @subpackage file
+ * @copyright 2011 Petr Skoda (http://skodak.org)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+@header('HTTP/1.0 404 not found');
@set_time_limit(0); // this could take a while! MDL-10954
}
- if ($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 = $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();
}
+ $rs->close();
// reset the fast modinfo cache
$reset = 'reset';
get_fast_modinfo($reset);
}
// Check if result is empty
- if (!$rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if (!$rs->valid()) {
if ($course->id != 1) {
$error = get_string('nocompletions', 'coursereport_completion');
}
echo $OUTPUT->notification($error);
+ $rs->close(); // not going to loop (but break), close rs
break;
}
$courses['unstarted'][] = $c_info;
}
}
-
- $rs->close();
+ $rs->close(); // after loop, close rs
// Loop through course status groups
foreach ($courses as $type => $infos) {
WHERE e.id IN(" . implode(',', $orderdata) . ")
ORDER BY e.userid";
- if (!$rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return;
}
}
while ($ei);
- $rs->close();
+ $rs->close(); // end of iteration, close rs
}
}
return null;
}
- if ($instance->enrolstartdate != 0 and $instance->enrolstartdate < time()) {
+ if ($instance->enrolstartdate != 0 and $instance->enrolstartdate > time()) {
//TODO: inform that we can not enrol yet
return null;
}
- if ($instance->enrolenddate != 0 and $instance->enrolenddate > time()) {
+ if ($instance->enrolenddate != 0 and $instance->enrolenddate < time()) {
//TODO: inform that enrolment is not possible any more
return null;
}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['filtername'] = 'Activity Names Auto-linking';
+$string['filtername'] = 'Activity names auto-linking';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['filtername'] = 'Algebra Notation';
+$string['filtername'] = 'Algebra notation';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['badwords'] = 'shit,fucked,fucker,fuck,dickhead, dick,cockhead,cock,cunt,asshole,arsehole,prick,bitch, jism,whore,slut,wanker, wank,bastard,dildo,masturbate, orgasm,penis,nigger, pussy,vagina';
-$string['filtername'] = 'Word Censorship';
+$string['badwords'] = 'shit,fucked,fucker,fuck,dickhead,dick,cockhead,cock,cunt,asshole,arsehole,prick,bitch,jism,whore,slut,wanker,wank,bastard,dildo,masturbate,orgasm,penis,nigger,pussy,vagina';
+$string['filtername'] = 'Word censorship';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['filtername'] = 'Email Protection';
+$string['filtername'] = 'Email protection';
$search = '/<a[^>]*href="([^<]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
+
+ $search = '/<a(\s+[^>]+?)?\s+href="((([^"]+)youtube\.com)\/view_play_list\?p=([^"]*))"[^>]*>(.*?)<\/a>/is';
+ $newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_playlist_callback', $newtext);
}
if (!empty($CFG->filter_mediaplugin_enable_img)) {
'</object>';
}
+/**
+ * Change Youtube playlist into embedded Youtube playlist videos
+ */
+function filter_mediaplugin_youtube_playlist_callback($link, $autostart=false) {
+
+ $site = s($link[4]);
+ $param = s($link[5]);
+ $info = s($link[6]);
+
+ return '<object title="'.$info.'"
+ class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
+ data="'.$site.'youtube.com/p/'.$param.'&fs=1&rel=0" width="400" height="320">'.
+ '<param name="movie" value="'.$site.'youtube.com/p/'.$param.'&fs=1&rel=0" />'.
+ '<param name="FlashVars" value="playerMode=embedded" />'.
+ '<param name="wmode" value="transparent" />'.
+ '<param name="allowFullScreen" value="true" />'.
+ '</object>';
+}
+
/**
* Change links to images into embedded images
*/
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['filtername'] = 'Multimedia Plugins';
+$string['filtername'] = 'Multimedia plugins';
$string['flashanimation'] = 'Flash animation';
$string['flashvideo'] = 'Flash video';
$string['mp3audio'] = 'MP3 audio';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['filtername'] = 'TeX Notation';
+$string['filtername'] = 'TeX notation';
GROUP BY gg.itemid";
$sum_array = array();
- if ($sums = $DB->get_recordset_sql($sql, $params)) {
- foreach ($sums as $itemid => $csum) {
- $sum_array[$itemid] = $csum->sum;
- }
- $sums->close();
+ $sums = $DB->get_recordset_sql($sql, $params);
+ foreach ($sums as $itemid => $csum) {
+ $sum_array[$itemid] = $csum->sum;
}
+ $sums->close();
$columncount=0;
WHERE g.courseid = :courseid $groupwhere $groupingwhere
ORDER BY g.name, u.lastname, u.firstname";
-if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $row) {
- $user = new stdClass();
- $user->id = $row->userid;
- $user->firstname = $row->firstname;
- $user->lastname = $row->lastname;
- $user->username = $row->username;
- $user->idnumber = $row->idnumber;
- if (!$row->groupingid) {
- $row->groupingid = -1;
- }
- if (!array_key_exists($row->groupid, $members[$row->groupingid])) {
- $members[$row->groupingid][$row->groupid] = array();
- }
- if(isset($user->id)){
- $members[$row->groupingid][$row->groupid][] = $user;
- }
+$rs = $DB->get_recordset_sql($sql, $params);
+foreach ($rs as $row) {
+ $user = new stdClass();
+ $user->id = $row->userid;
+ $user->firstname = $row->firstname;
+ $user->lastname = $row->lastname;
+ $user->username = $row->username;
+ $user->idnumber = $row->idnumber;
+ if (!$row->groupingid) {
+ $row->groupingid = -1;
+ }
+ if (!array_key_exists($row->groupid, $members[$row->groupingid])) {
+ $members[$row->groupingid][$row->groupid] = array();
+ }
+ if(isset($user->id)){
+ $members[$row->groupingid][$row->groupid][] = $user;
}
- $rs->close();
}
+$rs->close();
navigation_node::override_active_url(new moodle_url('/group/index.php', array('id'=>$courseid)));
$PAGE->navbar->add(get_string('overview', 'group'));
if (!isset($ACCESSLIB_PRIVATE->croncache[$roleid])) {
$ACCESSLIB_PRIVATE->croncache[$roleid] = array();
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $rd) {
- $ACCESSLIB_PRIVATE->croncache[$roleid][] = $rd;
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $rd) {
+ $ACCESSLIB_PRIVATE->croncache[$roleid][] = $rd;
}
+ $rs->close();
}
foreach ($ACCESSLIB_PRIVATE->croncache[$roleid] as $rd) {
}
} else {
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
+ $rs = $DB->get_recordset_sql($sql, $params);
+ if ($rs->valid()) {
foreach ($rs as $rd) {
$k = "{$rd->path}:{$roleid}";
$accessdata['rdef'][$k][$rd->capability] = $rd->permission;
}
unset($rd);
- $rs->close();
}
+ $rs->close();
}
return $accessdata;
ORDER BY ctx.depth, ctx.path";
$params = array($roleid, "$base/%");
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
+ $rs = $DB->get_recordset_sql($sql, $params);
+ if ($rs->valid()) {
foreach ($rs as $rd) {
$k = "{$rd->path}:{$roleid}";
$accessdata['rdef'][$k][$rd->capability] = $rd->permission;
}
unset($rd);
- $rs->close();
}
+ $rs->close();
return $accessdata;
}
$params = array($context->id, $context->path."/%");
$newrdefs = array();
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $rd) {
- $k = "{$rd->path}:{$rd->roleid}";
- if (!array_key_exists($k, $newrdefs)) {
- $newrdefs[$k] = array();
- }
- $newrdefs[$k][$rd->capability] = $rd->permission;
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $rd) {
+ $k = "{$rd->path}:{$rd->roleid}";
+ if (!array_key_exists($k, $newrdefs)) {
+ $newrdefs[$k] = array();
}
- $rs->close();
- } else {
- debugging('Bad SQL encountered!');
+ $newrdefs[$k][$rd->capability] = $rd->permission;
}
+ $rs->close();
compact_rdefs($newrdefs);
foreach ($newrdefs as $key=>$value) {
ORDER BY ctx.depth ASC, ctx.path DESC, rc.roleid ASC ";
$params = array($roleid, $context->path."/%");
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $rd) {
- $k = "{$rd->path}:{$roleid}";
- $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $rd) {
+ $k = "{$rd->path}:{$roleid}";
+ $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
}
+ $rs->close();
return $accessdata;
}
AND rc.roleid = ?
ORDER BY ctx.depth, ctx.path";
$params = array($context->path."/%", $roleid);
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $rd) {
- $k = "{$rd->path}:{$roleid}";
- $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $rd) {
+ $k = "{$rd->path}:{$roleid}";
+ $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
}
+ $rs->close();
//
// Say we loaded everything for the course context
// transactions used only for performance reasons here
$transaction = $DB->start_delegated_transaction();
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $ctx) {
- delete_context($ctx->contextlevel, $ctx->instanceid);
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $ctx) {
+ delete_context($ctx->contextlevel, $ctx->instanceid);
}
+ $rs->close();
$transaction->allow_commit();
return true;
// Note the result can be used directly as a context (we are going to), the course
// fields are just appended.
- if (!$rs = $DB->get_recordset_sql("SELECT x.*, c.id AS courseid $fieldlist
- FROM {course} c
- INNER JOIN {context} x
- ON (c.id=x.instanceid AND x.contextlevel=".CONTEXT_COURSE.")
- $orderby")) {
- return false;
- }
-
- // Check capability for each course in turn
$courses = array();
+ $rs = $DB->get_recordset_sql("SELECT x.*, c.id AS courseid $fieldlist
+ FROM {course} c
+ INNER JOIN {context} x
+ ON (c.id=x.instanceid AND x.contextlevel=".CONTEXT_COURSE.")
+ $orderby");
+ // Check capability for each course in turn
foreach ($rs as $coursecontext) {
if (has_capability($capability, $coursecontext, $userid, $doanything)) {
// We've got the capability. Make the record look like a course record
}
}
$rs->close();
- return $courses;
+ return empty($courses) ? false : $courses;
}
/**
';
// Loop through completions, and mark as complete
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $record) {
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $record) {
- $completion = new completion_criteria_completion((array)$record);
- $completion->mark_complete($record->timecompleted);
- }
-
- $rs->close();
+ $completion = new completion_criteria_completion((array)$record);
+ $completion->mark_complete($record->timecompleted);
}
+ $rs->close();
}
/**
";
// Loop through completions, and mark as complete
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $record) {
- $completion = new completion_criteria_completion((array)$record);
- $completion->mark_complete($record->timecompleted);
- }
-
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $record) {
+ $completion = new completion_criteria_completion((array)$record);
+ $completion->mark_complete($record->timecompleted);
}
+ $rs->close();
}
/**
';
// Loop through completions, and mark as complete
- if ($rs = $DB->get_recordset_sql($sql, array(time()))) {
- foreach ($rs as $record) {
-
- $completion = new completion_criteria_completion((array)$record);
- $completion->mark_complete($record->timeend);
- }
-
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, array(time()));
+ foreach ($rs as $record) {
+ $completion = new completion_criteria_completion((array)$record);
+ $completion->mark_complete($record->timeend);
}
+ $rs->close();
}
/**
// Loop through completions, and mark as complete
$now = time();
- if ($rs = $DB->get_recordset_sql($sql, array($now, $now))) {
- foreach ($rs as $record) {
+ $rs = $DB->get_recordset_sql($sql, array($now, $now));
+ foreach ($rs as $record) {
- $completion = new completion_criteria_completion((array)$record);
+ $completion = new completion_criteria_completion((array)$record);
- // Use time start if not 0, otherwise use timeenrolled
- if ($record->otimestart) {
- $completion->mark_complete($record->ctimestart);
- }
- else {
- $completion->mark_complete($record->ctimeenrolled);
- }
+ // Use time start if not 0, otherwise use timeenrolled
+ if ($record->otimestart) {
+ $completion->mark_complete($record->ctimestart);
+ } else {
+ $completion->mark_complete($record->ctimeenrolled);
}
-
- $rs->close();
}
+ $rs->close();
}
/**
';
// Loop through completions, and mark as complete
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $record) {
-
- $completion = new completion_criteria_completion((array)$record);
- $completion->mark_complete($record->timecompleted);
- }
-
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $record) {
+ $completion = new completion_criteria_completion((array)$record);
+ $completion->mark_complete($record->timecompleted);
}
+ $rs->close();
}
/**
userid
";
- // Check if result is empty
$now = time();
- if (!$rs = $DB->get_recordset_sql($sql, array($now, $now, $now, $now))) {
+ $rs = $DB->get_recordset_sql($sql, array($now, $now, $now, $now));
+
+ // Check if result is empty
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return;
}
userid
';
+ $rs = $DB->get_recordset_sql($sql, array('timestarted' => $timestarted));
+
// Check if result is empty
- if (!$rs = $DB->get_recordset_sql($sql, array('timestarted' => $timestarted))) {
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return;
}
list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
+ $totalcount = 0;
+ if (!$limitfrom) {
+ $limitfrom = 0;
+ }
+ $visiblecourses = array();
+
$sql = "SELECT $fields $ccselect
FROM {course} c
$ccjoin
ORDER BY $sort";
// pull out all course matching the cat
- if (!$rs = $DB->get_recordset_sql($sql, $params)) {
- return array();
- }
- $totalcount = 0;
-
- if (!$limitfrom) {
- $limitfrom = 0;
- }
-
+ $rs = $DB->get_recordset_sql($sql, $params);
// iteration will have to be done inside loop to keep track of the limitfrom and limitnum
- $visiblecourses = array();
foreach($rs as $course) {
context_instance_preload($course);
if ($course->visible <= 0) {
$searchcond = implode(" AND ", $searchcond);
+ $courses = array();
+ $c = 0; // counts how many visible courses we've seen
+
+ // Tiki pagination
+ $limitfrom = $page * $recordsperpage;
+ $limitto = $limitfrom + $recordsperpage;
+
list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT c.* $ccselect
FROM {course} c
$ccjoin
WHERE $searchcond AND c.id <> ".SITEID."
ORDER BY $sort";
- $courses = array();
- $c = 0; // counts how many visible courses we've seen
-
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- // Tiki pagination
- $limitfrom = $page * $recordsperpage;
- $limitto = $limitfrom + $recordsperpage;
- foreach($rs as $course) {
- context_instance_preload($course);
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
- if ($course->visible || has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
- // Don't exit this loop till the end
- // we need to count all the visible courses
- // to update $totalcount
- if ($c >= $limitfrom && $c < $limitto) {
- $courses[$course->id] = $course;
- }
- $c++;
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach($rs as $course) {
+ context_instance_preload($course);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ if ($course->visible || has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
+ // Don't exit this loop till the end
+ // we need to count all the visible courses
+ // to update $totalcount
+ if ($c >= $limitfrom && $c < $limitto) {
+ $courses[$course->id] = $course;
}
+ $c++;
}
- $rs->close();
}
+ $rs->close();
// our caller expects 2 bits of data - our return
// array, and an updated $totalcount
}
$categories = array();
- if( $rs = $DB->get_recordset_sql($sql, $params) ){
- foreach($rs as $cat) {
- context_instance_preload($cat);
- $catcontext = get_context_instance(CONTEXT_COURSECAT, $cat->id);
- if ($cat->visible || has_capability('moodle/category:viewhiddencategories', $catcontext)) {
- $categories[$cat->id] = $cat;
- }
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach($rs as $cat) {
+ context_instance_preload($cat);
+ $catcontext = get_context_instance(CONTEXT_COURSECAT, $cat->id);
+ if ($cat->visible || has_capability('moodle/category:viewhiddencategories', $catcontext)) {
+ $categories[$cat->id] = $cat;
}
- $rs->close();
}
+ $rs->close();
return $categories;
}
if ($oldversion < 2010033102.00) {
// rename course view capability to participate
- $params = array('view'=>'moodle/course:view', 'participate'=>'moodle/course:participate');
- $sql = "UPDATE {role_capabilities} SET capability = :participate WHERE capability = :view";
+ $params = array('viewcap'=>'moodle/course:view', 'participatecap'=>'moodle/course:participate');
+ $sql = "UPDATE {role_capabilities} SET capability = :participatecap WHERE capability = :viewcap";
$DB->execute($sql, $params);
- $sql = "UPDATE {capabilities} SET name = :participate WHERE name = :view";
+ $sql = "UPDATE {capabilities} SET name = :participatecap WHERE name = :viewcap";
$DB->execute($sql, $params);
// note: the view capability is readded again at the end of upgrade, but with different meaning
upgrade_main_savepoint(true, 2010033102.00);
$sql = "SELECT c.id
FROM {course_categories} c
WHERE c.parent > 0 AND c.parent NOT IN (SELECT pc.id FROM {course_categories} pc)";
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach ($rs as $cat) {
- $cat->depth = 1;
- $cat->path = '/'.$cat->id;
- $cat->parent = 0;
- $DB->update_record('course_categories', $cat);
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql);
+ foreach ($rs as $cat) {
+ $cat->depth = 1;
+ $cat->path = '/'.$cat->id;
+ $cat->parent = 0;
+ $DB->update_record('course_categories', $cat);
}
+ $rs->close();
// now add path and depth to top level categories
$sql = "UPDATE {course_categories}
$sql = "SELECT c.id, pc.path
FROM {course_categories} c, {course_categories} pc
WHERE c.parent=pc.id AND c.depth=0 AND pc.depth=?";
- if ($rs = $DB->get_recordset_sql($sql, array($parentdepth))) {
- foreach ($rs as $cat) {
- $cat->depth = $parentdepth+1;
- $cat->path = $cat->path.'/'.$cat->id;
- $DB->update_record('course_categories', $cat);
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, array($parentdepth));
+ foreach ($rs as $cat) {
+ $cat->depth = $parentdepth+1;
+ $cat->path = $cat->path.'/'.$cat->id;
+ $DB->update_record('course_categories', $cat);
}
+ $rs->close();
$parentdepth++;
if ($parentdepth > 100) {
//something must have gone wrong - nobody can have more than 100 levels of categories, right?
$count = $DB->count_records_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> '1'");
- if ($rs = $DB->get_recordset_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> '1'")) {
+ $rs = $DB->get_recordset_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> '1'");
+
+ if ($rs->valid()) {
upgrade_set_timeout(60*20); // set up timeout, may also abort execution
$DB->update_record('post', $entry);
$pbar->update($i, $count, "Migrated blog attachments - $i/$count.");
}
- $rs->close();
}
+ $rs->close();
@rmdir("$CFG->dataroot/blog/attachments/");
@rmdir("$CFG->dataroot/blog/");
$params = array_merge($in_params, array($current_mnet_localhost_host->id));
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $rec) {
- $DB->set_field('user', 'mnethostid', $current_mnet_localhost_host->id, array('id' => $rec->id));
- upgrade_set_timeout(60); /// Give upgrade at least 60 more seconds
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $rec) {
+ $DB->set_field('user', 'mnethostid', $current_mnet_localhost_host->id, array('id' => $rec->id));
+ upgrade_set_timeout(60); /// Give upgrade at least 60 more seconds
}
+ $rs->close();
// fix up any host records that have incorrect ids
$DB->set_field_select('mnet_host', 'applicationid', $moodleapplicationid, 'id = ? or id = ?', array($current_mnet_localhost_host->id, $current_mnet_all_hosts_host->id));
unset_config('backup_sche_gradebook_history');
unset_config('disablescheduleddbackups');
-}
\ No newline at end of file
+}
* @throws dml_exception if error
*/
public function record_exists_sql($sql, array $params=null) {
- if ($mrs = $this->get_recordset_sql($sql, $params, 0, 1)) {
- $return = $mrs->valid();
- $mrs->close();
- return $return;
- }
- return false;
+ $mrs = $this->get_recordset_sql($sql, $params, 0, 1);
+ $return = $mrs->valid();
+ $mrs->close();
+ return $return;
}
/**
$strictness = (int)$strictness;
if ($strictness == IGNORE_MULTIPLE) {
// do not limit here - ORA does not like that
- if (!$rs = $this->get_recordset_sql($sql, $params)) {
- return false;
- }
- foreach ($rs as $result) {
- $rs->close();
- return $result;
+ $rs = $this->get_recordset_sql($sql, $params);
+ $result = false;
+ foreach ($rs as $rec) {
+ $result = $rec;
+ break;
}
$rs->close();
- return false;
+ return $result;
}
return parent::get_record_sql($sql, $params, $strictness);
}
* @return array of values
*/
public function get_fieldset_sql($sql, array $params=null) {
- if(!$rs = $this->get_recordset_sql($sql, $params)) {
+ $rs = $this->get_recordset_sql($sql, $params);
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return false;
}
$result = array();
* @return array of objects, or empty array if no records were found, or false if an error occurred.
*/
public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
- if(!$rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum)) {
+ $rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return false;
}
$objects = array();
$params = array();
}
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $qhandler) {
- if (isset($failed[$qhandler->handlerid])) {
- // do not try to dispatch any later events when one already asked for retry or ended with exception
- continue;
- }
- $status = events_process_queued_handler($qhandler);
- if ($status === false) {
- // handler is asking for retry, do not send other events to this handler now
- $failed[$qhandler->handlerid] = $qhandler->handlerid;
- } else if ($status === NULL) {
- // means completely broken handler, event data was purged
- $failed[$qhandler->handlerid] = $qhandler->handlerid;
- } else {
- $processed++;
- }
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $qhandler) {
+ if (isset($failed[$qhandler->handlerid])) {
+ // do not try to dispatch any later events when one already asked for retry or ended with exception
+ continue;
+ }
+ $status = events_process_queued_handler($qhandler);
+ if ($status === false) {
+ // handler is asking for retry, do not send other events to this handler now
+ $failed[$qhandler->handlerid] = $qhandler->handlerid;
+ } else if ($status === NULL) {
+ // means completely broken handler, event data was purged
+ $failed[$qhandler->handlerid] = $qhandler->handlerid;
+ } else {
+ $processed++;
}
- $rs->close();
}
+ $rs->close();
// remove events that do not have any handlers waiting
$sql = "SELECT eq.id
* @return string if $text was passed in, the rewritten $text is returned. Otherwise NULL.
*/
function file_prepare_draft_area(&$draftitemid, $contextid, $component, $filearea, $itemid, array $options=null, $text=null) {
- global $CFG, $USER;
+ global $CFG, $USER, $CFG;
$options = (array)$options;
if (!isset($options['subdirs'])) {
$fs->create_file_from_storedfile($file_record, $file);
}
}
+ if (!is_null($text)) {
+ // at this point there should not be any draftfile links yet,
+ // because this is a new text from database that should still contain the @@pluginfile@@ links
+ // this happens when developers forget to post process the text
+ $text = str_replace("\"$CFG->httpswwwroot/draftfile.php", "\"$CFG->httpswwwroot/brokenfile.php#", $text);
+ }
} else {
// nothing to do
}
foreach ($rs as $dir) {
$this->delete_area_files($dir->contextid, $dir->component, $dir->filearea, $dir->itemid);
}
+ $rs->close();
mtrace('done.');
// remove trash pool files once a day
FROM {files} f
LEFT OUTER JOIN {context} c ON f.contextid = c.id
WHERE c.id IS NULL";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$fs = get_file_storage();
foreach ($rs as $ctx) {
$fs->delete_area_files($ctx->contextid);
}
}
+ $rs->close();
mtrace('done.');
mtrace('Deleting trash files... ', '');
ORDER BY g.userid";
// group the results by userid and aggregate the grades for this user
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
+ $rs = $DB->get_recordset_sql($sql, $params);
+ if ($rs->valid()) {
$prevuser = 0;
$grade_values = array();
$excluded = array();
$oldgrade = $used;
}
}
- $rs->close();
$this->aggregate_grades($prevuser, $items, $grade_values, $oldgrade, $excluded);//the last one
}
+ $rs->close();
return true;
}
$now = time(); // no rounding needed, this is not supposed to be called every 10 seconds
list($usql, $params) = $DB->get_in_or_equal($items);
$params[] = $now;
- if ($rs = $DB->get_recordset_select('grade_grades', "itemid $usql AND locked = 0 AND locktime > 0 AND locktime < ?", $params)) {
- foreach ($rs as $grade) {
- $grade_grade = new grade_grade($grade, false);
- $grade_grade->locked = time();
- $grade_grade->update('locktime');
- }
- $rs->close();
+ $rs = $DB->get_recordset_select('grade_grades', "itemid $usql AND locked = 0 AND locktime > 0 AND locktime < ?", $params);
+ foreach ($rs as $grade) {
+ $grade_grade = new grade_grade($grade, false);
+ $grade_grade->locked = time();
+ $grade_grade->update('locktime');
}
+ $rs->close();
}
/**
$return = true;
// group the grades by userid and use formula on the group
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
+ $rs = $DB->get_recordset_sql($sql, $params);
+ if ($rs->valid()) {
$prevuser = 0;
$grade_records = array();
$oldgrade = null;
}
$grade_records['gi'.$used->itemid] = $used->finalgrade;
}
- $rs->close();
if (!$this->use_formula($prevuser, $grade_records, $useditems, $oldgrade)) {
$return = false;
}
}
+ $rs->close();
return $return;
}
WHERE itemtype='mod' AND itemmodule=?";
// go all items for this module and delete them including the grades
- if ($rs = $DB->get_recordset_sql($sql, array($modname))) {
- foreach ($rs as $item) {
- $grade_item = new grade_item($item, false);
- $grade_item->delete('moduninstall');
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, array($modname));
+ foreach ($rs as $item) {
+ $grade_item = new grade_item($item, false);
+ $grade_item->delete('moduninstall');
}
+ $rs->close();
}
/**
SELECT 'x' FROM {grade_items} c WHERE c.itemtype='course' AND c.needsupdate=0 AND c.courseid=i.courseid)";
// go through all courses that have proper final grades and lock them if needed
- if ($rs = $DB->get_recordset_sql($sql, array($now))) {
- foreach ($rs as $item) {
- $grade_item = new grade_item($item, false);
- $grade_item->locked = $now;
- $grade_item->update('locktime');
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, array($now));
+ foreach ($rs as $item) {
+ $grade_item = new grade_item($item, false);
+ $grade_item->locked = $now;
+ $grade_item->update('locktime');
}
+ $rs->close();
$grade_inst = new grade_grade();
$fields = 'g.'.implode(',g.', $grade_inst->required_fields);
SELECT 'x' FROM {grade_items} c WHERE c.itemtype='course' AND c.needsupdate=0 AND c.courseid=i.courseid)";
// go through all courses that have proper final grades and lock them if needed
- if ($rs = $DB->get_recordset_sql($sql, array($now))) {
- foreach ($rs as $grade) {
- $grade_grade = new grade_grade($grade, false);
- $grade_grade->locked = $now;
- $grade_grade->update('locktime');
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, array($now));
+ foreach ($rs as $grade) {
+ $grade_grade = new grade_grade($grade, false);
+ $grade_grade->locked = $now;
+ $grade_grade->update('locktime');
}
+ $rs->close();
//TODO: do not run this cleanup every cron invocation
// cleanup history tables
WHERE gm.userid = ? AND g.courseid = ?";
$params = array($userid, $courseid);
- if (!$rs = $DB->get_recordset_sql($sql, $params)) {
+ $rs = $DB->get_recordset_sql($sql, $params);
+
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return array('0' => array());
}
GROUP BY ip
HAVING COUNT(*) >= ?";
$params = array($CFG->lastnotifyfailure, $CFG->notifyloginthreshold);
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $iprec) {
- if (!empty($iprec->ip)) {
- set_cache_flag('login_failure_by_ip', $iprec->ip, '1', 0);
- }
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $iprec) {
+ if (!empty($iprec->ip)) {
+ set_cache_flag('login_failure_by_ip', $iprec->ip, '1', 0);
}
- $rs->close();
}
+ $rs->close();
/// Get all the INFOs with more than notifyloginthreshold failures since lastnotifyfailure
/// and insert them into the cache_flags temp table
GROUP BY info
HAVING count(*) >= ?";
$params = array($CFG->lastnotifyfailure, $CFG->notifyloginthreshold);
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $inforec) {
- if (!empty($inforec->info)) {
- set_cache_flag('login_failure_by_info', $inforec->info, '1', 0);
- }
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $inforec) {
+ if (!empty($inforec->info)) {
+ set_cache_flag('login_failure_by_info', $inforec->info, '1', 0);
}
- $rs->close();
}
+ $rs->close();
/// Now, select all the login error logged records belonging to the ips and infos
/// since lastnotifyfailure, that we have stored in the cache_flags table
$count = 0;
$messages = '';
/// Iterate over the logs recordset
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $log) {
- $log->time = userdate($log->time);
- $messages .= get_string('notifyloginfailuresmessage','',$log)."\n";
- $count++;
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $log) {
+ $log->time = userdate($log->time);
+ $messages .= get_string('notifyloginfailuresmessage','',$log)."\n";
+ $count++;
}
+ $rs->close();
/// If we haven't run in the last hour and
/// we have something useful to report and we
*
*/
public function initialise() {
- global $DB;
+ global $DB, $SESSION;
if (during_initial_install()) {
return false;
}
$settings = $this->load_user_settings($this->page->course->id);
- $admin = $this->load_administration_settings();
+
+ if (isloggedin() && !isguestuser() && (!property_exists($SESSION, 'load_navigation_admin') || $SESSION->load_navigation_admin)) {
+ $admin = $this->load_administration_settings();
+ $SESSION->load_navigation_admin = ($admin->has_children());
+ } else {
+ $admin = false;
+ }
if ($context->contextlevel == CONTEXT_SYSTEM && $admin) {
$admin->force_open();
$this->add(get_string('returntooriginaluser', 'moodle', fullname($realuser, true)), $url, self::TYPE_SETTING, null, null, new pix_icon('t/left', ''));
}
- // Make sure the first child doesnt have proceed with hr set to true
-
foreach ($this->children as $key=>$node) {
if ($node->nodetype != self::NODETYPE_BRANCH || $node->children->count()===0) {
$node->remove();
} else if (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) {
//nginx - not officially supported
+ if (!isset($_SERVER['SCRIPT_NAME'])) {
+ die('Invalid server configuration detected, please try to add "fastcgi_param SCRIPT_NAME $fastcgi_script_name;" to the nginx server configuration.');
+ }
$rurl['scheme'] = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded
$text = $filtermanager->filter_text($text, $context, array('originalformat' => $format));
break;
}
+ if ($options['filter']) {
+ // at this point there should not be any draftfile links any more,
+ // this happens when developers forget to post process the text.
+ // The only potential problem is that somebody might try to format
+ // the text before storing into database which would be itself big bug.
+ $text = str_replace("\"$CFG->httpswwwroot/draftfile.php", "\"$CFG->httpswwwroot/brokenfile.php#", $text);
+ }
// Warn people that we have removed this old mechanism, just in case they
// were stupid enough to rely on it.
$countparticipants = count_enrolled_users($context);
$participants = get_enrolled_users($context, '', 0, 'u.*', '', $page*MESSAGE_CONTACTS_PER_PAGE, MESSAGE_CONTACTS_PER_PAGE);
-
+
$pagingbar = new paging_bar($countparticipants, $page, MESSAGE_CONTACTS_PER_PAGE, $PAGE->url, 'page');
echo $OUTPUT->render($pagingbar);
GROUP BY $userfields
ORDER BY u.firstname ASC";
- if ($rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id))){
- foreach($rs as $rd){
-
- if($rd->lastaccess >= $timefrom){
- // they have been active recently, so are counted online
- $onlinecontacts[] = $rd;
+ $rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id));
+ foreach ($rs as $rd) {
+ if ($rd->lastaccess >= $timefrom) {
+ // they have been active recently, so are counted online
+ $onlinecontacts[] = $rd;
- }else{
- $offlinecontacts[] = $rd;
- }
+ } else {
+ $offlinecontacts[] = $rd;
+ }
- if (!empty($user2) && $user2->id==$rd->id) {
- $user2->iscontact = true;
- }
+ if (!empty($user2) && $user2->id==$rd->id) {
+ $user2->iscontact = true;
}
- unset($rd);
- $rs->close();
}
+ $rs->close();
// get messages from anyone who isn't in our contact list and count the number
// of messages we have from each of them
GROUP BY $userfields
ORDER BY u.firstname ASC";
- if($rs = $DB->get_recordset_sql($strangersql, array($USER->id))){
- foreach($rs as $rd){
- $strangers[] = $rd;
- }
- unset($rd);
- $rs->close();
+ $rs = $DB->get_recordset_sql($strangersql, array($USER->id));
+ foreach ($rs as $rd) {
+ $strangers[] = $rd;
}
+ $rs->close();
return array($onlinecontacts, $offlinecontacts, $strangers);
}
$doingsearch = false;
if ($frm) {
- $doingsearch = !empty($frm->combinedsubmit) || !empty($frm->keywords) || (!empty($frm->personsubmit) and !empty($frm->name));
+ if (confirm_sesskey()) {
+ $doingsearch = !empty($frm->combinedsubmit) || !empty($frm->keywords) || (!empty($frm->personsubmit) and !empty($frm->name));
+ } else {
+ $frm = false;
+ }
}
if (!empty($frm->combinedsearch)) {
$eventdata->fullmessage = $message;
$eventdata->fullmessagehtml = '';
}
-
+
$eventdata->fullmessageformat = $format;
$eventdata->smallmessage = strip_tags($message);//strip just in case there are is any html that would break the popup notification
if (!empty($eventdata->fullmessagehtml)) {
$eventdata->fullmessagehtml .= "<br /><br />---------------------------------------------------------------------<br />".$emailtagline;
}
-
+
$eventdata->timecreated = time();
return message_send($eventdata);
}
*/
function message_mark_message_read($message, $timeread, $messageworkingempty=false) {
global $DB;
-
+
$message->timeread = $timeread;
$messageid = $message->id;
<table cellpadding="5" class="message_form">
<tr>
<td colspan="3" class="message_heading mdl-left">
- <input type="text" name="combinedsearch" size="40" id="combinedsearch" value="<?php echo $combinedsearchstring; ?>" />
+ <input type="hidden" name="sesskey" value="<?php p(sesskey()); ?>" />
+ <input type="text" name="combinedsearch" size="40" id="combinedsearch" value="<?php p($combinedsearchstring); ?>" />
<input type="submit" name="combinedsubmit" value="<?php print_string('searchcombined','message') ?>" />
<a href="index.php?usergroup=<?php echo VIEW_SEARCH ?>&advanced=1" id="advancedcontactsearchlink"><?php print_string('advanced') ?></a>
</td>
</tr>
<tr>
<td><label for="name"><?php print_string('name') ?></label></td>
- <td><input type="text" name="name" size="40" id="name" value="<? echo $personsearch ?>" /></td>
+ <td><input type="text" name="name" size="40" id="name" value="<?php p($personsearch) ?>" /></td>
<td><input type="submit" name="personsubmit" value="<?php print_string('searchforperson','message') ?>" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2">
- <input type="checkbox" name="mycourses" id="mycourses" /><label for="mycourses"><?php print_string('onlymycourses', 'message') ?></label></td>
+ <input type="checkbox" name="mycourses" id="mycourses" /><label for="mycourses"><?php print_string('onlymycourses', 'message') ?></label>
+ <input type="hidden" name="sesskey" value="<?php p(sesskey()); ?>" />
+ </td>
</tr>
<tr><td colspan="3"></td></tr>
</tr>
<tr>
<td><label for="keywords"><?php print_string('keywords', 'message') ?></label></td>
- <td><input type="text" name="keywords" id="keywords" size="40" value="<? echo $messagesearch ?>" /></td>
+ <td><input type="text" name="keywords" id="keywords" size="40" value="<?php p($messagesearch) ?>" /></td>
<td><input type="submit" name="keywordssubmit" value="<?php print_string('searchmessages','message') ?>" /></td>
</tr>
<tr><td> </td><td colspan="2"><input type="radio" name="keywordsoption" id="keywordsoption4" value="allusers" /><label for="keywordsoption4"><?php print_string('allusers', 'message') ?></label></td></tr>
<?php } ?>
-<?php
-/* Potential abuse problems - temporarily disabled
- echo '<tr><td colspan="3"><input type="radio" name="keywordsoption" alt="'.get_string('allstudents', 'message').'" value="courseusers" />'.get_string('allstudents', 'message').'<br /> '.$cs.'; </td></tr>';
-
-*/
-
-?>
-
</table>
</div>
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
- if ($rs = $DB->get_recordset_sql("SELECT s.id, s.userid, s.teacher, s.assignment, a.course, cm.id AS cmid $sqlfrom ORDER BY a.course, s.assignment")) {
+ $rs = $DB->get_recordset_sql("SELECT s.id, s.userid, s.teacher, s.assignment, a.course, cm.id AS cmid $sqlfrom ORDER BY a.course, s.assignment");
+ if ($rs->valid()) {
$pbar = new progress_bar('migrateassignmentfiles', 500, true);
-
$i = 0;
foreach ($rs as $submission) {
$i++;
@rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment");
@rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment");
}
- $rs->close();
-
}
+ $rs->close();
upgrade_mod_savepoint(true, 2008081900, 'assignment');
}
$sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
FROM {assignment} a, {course_modules} cm, {modules} m
WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
// too much debug output
$pbar = new progress_bar('assignmentupgradegrades', 500, true);
$i=0;
assignment_update_grades($assignment);
$pbar->update($i, $count, "Updating Assignment grades ($i/$count).");
}
- $rs->close();
upgrade_set_timeout(); // reset to default timeout
}
+ $rs->close();
}
/**
}
if ($oldversion < 2008081400) {
- if ($rs = $DB->get_recordset('data')) {
- $pattern = '/\#\#delete\#\#(\s+)\#\#approve\#\#/';
- $replacement = '##delete##$1##approve##$1##export##';
- foreach ($rs as $data) {
- $data->listtemplate = preg_replace($pattern, $replacement, $data->listtemplate);
- $data->singletemplate = preg_replace($pattern, $replacement, $data->singletemplate);
- $DB->update_record('data', $data);
- }
- $rs->close();
+ $pattern = '/\#\#delete\#\#(\s+)\#\#approve\#\#/';
+ $replacement = '##delete##$1##approve##$1##export##';
+ $rs = $DB->get_recordset('data');
+ foreach ($rs as $data) {
+ $data->listtemplate = preg_replace($pattern, $replacement, $data->listtemplate);
+ $data->singletemplate = preg_replace($pattern, $replacement, $data->singletemplate);
+ $DB->update_record('data', $data);
}
+ $rs->close();
+
upgrade_mod_savepoint(true, 2008081400, 'data');
}
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
- if ($rs = $DB->get_recordset_sql("SELECT c.id, f.type, r.dataid, c.recordid, f.id AS fieldid, r.userid, c.content, c.content1, d.course, r.userid, cm.id AS cmid $sqlfrom ORDER BY d.course, d.id")) {
+ $rs = $DB->get_recordset_sql("SELECT c.id, f.type, r.dataid, c.recordid, f.id AS fieldid, r.userid, c.content, c.content1, d.course, r.userid, cm.id AS cmid $sqlfrom ORDER BY d.course, d.id");
+ if ($rs->valid()) {
$pbar = new progress_bar('migratedatafiles', 500, true);
$i = 0;
@rmdir("$CFG->dataroot/$content->course/$CFG->moddata/data");
@rmdir("$CFG->dataroot/$content->course/$CFG->moddata");
}
- $rs->close();
}
+ $rs->close();
+
upgrade_mod_savepoint(true, 2008091400, 'data');
}
$lastdataid = null;
$lastcourseid = null;
$modcontext = null;
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach($rs as $res) {
- if ($res->dataid != $lastdataid || $res->courseid != $lastcourseid) {
- $cm = get_coursemodule_from_instance('data', $res->dataid, $res->courseid);
- if ($cm) {
- $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
- }
- $lastdataid = $res->dataid;
- $lastcourseid = $res->courseid;
- }
- $cmt = new stdClass();
- $cmt->contextid = $modcontext->id;
- $cmt->commentarea = 'database_entry';
- $cmt->itemid = $res->itemid;
- $cmt->content = $res->commentcontent;
- $cmt->format = $res->format;
- $cmt->userid = $res->userid;
- $cmt->timecreated = $res->timecreated;
- // comments class will throw an exception if error occurs
- $cmt_id = $DB->insert_record('comments', $cmt);
- if (!empty($cmt_id)) {
- $DB->delete_records('data_comments', array('id'=>$res->commentid));
+ $rs = $DB->get_recordset_sql($sql);
+ foreach($rs as $res) {
+ if ($res->dataid != $lastdataid || $res->courseid != $lastcourseid) {
+ $cm = get_coursemodule_from_instance('data', $res->dataid, $res->courseid);
+ if ($cm) {
+ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
+ $lastdataid = $res->dataid;
+ $lastcourseid = $res->courseid;
+ }
+ $cmt = new stdClass();
+ $cmt->contextid = $modcontext->id;
+ $cmt->commentarea = 'database_entry';
+ $cmt->itemid = $res->itemid;
+ $cmt->content = $res->commentcontent;
+ $cmt->format = $res->format;
+ $cmt->userid = $res->userid;
+ $cmt->timecreated = $res->timecreated;
+ // comments class will throw an exception if error occurs
+ $cmt_id = $DB->insert_record('comments', $cmt);
+ if (!empty($cmt_id)) {
+ $DB->delete_records('data_comments', array('id'=>$res->commentid));
}
}
+ $rs->close();
// the default exception handler will stop the script if error occurs before
$dbman->drop_table($table);
}
$conditions = array('fieldid'=>$this->field->id);
}
- if ($rs = $DB->get_recordset('data_content', $conditions)) {
+ $rs = $DB->get_recordset('data_content', $conditions);
+ if ($rs->valid()) {
$fs = get_file_storage();
foreach ($rs as $content) {
$fs->delete_area_files($this->context->id, 'mod_data', 'content', $content->id);
}
- $rs->close();
}
+ $rs->close();
return $DB->delete_records('data_content', $conditions);
}
$sql = "SELECT d.*, cm.idnumber AS cmidnumber, d.course AS courseid
FROM {data} d, {course_modules} cm, {modules} m
WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
// too much debug output
$pbar = new progress_bar('dataupgradegrades', 500, true);
$i=0;
data_update_grades($data, 0, false);
$pbar->update($i, $count, "Updating Database grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
$course_context = get_context_instance(CONTEXT_COURSE, $data->courseid);
$notenrolled = array();
$fields = array();
- if ($rs = $DB->get_recordset_sql($recordssql, array($data->courseid))) {
- foreach ($rs as $record) {
- if (array_key_exists($record->userid, $notenrolled) or !$record->userexists or $record->userdeleted
- or !is_enrolled($course_context, $record->userid)) {
- //delete ratings
- if (!$cm = get_coursemodule_from_instance('data', $record->dataid)) {
- continue;
- }
- $datacontext = get_context_instance(CONTEXT_MODULE, $cm->id);
- $ratingdeloptions->contextid = $datacontext->id;
- $ratingdeloptions->itemid = $record->id;
- $rm->delete_ratings($ratingdeloptions);
-
- $DB->delete_records('comments', array('itemid'=>$record->id, 'commentarea'=>'database_entry'));
- $DB->delete_records('data_content', array('recordid'=>$record->id));
- $DB->delete_records('data_records', array('id'=>$record->id));
- // HACK: this is ugly - the recordid should be before the fieldid!
- if (!array_key_exists($record->dataid, $fields)) {
- if ($fs = $DB->get_records('data_fields', array('dataid'=>$record->dataid))) {
- $fields[$record->dataid] = array_keys($fs);
- } else {
- $fields[$record->dataid] = array();
- }
- }
- foreach($fields[$record->dataid] as $fieldid) {
- fulldelete("$CFG->dataroot/$data->courseid/moddata/data/$record->dataid/$fieldid/$record->id");
+ $rs = $DB->get_recordset_sql($recordssql, array($data->courseid));
+ foreach ($rs as $record) {
+ if (array_key_exists($record->userid, $notenrolled) or !$record->userexists or $record->userdeleted
+ or !is_enrolled($course_context, $record->userid)) {
+ //delete ratings
+ if (!$cm = get_coursemodule_from_instance('data', $record->dataid)) {
+ continue;
+ }
+ $datacontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+ $ratingdeloptions->contextid = $datacontext->id;
+ $ratingdeloptions->itemid = $record->id;
+ $rm->delete_ratings($ratingdeloptions);
+
+ $DB->delete_records('comments', array('itemid'=>$record->id, 'commentarea'=>'database_entry'));
+ $DB->delete_records('data_content', array('recordid'=>$record->id));
+ $DB->delete_records('data_records', array('id'=>$record->id));
+ // HACK: this is ugly - the recordid should be before the fieldid!
+ if (!array_key_exists($record->dataid, $fields)) {
+ if ($fs = $DB->get_records('data_fields', array('dataid'=>$record->dataid))) {
+ $fields[$record->dataid] = array_keys($fs);
+ } else {
+ $fields[$record->dataid] = array();
}
- $notenrolled[$record->userid] = true;
}
+ foreach($fields[$record->dataid] as $fieldid) {
+ fulldelete("$CFG->dataroot/$data->courseid/moddata/data/$record->dataid/$fieldid/$record->id");
+ }
+ $notenrolled[$record->userid] = true;
}
- $rs->close();
- $status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotenrolled', 'data'), 'error'=>false);
}
+ $rs->close();
+ $status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotenrolled', 'data'), 'error'=>false);
}
// remove all ratings
return;
}
- if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'directory', 'migrated'=>0))) {
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'directory', 'migrated'=>0));
+
+ if (!$candidates->valid()) {
+ $candidates->close(); // Not going to iterate (but exit), close rs
return;
}
// clear all course modinfo caches
rebuild_course_cache(0, true);
-}
\ No newline at end of file
+}
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
- if ($rs = $DB->get_recordset_sql("SELECT p.id, p.attachment, p.userid, d.forum, f.course, cm.id AS cmid $sqlfrom ORDER BY f.course, f.id, d.id")) {
+ $rs = $DB->get_recordset_sql("SELECT p.id, p.attachment, p.userid, d.forum, f.course, cm.id AS cmid $sqlfrom ORDER BY f.course, f.id, d.id");
+ if ($rs->valid()) {
$pbar = new progress_bar('migrateforumfiles', 500, true);
@rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum/$post->forum");
@rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum");
}
- $rs->close();
}
+ $rs->close();
upgrade_mod_savepoint(true, 2008081900, 'forum');
}
$sql = "SELECT f.*, cm.idnumber AS cmidnumber, f.course AS courseid
FROM {forum} f, {course_modules} cm, {modules} m
WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$pbar = new progress_bar('forumupgradegrades', 500, true);
$i=0;
foreach ($rs as $forum) {
forum_update_grades($forum, 0, false);
$pbar->update($i, $count, "Updating Forum grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
- if ($rs = $DB->get_recordset_sql("SELECT ge.id, ge.userid, ge.attachment, ge.glossaryid, ge.sourceglossaryid, g.course, cm.id AS cmid $sqlfrom ORDER BY g.course, g.id")) {
+ $rs = $DB->get_recordset_sql("SELECT ge.id, ge.userid, ge.attachment, ge.glossaryid, ge.sourceglossaryid, g.course, cm.id AS cmid $sqlfrom ORDER BY g.course, g.id");
+ if ($rs->valid()) {
$pbar = new progress_bar('migrateglossaryfiles', 500, true);
@rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary/$entry->glossaryid");
@rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary");
}
- $rs->close();
}
+ $rs->close();
upgrade_mod_savepoint(true, 2008081900, 'glossary');
}
$modcontext = null;
/// move glossary comments to comments table
- if ($rs = $DB->get_recordset_sql($sql)) {
- foreach($rs as $res) {
- if ($res->glossaryid != $lastglossaryid || $res->courseid != $lastcourseid) {
- $cm = get_coursemodule_from_instance('glossary', $res->glossaryid, $res->courseid);
- if ($cm) {
- $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
- }
- $lastglossaryid = $res->glossaryid;
- $lastcourseid = $res->courseid;
- }
- $cmt = new stdClass();
- $cmt->contextid = $modcontext->id;
- $cmt->commentarea = 'glossary_entry';
- $cmt->itemid = $res->itemid;
- $cmt->content = $res->commentcontent;
- $cmt->format = $res->format;
- $cmt->userid = $res->userid;
- $cmt->timecreated = $res->timemodified;
- $cmt_id = $DB->insert_record('comments', $cmt);
- if (!empty($cmt_id)) {
- $DB->delete_records('glossary_comments', array('id'=>$res->old_id));
+ $rs = $DB->get_recordset_sql($sql);
+ foreach($rs as $res) {
+ if ($res->glossaryid != $lastglossaryid || $res->courseid != $lastcourseid) {
+ $cm = get_coursemodule_from_instance('glossary', $res->glossaryid, $res->courseid);
+ if ($cm) {
+ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
+ $lastglossaryid = $res->glossaryid;
+ $lastcourseid = $res->courseid;
+ }
+ $cmt = new stdClass();
+ $cmt->contextid = $modcontext->id;
+ $cmt->commentarea = 'glossary_entry';
+ $cmt->itemid = $res->itemid;
+ $cmt->content = $res->commentcontent;
+ $cmt->format = $res->format;
+ $cmt->userid = $res->userid;
+ $cmt->timecreated = $res->timemodified;
+ $cmt_id = $DB->insert_record('comments', $cmt);
+ if (!empty($cmt_id)) {
+ $DB->delete_records('glossary_comments', array('id'=>$res->old_id));
}
}
+ $rs->close();
$dbman->drop_table($table);
}
$sql = "SELECT g.*, cm.idnumber AS cmidnumber, g.course AS courseid
FROM {glossary} g, {course_modules} cm, {modules} m
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$pbar = new progress_bar('glossaryupgradegrades', 500, true);
$i=0;
foreach ($rs as $glossary) {
glossary_update_grades($glossary, 0, false);
$pbar->update($i, $count, "Updating Glossary grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
$course_context = get_context_instance(CONTEXT_COURSE, $data->courseid);
$notenrolled = array();
- if ($rs = $DB->get_recordset_sql($entriessql, $params)) {
+ $rs = $DB->get_recordset_sql($entriessql, $params);
+ if ($rs->valid()) {
foreach ($rs as $entry) {
if (array_key_exists($entry->userid, $notenrolled) or !$entry->userexists or $entry->userdeleted
or !is_enrolled($course_context , $entry->userid)) {
}
}
}
- $rs->close();
$status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotenrolled', 'glossary'), 'error'=>false);
}
+ $rs->close();
}
// remove all ratings
return;
}
- if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'ims', 'migrated'=>0))) {
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'ims', 'migrated'=>0));
+ if (!$candidates->valid()) {
+ $candidates->close(); // Not going to iterate (but exit), close rs
return;
}
fulldelete($root);
}
}
-
$candidates->close();
// clear all course modinfo caches
$sql = "SELECT l.*, cm.idnumber AS cmidnumber, l.course AS courseid
FROM {lesson} l, {course_modules} cm, {modules} m
WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$pbar = new progress_bar('lessonupgradegrades', 500, true);
$i=0;
foreach ($rs as $lesson) {
lesson_update_grades($lesson, 0, false);
$pbar->update($i, $count, "Updating Lesson grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
$fs = get_file_storage();
- if ($candidates = $DB->get_recordset('resource_old', array('type'=>'html', 'migrated'=>0))) {
- foreach ($candidates as $candidate) {
- page_20_migrate_candidate($candidate, $fs, FORMAT_HTML);
- }
- $candidates->close();
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'html', 'migrated'=>0));
+ foreach ($candidates as $candidate) {
+ page_20_migrate_candidate($candidate, $fs, FORMAT_HTML);
}
-
- if ($candidates = $DB->get_recordset('resource_old', array('type'=>'text', 'migrated'=>0))) {
- foreach ($candidates as $candidate) {
- //there might be some rubbish instead of format int value
- $format = (int)$candidate->reference;
- if ($format < 0 or $format > 4) {
- $format = FORMAT_MOODLE;
- }
- page_20_migrate_candidate($candidate, $fs, $format);
+ $candidates->close();
+
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'text', 'migrated'=>0));
+ foreach ($candidates as $candidate) {
+ //there might be some rubbish instead of format int value
+ $format = (int)$candidate->reference;
+ if ($format < 0 or $format > 4) {
+ $format = FORMAT_MOODLE;
}
- $candidates->close();
+ page_20_migrate_candidate($candidate, $fs, $format);
}
+ $candidates->close();
// clear all course modinfo caches
rebuild_course_cache(0, true);
$this->pagequestionids = array();
// Get the appropriate layout string (from quiz or attempt).
- $layout = $this->get_layout_string();
+ $layout = quiz_clean_layout($this->get_layout_string(), true);
if (empty($layout)) {
// Nothing to do.
return;
}
// Break up the layout string into pages.
- $pagelayouts = explode(',0', quiz_clean_layout($layout, true));
+ $pagelayouts = explode(',0', $layout);
// Strip off any empty last page (normally there is one).
if (end($pagelayouts) == '') {
$sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
FROM {quiz} a, {course_modules} cm, {modules} m
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$pbar = new progress_bar('quizupgradegrades', 500, true);
$i=0;
foreach ($rs as $quiz) {
quiz_update_grades($quiz, 0, false);
$pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
$string['overview'] = 'Grades';
$string['overviewdownload'] = 'Overview download';
$string['overviewreport'] = 'Grades report';
-$string['overviewreportgraph'] = 'Overall Number of Students Achieving Grade Ranges';
-$string['overviewreportgraphgroup'] = 'Number of Students in Group \'{$a}\' Achieving Grade Ranges';
+$string['overviewreportgraph'] = 'Overall number of students achieving grade ranges';
+$string['overviewreportgraphgroup'] = 'Number of students in group \'{$a}\' achieving grade ranges';
$string['pagesize'] = 'Page size';
$string['preferencespage'] = 'Preferences just for this page';
$string['preferencessave'] = 'Show report';
*/
$string['cannotloadoptions'] = 'Could not load question options';
-$string['pagesize'] = 'Page Size';
+$string['pagesize'] = 'Page size';
$string['reportresponses'] = 'Responses';
$string['responses'] = 'Responses';
$string['responsesdownload'] = 'Responses download';
$string['count'] = 'Count';
$string['coursename'] = 'Course name';
$string['detailedanalysis'] = 'More detailed analysis of the responses to this question';
-$string['discrimination_index'] = 'Discrimination Index';
-$string['discriminative_efficiency'] = 'Discriminative Efficiency';
+$string['discrimination_index'] = 'Discrimination index';
+$string['discriminative_efficiency'] = 'Discriminative efficiency';
$string['downloadeverything'] = 'Download full report as';
$string['duration'] = 'Open for';
$string['effective_weight'] = 'Effective weight';
$string['position'] = 'Position';
$string['positions'] = 'Position(s)';
$string['questioninformation'] = 'Question information';
-$string['questionname'] = 'Question Name';
+$string['questionname'] = 'Question name';
$string['questionnumber'] = 'Q#';
$string['questionstatistics'] = 'Question statistics';
-$string['questiontype'] = 'Question Type';
+$string['questiontype'] = 'Question type';
$string['quizinformation'] = 'Quiz information';
$string['quizname'] = 'Quiz name';
$string['quizoverallstatistics'] = 'Quiz overall statistics';
$string['statisticsreport'] = 'Statistics report';
$string['statisticsreportgraph'] = 'Statistics for question positions';
$string['statistics:view'] = 'View statistics report';
-$string['statsfor'] = 'Quiz Statistics (for {$a})';
+$string['statsfor'] = 'Quiz statistics (for {$a})';
/// or a button to go back to the course page.
echo $OUTPUT->box_start('quizattempt');
$buttontext = ''; // This will be set something if as start/continue attempt button should appear.
- if (!$quiz->questions) {
+ if (!quiz_clean_layout($quiz->questions, true)) {
echo $OUTPUT->heading(get_string("noquestions", "quiz"));
} else {
if ($unfinished) {
JOIN {modules} m ON m.name='resource'
JOIN {course_modules} cm ON (cm.module = m.id AND cm.instance = r.id)";
- if ($instances = $DB->get_recordset_sql($sql)) {
- foreach ($instances as $instance) {
- $context = get_context_instance(CONTEXT_MODULE, $instance->cmid);
- $component = 'mod_resource';
- $filearea = 'content';
- $itemid = 0;
- $filepath = file_correct_filepath(dirname($instance->mainfile));
- $filename = basename($instance->mainfile);
- file_set_sortorder($context->id, $component, $filearea, $itemid, $filepath, $filename, 1);
- }
+ $instances = $DB->get_recordset_sql($sql);
+ foreach ($instances as $instance) {
+ $context = get_context_instance(CONTEXT_MODULE, $instance->cmid);
+ $component = 'mod_resource';
+ $filearea = 'content';
+ $itemid = 0;
+ $filepath = file_correct_filepath(dirname($instance->mainfile));
+ $filename = basename($instance->mainfile);
+ file_set_sortorder($context->id, $component, $filearea, $itemid, $filepath, $filename, 1);
}
+ $instances->close();
/// Define field mainfile to be dropped from resource
$table = new xmldb_table('resource');
$withrelativelinks = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/x-shockwave-flash');
// note: pdf doc and other types may contain links too, but we do not support relative links there
- if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0))) {
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0));
+ if (!$candidates->valid()) {
+ $candidates->close(); // Not going to iterate (but exit), close rs
return;
}
$siteid = get_site()->id;
$fs = get_file_storage();
- if (strpos($path, 'LOCALPATH') === 0) {
+ if (empty($candidate->cmid)) {
+ // skip borked records
+ continue;
+
+ } else if (strpos($path, 'LOCALPATH') === 0) {
// ignore not maintained local files - sorry
continue;
return true;
}
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
- $strexpand = get_string('expcoll','scorm');
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
}
$result = new stdClass();
- //$result->toc = "<ul id='s0' class='$liststyle'>\n";
if ($tocheader) {
$result->toc = '<div id="scorm_layout">';
$result->toc .= '<div id="scorm_toc">';
$i--;
}
if (($i == 0) && ($sco->parent != $currentorg)) {
- $style = '';
- if (isset($_COOKIE['hide:SCORMitem'.$sco->id])) {
- $style = ' style="display: none;"';
- }
- //$result->toc .= "\t\t<li><ul id='s$sublist' class='$liststyle'$style>\n";
$result->toc .= "\t\t<ul>\n";
$level++;
} else {
}
if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
- $icon = 'minus';
- if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
- $icon = 'plus';
- }
- //$result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$OUTPUT->pix_url($icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
- } else if ($isvisible) {
- //$result->toc .= '<img src="'.$OUTPUT->pix_url('spacer', 'scorm').'" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
}
if (!empty($sco->launch)) {
if ($isvisible) {
- $startbold = '';
- $endbold = '';
$score = '';
if (empty($scoid) && ($mode != 'normal')) {
$scoid = $sco->id;
$scoid = $sco->id;
}
}
- if ($usertrack->score_raw != '') {
+ if ($usertrack->score_raw != '' && has_capability('mod/scorm:viewscores', get_context_instance(CONTEXT_MODULE,$cmid))) {
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
}
$strsuspended = get_string('suspended','scorm');
}
}
if ($sco->id == $scoid) {
- $startbold = '<b>';
- $endbold = '</b>';
$findnext = true;
- $shownext = isset($sco->next) ? $sco->next : 0;
- $showprev = isset($sco->previous) ? $sco->previous : 0;
}
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
- $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+
$thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
$link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
- //$result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- if ($sco->launch) {
- $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
- $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else {
+ if ($sco->launch) {
+ $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
+ } else {
+ $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ }
}
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
if ($play) {
// should be disabled
$result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
- }
- else {
+ } else {
$result->toc .= $statusicon.' '.format_string($sco->title)."\n";
}
}
return $result;
}
-
-
return eval('return '.implode($stack).';');
}
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
- $strexpand = get_string('expcoll','scorm');
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
}
$result = new stdClass();
- //$result->toc = "<ul id='s0' class='$liststyle'>\n";
if ($tocheader) {
$result->toc = '<div id="scorm_layout">';
$result->toc .= '<div id="scorm_toc">';
$i--;
}
if (($i == 0) && ($sco->parent != $currentorg)) {
- $style = '';
- if (isset($_COOKIE['hide:SCORMitem'.$sco->id])) {
- $style = ' style="display: none;"';
- }
- //$result->toc .= "\t\t<li><ul id='s$sublist' class='$liststyle'$style>\n";
$result->toc .= "\t\t<ul>\n";
-
-
-
$level++;
} else {
$result->toc .= $closelist;
}
if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
- $icon = 'minus';
- if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
- $icon = 'plus';
- }
- //$result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$OUTPUT->pix_url($icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
- } else if ($isvisible) {
- //$result->toc .= '<img src="'.$OUTPUT->pix_url('spacer', 'scorm').'" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
}
if (!empty($sco->launch)) {
if ($isvisible) {
- $startbold = '';
- $endbold = '';
$score = '';
if (empty($scoid) && ($mode != 'normal')) {
$scoid = $sco->id;
$scoid = $sco->id;
}
}
- if ($usertrack->score_raw != '') {
+ if ($usertrack->score_raw != '' && has_capability('mod/scorm:viewscores', get_context_instance(CONTEXT_MODULE,$cmid))) {
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
}
$strsuspended = get_string('suspended','scorm');
}
}
if ($sco->id == $scoid) {
- $startbold = '<b>';
- $endbold = '</b>';
$findnext = true;
- $shownext = isset($sco->next) ? $sco->next : 0;
- $showprev = isset($sco->previous) ? $sco->previous : 0;
}
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
- // $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
$thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
$link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."\n";
- //$result->toc .= $startbold.'<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>'.$endbold."\n";
- if ($sco->launch) {
- $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
- $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else { //display toc for inside scorm player
+ if ($sco->launch) {
+ $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
+ } else {
+ $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ }
}
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
if ($play) {
// should be disabled
$result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
- }
- else {
+ } else {
$result->toc .= $statusicon.' '.format_string($sco->title)."\n";
}
}
}
-
if ($scorm->hidetoc == 0) {
$PAGE->requires->data_for_js('scormdata', array(
'plusicon' => $OUTPUT->pix_url('plus', 'scorm'),
return $result;
}
-
-
<?php
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
- $strexpand = get_string('expcoll','scorm');
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
$i--;
}
if (($i == 0) && ($sco->parent != $currentorg)) {
- $style = '';
- if (isset($_COOKIE['hide:SCORMitem'.$sco->id])) {
- $style = ' style="display: none;"';
- }
- //$result->toc .= "\t\t<li><ul id='s$sublist' class='$liststyle'$style>\n";
$result->toc .= "\t\t><ul>\n";
$level++;
} else {
if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) &&
(($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
- $icon = 'minus';
- if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
- $icon = 'plus';
- }
-// $result->toc .= "\t\t".'<li><a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');">'.
-// '<img id="img'.$sublist.'" src="'.$OUTPUT->pix_url($icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
- } else if ($isvisible) {
-// $result->toc .= "\t\t".'<li><img src="'.$OUTPUT->pix_url('spacer', 'scorm').'" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
}
if (!empty($sco->launch)) {
if ($isvisible) {
- $startbold = '';
- $endbold = '';
$score = '';
if (empty($scoid) && ($mode != 'normal')) {
$scoid = $sco->id;
$scoid = $sco->id;
}
}
- if ($usertrack->score_raw != '') {
+ if ($usertrack->score_raw != '' && has_capability('mod/scorm:viewscores', get_context_instance(CONTEXT_MODULE,$cmid))) {
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
}
$strsuspended = get_string('suspended','scorm');
}
if ($sco->id == $scoid) {
- $startbold = '<b>';
- $endbold = '</b>';
$findnext = true;
- $shownext = isset($sco->next) ? $sco->next : 0;
- $showprev = isset($sco->prev) ? $sco->prev : 0;
}
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
+
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
- $thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
- $link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
- //$result->toc .= '<li><a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>'."</li>\n";
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else {
if ($sco->launch) {
+ $link = 'a='.$scorm->id.'&scoid='.$sco->id.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
$result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
+ } else {
$result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
}
- $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
+ }
+ $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
if ($sco->id == $scoid) {
$result->prerequisites = false;
}
- //$result->toc .= $statusicon.' '.format_string($sco->title)."\n";
if ($play) {
// should be disabled
$result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
- }
- else {
+ } else {
$result->toc .= $statusicon.' '.format_string($sco->title)."\n";
}
}
return $result;
}
-
-
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
- if ($rs = $DB->get_recordset_sql("SELECT s.id, s.scormtype, s.reference, s.course, cm.id AS cmid $sqlfrom ORDER BY s.course, s.id")) {
+ $rs = $DB->get_recordset_sql("SELECT s.id, s.scormtype, s.reference, s.course, cm.id AS cmid $sqlfrom ORDER BY s.course, s.id");
+ if ($rs->valid()) {
$pbar = new progress_bar('migratescormfiles', 500, true);
@rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/scorm/");
@rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/");
}
- $rs->close();
}
+ $rs->close();
/// scorm savepoint reached
upgrade_mod_savepoint(true, 2008090304, 'scorm');
$string['exceededmaxattempts'] = 'You have reached the maximum number of attempts.';
$string['exit'] = 'Exit course';
$string['exitactivity'] = 'Exit activity';
-$string['expcoll'] = 'Expand/Collide';
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
$string['external'] = 'Update external packages timing';
$string['failed'] = 'Failed';
$sql = "SELECT s.*, cm.idnumber AS cmidnumber, s.course AS courseid
FROM {scorm} s, {course_modules} cm, {modules} m
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
- if ($rs = $DB->get_recordset_sql($sql)) {
+ $rs = $DB->get_recordset_sql($sql);
+ if ($rs->valid()) {
$pbar = new progress_bar('scormupgradegrades', 500, true);
$i=0;
foreach ($rs as $scorm) {
scorm_update_grades($scorm, 0, false);
$pbar->update($i, $count, "Updating Scorm grades ($i/$count).");
}
- $rs->close();
}
+ $rs->close();
}
/**
define('FIRSTATTEMPT', '2');
define('LASTATTEMPT', '3');
+define('TOCJSLINK', 1);
+define('TOCFULLURL', 2);
+
/// Local Library of functions for module scorm
/**
break;
case HIGHESTATTEMPT:
$maxscore = 0;
- $attempttime = 0;
for ($attempt = 1; $attempt <= $lastattempt; $attempt++) {
$attemptscore = scorm_grade_user_attempt($scorm, $userid, $attempt);
$maxscore = $attemptscore > $maxscore ? $attemptscore: $maxscore;
global $CFG, $DB, $PAGE, $OUTPUT;
$strupdate = get_string('update');
- $strmodule = get_string('modulename','scorm');
$context = get_context_instance(CONTEXT_COURSE,$course->id);
echo '<div class="mod-scorm">';
}
$colspan = ' colspan="2"';
}
- $options = (object)array('noclean'=>true);
$headertext .= '</td></tr><tr><td'.$colspan.'>'.get_string('summary').':<br />'.format_module_intro('scorm', $scorm, $scorm->coursemodule).'</td></tr></table>';
echo $OUTPUT->box($headertext,'generalbox boxwidthwide');
- scorm_view_display($user, $scorm, 'view.php?id='.$course->id, $cm, '100%');
+ scorm_view_display($user, $scorm, 'view.php?id='.$course->id, $cm);
} else {
if (has_capability('moodle/course:update', $context)) {
// Create a new activity
echo '</div>';
}
-function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
+function scorm_view_display ($user, $scorm, $action, $cm) {
global $CFG, $DB, $PAGE, $OUTPUT;
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
}
}
-/*
- $orgidentifier = '';
- if ($org = $DB->get_record('scorm_scoes', array('id'=>$organization))) {
- if (($org->organization == '') && ($org->launch == '')) {
- $orgidentifier = $org->identifier;
- } else {
- $orgidentifier = $org->organization;
- }
- }*/
-
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
if (!file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php')) {
$scorm->version = 'scorm_12';
}
require_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php');
- $result = scorm_get_toc($user,$scorm,'structlist',$orgidentifier);
+ $result = scorm_get_toc($user,$scorm,$cm->id,TOCFULLURL,$orgidentifier);
$incomplete = $result->incomplete;
// do we want the TOC to be displayed?
}
$result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<BR>';
- $gradereported = 0;
- $gradesum = 0;
if ($scorm->maxattempt == 1) {
switch ($scorm->grademethod) {
case GRADEHIGHEST:
// then convert in the same way as SCORM 2004
$pattern = array( '#T0+H#', '#([A-Z])0+M#', '#([A-Z])[0.]+S#', '#\.0+S#', '#0*(\d+)H#', '#0*(\d+)M#', '#0+\.(\d+)S#', '#0*([\d.]+)S#', '#T#' );
$replace = array( 'T', '$1', '$1', 'S', '$1 '.$strhours.' ', '$1 '.$strminutes.' ', '0.$1 '.$strseconds, '$1 '.$strseconds, '' );
- //$pattern = '##';
- //$replace = '';
}
$result = preg_replace($pattern, $replace, $duration);
}
$attemptstr = '&attempt=' . $attempt;
- $result = scorm_get_toc($USER, $scorm, 'structurelist', $currentorg, $scoid, $mode, $attempt, true, true);
+ $result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
$sco = $result->sco;
if (($mode == 'browse') && ($scorm->hidebrowse == 1)) {
$result = true;
$request = null;
if (has_capability('mod/scorm:savetrack', get_context_instance(CONTEXT_MODULE,$cm->id))) {
- $result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,$attempt,true, false);
+ $result = scorm_get_toc($USER,$scorm,$cm->id,TOCJSLINK,$currentorg,$scoid,$mode,$attempt,true, false);
echo $result->toc;
}
}
$slist = implode(',', $ids); // there should not be hundreds of glossaries in one course, right?
- if (!$rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,
- u.firstname, u.lastname, u.email, u.picture
- FROM {survey_answers} sa
- JOIN {user} u ON u.id = sa.userid
- WHERE sa.survey IN ($slist) AND sa.time > ?
- GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture
- ORDER BY time ASC", array($timestart))) {
+ $rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,
+ u.firstname, u.lastname, u.email, u.picture
+ FROM {survey_answers} sa
+ JOIN {user} u ON u.id = sa.userid
+ WHERE sa.survey IN ($slist) AND sa.time > ?
+ GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture
+ ORDER BY time ASC", array($timestart));
+ if (!$rs->valid()) {
+ $rs->close(); // Not going to iterate (but exit), close rs
return false;
}
return;
}
- if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0))) {
+ $candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0));
+ if (!$candidates->valid()) {
+ $candidates->close(); // Not going to iterate (but exit), close rs
return;
}
// clear all course modinfo caches
rebuild_course_cache(0, true);
-}
\ No newline at end of file
+}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['multianswer'] = 'Embedded Answers (Cloze)';
-$string['multianswer_help'] = 'Embedded Answers (Cloze) format enables the import of a passage of text with questions such as multiple-choice and short answer embedded within it.';
+$string['multianswer'] = 'Embedded answers (Cloze)';
+$string['multianswer_help'] = 'Embedded answers (Cloze) format enables the import of a passage of text with questions such as multiple-choice and short answer embedded within it.';
$string['multianswer_link'] = 'question/type/multianswer';
*/
$string['addingcalculated'] = 'Adding a calculated question';
-$string['additem'] = 'Add Item';
+$string['additem'] = 'Add item';
$string['addmoreanswerblanks'] = 'Add another answer blank.';
-$string['addmoreunitblanks'] = 'Blanks for {$a} More Units';
-$string['addsets'] = 'Add Set(s)';
+$string['addmoreunitblanks'] = 'Blanks for {$a} more units';
+$string['addsets'] = 'Add set(s)';
$string['answerhdr'] = 'Answer';
$string['answerstoleranceparam'] = 'Answers tolerance parameters';
$string['atleastoneanswer'] = 'You need to provide at least one answer.';
$string['correctfeedback'] = 'For any correct response';
$string['dataitemdefined']='with {$a} numerical values already defined is available';
$string['datasetrole']= ' The wild cards <strong>{x..}</strong> will be substituted by a numerical value from their dataset';
-$string['deleteitem'] = 'Delete Item';
-$string['deletelastitem'] = 'Delete Last Item';
+$string['deleteitem'] = 'Delete item';
+$string['deletelastitem'] = 'Delete last item';
$string['editingcalculated'] = 'Editing a Calculated question';
$string['editdatasets'] = 'Edit the wildcards datasets';
$string['editdatasets_help'] = 'Wildcard values may be created by entering a number in each wild card field then clicking the add button. To automatically generate 10 or more values, select the number of values required before clicking the add button. A uniform distribution means any value between the limits is equally likely to be generated; a loguniform distribution means that values towards the lower limit are more likely.';
$string['forceregeneration'] = 'force regeneration';
$string['forceregenerationall'] = 'forceregeneration of all wildcards';
$string['forceregenerationshared'] = 'forceregeneration of only non-shared wildcards';
-$string['getnextnow'] = 'Get New \'Item to Add\' Now';
+$string['getnextnow'] = 'Get new \'Item to Add\' now';
$string['hexanotallowed'] = 'Dataset <strong>{$a->name}</strong> hexadecimal format value $a->value is not allowed' ;
$string['incorrectfeedback'] = 'For any incorrect response';
$string['item(s)'] = 'item(s)';
$string['itemno'] = 'Item {$a}';
$string['itemscount']='Items<br />Count';
-$string['itemtoadd'] = 'Item To Add';
+$string['itemtoadd'] = 'Item to add';
$string['keptcategory1'] = 'will use the same existing shared dataset as before';
$string['keptcategory2'] = 'a file from the same category reusable set of files as before';
$string['keptcategory3'] = 'a link from the same category reusable set of links as before';
$string['keptlocal3'] = 'a link from the same question private set of links as before';
$string['lastitem(s)'] = 'last items(s)';
$string['loguniform'] = 'Loguniform';
-$string['makecopynextpage'] = 'Next Page (new question)';
+$string['makecopynextpage'] = 'Next page (new question)';
$string['mandatoryhdr'] = 'Mandatory wild cards present in answers';
$string['minmax'] = 'Range of Values';
$string['mustbenumeric'] = 'You must enter a number here.';
$string['newlocal2'] = 'a file from a new set of files that will only be used by this question';
$string['newlocal3'] = 'a link from a new set of links that will only be used by this question';
$string['nextitemtoadd'] = 'Next \'Item to Add\'';
-$string['nextpage'] = 'Next Page';
+$string['nextpage'] = 'Next page';
$string['nocoherencequestionsdatyasetcategory'] = 'For question id {$a->qid}, the category id {$a->qcat} is not identical with the shared wild card {$a->name} category id {$a->sharedcat}. Edit the question.';
$string['nocommaallowed'] = 'The , cannot be used, use . as in 0.013 or 1.3e-2' ;
$string['nodataset'] = 'nothing - it is not a wild card';
$string['addingcalculatedmulti'] = 'Adding a Calculated multichoice question';
$string['calculatedmulti'] = 'Calculated multichoice';
-$string['calculatedmultisummary'] = 'Calculated Multichoice questions are like multichoice questions which choice elements can include formula results from numeric values that are selected randomly from a set when the quiz is taken.';
-$string['calculatedmulti_help'] = 'Calculated Multichoice questions are like multichoice questions which in their choice elements can be included numerical formula results using wildcards in curly brackets that are substituted with individual values when the quiz is taken. For example, if the question "What is the area of a rectangle of length {l} and width {w}?" one of the choice is {={l}*{w}} (where * denotes multiplication). ';
+$string['calculatedmultisummary'] = 'Calculated multichoice questions are like multichoice questions which choice elements can include formula results from numeric values that are selected randomly from a set when the quiz is taken.';
+$string['calculatedmulti_help'] = 'Calculated multichoice questions are like multichoice questions which in their choice elements can be included numerical formula results using wildcards in curly brackets that are substituted with individual values when the quiz is taken. For example, if the question "What is the area of a rectangle of length {l} and width {w}?" one of the choice is {={l}*{w}} (where * denotes multiplication). ';
$string['calculatedmulti_link'] = 'question/type/calculatedmulti';
-$string['editingcalculatedmulti'] = 'Editing a Calculated Multichoice question';
+$string['editingcalculatedmulti'] = 'Editing a Calculated multichoice question';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['addingcalculatedsimple'] = 'Adding a Simple Calculated question';
+$string['addingcalculatedsimple'] = 'Adding a Simple calculated question';
$string['atleastonewildcard'] = 'There must be at least one wild card <strong>{x..}</strong> present in the correct answer formulas';
-$string['calculatedsimple'] = 'Calculated Simple';
+$string['calculatedsimple'] = 'Calculated simple';
$string['calculatedsimple_help'] = 'Simple calculated questions enable individual numerical questions to be created using wildcards that are substituted with individual values when the quiz is taken. Simple calculated questions offer the most used features of the calculated question with a simpler creation interface.';
$string['calculatedsimple_link'] = 'question/type/calculatedsimple';
$string['calculatedsimplesummary'] = 'A simpler version of calculated questions which are like numerical questions but with the numbers used selected randomly from a set when the quiz is taken.';
$string['converttocalculated'] = 'Save as a new regular calculated question';
-$string['editingcalculatedsimple'] = 'Editing a Simple Calculated question';
+$string['editingcalculatedsimple'] = 'Editing a Simple calculated question';
$string['findwildcards'] = 'Find the wild cards {x..} present in the correct answer formulas';
$string['generatenewitemsset'] = 'Generate';
$string['mustbenumeric'] = 'You must enter a number here.';
$mform->addElement('submit', 'analyzequestion', get_string('decodeverifyquestiontext','qtype_multianswer'));
$mform->registerNoSubmitButton('analyzequestion');
- echo '<div class="ablock clearfix">';
- echo '<div class=" clearfix">';
if ( $this->reload ){
+ $mform->addElement('html', '<div class="ablock clearfix">');
+ $mform->addElement('html', '<div class=" clearfix">');
for ($sub =1;$sub <=$countsubquestions ;$sub++) {
$this->editas[$sub] = 'unknown type';
}
}
- echo '</div>';
+ $mform->addElement('html', '</div>');
$this->negative_diff =$countsavedsubquestions - $countsubquestions ;
if ( ($this->negative_diff > 0 ) ||$this->qtype_change || ($this->used_in_quiz && $this->negative_diff != 0)){
$mform->addElement('header', 'additemhdr', get_string('warningquestionmodified','qtype_multianswer'));
if($this->qtype_change ) {
$mform->addElement('static', 'alert1', "<strong>".get_string('questiontypechanged','qtype_multianswer')."</strong>",get_string('questiontypechangedcomment','qtype_multianswer'));
}
- echo '</div>';
+ $mform->addElement('html', '</div>');
}
if( $this->used_in_quiz){
if($this->negative_diff < 0) {
*/
$string['addingmultianswer'] = 'Adding an Embedded answers (Cloze) question';
-$string['confirmquestionsaveasedited'] = ' I confirm that I want the question to be saved as edited';
+$string['confirmquestionsaveasedited'] = 'I confirm that I want the question to be saved as edited';
$string['confirmsave'] = 'Confirm then save {$a}';
-$string['correctanswer'] = 'Correct Answer';
-$string['correctanswerandfeedback'] = 'Correct Answer and Feedback';
-$string['decodeverifyquestiontext'] = 'Decode and Verify the Question Text';
+$string['correctanswer'] = 'Correct answer';
+$string['correctanswerandfeedback'] = 'Correct answer and feedback';
+$string['decodeverifyquestiontext'] = 'Decode and verify the question text';
$string['editingmultianswer'] = 'Editing an Embedded answers (Cloze) question';
$string['layout'] = 'Layout';
$string['layouthorizontal'] = 'Horizontal row of radio-buttons';
$string['nooptionsforsubquestion'] = 'Unable to get options for question part # {$a->sub} (question->id={$a->id})';
$string['noquestions'] = 'The Cloze(multianswer) question "<strong>{$a}</strong>" does not contain any question';
$string['qtypenotrecognized'] = 'questiontype {$a} not recognized';
-$string['questionnadded'] = '"Question added "';
+$string['questionnadded'] = 'Question added';
$string['questiondefinition'] = 'Question definition';
$string['questiondeleted'] = 'Question deleted' ;
$string['questioninquiz'] = '
$string['questionnotfound'] = 'Unable to find question of question part #{$a}';
$string['questionsaveasedited'] = 'The question will be saved as edited';
$string['questiontypechanged'] = 'Question type changed';
-$string['questiontypechangedcomment'] = ' At least one question type has been changed.<br \> Did you add, delete or move a question? <br \>Look ahead. ';
+$string['questiontypechangedcomment'] = 'At least one question type has been changed.<br \>Did you add, delete or move a question?<br \>Look ahead.';
$string['questionusedinquiz'] = 'This question is used in {$a->nb_of_quiz} quiz(s), total attempt(s) : {$a->nb_of_attempts} ';
$string['unknownquestiontypeofsubquestion'] = 'Unknown question type: {$a->type} of question part # {$a->sub}';
$string['warningquestionmodified'] = '<b>WARNING</b>' ;
$string['multichoicesummary'] = 'Allows the selection of a single or multiple responses from a pre-defined list.';
$string['notenoughanswers'] = 'This type of question requires at least {$a} choices';
$string['overallcorrectfeedback'] = 'Feedback for any correct response';
-$string['overallfeedback'] = 'Overall Feedback';
+$string['overallfeedback'] = 'Overall feedback';
$string['overallincorrectfeedback'] = 'Feedback for any incorrect response';
$string['overallpartiallycorrectfeedback'] = 'Feedback for any partially correct response';
$string['partiallycorrectfeedback'] = 'For any partially correct response';
$search_text = optional_param('s', '', PARAM_CLEANHTML);
$linkexternal = optional_param('linkexternal', '', PARAM_ALPHA);
-@header('Content-type: text/plain; charset=utf-8');
+list($context, $course, $cm) = get_context_info_array($contextid);
+require_login($course, false, $cm);
+$PAGE->set_context($context);
+
+echo $OUTPUT->header(); // send headers
+@header('Content-type: text/html; charset=utf-8');
// if uploaded file is larger than post_max_size (php.ini) setting, $_POST content will lost
if (empty($_POST) && !empty($action)) {
die(json_encode($err));
}
-list($context, $course, $cm) = get_context_info_array($contextid);
-require_login($course, false, $cm);
-$PAGE->set_context($context);
-
-echo $OUTPUT->header(); // send headers
-
if (!confirm_sesskey()) {
$err->error = get_string('invalidsesskey');
die(json_encode($err));
list($tag_string, $params) = $DB->get_in_or_equal($tags);
- if ($rs = $DB->get_recordset_sql("SELECT * FROM {tag} WHERE name $tag_string ORDER BY name", $params)) {
- foreach ($rs as $record) {
- if ($return_value == TAG_RETURN_OBJECT) {
- $result[$record->name] = $record;
- } else { // TAG_RETURN_ARRAY
- $result[$record->name] = $record->id;
- }
+ $rs = $DB->get_recordset_sql("SELECT * FROM {tag} WHERE name $tag_string ORDER BY name", $params);
+ foreach ($rs as $record) {
+ if ($return_value == TAG_RETURN_OBJECT) {
+ $result[$record->name] = $record;
+ } else { // TAG_RETURN_ARRAY
+ $result[$record->name] = $record->id;
}
- $rs->close();
}
+ $rs->close();
if ($return_an_int) {
return array_pop($result);
margin-top:30px;
}
+/*YUI Reset */
+/*full menu bar */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-content {
+ background: none !important;
+}
+/*single items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label {
+ background: none !important;
+}
+/*active items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-active, .yui3-skin-sam .yui3-menu-horizontal .yui3-menuitem-active .yui3-menuitem-content, .yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-menuvisible {
+ background: #f9f9f9 !important;
+ border-color:inherit;
+}
+
#custommenu .yui3-menu-horizontal,
#custommenu .yui3-menu-horizontal.javascript-disabled {
padding-left:100px;
}
#custommenu .yui3-menu-horizontal.javascript-disabled .yui3-menu-content li li:hover,
-.yui3-skin-sam #custommenu .yui3-menu .yui3-menuitem.yui3-menuitem-active .yui3-menuitem-content {
- background-color:#FFF;
+.yui3-skin-sam #custommenu .yui3-menu .custom_menu_submenu .yui3-menuitem.yui3-menuitem-active .yui3-menuitem-content, #custommenu .yui3-menu-horizontal .custom_menu_submenu .yui3-menu-content .yui3-menu-label-active {
+ background-color:#FFF !important;
}
\ No newline at end of file
.path-course .clearfloat {float:none; clear:both;height:0px;}
+
+/*all courses view*/
+#page-course-index .categorylist .course.clearfloat { height: auto; }
+
/**
* Overide for RTL layout
*/
font-family:"Trebuchet MS", Helvetica, Arial, sans-serif;
}
-
#wrapper {
margin: 25px 75px;
background: #fff;
}
#footer {
- color: #fff;
- text-align: center;
+ color: #fff;
+ text-align: center;
}
/* Dock
-----------------------------*/
}
.myclear {
-clear: both;
+ clear: both;
}
.has-custom-menu #page-header .headermain {
border-width:0;
}
+/*YUI Reset */
+/*full menu bar */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-content {
+ background: none !important;
+}
+/*single items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label {
+ background: none !important;
+}
+/*active items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-active, .yui3-skin-sam .yui3-menu-horizontal .yui3-menuitem-active .yui3-menuitem-content, .yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-menuvisible {
+ background: none !important;
+ border-color:inherit;
+}
+
+.yui3-menuitem, .yui3-menuitem .yui3-menuitem-content {
+ border: none !important;
+}
+
#custommenu .yui3-menu-horizontal .yui3-menu-content ul ul,
#custommenu .yui3-menu-horizontal.javascript-disabled .yui3-menu-content ul ul {
background-color:#F9F9F9;
border-top-width:0;
}
-#custommenu .yui3-menu-horizontal .yui3-menu-content .yui3-menu-label {
- color:#FFF;
+#custommenu .yui3-menu-horizontal .yui3-menu-content .yui3-menu-label, .yui3-menuitem .yui3-menuitem-content, .yui3-menuitem {
+ color:#FFF !important;
}
.yui3-skin-sam #custommenu .yui3-menu-content,
padding:0;
}
-#custommenu .custom_menu_submenu .yui3-menu-content .yui3-menu-label {
- color: #000;
+#custommenu .custom_menu_submenu .yui3-menu-content .yui3-menu-label, .custom_menu_submenu .yui3-menuitem .yui3-menuitem-content {
+ color: #000 !important;
}
#custommenu .yui3-menu-horizontal.javascript-disabled .yui3-menu-content li li:hover,
#custommenu .yui3-menu-horizontal.javascript-disabled .yui3-menu-content li li:hover a,
-.yui3-skin-sam #custommenu .yui3-menu .yui3-menuitem.yui3-menuitem-active .yui3-menuitem-content {
- background-color:#F14E16;
- color:#FFF;
+.yui3-skin-sam #custommenu .yui3-menu .custom_menu_submenu .yui3-menuitem.yui3-menuitem-active .yui3-menuitem-content {
+ background-color:#F14E16 !important;
+ color:#FFF !important;
}
.yui3-skin-sam .yui3-menu-label-active,
.yui3-skin-sam .yui3-menu-label-menuvisible,
.yui3-skin-sam .yui3-menu .yui3-menu .yui3-menu-label-active,
-.yui3-skin-sam .yui3-menu .yui3-menu .yui3-menu-label-menuvisible {
- background-color:#F14E16;
+.yui3-skin-sam .yui3-menu .yui3-menu .yui3-menu-label-menuvisible, #custommenu .custom_menu_submenu .yui3-menu-content .yui3-menu-label-active, #custommenu .custom_menu_submenu .yui3-menu-content .yui3-menu-label-menuvisible {
+ background-color:#F14E16 !important;
color:#FFF !important;
}
-
-
-
#custommenu .yui3-menu-horizontal .yui3-menu-content li a {
cursor:pointer;
}
width: 100%;
}
-#header {
+div#header {
width: 91%;
min-width: 910px;
height: 30px;
}
.side-post-only #page-content #region-post {
- left: [[setting:regionpostwidth]];
+ left: [[setting:regionsumwidth]];
width: [[setting:regionpostwidth]];
}
/* Global
--------------------------*/
-
body {
- background: #fff;
- margin: 0;
- padding: 0;
- color: #281f18;
+ background: #fff;
+ margin: 0;
+ padding: 0;
+ color: #281f18;
}
html {
- height: 100%;
+ height: 100%;
}
body {
- margin: 0;
- padding: 0;
- height: 100%;
+ margin: 0;
+ padding: 0;
+ height: 100%;
}
body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,input,textarea {
- font-family: 'Myriad Pro', 'Myriad', helvetica, arial, sans-serif;
+ font-family: 'Myriad Pro', 'Myriad', helvetica, arial, sans-serif;
}
.wrapper {
- margin: 0 35px;
- min-width: 910px;
+ margin: 0 35px;
+ min-width: 910px;
}
a:hover,a:active {
- color: #000;
+ color: #000;
}
a img {
- border: none;
+ border: none;
}
a:active {
- outline: none;
+ outline: none;
}
/* Header
---------------------------*/
-
#page-header {
- background: #333;
- color: #fff;
- height: 30px;
- z-index: 99999;
- position: relative;
+ background: #333;
+ color: #fff;
+ height: 30px;
+ z-index: 99999;
+ position: relative;
}
#page-header div.headermenu {
- height: 30px;
- padding-bottom: 0px;
- margin-bottom: 0px;
- padding-top: 0px;
- margin-top: 0px;
- line-height: 30px;
+ height: 30px;
+ padding-bottom: 0px;
+ margin-bottom: 0px;
+ padding-top: 0px;
+ margin-top: 0px;
+ line-height: 30px;
}
+
#page-header a:link,
#page-header a:visited {
- color: #fff;
- text-decoration: underline;
+ color: #fff;
+ text-decoration: underline;
}
-
#newheader {
- height: 100px;
- position: relative;
+ height: 100px;
+ position: relative;
}
#newheaderleft {
- height: 100px;
- width: 50px;
- position: absolute;
- left: -50px;
+ height: 100px;
+ width: 50px;
+ position: absolute;
+ left: -50px;
}
+
h1.headermain {
- margin-left: 0px;
- padding-left: 0px;
- color: #fff;
- margin-top: 35px;
- font-family: 'Myriad Pro', 'Myriad', helvetica, arial, sans-serif;
- text-shadow: 2px 3px 3px #292929;
- letter-spacing: -1px;
- -webkit-text-stroke: 1px white;
+ margin-left: 0px;
+ padding-left: 0px;
+ color: #fff;
+ margin-top: 35px;
+ font-family: 'Myriad Pro', 'Myriad', helvetica, arial, sans-serif;
+ text-shadow: 2px 3px 3px #292929;
+ letter-spacing: -1px;
+ -webkit-text-stroke: 1px white;
}
#region-main-box {
- background: #eee;
+ background: #eee;
}
#region-post-box {
- background: #fff;
+ background: #fff;
}
#page-footer {
- background: #333;
- color: #fff;
+ background: #333;
+ color: #fff;
}
#page-content, #region-main-box, #region-main-wrap, #page-content-wrapper, #top, div.region-content {
- min-height: 100%;
- position: relative;
+ min-height: 100%;
+ position: relative;
}
#region-main-box {
- -webkit-box-shadow: 6px 0px 8px #ccc;
- -moz-box-shadow: 6px 0px 8px #ccc;
- box-shadow: 6px 0px 8px #ccc;
+ -webkit-box-shadow: 6px 0px 8px #ccc;
+ -moz-box-shadow: 6px 0px 8px #ccc;
+ box-shadow: 6px 0px 8px #ccc;
}
#region-main {
- -webkit-box-shadow: 6px 0px 8px #ccc;
- -moz-box-shadow: 6px 0px 8px #ccc;
- box-shadow: 6px 0px 8px #ccc;
+ -webkit-box-shadow: 6px 0px 8px #ccc;
+ -moz-box-shadow: 6px 0px 8px #ccc;
+ box-shadow: 6px 0px 8px #ccc;
}
.side-pre-only #region-main, .content-only #region-main, .content-only #region-main-box {
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ box-shadow: none;
}
/* Navbar
--------------------------*/
-
.navbar {
- margin-top: 10px;
-
+ margin-top: 10px;
}
.navbar .wrapper {
- margin-left: 0px !important;
- padding-left: 0px !important;
-
+ margin-left: 0px !important;
+ padding-left: 0px !important;
}
.breadcrumb .sep {
- color: #777;
- font-size: 0.8em;
+ color: #777;
+ font-size: 0.8em;
}
.navbutton {
- margin-top: 40px;
- margin-right: 10px;
- font-size: 12px;
+ margin-top: 40px;
+ margin-right: 10px;
+ font-size: 12px;
}
-
/* Blocks
---------------------------*/
-
.block {
- border: none;
- margin-bottom: 25px;
+ border: none;
+ margin-bottom: 25px;
}
.block .header {
- border-bottom:none;
- text-transform: uppercase;
+ border-bottom:none;
+ text-transform: uppercase;
}
.block.hidden .header {
- border-top: 1px solid #dadada;
- border-bottom: 1px solid #dadada;
+ border-top: 1px solid #dadada;
+ border-bottom: 1px solid #dadada;
}
.block .title h2 {
- font-weight: normal;
- font-size: 1.1em;
- margin: 0;
+ font-weight: normal;
+ font-size: 1.1em;
+ margin: 0;
}
.block .content {
- font-size: 0.95em;
+ font-size: 0.95em;
}
.
/* Forums
---------------------------*/
-
.forumpost .subject {
- font-size: 1.2em;
+ font-size: 1.2em;
}
.forumpost .author {
- font-size: 0.9em;
+ font-size: 0.9em;
}
.forumpost .content {
- border-bottom:5px solid #aaa;
- padding:5px 7px 10px 7px;
+ border-bottom:5px solid #aaa;
+ padding:5px 7px 10px 7px;
}
.forumpost .topic {
- background: #eee;
- border-bottom: 1px solid #aaa;
+ background: #eee;
+ border-bottom: 1px solid #aaa;
}
/* Course
-------------------------------*/
-
.course-content .main {
- border: 1px solid #eee;
- background: #eee;
+ border: 1px solid #eee;
+ background: #eee;
}
.course-content .current {
- background: #1f5480;
- color: #fff;
+ background: #1f5480;
+ color: #fff;
}
.course-content .main .content {
- background: #fff;
+ background: #fff;
}
/* YUI Menu
-------------------------------*/
-
#custommenu {
- width: 70%;
- float: left;
+ width: 60%;
+ float: left;
+}
+
+/*YUI Reset */
+/*full menu bar */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-content {
+ background: none !important;
+}
+/*single items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label {
+ background: none !important;
+}
+/*active items */
+.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-active, .yui3-skin-sam .yui3-menu-horizontal .yui3-menuitem-active .yui3-menuitem-content, .yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label-menuvisible {
+ background: #666 !important;
+ border-color:inherit;
}
div.yui3-menu-content {
- border: none !important;
+ border: none !important;
}
.yui3-menu-content li a {
- font-size: 11px;
- font-weight: 200;
- line-height: 30px;
- text-transform: uppercase;
- cursor: pointer;
- border-right: none !important;
- border-top: none !important;
- border-bottom: none !important;
- text-decoration: none !important;
- margin-left: 0px !important;
- padding-left: 0px !important;
- margin-right: 10px !important;
+ font-size: 11px;
+ font-weight: 200;
+ line-height: 30px;
+ text-transform: uppercase;
+ cursor: pointer;
+ border-right: none !important;
+ border-top: none !important;
+ border-bottom: none !important;
+ text-decoration: none !important;
+ margin-left: 0px !important;
+ padding-left: 0px !important;
+ margin-right: 10px !important;
+ padding-left: 5px !important;
}
.yui3-menu-content li a:hover {
- text-decoration: underline;
+ text-decoration: underline;
}
div.custom_menu_submenu li a {
- line-height: 30px;
- text-shadow: none !important;
- color: #333 !important;
- margin-left: 5px !important;
+ line-height: 30px;
+ text-shadow: none !important;
+ color: #fff !important;
+ margin-left: 5px !important;
+}
+
+.custom_menu_submenu {
+ background: #333;
}
div.firstdockitem {
- margin-top: 30px;
+ margin-top: 30px;
}
-.headermenu .logininfo, .headermenu div, .headermenu form {
- display: inline;
+.headermenu .logininfo, .headermenu .langmenu, .headermenu .langmenu div, .headermenu .langmenu form, .headermenu .langmenu select, .headermenu .langmenu label {
+ display: inline !important;
}
.headermenu .logininfo {
- padding-right: 5px;
+ padding-right: 5px;
}
\ No newline at end of file
$errors = array();
/// Check for uniqueness of data if required
if ($this->is_unique()) {
- if ($userid = $DB->get_field('user_info_data', 'userid', array('fieldid'=>$this->field->id, 'data'=>$usernew->{$this->inputname}))) {
- if ($userid != $usernew->id) {
- $errors["{$this->inputname}"] = get_string('valuealreadyused');
- }
+ $userid = $DB->get_field_sql('
+ SELECT userid
+ FROM {user_info_data}
+ WHERE fieldid = ?
+ AND ' . $DB->sql_compare_text('data') . ' = ?',
+ array($this->field->id, $usernew->{$this->inputname}));
+ if ($userid && $userid != $usernew->id) {
+ $errors[$this->inputname] = get_string('valuealreadyused');
}
}
return $errors;
JOIN {groups} g ON gm.groupid = g.id
WHERE u.id $membersidsclause AND g.courseid = :courseid ";
$params['courseid'] = $courseid;
- if ($rs = $DB->get_recordset_sql($sql, $params)) {
- foreach ($rs as $usergroup) {
- $usergroups[$usergroup->userid][$usergroup->id] = $usergroup;
- }
- $rs->close();
+ $rs = $DB->get_recordset_sql($sql, $params);
+ foreach ($rs as $usergroup) {
+ $usergroups[$usergroup->userid][$usergroup->id] = $usergroup;
}
+ $rs->close();
foreach ($potentialmembersids as $userid) {
if (isset($usergroups[$userid])) {