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


PHP object::addElement方法代码示例

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


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

示例1: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreeitems', 'qtype_order'));
     $mform->closeHeaderBefore('answersinstruct');
     $mform->addElement('advcheckbox', 'horizontal', get_string('horizontal', 'qtype_order'), null, null, array(0, 1));
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'choicehdr', get_string('itemno', 'qtype_order', '{no}'));
     // change elements to support htmleditor (nadavkav)
     $repeated[] =& $mform->createElement('htmleditor', 'subquestions', '', array('cols' => 40, 'rows' => 13));
     if (isset($this->question->options)) {
         $countsubquestions = count($this->question->options->subquestions);
     } else {
         $countsubquestions = 0;
     }
     $repeatsatstart = QUESTION_NUMANS_START > $countsubquestions + QUESTION_NUMANS_ADD ? QUESTION_NUMANS_START : $countsubquestions + QUESTION_NUMANS_ADD;
     $mform->setType('subquestion', PARAM_TEXT);
     $this->repeat_elements($repeated, $repeatsatstart, array(), 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreqblanks', 'qtype_order'));
     $repeats = optional_param('noanswers', '', PARAM_INT);
     $addfields = optional_param('addanswers', '', PARAM_TEXT);
     if (!empty($addfields)) {
         $repeats += QUESTION_NUMANS_ADD;
     }
     for ($count = 0; $count < $repeats; $count++) {
         $mform->addElement('hidden', 'subanswers[' . $count . ']', $count + 1);
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:edit_order_form.php

示例2: date

    /**
     * Define the setting for a datetime custom field
     *
     * @param object $form the user form
     */
    function define_form_specific($form) {
        // Create variables to store start and end
        $currentyear = date('Y');
        $startyear = $currentyear - 100;
        $endyear = $currentyear + 20;

        // Create array for the years
        $arryears = array();
        for ($i = $startyear; $i <= $endyear; $i++) {
            $arryears[$i] = $i;
        }

        // Add elements
        $form->addElement('select', 'param1', get_string('startyear', 'profilefield_datetime'), $arryears);
        $form->setType('param1', PARAM_INT);
        $form->setDefault('param1', $currentyear);

        $form->addElement('select', 'param2', get_string('endyear', 'profilefield_datetime'), $arryears);
        $form->setType('param2', PARAM_INT);
        $form->setDefault('param2', $currentyear + 20);

        $form->addElement('checkbox', 'param3', get_string('wanttime', 'profilefield_datetime'));
        $form->setType('param3', PARAM_INT);

        $form->addElement('hidden', 'defaultdata', '0');
        $form->setType('defaultdata', PARAM_INT);
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:32,代码来源:define.class.php

示例3: setup_upload_gradatt

 /**
  * Add form elements for upload graduate attributes.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_gradatt($mform)
 {
     $mform->addElement('header', 'upload_gradatt_header', get_string('upload_gradatt_header', 'local_metadata'));
     $mform->addHelpButton('upload_gradatt_header', 'upload_gradatt_header', 'local_metadata');
     $mform->addElement('filepicker', 'temp_gradatt', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'upload_gradatt', get_string('upload_gradatt', 'local_metadata'));
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:12,代码来源:university_gradatt.php

示例4: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $QTYPES;
     $menu = array(get_string('answersingleno', 'qtype_multichoice'), get_string('answersingleyes', 'qtype_multichoice'));
     $mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_multichoice'), $menu);
     $mform->setDefault('single', 1);
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
     $mform->setHelpButton('shuffleanswers', array('multichoiceshuffle', get_string('shuffleanswers', 'qtype_multichoice'), 'quiz'));
     $mform->setDefault('shuffleanswers', 1);
     $numberingoptions = $QTYPES[$this->qtype()]->get_numbering_styles();
     $menu = array();
     foreach ($numberingoptions as $numberingoption) {
         $menu[$numberingoption] = get_string('answernumbering' . $numberingoption, 'qtype_multichoice');
     }
     $mform->addElement('select', 'answernumbering', get_string('answernumbering', 'qtype_multichoice'), $menu);
     $mform->setDefault('answernumbering', 'abc');
     /*        $mform->addElement('static', 'answersinstruct', get_string('choices', 'qtype_multichoice'), get_string('fillouttwochoices', 'qtype_multichoice'));
             $mform->closeHeaderBefore('answersinstruct');
     */
     $creategrades = get_grade_options();
     $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), $creategrades->gradeoptionsfull, max(5, QUESTION_NUMANS_START));
     $mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'qtype_multichoice'));
     foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $feedbackname) {
         $mform->addElement('htmleditor', $feedbackname, get_string($feedbackname, 'qtype_multichoice'), array('course' => $this->coursefilesid));
         $mform->setType($feedbackname, PARAM_RAW);
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:32,代码来源:edit_multichoice_form.php

示例5: add_unit_options

 /**
  * Add the unit handling options to the form.
  * @param object $mform the form being built.
  */
 protected function add_unit_options($mform)
 {
     $mform->addElement('header', 'unithandling', get_string('unithandling', 'qtype_numerical'));
     $unitoptions = array(qtype_numerical::UNITNONE => get_string('onlynumerical', 'qtype_numerical'), qtype_numerical::UNITOPTIONAL => get_string('manynumerical', 'qtype_numerical'), qtype_numerical::UNITGRADED => get_string('unitgraded', 'qtype_numerical'));
     $mform->addElement('select', 'unitrole', get_string('unithandling', 'qtype_numerical'), $unitoptions);
     $penaltygrp = array();
     $penaltygrp[] = $mform->createElement('text', 'unitpenalty', get_string('unitpenalty', 'qtype_numerical'), array('size' => 6));
     $mform->setType('unitpenalty', PARAM_FLOAT);
     $mform->setDefault('unitpenalty', 0.1);
     $unitgradingtypes = array(qtype_numerical::UNITGRADEDOUTOFMARK => get_string('decfractionofresponsegrade', 'qtype_numerical'), qtype_numerical::UNITGRADEDOUTOFMAX => get_string('decfractionofquestiongrade', 'qtype_numerical'));
     $penaltygrp[] = $mform->createElement('select', 'unitgradingtypes', '', $unitgradingtypes);
     $mform->setDefault('unitgradingtypes', 1);
     $mform->addGroup($penaltygrp, 'penaltygrp', get_string('unitpenalty', 'qtype_numerical'), ' ', false);
     $mform->addHelpButton('penaltygrp', 'unitpenalty', 'qtype_numerical');
     $unitinputoptions = array(qtype_numerical::UNITINPUT => get_string('editableunittext', 'qtype_numerical'), qtype_numerical::UNITRADIO => get_string('unitchoice', 'qtype_numerical'), qtype_numerical::UNITSELECT => get_string('unitselect', 'qtype_numerical'));
     $mform->addElement('select', 'multichoicedisplay', get_string('studentunitanswer', 'qtype_numerical'), $unitinputoptions);
     $unitsleftoptions = array(0 => get_string('rightexample', 'qtype_numerical'), 1 => get_string('leftexample', 'qtype_numerical'));
     $mform->addElement('select', 'unitsleft', get_string('unitposition', 'qtype_numerical'), $unitsleftoptions);
     $mform->setDefault('unitsleft', 0);
     $mform->disabledIf('penaltygrp', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('penaltygrp', 'unitrole', 'eq', qtype_numerical::UNITOPTIONAL);
     $mform->disabledIf('unitsleft', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('multichoicedisplay', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('multichoicedisplay', 'unitrole', 'eq', qtype_numerical::UNITOPTIONAL);
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:29,代码来源:edit_numerical_form.php

示例6: definition_inner

    /**
     * Add question-type specific form fields.
     *
     * @param object $mform the form being built.
     */
    protected function definition_inner($mform) {
        $menu = array(
            get_string('answersingleno', 'qtype_multichoice'),
            get_string('answersingleyes', 'qtype_multichoice'),
        );
        $mform->addElement('select', 'single',
                get_string('answerhowmany', 'qtype_multichoice'), $menu);
        $mform->setDefault('single', 1);

        $mform->addElement('advcheckbox', 'shuffleanswers',
                get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
        $mform->addHelpButton('shuffleanswers', 'shuffleanswers', 'qtype_multichoice');
        $mform->setDefault('shuffleanswers', 1);

        $mform->addElement('select', 'answernumbering',
                get_string('answernumbering', 'qtype_multichoice'),
                qtype_multichoice::get_numbering_styles());
        $mform->setDefault('answernumbering', 'abc');

        $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'),
                question_bank::fraction_options_full(), max(5, QUESTION_NUMANS_START));

        $this->add_combined_feedback_fields(true);
        $mform->disabledIf('shownumcorrect', 'single', 'eq', 1);

        $this->add_interactive_settings(true, true);
    }
开发者ID:Burick,项目名称:moodle,代码行数:32,代码来源:edit_multichoice_form.php

示例7: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffle', 'quiz'), null, null, array(0, 1));
     $mform->setHelpButton('shuffleanswers', array('matchshuffle', get_string('shuffle', 'quiz'), 'quiz'));
     $mform->setDefault('shuffleanswers', 1);
     $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreequestions', 'quiz'));
     $mform->closeHeaderBefore('answersinstruct');
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'choicehdr', get_string('questionno', 'quiz', '{no}'));
     $repeated[] =& $mform->createElement('textarea', 'subquestions', get_string('question', 'quiz'), array('cols' => 40, 'rows' => 3));
     $repeated[] =& $mform->createElement('text', 'subanswers', get_string('answer', 'quiz'), array('size' => 50));
     if (isset($this->question->options)) {
         $countsubquestions = count($this->question->options->subquestions);
     } else {
         $countsubquestions = 0;
     }
     if ($this->question->formoptions->repeatelements) {
         $repeatsatstart = QUESTION_NUMANS_START > $countsubquestions + QUESTION_NUMANS_ADD ? QUESTION_NUMANS_START : $countsubquestions + QUESTION_NUMANS_ADD;
     } else {
         $repeatsatstart = $countsubquestions;
     }
     $mform->setType('subanswer', PARAM_TEXT);
     $mform->setType('subquestion', PARAM_TEXT);
     $this->repeat_elements($repeated, $repeatsatstart, array(), 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreqblanks', 'qtype_match'));
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:30,代码来源:edit_match_form.php

示例8: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffle', 'quiz'), null, null, array(0, 1));
     $mform->setHelpButton('shuffleanswers', array('matchshuffle', get_string('shuffle', 'quiz'), 'quiz'));
     $mform->setDefault('shuffleanswers', 1);
     $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreeqsandtwoas', 'qtype_match'));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('questionno', 'quiz', '{no}'), 0);
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:14,代码来源:edit_match_form.php

示例9: buildQuickForm

 /**
  * build form for address input fields 
  *
  * @param object $form - CRM_Core_Form (or subclass)
  * @param array reference $location - location array
  * @param int $locationId - location id whose block needs to be built.
  * @return none
  *
  * @access public
  * @static
  */
 static function buildQuickForm(&$form)
 {
     $blockId = $form->get('Address_Block_Count') ? $form->get('Address_Block_Count') : 1;
     $config =& CRM_Core_Config::singleton();
     $countryDefault = $config->defaultContactCountry;
     $form->applyFilter('__ALL__', 'trim');
     $js = array('onChange' => 'checkLocation( this.id );');
     $form->addElement('select', "address[{$blockId}][location_type_id]", ts('Location Type'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::locationType(), $js);
     $js = array('id' => "Address_" . $blockId . "_IsPrimary", 'onClick' => 'singleSelect( this.id );');
     $form->addElement('checkbox', "address[{$blockId}][is_primary]", ts('Primary location for this contact'), ts('Primary location for this contact'), $js);
     $js = array('id' => "Address_" . $blockId . "_IsBilling", 'onClick' => 'singleSelect( this.id );');
     $form->addElement('checkbox', "address[{$blockId}][is_billing]", ts('Billing location for this contact'), ts('Billing location for this contact'), $js);
     require_once 'CRM/Core/BAO/Preferences.php';
     $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', true, null, true);
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address');
     $elements = array('address_name' => array(ts('Address Name'), $attributes['address_name'], null), 'street_address' => array(ts('Street Address'), $attributes['street_address'], null), 'supplemental_address_1' => array(ts('Addt\'l Address 1'), $attributes['supplemental_address_1'], null), 'supplemental_address_2' => array(ts('Addt\'l Address 2'), $attributes['supplemental_address_2'], null), 'city' => array(ts('City'), $attributes['city'], null), 'postal_code' => array(ts('Zip / Postal Code'), $attributes['postal_code'], null), 'postal_code_suffix' => array(ts('Postal Code Suffix'), array('size' => 4, 'maxlength' => 12), null), 'county_id' => array(ts('County'), $attributes['county_id'], 'county'), 'state_province_id' => array(ts('State / Province'), $attributes['state_province_id'], null), 'country_id' => array(ts('Country'), $attributes['country_id'], null), 'geo_code_1' => array(ts('Latitude'), array('size' => 9, 'maxlength' => 10), null), 'geo_code_2' => array(ts('Longitude'), array('size' => 9, 'maxlength' => 10), null));
     $stateCountryMap = array();
     foreach ($elements as $name => $v) {
         list($title, $attributes, $select) = $v;
         $nameWithoutID = strpos($name, '_id') !== false ? substr($name, 0, -3) : $name;
         if (!CRM_Utils_Array::value($nameWithoutID, $addressOptions)) {
             continue;
         }
         if (!$attributes) {
             $attributes = $attributes[$name];
         }
         //build normal select if country is not present in address block
         if ($name == 'state_province_id' && !$addressOptions['country']) {
             $select = 'stateProvince';
         }
         if (!$select) {
             if ($name == 'country_id' || $name == 'state_province_id') {
                 if ($name == 'country_id') {
                     $stateCountryMap[$blockId]['country'] = "address_{$blockId}_{$name}";
                     $selectOptions = array('' => ts('- select -')) + CRM_Core_PseudoConstant::country();
                 } else {
                     $stateCountryMap[$blockId]['state_province'] = "address_{$blockId}_{$name}";
                     if ($countryDefault) {
                         $selectOptions = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($countryDefault);
                     } else {
                         $selectOptions = array('' => ts('- select a country -'));
                     }
                 }
                 $form->addElement('select', "address[{$blockId}][{$name}]", $title, $selectOptions);
             } else {
                 if ($name == 'address_name') {
                     $name = "name";
                 }
                 $form->addElement('text', "address[{$blockId}][{$name}]", $title, $attributes);
             }
         } else {
             $form->addElement('select', "address[{$blockId}][{$name}]", $title, array('' => ts('- select -')) + CRM_Core_PseudoConstant::$select());
         }
     }
     require_once 'CRM/Core/BAO/Address.php';
     CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:68,代码来源:Address.php

示例10: config_form_display

    /**
     * Add appropriate form elements to the critieria form
     * @access  public
     * @param   object  $mform  Moodle forms object
     * @param   mixed   $data   optional
     * @return  void
     */
    public function config_form_display(&$mform, $data = null) {
        $mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
        $mform->addElement('text', 'criteria_grade_value', get_string('passinggrade', 'completion'));
        $mform->setDefault('criteria_grade_value', $data);

        if ($this->id) {
            $mform->setDefault('criteria_grade', 1);
            $mform->setDefault('criteria_grade_value', $this->gradepass);
        }
    }
开发者ID:nuckey,项目名称:moodle,代码行数:17,代码来源:completion_criteria_grade.php

示例11: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('advcheckbox', 'horizontal', get_string('horizontal', 'qtype_order'), null, null, array(0, 1));
     $mform->setDefault('horizontal', 0);
     $mform->addElement('static', 'answersinstruct', get_string('availablechoices', 'qtype_match'), get_string('filloutthreeitems', 'qtype_order'));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('questionno', 'question', '{no}'), 0);
     $this->add_combined_feedback_fields(true);
     $this->add_interactive_settings(true, true);
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:15,代码来源:edit_order_form.php

示例12: setup_upload_categories

 /**
  * Add form elements for upload course categories.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_categories($mform)
 {
     $mform->addElement('header', 'upload_category_header', get_string('upload_category_header', 'local_metadata'));
     $mform->addHelpButton('upload_category_header', 'upload_category_header', 'local_metadata');
     $mform->addElement('text', 'category_label', get_string('category_label', 'local_metadata'));
     $mform->setType('category_label', PARAM_TEXT);
     //$mform->addRule('category_label', get_string('err_required'), 'required', null, 'server');
     //$faculty_selection = $mform->addElement ('select', 'course_faculty', get_string ( 'course_faculty', 'local_metadata' ), $faculty_list);
     $mform->addElement('filepicker', 'temp_categories', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'submit_category', get_string('submit_category', 'local_metadata'));
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:16,代码来源:categories_form.php

示例13: array

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('select', 'correctanswer', get_string('correctanswer', 'qtype_truefalse'), array(0 => get_string('false', 'qtype_truefalse'), 1 => get_string('true', 'qtype_truefalse')));
     $mform->addElement('htmleditor', 'feedbacktrue', get_string('feedbacktrue', 'qtype_truefalse'), array('course' => $this->coursefilesid));
     $mform->setType('feedbacktrue', PARAM_RAW);
     $mform->addElement('htmleditor', 'feedbackfalse', get_string('feedbackfalse', 'qtype_truefalse'), array('course' => $this->coursefilesid));
     $mform->setType('feedbackfalse', PARAM_RAW);
     // Fix penalty factor at 1.
     $mform->setDefault('penalty', 1);
     $mform->freeze('penalty');
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:16,代码来源:edit_truefalse_form.php

示例14: setup_upload_program_obj

 /**
  * Add form elements for upload a file for program objective.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_program_obj($mform)
 {
     $mform->addElement('header', 'program_obj_header', get_string('program_obj_header', 'local_metadata'));
     // Text box to add new program specific learning objectives
     $mform->addElement('text', 'new_group', get_string('new_group', 'local_metadata'), '');
     //$mform->addRule('new_group', get_string('err_required', 'local_metadata'), 'required', null, 'client');
     $mform->setType('new_group', PARAM_RAW);
     $mform->addHelpButton('program_obj_header', 'program_obj_header', 'local_metadata');
     $mform->addElement('filepicker', 'temp_program_obj', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'upload_program_obj', get_string('upload_program_obj', 'local_metadata'));
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:16,代码来源:knowledge_form.php

示例15: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  * @access  public
  * @param   object  $mform  Moodle forms object
  * @param   mixed   $data   optional
  * @return  void
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_date', get_string('enable'));
     $mform->addElement('date', 'criteria_date_value', get_string('afterspecifieddate', 'completion'));
     // If instance of criteria exists
     if ($this->id) {
         $mform->setDefault('criteria_date', 1);
         $mform->setDefault('criteria_date_value', $this->timeend);
     } else {
         $mform->setDefault('criteria_date_value', time() + 3600 * 24);
     }
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:19,代码来源:completion_criteria_date.php


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