当前位置: 首页>>代码示例>>PHP>>正文


PHP moodleform::is_submitted方法代码示例

本文整理汇总了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);
             }
         }
     }
 }
开发者ID:nathanfriend,项目名称:moodle-block_ilp,代码行数:73,代码来源:ilp_element_plugin.php


注:本文中的moodleform::is_submitted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。