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


PHP moodleform_mod::definition_after_data方法代码示例

本文整理汇总了PHP中moodleform_mod::definition_after_data方法的典型用法代码示例。如果您正苦于以下问题:PHP moodleform_mod::definition_after_data方法的具体用法?PHP moodleform_mod::definition_after_data怎么用?PHP moodleform_mod::definition_after_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在moodleform_mod的用法示例。


在下文中一共展示了moodleform_mod::definition_after_data方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: definition_after_data

 public function definition_after_data()
 {
     global $DB;
     parent::definition_after_data();
     $mform = $this->_form;
     // If sharing is turned on, check to see if they can turn it off.
     if ($mform->elementExists('enablesharing') && $mform->getElementValue('enablesharing')) {
         // Look for any shared pages that use this id.
         $subpageid = $mform->getElementValue('instance');
         if ($DB->record_exists('sharedsubpage', array('subpageid' => $subpageid))) {
             $mform->getElement('enablesharing')->freeze();
         }
     }
 }
开发者ID:ninelanterns,项目名称:moodle-mod_subpage,代码行数:14,代码来源:mod_form.php

示例2: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     if ($id = $mform->getElementValue('update')) {
         $dta = $mform->getElementValue('open');
         $dt = mktime($dta['hour'][0], $dta['minute'][0], 0, $dta['month'][0], $dta['day'][0], $dta['year'][0]);
         if ($dt < time()) {
             $el = $mform->createElement('static', 'openlabel', 'Open', date("D d/m/Y H:i", $dt));
             $mform->insertElementBefore($el, 'open');
             $mform->removeElement('open');
             $mform->addElement('hidden', 'opendt', $dt);
         }
     }
 }
开发者ID:netspotau,项目名称:moodle-mod_teambuilder,代码行数:15,代码来源:mod_form.php

