Added ability to edit an element on the rearrange page

Increased the Moodle version required as this feature
uses the AMD module 'core/fragment' which was introduced
in 3.1.
This commit is contained in:
Mark Nelson 2016-06-13 19:39:57 +08:00
parent 65aee9c9c0
commit 555bca9ebb
13 changed files with 510 additions and 15 deletions

View file

@ -101,6 +101,7 @@ abstract class element {
* Can be overridden if more functionality is needed.
*
* @param \stdClass $data the form data
* @return bool true of success, false otherwise.
*/
public function save_form_elements($data) {
global $DB;
@ -119,13 +120,13 @@ abstract class element {
// Check if we are updating, or inserting a new element.
if (!empty($this->element->id)) { // Must be updating a record in the database.
$element->id = $this->element->id;
$DB->update_record('customcert_elements', $element);
return $DB->update_record('customcert_elements', $element);
} else { // Must be adding a new one.
$element->element = $data->element;
$element->pageid = $data->pageid;
$element->sequence = \mod_customcert\element_helper::get_element_sequence($element->pageid);
$element->timecreated = time();
$DB->insert_record('customcert_elements', $element);
return $DB->insert_record('customcert_elements', $element, false);
}
}