mirror of
https://github.com/moodle/moodle.git
synced 2025-06-05 07:35:09 +02:00
MDL-14679 fixed remaining old style update_record()s
This commit is contained in:
parent
a9637e7df4
commit
dd88de0ebd
@ -1024,27 +1024,24 @@ class test extends XMLDBAction {
|
||||
/// Calculate its length
|
||||
$textlen = $textlib->strlen($basetext);
|
||||
$imglen = strlen($basetext);
|
||||
if ($DB->update_record('newnameforthetable', $rec)) {
|
||||
if ($new = $DB->get_record('newnameforthetable', array('id'=>$rec->id))) {
|
||||
$newtextlen = $textlib->strlen($new->intro);
|
||||
$newimglen = strlen($new->avatar);
|
||||
if ($basetext === $new->avatar && $basetext === $new->intro) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok',
|
||||
$newimglen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
if ($rec->avatar !== $new->avatar) {
|
||||
$test->error = $DB->get_last_error();
|
||||
$test->sql = array($newimglen . ' bytes (binary) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
} else {
|
||||
$test->error = $DB->get_last_error();
|
||||
$test->sql = array($newtextlen . ' cc. (text) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
}
|
||||
$DB->update_record('newnameforthetable', $rec);
|
||||
if ($new = $DB->get_record('newnameforthetable', array('id'=>$rec->id))) {
|
||||
$newtextlen = $textlib->strlen($new->intro);
|
||||
$newimglen = strlen($new->avatar);
|
||||
if ($basetext === $new->avatar && $basetext === $new->intro) {
|
||||
$test->sql = array($newtextlen . ' cc. (text) sent and received ok',
|
||||
$newimglen . ' bytes (binary) sent and received ok');
|
||||
$test->status = true;
|
||||
} else {
|
||||
$test->error = $DB->get_last_error();
|
||||
if ($rec->avatar !== $new->avatar) {
|
||||
$test->error = $DB->get_last_error();
|
||||
$test->sql = array($newimglen . ' bytes (binary) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
} else {
|
||||
$test->error = $DB->get_last_error();
|
||||
$test->sql = array($newtextlen . ' cc. (text) transfer failed. Data changed!');
|
||||
$test->status = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$test->error = $DB->get_last_error();
|
||||
|
@ -263,11 +263,8 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->auth = 'nologin';
|
||||
if ($DB->update_record('user', $updateuser)) {
|
||||
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
} else {
|
||||
echo "\t"; print_string('auth_dbsuspendusererror', 'auth_db', $user->username); echo "\n";
|
||||
}
|
||||
$DB->update_record('user', $updateuser);
|
||||
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -715,11 +715,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->auth = 'nologin';
|
||||
if ($DB->update_record('user', $updateuser)) {
|
||||
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
} else {
|
||||
echo "\t"; print_string('auth_dbsuspendusererror', 'auth_db', $user->username); echo "\n";
|
||||
}
|
||||
$DB->update_record('user', $updateuser);
|
||||
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -743,11 +740,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$updateuser = new object();
|
||||
$updateuser->id = $user->id;
|
||||
$updateuser->auth = $this->authtype;
|
||||
if ($DB->update_record('user', $updateuser)) {
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
} else {
|
||||
echo "\t"; print_string('auth_dbrevivedusererror', 'auth_db', $user->username); echo "\n";
|
||||
}
|
||||
$DB->update_record('user', $updateuser);
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
}
|
||||
} else {
|
||||
print_string('nouserentriestorevive', 'auth_ldap');
|
||||
|
@ -101,9 +101,8 @@ if ($externalblogform->is_cancelled()){
|
||||
$external->filtertags = $data->filtertags;
|
||||
$external->timemodified = mktime();
|
||||
|
||||
if ($DB->update_record('blog_external', $external)) {
|
||||
tag_set('blog_external', $external->id, explode(',', $data->autotags));
|
||||
}
|
||||
$DB->update_record('blog_external', $external);
|
||||
tag_set('blog_external', $external->id, explode(',', $data->autotags));
|
||||
|
||||
} else {
|
||||
print_error('wrongexternalid', 'blog');
|
||||
|
@ -476,19 +476,11 @@ class assignment_upload extends assignment_base {
|
||||
$updated->timemodified = time();
|
||||
$updated->data1 = $data->text;
|
||||
|
||||
if ($DB->update_record('assignment_submissions', $updated)) {
|
||||
add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
redirect($returnurl);
|
||||
$submission = $this->get_submission($USER->id);
|
||||
$this->update_grade($submission);
|
||||
|
||||
} else {
|
||||
$this->view_header(get_string('notes', 'assignment'));
|
||||
echo $OUTPUT->notification(get_string('notesupdateerror', 'assignment'));
|
||||
echo $OUTPUT->continue_button($returnurl);
|
||||
$this->view_footer();
|
||||
die;
|
||||
}
|
||||
$DB->update_record('assignment_submissions', $updated);
|
||||
add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
redirect($returnurl);
|
||||
$submission = $this->get_submission($USER->id);
|
||||
$this->update_grade($submission);
|
||||
}
|
||||
|
||||
/// show notes edit form
|
||||
@ -550,28 +542,27 @@ class assignment_upload extends assignment_base {
|
||||
$updates = new object();
|
||||
$updates->id = $submission->id;
|
||||
$updates->timemodified = time();
|
||||
if ($DB->update_record('assignment_submissions', $updates)) {
|
||||
add_to_log($this->course->id, 'assignment', 'upload',
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$this->update_grade($submission);
|
||||
if (!$this->drafts_tracked()) {
|
||||
$this->email_teachers($submission);
|
||||
}
|
||||
|
||||
// send files to event system
|
||||
$files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id);
|
||||
// Let Moodle know that assessable files were uploaded (eg for plagiarism detection)
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'assignment';
|
||||
$eventdata->cmid = $this->cm->id;
|
||||
$eventdata->itemid = $submission->id;
|
||||
$eventdata->courseid = $this->course->id;
|
||||
$eventdata->userid = $USER->id;
|
||||
if ($files) {
|
||||
$eventdata->files = $files;
|
||||
}
|
||||
events_trigger('assessable_file_uploaded', $eventdata);
|
||||
$DB->update_record('assignment_submissions', $updates);
|
||||
add_to_log($this->course->id, 'assignment', 'upload',
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$this->update_grade($submission);
|
||||
if (!$this->drafts_tracked()) {
|
||||
$this->email_teachers($submission);
|
||||
}
|
||||
|
||||
// send files to event system
|
||||
$files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id);
|
||||
// Let Moodle know that assessable files were uploaded (eg for plagiarism detection)
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'assignment';
|
||||
$eventdata->cmid = $this->cm->id;
|
||||
$eventdata->itemid = $submission->id;
|
||||
$eventdata->courseid = $this->course->id;
|
||||
$eventdata->userid = $USER->id;
|
||||
if ($files) {
|
||||
$eventdata->files = $files;
|
||||
}
|
||||
events_trigger('assessable_file_uploaded', $eventdata);
|
||||
$returnurl = new moodle_url('/mod/assignment/view.php', array('id'=>$this->cm->id));
|
||||
redirect($returnurl);
|
||||
}
|
||||
@ -670,19 +661,12 @@ class assignment_upload extends assignment_base {
|
||||
$updated->data2 = ASSIGNMENT_STATUS_SUBMITTED;
|
||||
$updated->timemodified = time();
|
||||
|
||||
if ($DB->update_record('assignment_submissions', $updated)) {
|
||||
add_to_log($this->course->id, 'assignment', 'upload', //TODO: add finalize action to log
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid);
|
||||
$this->update_grade($submission);
|
||||
$this->email_teachers($submission);
|
||||
} else {
|
||||
$this->view_header(get_string('submitformarking', 'assignment'));
|
||||
echo $OUTPUT->notification(get_string('finalizeerror', 'assignment'));
|
||||
echo $OUTPUT->continue_button($returnurl);
|
||||
$this->view_footer();
|
||||
die;
|
||||
}
|
||||
$DB->update_record('assignment_submissions', $updated);
|
||||
add_to_log($this->course->id, 'assignment', 'upload', //TODO: add finalize action to log
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid);
|
||||
$this->update_grade($submission);
|
||||
$this->email_teachers($submission);
|
||||
|
||||
// Trigger assessable_files_done event to show files are complete
|
||||
$eventdata = new object();
|
||||
@ -717,12 +701,11 @@ class assignment_upload extends assignment_base {
|
||||
$updated->id = $submission->id;
|
||||
$updated->data2 = ASSIGNMENT_STATUS_CLOSED;
|
||||
|
||||
if ($DB->update_record('assignment_submissions', $updated)) {
|
||||
add_to_log($this->course->id, 'assignment', 'upload', //TODO: add finalize action to log
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid, false, true);
|
||||
$this->update_grade($submission);
|
||||
}
|
||||
$DB->update_record('assignment_submissions', $updated);
|
||||
add_to_log($this->course->id, 'assignment', 'upload', //TODO: add finalize action to log
|
||||
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid, false, true);
|
||||
$this->update_grade($submission);
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
@ -745,18 +728,11 @@ class assignment_upload extends assignment_base {
|
||||
$updated = new object();
|
||||
$updated->id = $submission->id;
|
||||
$updated->data2 = '';
|
||||
if ($DB->update_record('assignment_submissions', $updated)) {
|
||||
//TODO: add unfinalize action to log
|
||||
add_to_log($this->course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid);
|
||||
$this->update_grade($submission);
|
||||
} else {
|
||||
$this->view_header(get_string('submitformarking', 'assignment'));
|
||||
echo $OUTPUT->notification(get_string('unfinalizeerror', 'assignment'));
|
||||
echo $OUTPUT->continue_button($returnurl);
|
||||
$this->view_footer();
|
||||
die;
|
||||
}
|
||||
$DB->update_record('assignment_submissions', $updated);
|
||||
//TODO: add unfinalize action to log
|
||||
add_to_log($this->course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->assignment->id, $this->assignment->id, $this->cm->id);
|
||||
$submission = $this->get_submission($userid);
|
||||
$this->update_grade($submission);
|
||||
}
|
||||
|
||||
if ($forcemode==null) {
|
||||
|
@ -136,7 +136,7 @@ function chat_add_instance($chat) {
|
||||
*
|
||||
* @global object
|
||||
* @param object $chat
|
||||
* @return int
|
||||
* @return bool
|
||||
*/
|
||||
function chat_update_instance($chat) {
|
||||
global $DB;
|
||||
@ -145,22 +145,21 @@ function chat_update_instance($chat) {
|
||||
$chat->id = $chat->instance;
|
||||
|
||||
|
||||
if ($returnid = $DB->update_record("chat", $chat)) {
|
||||
$DB->update_record("chat", $chat);
|
||||
|
||||
$event = new object();
|
||||
$event = new object();
|
||||
|
||||
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'chat', 'instance'=>$chat->id))) {
|
||||
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'chat', 'instance'=>$chat->id))) {
|
||||
|
||||
$event->name = $chat->name;
|
||||
$event->description = format_module_intro('chat', $chat, $chat->coursemodule);
|
||||
$event->timestart = $chat->chattime;
|
||||
$event->name = $chat->name;
|
||||
$event->description = format_module_intro('chat', $chat, $chat->coursemodule);
|
||||
$event->timestart = $chat->chattime;
|
||||
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
}
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
}
|
||||
|
||||
return $returnid;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -616,7 +616,7 @@ function data_decode_content_links_caller($restore) {
|
||||
|
||||
/// Update record if any field changed
|
||||
if($changed) {
|
||||
$status = $DB->update_record("data",$newdata);
|
||||
$DB->update_record("data",$newdata);
|
||||
}
|
||||
|
||||
/// Do some output
|
||||
@ -650,7 +650,7 @@ function data_decode_content_links_caller($restore) {
|
||||
if ($result != $content) {
|
||||
/// Update record
|
||||
$comment->content = $result;
|
||||
$status = $DB->update_record("data_comments",$comment);
|
||||
$DB->update_record("data_comments",$comment);
|
||||
if (debugging()) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
|
||||
@ -718,7 +718,7 @@ function data_decode_content_links_caller($restore) {
|
||||
$cnt->content4 = $result4;
|
||||
}
|
||||
/// Update record with the changed fields
|
||||
$status = $DB->update_record("data_content",$cnt);
|
||||
$DB->update_record("data_content",$cnt);
|
||||
if (debugging()) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
|
||||
|
@ -136,9 +136,8 @@ if (($mytemplate = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
// Check for multiple tags, only need to check for add template.
|
||||
if ($mode != 'addtemplate' or data_tags_check($data->id, $newtemplate->{$mode})) {
|
||||
if ($DB->update_record('data', $newtemplate)) {
|
||||
echo $OUTPUT->notification(get_string('templatesaved', 'data'), 'notifysuccess');
|
||||
}
|
||||
$DB->update_record('data', $newtemplate);
|
||||
echo $OUTPUT->notification(get_string('templatesaved', 'data'), 'notifysuccess');
|
||||
}
|
||||
add_to_log($course->id, 'data', 'templates saved', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
|
||||
}
|
||||
|
@ -295,7 +295,7 @@
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// Check to see if groups are being used here
|
||||
@ -407,9 +407,8 @@ if ($showactivity) {
|
||||
if ($approverecord->dataid == $data->id) { // Must be from this database
|
||||
$newrecord->id = $approverecord->id;
|
||||
$newrecord->approved = 1;
|
||||
if ($DB->update_record('data_records', $newrecord)) {
|
||||
echo $OUTPUT->notification(get_string('recordapproved','data'), 'notifysuccess');
|
||||
}
|
||||
$DB->update_record('data_records', $newrecord);
|
||||
echo $OUTPUT->notification(get_string('recordapproved','data'), 'notifysuccess');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,10 +208,8 @@ class feedback_item_label extends feedback_item_base {
|
||||
|
||||
// $item = new object();
|
||||
// $item->id = $data->id
|
||||
if($DB->update_record('feedback_item', $item)) {
|
||||
return $item->id;
|
||||
}
|
||||
return false;
|
||||
$DB->update_record('feedback_item', $item);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
function get_hasvalue() {
|
||||
|
@ -136,9 +136,8 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
$file_record = array('contextid'=>$context->id, 'component'=>'mod_form', 'filearea'=>$filearea, 'itemid'=>$post->id, 'filepath'=>'/', 'filename'=>$filename, 'userid'=>$post->userid);
|
||||
if ($fs->create_file_from_pathname($file_record, $filepath)) {
|
||||
$post->attachment = '1';
|
||||
if ($DB->update_record('forum_posts', $post)) {
|
||||
unlink($filepath);
|
||||
}
|
||||
$DB->update_record('forum_posts', $post);
|
||||
unlink($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6762,9 +6762,8 @@ function forum_discussion_update_last_post($discussionid) {
|
||||
$discussionobject->id = $discussionid;
|
||||
$discussionobject->usermodified = $lastpost->userid;
|
||||
$discussionobject->timemodified = $lastpost->modified;
|
||||
if ($DB->update_record('forum_discussions', $discussionobject)) {
|
||||
return $lastpost->id;
|
||||
}
|
||||
$DB->update_record('forum_discussions', $discussionobject);
|
||||
return $lastpost->id;
|
||||
}
|
||||
|
||||
// To get here either we couldn't find a post for the discussion (weird)
|
||||
|
@ -82,9 +82,8 @@ function xmldb_glossary_upgrade($oldversion) {
|
||||
$file_record = array('contextid'=>$context->id, 'component'=>'mod_glossary', 'filearea'=>$filearea, 'itemid'=>$entry->id, 'filepath'=>'/', 'filename'=>$filename, 'userid'=>$entry->userid);
|
||||
if ($fs->create_file_from_pathname($file_record, $filepath)) {
|
||||
$entry->attachment = '1';
|
||||
if ($DB->update_record('glossary_entries', $entry)) {
|
||||
unlink($filepath);
|
||||
}
|
||||
$DB->update_record('glossary_entries', $entry);
|
||||
unlink($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,13 +116,13 @@ function glossary_update_instance($glossary) {
|
||||
print_error('unknowformat', '', '', $glossary->displayformat);
|
||||
}
|
||||
|
||||
$return = $DB->update_record("glossary", $glossary);
|
||||
$DB->update_record("glossary", $glossary);
|
||||
if ($glossary->defaultapproval) {
|
||||
$DB->execute("UPDATE {glossary_entries} SET approved = 1 where approved <> 1 and glossaryid = ?", array($glossary->id));
|
||||
}
|
||||
glossary_grade_item_update($glossary);
|
||||
|
||||
return $return;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -560,7 +560,7 @@
|
||||
if ($result != $content) {
|
||||
//Update record
|
||||
$quiz->intro = $result;
|
||||
$status = $DB->update_record("quiz",$quiz);
|
||||
$DB->update_record("quiz",$quiz);
|
||||
if (debugging()) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
|
||||
@ -606,7 +606,7 @@
|
||||
$wtm = new WikiToMarkdown();
|
||||
$record->questiontext = $wtm->convert($record->questiontext, $restore->course_id);
|
||||
$record->questiontextformat = FORMAT_MARKDOWN;
|
||||
$status = $DB->update_record('question', $record);
|
||||
$DB->update_record('question', $record);
|
||||
//Do some output
|
||||
$i++;
|
||||
if (($i+1) % 1 == 0) {
|
||||
|
@ -1757,7 +1757,7 @@
|
||||
$wtm = new WikiToMarkdown();
|
||||
$record->questiontext = $wtm->convert($record->questiontext, $restore->course_id);
|
||||
$record->questiontextformat = FORMAT_MARKDOWN;
|
||||
$status = $DB->update_record('question', $record);
|
||||
$DB->update_record('question', $record);
|
||||
//Do some output
|
||||
$i++;
|
||||
if (($i+1) % 1 == 0) {
|
||||
|
@ -351,7 +351,7 @@
|
||||
$value = scorm_add_time($track->value, $SESSION->scorm_session_time);
|
||||
$track->value = $value;
|
||||
$track->timemodified = time();
|
||||
$id = $DB->update_record('scorm_scoes_track',$track);
|
||||
$DB->update_record('scorm_scoes_track',$track);
|
||||
} else {
|
||||
$track = new object();
|
||||
$track->userid = $USER->id;
|
||||
|
@ -266,9 +266,8 @@ function scorm_parse_aicc($scorm) {
|
||||
$id = null;
|
||||
if ($oldscoid = scorm_array_search('identifier',$sco->identifier,$oldscoes)) {
|
||||
$sco->id = $oldscoid;
|
||||
if ($DB->update_record('scorm_scoes',$sco)) {
|
||||
$id = $oldscoid;
|
||||
}
|
||||
$DB->update_record('scorm_scoes',$sco);
|
||||
$id = $oldscoid;
|
||||
$DB->delete_records('scorm_scoes_data', array('scoid'=>$oldscoid));
|
||||
unset($oldscoes[$oldscoid]);
|
||||
} else {
|
||||
|
@ -376,7 +376,7 @@ function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value,$fo
|
||||
if ($tracktest = $DB->get_record_select('scorm_scoes_track','userid=? AND scormid=? AND scoid=? AND attempt=? AND element=\'cmi.core.lesson_status\'', array($userid, $scormid, $scoid, $attempt))) {
|
||||
if ($tracktest->value == "incomplete") {
|
||||
$tracktest->value = "completed";
|
||||
$idtest = $DB->update_record('scorm_scoes_track',$tracktest);
|
||||
$DB->update_record('scorm_scoes_track',$tracktest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,7 +386,8 @@ function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value,$fo
|
||||
if ($element != 'x.start.time' ) { //don't update x.start.time - keep the original value.
|
||||
$track->value = addslashes_js($value);
|
||||
$track->timemodified = time();
|
||||
$id = $DB->update_record('scorm_scoes_track',$track);
|
||||
$DB->update_record('scorm_scoes_track',$track);
|
||||
$id = $track->id;
|
||||
}
|
||||
} else {
|
||||
$track->userid = $userid;
|
||||
|
@ -172,9 +172,8 @@ function xmldb_workshop_upgrade($oldversion) {
|
||||
'userid' => $submission->authorid);
|
||||
if ($fs->create_file_from_pathname($filerecord, $filepath)) {
|
||||
$submission->attachment = 1;
|
||||
if ($DB->update_record('workshop_submissions', $submission)) {
|
||||
unlink($filepath);
|
||||
}
|
||||
$DB->update_record('workshop_submissions', $submission);
|
||||
unlink($filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@
|
||||
} else {
|
||||
$updateobj->parent = 0;
|
||||
}
|
||||
$status = $status && $DB->update_record('question_categories', $updateobj);
|
||||
$DB->update_record('question_categories', $updateobj);
|
||||
}
|
||||
}
|
||||
//now we have recoded all parents, check through all parents and set parent to be
|
||||
@ -291,7 +291,7 @@
|
||||
$updateobj = new object();
|
||||
$updateobj->id = $id;
|
||||
$updateobj->parent = $parent;
|
||||
$status = $status && $DB->update_record('question_categories', $updateobj);
|
||||
$DB->update_record('question_categories', $updateobj);
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
|
@ -319,7 +319,7 @@ class question_shortanswer_qtype extends default_questiontype {
|
||||
// We have the answers field recoded to its new ids
|
||||
$questionextradata->answers = $answers_field;
|
||||
// Update the question
|
||||
$status = $status && $DB->update_record($questionextensiontable, $questionextradata);
|
||||
$DB->update_record($questionextensiontable, $questionextradata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,9 +368,8 @@ function profile_move_category($id, $move) {
|
||||
$category->sortorder = $neworder;
|
||||
|
||||
/// Update the category records
|
||||
if ($DB->update_record('user_info_category', $category) and $DB->update_record('user_info_category', $swapcategory)) {
|
||||
return true;
|
||||
}
|
||||
$DB->update_record('user_info_category', $category) and $DB->update_record('user_info_category', $swapcategory);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user