本文整理汇总了PHP中moodleform::is_submitted方法的典型用法代码示例。如果您正苦于以下问题:PHP moodleform::is_submitted方法的具体用法?PHP moodleform::is_submitted怎么用?PHP moodleform::is_submitted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodleform
的用法示例。
在下文中一共展示了moodleform::is_submitted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Edit the plugin instance
*
* @param object $plugin
*/
public final function edit($report_id, $plugin_id, $reportfield_id)
{
global $CFG, $PARSER, $USER;
//get the report field record
$reportfield = $this->dbc->get_report_field_data($reportfield_id);
// include the moodle form library
require_once $CFG->libdir . '/formslib.php';
//include ilp_formslib
require_once $CFG->dirroot . '/blocks/ilp/classes/ilp_formslib.class.php';
// get the name of the evidence class being edited
$classname = get_class($this) . '_mform';
// include the moodle form for this table
include_once "{$CFG->dirroot}/blocks/ilp/classes/form_elements/plugins/{$classname}.php";
if (!class_exists($classname)) {
print_error('noeditilpform', 'block_ilp', '', get_class($this));
}
if (!empty($reportfield->id)) {
$plugin = $this->dbc->get_form_element_plugin($reportfield->plugin_id);
//get the form element data from the plugin table
$form_element = $this->dbc->get_form_element_by_reportfield($plugin->tablename, $reportfield->id);
$non_attrib = array('id', 'timemodified', 'timecreated');
if (!empty($form_element)) {
foreach ($form_element as $attrib => $value) {
if (!in_array($attrib, $non_attrib)) {
$reportfield->{$attrib} = $value;
}
}
}
$this->return_data($reportfield);
} else {
//new element - check for config file
if (file_exists($this->local_config_file)) {
$reportfield->optionlist = self::itemlist_flatten(parse_ini_file($this->local_config_file));
}
}
// instantiate the form and load the data
$this->mform = new $classname($report_id, $plugin_id, $USER->id);
$this->mform->set_data($reportfield);
//enter a back u
$backurl = $CFG->wwwroot . "/blocks/ilp/actions/edit_prompt.php?report_id={$report_id}";
//was the form cancelled?
if ($this->mform->is_cancelled()) {
//send the user back
redirect($backurl, get_string('returnreportprompt', 'block_ilp'), ILP_REDIRECT_DELAY);
}
//was the form submitted?
// has the form been submitted?
if ($this->mform->is_submitted()) {
// check the validation rules
if ($this->mform->is_validated()) {
//get the form data submitted
$formdata = $this->mform->get_data();
$formdata->audit_type = $this->audit_type();
// process the data
$success = $this->mform->process_data($formdata);
//if saving the data was not successful
if (!$success) {
//print an error message
print_error(get_string("fieldcreationerror", 'block_ilp'), 'block_ilp');
}
if ($this->mform->is_submitted()) {
//return the user to the
$return_url = $CFG->wwwroot . "/blocks/ilp/actions/edit_prompt.php?report_id={$report_id}";
redirect($return_url, get_string("fieldcreationsuc", 'block_ilp'), ILP_REDIRECT_DELAY);
}
}
}
}