} if (!$DB->delete_records('facetoface_session_data', array('fieldid' => $id))) { throw new Exception(get_string('error:couldnotdeletefield', 'facetoface')); } $transaction->allow_commit(); } catch (Exception $e) { $transaction->rollback($e); } redirect($returnurl); } } $mform = new mod_facetoface_customfield_form(null, compact('id')); if ($mform->is_cancelled()) { redirect($returnurl); } if ($fromform = $mform->get_data()) { // Form submitted if (empty($fromform->submitbutton)) { print_error('error:unknownbuttonclicked', 'facetoface', $returnurl); } // Post-process the input if (empty($fromform->required)) { $fromform->required = 0; } if (empty($fromform->showinsummary)) {
$transaction = $DB->start_delegated_transaction(); try { if (!$DB->delete_records('facetoface_session_field', array('id' => $id))) { throw new Exception(get_string('error:couldnotdeletefield', 'facetoface')); } if (!$DB->delete_records('facetoface_session_data', array('fieldid' => $id))) { throw new Exception(get_string('error:couldnotdeletefield', 'facetoface')); } $transaction->allow_commit(); } catch (Exception $e) { $transaction->rollback($e); } redirect($returnurl); } } $mform = new mod_facetoface_customfield_form(null, compact('id')); if ($mform->is_cancelled()) { redirect($returnurl); } if ($fromform = $mform->get_data()) { // Form submitted. if (empty($fromform->submitbutton)) { print_error('error:unknownbuttonclicked', 'facetoface', $returnurl); } // Post-process the input. if (empty($fromform->required)) { $fromform->required = 0; } if (empty($fromform->isfilter)) { $fromform->isfilter = 0; }