コード例 #1
0
            new moodle_url($returnurl));
        echo $OUTPUT->footer();
        exit;
    }
    else {
        $transaction = $DB->start_delegated_transaction();
        $DB->delete_records('facetoface_notice', array('id' => $id));
        $DB->delete_records('facetoface_notice_data', array('noticeid' => $id));
        $transaction->allow_commit();
        redirect($returnurl);
    }
}

$customfields = facetoface_get_session_customfields();

$mform = new mod_facetoface_sitenotice_form(null, compact('id', 'customfields'));
if ($mform->is_cancelled()) {
    redirect($returnurl);
}

if ($fromform = $mform->get_data()) { // Form submitted

    if (empty($fromform->submitbutton)) {
        print_error('error:unknownbuttonclicked', 'facetoface', $returnurl);
    }



    $todb = new stdClass();
    $todb->name = trim($fromform->name);
    $todb->text = trim($fromform->text['text']);
コード例 #2
0
        $info->name = format_string($notice->name);
        $info->text = format_text($notice->text, FORMAT_HTML);
        $optionsyes = array('id' => $id, 'sesskey' => $USER->sesskey, 'd' => 1, 'confirm' => 1);
        echo $OUTPUT->confirm(get_string('noticedeleteconfirm', 'facetoface', $info), new moodle_url("sitenotice.php", $optionsyes), new moodle_url($returnurl));
        echo $OUTPUT->footer();
        exit;
    } else {
        $transaction = $DB->start_delegated_transaction();
        $DB->delete_records('facetoface_notice', array('id' => $id));
        $DB->delete_records('facetoface_notice_data', array('noticeid' => $id));
        $transaction->allow_commit();
        redirect($returnurl);
    }
}
$customfields = facetoface_get_session_customfields();
$mform = new mod_facetoface_sitenotice_form(null, compact('id', 'customfields'));
if ($mform->is_cancelled()) {
    redirect($returnurl);
}
if ($fromform = $mform->get_data()) {
    // Form submitted.
    if (empty($fromform->submitbutton)) {
        print_error('error:unknownbuttonclicked', 'facetoface', $returnurl);
    }
    $todb = new stdClass();
    $todb->name = trim($fromform->name);
    $todb->text = trim($fromform->text['text']);
    $transaction = $DB->start_delegated_transaction();
    if ($notice != null) {
        $todb->id = $notice->id;
        $DB->update_record('facetoface_notice', $todb);