/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function econsole_update_instance($econsole) { $econsole->timemodified = time(); $econsole->id = $econsole->instance; # May have to add extra stuff in here # return update_record("econsole", $econsole); }
/** * TODO comment this */ function process_data($data) { global $CFG, $USER; foreach ($data->unit as $idx => $v) { $qual = get_record('ilp_qual_units', 'UniqueReferenceNumber', $idx, 'courseid', $data->course_id); if (empty($qual)) { $course = get_record('course', 'id', $data->course_id); $qualificationunits = $this->db->return_table_values('ofqual_qualification_units', array('UniqueReferenceNumber' => array('=' => "'{$idx}'"), 'qualificationid' => array('=' => "'{$course->idnumber}'"))); if (!empty($qualificationunits)) { $qual = new stdClass(); $q = $qualificationunits[0]; $qual->courseid = $data->course_id; //$qual->academic_year = $q['academic_year']; $qual->qualificationid = $q['QualificationID']; $qual->UniqueReferenceNumber = $q['UniqueReferenceNumber']; $qual->title = $q['Title']; $qual->unitownerreference = $q['UnitOwnerReference']; $qual->selected = !empty($v) ? 1 : 0; $qual->title = mysql_real_escape_string($qual->title); $qual->title = str_replace("'", "", $qual->title); insert_record('ilp_qual_units', $qual); } } else { $qual->title = mysql_real_escape_string($qual->title); $qual->title = str_replace("'", "", $qual->title); $qual->selected = !empty($v) ? 1 : 0; update_record('ilp_qual_units', $qual); } } }
function deletepost_submit(Pieform $form, $values) { global $SESSION, $USER; $objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.id = ?\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", array($values['post'])); if ($objectionable !== false) { // Trigger activity. $data = new StdClass(); $data->postid = $values['post']; $data->message = ''; $data->reporter = $USER->get('id'); $data->ctime = time(); $data->event = DELETE_OBJECTIONABLE_POST; activity_occurred('reportpost', $data, 'interaction', 'forum'); } update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post'])); $SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum')); // Figure out which parent record to redirect us to. If the parent record is deleted, // keep moving up the chain until you find one that's not deleted. $postrec = new stdClass(); $postrec->parent = $values['parent']; do { $postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent'); } while ($postrec && $postrec->deleted && $postrec->parent); $redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic']; if ($postrec && $postrec->parent) { $redirecturl .= '&post=' . $postrec->id; } redirect($redirecturl); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $deva An object from the form in mod_form.php * @return boolean Success/Fail */ function deva_update_instance($deva) { $deva->timemodified = time(); $deva->id = $deva->instance; # You may have to add extra stuff in here # return update_record('deva', $deva); }
function deletepost_submit(Pieform $form, $values) { global $SESSION; update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post'])); $SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum')); redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $values['parent']); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function poodllpairwork_update_instance($pairwork) { $pairwork->timemodified = time(); $pairwork->id = $pairwork->instance; # May have to add extra stuff in here # return update_record("poodllpairwork", $pairwork); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function jeliot_update_instance($jeliot) { $jeliot->timemodified = time(); $jeliot->id = $jeliot->instance; # May have to add extra stuff in here # return update_record("jeliot", $jeliot); }
function xmldb_blocktype_openbadgedisplayer_upgrade($oldversion = 0) { if ($oldversion < 2015062301) { $blocks = get_records_array('block_instance', 'blocktype', 'openbadgedisplayer'); if (is_array($blocks)) { foreach ($blocks as $block) { $configdata = unserialize($block->configdata); if (isset($configdata['badgegroup'])) { // Append source to legacy values if (is_string($configdata['badgegroup'])) { $configdata['badgegroup'] = 'backpack:' . $configdata['badgegroup']; } else { if (is_array($configdata['badgegroup'])) { foreach ($configdata['badgegroup'] as &$group) { $group = str_replace('https://openbadgepassport.com/', 'passport', $group); $group = str_replace('https://backpack.openbadges.org/', 'backpack', $group); } } } $block->configdata = serialize($configdata); update_record('block_instance', $block, 'id'); } } } } return true; }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function flv_update_instance($flv) { $flv->timemodified = time(); $flv->id = $flv->instance; # May have to add extra stuff in here # return update_record("flv", $flv); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $quotasystem An object from the form in mod_form.php * @return boolean Success/Fail */ function quotasystem_update_instance($quotasystem) { $quotasystem->timemodified = time(); $quotasystem->id = $quotasystem->instance; # You may have to add extra stuff in here # return update_record('quotasystem', $quotasystem); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $ejercicios An object from the form in mod_form.php * @return boolean Success/Fail */ function ejercicios_update_instance($ejercicios) { $ejercicios->timemodified = time(); $ejercicios->id = $ejercicios->instance; # You may have to add extra stuff in here # return update_record('ejercicios', $ejercicios); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $casecourseware An object from the form in mod_form.php * @return boolean Success/Fail */ function casecourseware_update_instance($casecourseware) { $casecourseware->timemodified = time(); $casecourseware->id = $casecourseware->instance; # You may have to add extra stuff in here # return update_record('casecourseware', $casecourseware); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function swf_update_instance($swf) { $swf->timemodified = time(); $swf->id = $swf->instance; # May have to add extra stuff in here # return update_record("swf", $swf); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function studynotes_update_instance($studynotes) { $studynotes->timemodified = time(); $studynotes->id = $studynotes->instance; # May have to add extra stuff in here # return update_record("studynotes", $studynotes); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function slideshow_update_instance($slideshow) { $slideshow->timemodified = time(); $slideshow->id = $slideshow->instance; # May have to add extra stuff in here # return update_record("slideshow", $slideshow); }
function ouwiki_update_instance($ouwiki) { global $CFG; $ok = true; $ouwiki->id = $ouwiki->instance; // Set up null values $nullvalues = array('editbegin', 'editend', 'timeout'); foreach ($nullvalues as $nullvalue) { if (empty($ouwiki->{$nullvalue})) { unset($ouwiki->{$nullvalue}); $ok &= execute_sql("UPDATE {$CFG->prefix}ouwiki SET {$nullvalue}=NULL WHERE id={$ouwiki->id}", false); } } if (strlen(preg_replace('/(<.*?>)|(&.*?;)|\\s/', '', $ouwiki->summary)) == 0) { unset($ouwiki->summary); $ok &= execute_sql("UPDATE {$CFG->prefix}ouwiki SET summary=NULL WHERE id={$ouwiki->id}", false); } ouwiki_check_groups($ouwiki); // insitu editing if (class_exists('ouflags') && has_capability('local/course:revisioneditor', get_context_instance(CONTEXT_COURSE, $ouwiki->course), null, false)) { include_once $CFG->dirroot . '/local/insitu/lib.php'; return oci_mod_make_backup_and_save_instance($ouwiki); } // Update main record $ok &= update_record("ouwiki", $ouwiki); return $ok; }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function mplayer_update_instance($mplayer) { $mplayer->timemodified = time(); $mplayer->id = $mplayer->instance; # May have to add extra stuff in here # return update_record("mplayer", $mplayer); }
/** * Given an object containing all the necessary data, * (defined by the form in mod.html) this function * will update an existing instance with new data. * * @param object $instance An object from the form in mod.html * @return boolean Success/Fail **/ function tab_update_instance($tab) { $tab->timemodified = time(); $tab->id = $tab->instance; # May have to add extra stuff in here # return update_record("tab", $tab); }
function submitview_submit(Pieform $form, $values) { global $SESSION, $viewid, $groupid; update_record('view', array('submittedgroup' => $groupid), array('id' => $viewid)); $SESSION->add_ok_msg(get_string('viewsubmitted', 'view')); redirect('/view/'); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $shoppingcart An object from the form in mod_form.php * @return boolean Success/Fail */ function shoppingcart_update_instance($shoppingcart) { $shoppingcart->timemodified = time(); $shoppingcart->id = $shoppingcart->instance; # You may have to add extra stuff in here # return update_record('shoppingcart', $shoppingcart); }
public static function restore_data($data, $restore) { $linknamestatus = $linkurlstatus = false; foreach ($data as $datum) { switch ($datum->name) { case 'linkname': // We just want to know that it is there $linknamestatus = true; break; case 'linkurl': $content = $datum->value; $result = restore_decode_content_links_worker($content, $restore); if ($result != $content) { $datum->value = addslashes($result); if (debugging() and !defined('RESTORE_SILENTLY')) { echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />'; } $linkurlstatus = update_record('pagemenu_link_data', $datum); } else { $linkurlstatus = true; } break; default: debugging('Deleting unknown data type: ' . $datum->name); // Not recognized delete_records('pagemenu_link_data', 'id', $datum->id); break; } } return $linkurlstatus and $linknamestatus; }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $rafl An object from the form in mod_form.php * @return boolean Success/Fail */ function rafl_update_instance($rafl) { $rafl->timemodified = time(); $rafl->id = $rafl->instance; # You may have to add extra stuff in here # return update_record('rafl', $rafl); }
function editfontform_submit(Pieform $form, $values) { global $USER, $SESSION; update_record('skin_fonts', array('title' => $values['fonttitle'], 'notice' => $values['fontnotice'], 'onlyheading' => $values['fonttype'] == 'heading' ? 1 : 0, 'fontstack' => '\'' . escape_css_string($values['fonttitle']) . '\'', 'genericfont' => $values['genericfont']), array('name' => $values['fontname'])); $SESSION->add_ok_msg(get_string('fontedited', 'skin')); redirect('/admin/site/fonts.php'); }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $diplome An object from the form in mod_form.php * @return boolean Success/Fail */ function diplome_update_instance($diplome) { $diplome->timemodified = time(); $diplome->id = $diplome->instance; # You may have to add extra stuff in here # return update_record('diplome', $diplome); }
function save_question_options($question) { if ($answer = get_record("question_answers", "question", $question->id)) { // Existing answer, so reuse it $answer->answer = $question->feedback; $answer->feedback = $question->feedback; $answer->fraction = $question->fraction; if (!update_record("question_answers", $answer)) { $result = new stdClass(); $result->error = "Could not update quiz answer!"; return $result; } } else { $answer = new stdClass(); $answer->question = $question->id; $answer->answer = $question->feedback; $answer->feedback = $question->feedback; $answer->fraction = $question->fraction; if (!($answer->id = insert_record("question_answers", $answer))) { $result = new stdClass(); $result->error = "Could not insert quiz answer!"; return $result; } } return true; }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $vimoodle An object from the form in mod_form.php * @return boolean Success/Fail */ function vimoodle_update_instance($vimoodle) { $vimoodle->timemodified = time(); $vimoodle->id = $vimoodle->instance; # You may have to add extra stuff in here # return update_record('vimoodle', $vimoodle); }
function openmeetings_update_instance($openmeetings) { $openmeetings->timemodified = time(); $openmeetings->id = $openmeetings->instance; # May have to add extra stuff in here # return update_record("openmeetings", $openmeetings); }
/** * Library of functions used by the RQP question type * * @version $Id: lib.php,v 1.2 2006/09/18 13:24:45 moodler Exp $ * @author Alex Smith and other members of the Serving Mathematics project * {@link http://maths.york.ac.uk/serving_maths} * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ function question_rqp_save_type($type) { if (empty($type->id)) { return insert_record('question_rqp_types', $type, false); } return update_record('question_rqp_types', $type); }
function save_question_options($question) { $result = true; $update = true; $answer = get_record("question_answers", "question", $question->id); if (!$answer) { $answer = new stdClass(); $answer->question = $question->id; $update = false; } $answer->answer = $question->feedback; $answer->feedback = $question->feedback; $answer->fraction = $question->fraction; if ($update) { if (!update_record("question_answers", $answer)) { $result = new stdClass(); $result->error = "Could not update quiz answer!"; } } else { if (!($answer->id = insert_record("question_answers", $answer))) { $result = new stdClass(); $result->error = "Could not insert quiz answer!"; } } return $result; }
function update_questionbank() { global $USER, $FULLME; $myurl = new moodle_url($FULLME); $myurl->param('first', 'second'); //print_object($myurl->get_query_string()); //notice('die please'); $qid = optional_param('qid', null); $theQuestion = optional_param('question', null); if (empty($theQuestion)) { return; } $question = get_record('memorybank_bank', 'id', $qid); print_object($question); $question->question = optional_param('question', null); $question->answer = optional_param('answer', null); $question->reference = optional_param('reference', null); $question->initialgrade = optional_param('initialgrade', 4); $question->category = optional_param('category', 0); $question->visible = optional_param('visible', 0); $initviewtime = optional_param('initviewtime', 0); $question->initviewtime = make_timestamp($initviewtime['year'], $initviewtime['month'], $initviewtime['day'], $initviewtime['hour'], $initviewtime['minute']); $question->modifiedby = $USER->id; $question->timemodified = time(); print_object($question); update_record('memorybank_bank', $question); }