示例3: definition_after_data

    /**
     * Make fields editable or non-editable depending on the administrator choices
     * @see moodleform_mod::definition_after_data()
     */
    public function definition_after_data() {
        parent::definition_after_data();

        //$mform =& $this->_form;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:9,代码来源:mod_form.php

示例4: array

 function definition_after_data()
 {
     global $COURSE, $DB;
     parent::definition_after_data();
     $mform =& $this->_form;
     $mainglossaryel =& $mform->getElement('mainglossary');
     $mainglossary = $DB->get_record('glossary', array('mainglossary' => 1, 'course' => $COURSE->id));
     if ($mainglossary && $mainglossary->id != $mform->getElementValue('instance')) {
         //secondary glossary, a main one already exists in this course.
         $mainglossaryel->setValue(0);
         $mainglossaryel->freeze();
         $mainglossaryel->setPersistantFreeze(true);
     } else {
         $mainglossaryel->unfreeze();
         $mainglossaryel->setPersistantFreeze(false);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:17,代码来源:mod_form.php

示例5:

 function definition_after_data()
 {
     if ($this->current->instance and $this->current->tobemigrated) {
         // resource not migrated yet
         return;
     }
     parent::definition_after_data();
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:8,代码来源:mod_form.php

示例6: definition_after_data

 /**
  * Set the grade item categories when editing an instance
  */
 public function definition_after_data()
 {
     $mform =& $this->_form;
     if ($id = $mform->getElementValue('update')) {
         $instance = $mform->getElementValue('instance');
         $gradeitems = grade_item::fetch_all(array('itemtype' => 'mod', 'itemmodule' => 'workshop', 'iteminstance' => $instance, 'courseid' => $this->course->id));
         if (!empty($gradeitems)) {
             foreach ($gradeitems as $gradeitem) {
                 // here comes really crappy way how to set the value of the fields
                 // gradecategory and gradinggradecategory - grrr QuickForms
                 $decimalpoints = $gradeitem->get_decimals();
                 if ($gradeitem->itemnumber == 0) {
                     $submissiongradepass = $mform->getElement('submissiongradepass');
                     $submissiongradepass->setValue(format_float($gradeitem->gradepass, $decimalpoints));
                     $group = $mform->getElement('submissiongradegroup');
                     $elements = $group->getElements();
                     foreach ($elements as $element) {
                         if ($element->getName() == 'gradecategory') {
                             $element->setValue($gradeitem->categoryid);
                         }
                     }
                 } else {
                     if ($gradeitem->itemnumber == 1) {
                         $gradinggradepass = $mform->getElement('gradinggradepass');
                         $gradinggradepass->setValue(format_float($gradeitem->gradepass, $decimalpoints));
                         $group = $mform->getElement('gradinggradegroup');
                         $elements = $group->getElements();
                         foreach ($elements as $element) {
                             if ($element->getName() == 'gradinggradecategory') {
                                 $element->setValue($gradeitem->categoryid);
                             }
                         }
                     }
                 }
             }
         }
     }
     parent::definition_after_data();
 }
开发者ID:sirromas,项目名称:lms,代码行数:42,代码来源:mod_form.php

示例7:

 function definition_after_data()
 {
     parent::definition_after_data();
     $mform =& $this->_form;
     $type =& $mform->getElement('type');
     $typevalue = $mform->getElementValue('type');
     //we don't want to have these appear as possible selections in the form but
     //we want the form to display them if they are set.
     if ($typevalue[0] == 'news') {
         $type->addOption(get_string('namenews', 'forum'), 'news');
         $mform->addHelpButton('type', 'namenews', 'forum');
         $type->freeze();
         $type->setPersistantFreeze(true);
     }
     if ($typevalue[0] == 'social') {
         $type->addOption(get_string('namesocial', 'forum'), 'social');
         $type->freeze();
         $type->setPersistantFreeze(true);
     }
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:20,代码来源:mod_form.php

示例8: definition_after_data

 /**
  * Set the grade item categories when editing an instance
  */
 public function definition_after_data()
 {
     parent::definition_after_data();
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:7,代码来源:mod_form.php

示例9: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     $mform =& $this->_form;
     $data = $this->current;
     $choices = array();
     if (!empty($data->id)) {
         global $DB;
         /* The method $this->get_submitted_data() does only return values for fields that are already
            defined->load ids from db -> create fields(values are overwritten by submitted data). */
         $choices = $DB->get_records('ratingallocate_choices', array('ratingallocateid' => $data->id), 'title ASC');
     } else {
         $this->newchoicecounter = 2;
     }
     // If there is already submitted data?
     if ($this->is_submitted()) {
         // Load new_choice_counter.
         if (property_exists($this->get_submitted_data(), self::NEW_CHOICE_COUNTER)) {
             $this->newchoicecounter = $this->get_submitted_data()->{self::NEW_CHOICE_COUNTER};
         }
         // Increment new choice counter if add_new_choice button was pressed.
         if (property_exists($this->get_submitted_data(), self::ADD_CHOICE_ACTION)) {
             $this->newchoicecounter++;
         }
     }
     for ($i = 0; $i < $this->newchoicecounter; $i++) {
         $choices[] = $this->create_empty_choice($i + 1);
     }
     // Generate array with ids of all choices.
     $choiceids = array_map(function ($elem) {
         return (int) $elem->id;
     }, $choices);
     // Initialize variable.
     $deletechoicearray = array();
     // If delete choice button was pressed.
     if ($this->is_submitted()) {
         // Retrieve ids of choices to be deleted from the static field.
         if (property_exists($this->get_submitted_data(), self::DELETED_CHOICE_IDS)) {
             $deletedchoiceids = $this->get_submitted_data()->{self::DELETED_CHOICE_IDS};
         }
         // If the string is not empty the array of choice ids is exploded from it.
         if (!empty($deletedchoiceids)) {
             $deletechoicearray = explode(',', $deletedchoiceids);
         }
         // Parses all delete choice ids to integers.
         $integercheck = function ($elem) {
             return (int) $elem;
         };
         array_map($integercheck, $deletechoicearray);
         // Retrieve id of choice to be deleted if delete button was pressed.
         $matches = preg_grep('/' . self::DELETE_CHOICE_ACTION . '([-]?[0-9]+)/', array_keys($mform->getSubmitValues()));
         // Only proceed if exaclty one delete button was found in the submitted data.
         if (count($matches) == 1) {
             // Retrieve the id as an Integer from the button name.
             $elem = array_pop($matches);
             $parts = explode('_', $elem);
             $deletechoiceid = (int) array_pop($parts);
             // If the id matches one of the choices add it to the choices to be deleted.
             if (in_array($deletechoiceid, $choiceids)) {
                 $deletechoicearray[] = $deletechoiceid;
             }
         }
     }
     // Clean array to only contain feasible ids.
     $deletechoicearray = array_intersect($deletechoicearray, $choiceids);
     // Create fields for all choices.
     foreach ($choices as $id => $choice) {
         if (!in_array($choice->id, $deletechoicearray)) {
             $this->add_choice_group($mform, $choice);
         } else {
             // The nosubmit button has to be added since the form uses it for no_submit_button_pressed().
             $mform->registerNoSubmitButton(self::DELETE_CHOICE_ACTION . $choice->id);
         }
     }
     if ($this->is_submitted()) {
         $subdata = $this->get_submitted_data();
         $allstrategyoptions = $subdata->{self::STRATEGY_OPTIONS};
     } else {
         if (isset($data->setting)) {
             $allstrategyoptions = json_decode($data->setting, true);
         }
     }
     // Add dynamic settings fields.
     foreach (\strategymanager::get_strategies() as $strategy) {
         // Load strategy class.
         $strategyclassp = 'ratingallocate\\' . $strategy . '\\strategy';
         /* @var $strategyclass \strategytemplate */
         if (isset($allstrategyoptions) && array_key_exists($strategy, $allstrategyoptions)) {
             $strategyclass = new $strategyclassp($allstrategyoptions[$strategy]);
         } else {
             $strategyclass = new $strategyclassp();
         }
         $strategyplaceholder = self::STRATEGY_OPTIONS_PLACEHOLDER . '[' . $strategy . ']';
         // Add options fields.
         $dynamicsettingsfields = $strategyclass->get_dynamic_settingfields();
         foreach ($dynamicsettingsfields as $key => $value) {
             $fieldid = $this->get_settingsfield_identifier($strategy, $key);
             $this->add_settings_field($fieldid, $value, $strategy, $mform);
             $mform->insertElementBefore($mform->removeElement($fieldid, false), $strategyplaceholder);
         }
//.........这里部分代码省略.........
开发者ID:andrewhancox,项目名称:moodle-mod_ratingallocate,代码行数:101,代码来源:mod_form.php

示例10:

 function definition_after_data()
 {
     parent::definition_after_data();
     global $COURSE;
     $mform =& $this->_form;
     if ($this->clone) {
         $mform->removeElement('groupmode');
         return;
     }
     $targetforumid = $mform->getElementValue('removeto');
     $targetforumid = $targetforumid[0];
     $removeafter = $mform->getElementValue('removeafter');
     $removeafter = $removeafter[0];
     if ($removeafter && $targetforumid) {
         $modinfo = get_fast_modinfo($COURSE);
         if (!array_key_exists($targetforumid, $modinfo->instances['forumng'])) {
             $mform->getElement('removeto')->addOption(get_string('invalidforum', 'forumng'), $targetforumid);
         }
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:20,代码来源:mod_form.php

示例11: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     global $DB;
     $mform = $this->_form;
     $cmid = $mform->getElementValue('coursemodule');
     $mform->removeElement('groupmode');
     // Remove group mode as cutom method is implemented.
     if (!empty($cmid)) {
         // The user is updating the instance of the activity.
         // Remove the file manager as the annotations may not make .
         // sense if the file they are applied to are changed.
         $mform->removeElement('files');
         // Find out what type of document it was and set selector.
         $table = "annotation_document";
         $results = $DB->get_records($table, array('cmid' => $cmid));
         foreach ($results as $result) {
             $documenttype = $result->documenttype;
             $groupannotation = $result->groupannotation;
             $groupannotationsvisible = $result->groupannotationsvisible;
             $allowfrom = $result->allowfrom;
             $allowuntil = $result->allowuntil;
             break;
         }
         $mform->setDefault('type', $documenttype);
         $mform->setDefault('groupannotation', $groupannotation);
         $mform->setDefault('groupannotationsvisible', $groupannotationsvisible);
         $mform->setDefault('allowfrom', $allowfrom);
         $mform->setDefault('allowuntil', $allowuntil);
     }
 }
开发者ID:jamiemcg,项目名称:moodle-collaborative-annotation,代码行数:31,代码来源:mod_form.php

示例12:

 function definition_after_data()
 {
     parent::definition_after_data();
     global $COURSE;
     $mform =& $this->_form;
     $coursemodule =& $mform->getElementValue('coursemodule');
     if ($coursemodule) {
         $mform->hardFreeze('timeopen');
         $mform->hardFreeze('timeclose');
         $mform->hardFreeze('timeslot');
         $mform->hardFreeze('timeblock');
     }
 }
开发者ID:eriko,项目名称:interview,代码行数:13,代码来源:mod_form.php


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