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


PHP moodleform::definition_after_data方法代码示例

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


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

示例1: foreach

 function definition_after_data()
 {
     global $CFG;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = get_record(CLSTCURTABLE, 'id', $association_id)) {
             //cluster stuff
             if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             //curriculum stuff
             $curriculum_sql = "SELECT cur.idnumber,\n                                          cur.name,\n                                          cur.description,\n                                          cur.reqcredits,\n                                   COUNT(curcrs.id) as numcourses\n                                   FROM {$CFG->prefix}crlm_curriculum cur\n                                   LEFT JOIN {$CFG->prefix}crlm_curriculum_course curcrs\n                                   ON curcrs.curriculumid = cur.id\n                                   WHERE cur.id = {$record->curriculumid}";
             if ($curriculum_record = get_record_sql($curriculum_sql)) {
                 foreach ($this->curriculum_fields as $id => $display) {
                     $element =& $mform->getElement('curriculum' . $id);
                     $element->setValue($curriculum_record->{$id});
                 }
             }
             //association stuff
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:28,代码来源:clustercurriculumeditform.class.php

示例2: foreach

 function definition_after_data()
 {
     global $CFG, $DB;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = $DB->get_record(clustercurriculum::TABLE, array('id' => $association_id))) {
             //cluster stuff
             if ($cluster_record = $DB->get_record(userset::TABLE, array('id' => $record->clusterid))) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             //curriculum stuff
             $curriculum_sql = "SELECT cur.idnumber,\n                                          cur.name,\n                                          cur.description,\n                                          cur.reqcredits,\n                                   COUNT(curcrs.id) as numcourses\n                                   FROM {" . curriculum::TABLE . "} cur\n                                   LEFT JOIN {" . curriculumcourse::TABLE . "} curcrs\n                                   ON curcrs.curriculumid = cur.id\n                                   WHERE cur.id = ?";
             $params = array($record->curriculumid);
             if ($curriculum_record = $DB->get_record_sql($curriculum_sql, $params)) {
                 foreach ($this->curriculum_fields as $id => $display) {
                     $element =& $mform->getElement('curriculum' . $id);
                     $element->setValue($curriculum_record->{$id});
                 }
             }
             //association stuff
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:29,代码来源:clustercurriculumeditform.class.php

示例3: foreach

 function definition_after_data()
 {
     global $CFG;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = get_record(CLSTTRKTABLE, 'id', $association_id)) {
             if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             $track_sql = "SELECT trk.*,\n                                     cur.name AS parcur,\n                                     (SELECT COUNT(*)\n                                      FROM {$CFG->prefix}crlm_track_class\n                                      WHERE trackid = trk.id ) as class\n                              FROM {$CFG->prefix}crlm_track trk\n                              JOIN {$CFG->prefix}crlm_curriculum cur\n                              ON trk.curid = cur.id\n                              WHERE trk.defaulttrack = 0\n                              AND trk.id = {$record->trackid}";
             if ($track_record = get_record_sql($track_sql)) {
                 foreach ($this->track_fields as $id => $display) {
                     $element =& $mform->getElement('track' . $id);
                     $element->setValue($track_record->{$id});
                 }
             }
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:25,代码来源:clustertrackeditform.class.php

示例4: foreach

 function definition_after_data()
 {
     global $CFG, $DB;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = $DB->get_record(clustertrack::TABLE, array('id' => $association_id))) {
             if ($cluster_record = $DB->get_record(userset::TABLE, array('id' => $record->clusterid))) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             $params = array();
             $track_sql = "SELECT trk.*,\n                                     cur.name AS parcur,\n                                     (SELECT COUNT(*)\n                                      FROM {" . trackassignment::TABLE . "}\n                                      WHERE trackid = trk.id ) as class\n                              FROM {" . track::TABLE . "} trk\n                              JOIN {" . curriculum::TABLE . "} cur\n                              ON trk.curid = cur.id\n                              WHERE trk.defaulttrack = 0\n                              AND trk.id = :trackid";
             $params['trackid'] = $record->trackid;
             if ($track_record = $DB->get_record_sql($track_sql, $params)) {
                 foreach ($this->track_fields as $id => $display) {
                     $element =& $mform->getElement('track' . $id);
                     $element->setValue($track_record->{$id});
                 }
             }
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:27,代码来源:clustertrackeditform.class.php

示例5: definition_after_data

 public function definition_after_data()
 {
     global $DB, $USER;
     parent::definition_after_data();
     $mform =& $this->_form;
     $unlocksystemid_element = $mform->getElement('unlocksystemid');
     $unlocksystemid = $unlocksystemid_element->getValue();
     $courseid_element = $mform->getElement('courseid');
     $courseid = $courseid_element->getValue();
     $mform->addElement('textarea', 'whereclause', get_string("advancedconditionaddselect", 'block_game_content_unlock'));
     $mform->addRule('whereclause', null, 'required', null, 'client');
     $options = array(0 => get_string('advancedconditionaddtrueifzero', 'block_game_content_unlock'), 1 => get_string('advancedconditionaddtrueifnotzero', 'block_game_content_unlock'), 2 => get_string('advancedconditionaddtrueifegthan', 'block_game_content_unlock'));
     $mform->addElement('select', 'trueif', get_string('advancedconditionaddtrueif', 'block_game_content_unlock'), $options, null);
     $mform->addRule('trueif', null, 'required', null, 'client');
     $mform->addElement('text', 'count', get_string('advancedconditionaddcount', 'block_game_content_unlock'));
     $mform->disabledIf('count', 'trueif', 'neq', 2);
     $this->add_action_buttons(true, get_string('advancedconditionaddbutton', 'block_game_content_unlock'));
 }
开发者ID:LoysGibertoni,项目名称:mdl_block_content_unlock,代码行数:18,代码来源:block_game_content_unlock_advancedconditionadd_form.php

示例6:

 /**
  * This function is used for uploading program objectives
  * @return void
  */
 function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     $this->upload_program_obj($mform);
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:10,代码来源:knowledge_form.php

示例7:

 /**
  * This function is used for uploading and deleting graduate attributes.
  * @return void
  */
 function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     $this->upload_graduate_attributes($mform);
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:10,代码来源:university_gradatt.php

示例8:

 function definition_after_data()
 {
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($mform->elementExists('format')) {
         $mform->getElement('format')->setValue(FORMAT_MOODLE);
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:8,代码来源:editpost_form.php

示例9: 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

示例10:

 /**
  * This function is used for uploading and deleting course categories.
  * @return void
  */
 function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     $data = $this->get_data();
     $category_was_uploaded = $mform->getSubmitValue('submit_category');
     if ($category_was_uploaded) {
         $files = $this->get_draft_files('temp_categories');
         $this->submit_category($data, $mform, $files);
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:15,代码来源:categories_form.php

示例11: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($this->is_submitted()) {
         if (property_exists($this->get_submitted_data(), self::FILTER_STATE)) {
             $this->filter_state = $this->get_submitted_data()->{self::FILTER_STATE};
         }
         // Only switch the filter state, if the filter button was pressed
         if (property_exists($this->get_submitted_data(), self::FILTER_BUTTON)) {
             switch ($this->filter_state) {
                 case self::FILTER_ALL:
                     $this->filter_state = self::FILTER_ONLY_RATERS;
                     break;
                 case self::FILTER_ONLY_RATERS:
                     $this->filter_state = self::FILTER_ALL;
                     break;
             }
         }
     }
     // add explanation as html
     $mform->insertElementBefore($mform->createElement('html', '<p>' . get_string('allocation_manual_explain_' . $this->filter_state, ratingallocate_MOD_NAME) . '</p>'), self::EXLPANATION_PLACEHOLDER);
     $mform->removeElement(self::EXLPANATION_PLACEHOLDER);
     // operations epending on filter_state
     // * rename filter button
     // * set rating data
     $filter_button_text = 'Filter';
     switch ($this->filter_state) {
         case self::FILTER_ALL:
             $filter_button_text = get_string('manual_allocation_filter_only_raters', ratingallocate_MOD_NAME);
             $ratingdata = $this->ratingallocate->get_ratings_for_rateable_choices();
             break;
         case self::FILTER_ONLY_RATERS:
             $filter_button_text = get_string('manual_allocation_filter_all', ratingallocate_MOD_NAME);
             $ratingdata = $this->ratingallocate->get_ratings_for_rateable_choices_for_raters_without_alloc();
             break;
     }
     $mform->getElement(self::FILTER_BUTTON)->setValue($filter_button_text);
     $empty_preferences = array();
     foreach ($this->ratingallocate->get_rateable_choices() as $choiceid => $choice) {
         $empty_preferences[$choiceid] = get_string('no_rating_given', ratingallocate_MOD_NAME);
     }
     $userdata = array();
     if ($this->filter_state == self::FILTER_ALL) {
         // Create one entry for each user choice combination
         foreach ($this->ratingallocate->get_raters_in_course() as $userid => $users) {
             $userdata[$userid] = $empty_preferences;
         }
     }
     $different_ratings = array();
     // Add actual rating data to userdata
     foreach ($ratingdata as $rating) {
         if (!array_key_exists($rating->userid, $userdata)) {
             $userdata[$rating->userid] = $empty_preferences;
         }
         $userdata[$rating->userid][$rating->choiceid] = $rating->rating;
         $different_ratings[$rating->rating] = $rating->rating;
     }
     $usersincourse = $this->ratingallocate->get_raters_in_course();
     $choicesWithAllocations = $this->ratingallocate->get_choices_with_allocationcount();
     foreach ($userdata as $userid => $userdat) {
         $headerelem = 'head_ratingallocate_u' . $userid;
         $elemprefix = 'data[' . $userid . ']';
         $ratingelem = $elemprefix . '[' . self::ASSIGN . ']';
         $rating_titles = $this->ratingallocate->get_options_titles($different_ratings);
         $radioarray = array();
         foreach ($userdat as $choiceid => $rat) {
             $title = key_exists($rat, $rating_titles) ? get_string('rated', ratingallocate_MOD_NAME, $rating_titles[$rat]) : $rat;
             $optionname = $choicesWithAllocations[$choiceid]->title . ' [' . $title . "] (" . ($choicesWithAllocations[$choiceid]->usercount > 0 ? $choicesWithAllocations[$choiceid]->usercount : "0") . "/" . $choicesWithAllocations[$choiceid]->maxsize . ")";
             $radioarray[] =& $mform->createElement('radio', $ratingelem, '', $optionname, $choiceid, '');
         }
         // Adding static elements to support css
         $radioarray = $this->ratingallocate->prepare_horizontal_radio_choice($radioarray, $mform);
         // wichtig, einen Gruppennamen zu setzen, damit später die Errors an der korrekten Stelle angezeigt werden können.
         $mform->addGroup($radioarray, 'radioarr_' . $userid, fullname($usersincourse[$userid]), null, false);
         $userallocations = $this->ratingallocate->get_allocations_for_user($userid);
         $allocation = array_pop($userallocations);
         if (isset($allocation)) {
             $mform->setDefault($ratingelem, $allocation->choiceid);
         }
     }
     if (!count($userdata) > 0) {
         $mform->addElement('header', 'notification', get_string('no_user_to_allocate', ratingallocate_MOD_NAME));
         $mform->addElement('cancel');
     } else {
         $this->add_action_buttons();
     }
     $mform->getElement(self::FILTER_STATE)->setValue($this->filter_state);
 }
开发者ID:andrewhancox,项目名称:moodle-mod_ratingallocate,代码行数:89,代码来源:form_manual_allocation.php

示例12:

 function definition_after_data()
 {
     parent::definition_after_data();
     global $USER;
     // Anonymous post, only allow the original user to change this setting
     $mform =& $this->_form;
     $anon =& $mform->getElement('anonymouspost');
     $uservalue = $mform->getElementValue('userid');
     if ($USER->id != $uservalue) {
         $anon->freeze();
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:12,代码来源:post_form.php

示例13: definition_after_data

 public function definition_after_data()
 {
     parent::definition_after_data();
     $mform =& $this->_form;
     $this->add_action_buttons(false);
 }
开发者ID:advancingdesign,项目名称:moodle-local_enrolmentreminder,代码行数:6,代码来源:forms.php

示例14:

 /**
  * This function is used for uploading course objective and required readings.
  * and delete required reading.
  * @return void
  */
 function definition_after_data()
 {
     parent::definition_after_data();
     $mform = $this->_form;
     $this->delete_reading($mform);
     $this->upload_req_reading($mform);
     $this->upload_course_obj($mform);
     $this->delete_graduate_attribute($mform);
     if (isset($_POST['option_add_fields_reading'])) {
         redirect_to_anchor('reading', 'id_option_add_fields_reading', -200);
     }
     if (isset($_POST['option_add_fields_knowledge'])) {
         redirect_to_anchor('knowledge', 'id_option_add_fields_knowledge', -100);
     }
     if (isset($_POST['option_add_fields_skill'])) {
         redirect_to_anchor('skill', 'id_option_add_fields_skill', -100);
     }
     if (isset($_POST['option_add_fields_attitude'])) {
         redirect_to_anchor('attitude', 'id_option_add_fields_attitude', -100);
     }
     if (isset($_POST['option_add_fields_gradAtt'])) {
         redirect_to_anchor('gradAtt', 'id_option_add_fields_gradAtt', -100);
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:29,代码来源:general_form.php


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