/**
  * 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);
     }
 }
Example #2
0
    /**
     * 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);
    }
 /**
  * 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'));
 }
 /**
  * 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);
     }
 }
 /**
  * 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);
 }
Example #6
0
    /**
     * 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);
    }
 /**
  * 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'));
 }
 /**
  * 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);
 }
Example #9
0
 /**
  * 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);
 }
    /**
     * 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);
        }
    }
 /**
  * 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);
 }
 /**
  * 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'));
 }
 /**
  * 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');
 }
 /**
  * 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'));
 }
 /**
  * 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);
     }
 }
 /**
  * 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_duration', get_string('enable'));
     $thresholdmenu = array();
     for ($i = 1; $i <= 30; $i++) {
         $seconds = $i * 86400;
         $thresholdmenu[$seconds] = get_string('numdays', '', $i);
     }
     $mform->addElement('select', 'criteria_duration_days', get_string('daysafterenrolment', 'completion'), $thresholdmenu);
     if ($this->id) {
         $mform->setDefault('criteria_duration', 1);
         $mform->setDefault('criteria_duration_days', $this->enrolperiod);
     }
 }
Example #17
0
 /**
  * function to build location block
  *
  * @param object $form the object of the form (QF Object)
  * @param int $maxLocationBlocks no of location blocks
  *
  * @static 
  * @access public
  */
 function &buildLocationBlock(&$form, $maxLocationBlocks)
 {
     $location = array();
     for ($locationId = 1; $locationId <= $maxLocationBlocks; $locationId++) {
         $location[$locationId]['location_type_id'] = $form->addElement('select', "location[{$locationId}][location_type_id]", null, CRM_Core_PseudoConstant::locationType());
         $location[$locationId]['is_primary'] = $form->addElement('checkbox', "location[{$locationId}][is_primary]", ts('Primary location for this contact'), ts('Primary location for this contact'), array('onchange' => "location_is_primary_onclick('" . $form->getName() . "', {$locationId}, {$maxLocationBlocks});"));
         $location[$locationId]['name'] = $form->addElement('text', "location[{$locationId}][name]", ts('Location Name'), CRM_Core_PseudoConstant::locationType());
         CRM_Contact_Form_Address::buildAddressBlock($form, $location, $locationId);
         CRM_Contact_Form_Phone::buildPhoneBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
         CRM_Contact_Form_Email::buildEmailBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
         CRM_Contact_Form_IM::buildIMBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
         CRM_Core_ShowHideBlocks::linksForArray($form, $locationId, $maxLocationBlocks, "location", '', '');
     }
     return $location;
 }
Example #18
0
 /**
  * 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
  */
 function buildAddressBlock(&$form, &$location, $locationId)
 {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address');
     $location[$locationId]['address']['street_address'] = $form->addElement('text', "location[{$locationId}][address][street_address]", ts('Street Address'), $attributes['street_address']);
     $location[$locationId]['address']['supplemental_address_1'] = $form->addElement('text', "location[{$locationId}][address][supplemental_address_1]", ts('Addt\'l Address 1'), $attributes['supplemental_address_1']);
     $location[$locationId]['address']['supplemental_address_2'] = $form->addElement('text', "location[{$locationId}][address][supplemental_address_2]", ts('Addt\'l Address 2'), $attributes['supplemental_address_2']);
     $location[$locationId]['address']['city'] = $form->addElement('text', "location[{$locationId}][address][city]", ts('City'), $attributes['city']);
     $location[$locationId]['address']['postal_code'] = $form->addElement('text', "location[{$locationId}][address][postal_code]", ts('Zip / Postal Code'), $attributes['postal_code']);
     $location[$locationId]['address']['postal_code_suffix'] = $form->addElement('text', "location[{$locationId}][address][postal_code_suffix]", ts('Add-on Code'), array('size' => 4, 'maxlength' => 12));
     $location[$locationId]['address']['state_province_id'] = $form->addElement('select', "location[{$locationId}][address][state_province_id]", ts('State / Province'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvince());
     $location[$locationId]['address']['country_id'] = $form->addElement('select', "location[{$locationId}][address][country_id]", ts('Country'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::country());
     //CRM_Contact_Form_StateCountry::stateCountryBuildForm(&$form, &$location, $locationId);
     $location[$locationId]['address']['geo_code_1'] = $form->addElement('text', "location[{$locationId}][address][geo_code_1]", ts('Latitude'), array('size' => 4, 'maxlength' => 8));
     $location[$locationId]['address']['geo_code_2'] = $form->addElement('text', "location[{$locationId}][address][geo_code_2]", ts('Longitude'), array('size' => 4, 'maxlength' => 8));
 }
Example #19
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_sck', null, get_string('isafter', 'filters'), null, array('0', '1'));
     $objs[] =& $mform->createElement('date_selector', $this->_uniqueid . '_sdt', null, array('optional' => false));
     $objs[] =& $mform->createElement('static', $this->_uniqueid . '_break', null, '<br/>');
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_eck', null, get_string('isbefore', 'filters'), null, array('0', '1'));
     $objs[] =& $mform->createElement('date_selector', $this->_uniqueid . '_edt', null, array('optional' => false));
     if ($this->_never_included) {
         $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_never', null, get_string('includenever', 'filters'));
     }
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $grp->setHelpButton($this->_filterhelp);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
     $mform->disabledIf($this->_uniqueid . '_sdt[day]', $this->_uniqueid . '_sck', '0');
     $mform->disabledIf($this->_uniqueid . '_sdt[month]', $this->_uniqueid . '_sck', '0');
     $mform->disabledIf($this->_uniqueid . '_sdt[year]', $this->_uniqueid . '_sck', '0');
     $mform->disabledIf($this->_uniqueid . '_edt[day]', $this->_uniqueid . '_eck', '0');
     $mform->disabledIf($this->_uniqueid . '_edt[month]', $this->_uniqueid . '_eck', '0');
     $mform->disabledIf($this->_uniqueid . '_edt[year]', $this->_uniqueid . '_eck', '0');
     if ($this->_never_included) {
         $mform->disabledIf($this->_uniqueid . '_never', $this->_uniqueid . '_eck', '0');
     }
 }
 /**
  * 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_self', get_string('enable'));
     if ($this->id) {
         $mform->setDefault('criteria_self', 1);
     }
 }
 /**
  * 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_activity[' . $data->id . ']', ucfirst(self::get_mod_name($data->module)) . ' - ' . $data->name);
     if ($this->id) {
         $mform->setDefault('criteria_activity[' . $data->id . ']', 1);
     }
 }
Example #22
0
 /**
  * Constructor Summary
  *
  * o Creates a standard progress bar into a dialog box (QuickForm).
  *   Form name, buttons 'start', 'cancel' labels and style, and
  *   title of dialog box may also be changed.
  *   <code>
  *   $monitor = new HTML_Progress_Monitor();
  *   </code>
  *
  * o Creates a progress bar into a dialog box, with only a new
  *   form name.
  *   <code>
  *   $monitor = new HTML_Progress_Monitor($formName);
  *   </code>
  *
  * o Creates a progress bar into a dialog box, with a new form name,
  *   new buttons name and style, and also a different title box.
  *   <code>
  *   $monitor = new HTML_Progress_Monitor($formName, $attributes);
  *   </code>
  *
  * @param      string    $formName      (optional) Name of monitor dialog box (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      1.0
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function HTML_Progress_Monitor($formName = 'ProgressMonitor', $attributes = array(), $errorPrefs = array())
 {
     $bar = new HTML_Progress($errorPrefs);
     $this->_progress = $bar;
     if (!is_string($formName)) {
         return $this->_progress->raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$formName', 'was' => gettype($formName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return $this->_progress->raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     $this->_id = md5(microtime());
     $this->_form = new HTML_QuickForm($formName);
     $this->_form->removeAttribute('name');
     // XHTML compliance
     $this->windowname = isset($attributes['title']) ? $attributes['title'] : 'In progress ...';
     $this->buttonStart = isset($attributes['start']) ? $attributes['start'] : 'Start';
     $this->buttonCancel = isset($attributes['cancel']) ? $attributes['cancel'] : 'Cancel';
     $buttonAttr = isset($attributes['button']) ? $attributes['button'] : '';
     $this->_form->addElement('header', 'windowname', $this->windowname);
     $this->_form->addElement('static', 'progressBar');
     $this->_form->addElement('static', 'progressStatus');
     $style = $this->isStarted() ? array('disabled' => 'true') : null;
     $buttons[] =& $this->_form->createElement('submit', 'start', $this->buttonStart, $style);
     $buttons[] =& $this->_form->createElement('submit', 'cancel', $this->buttonCancel);
     $buttons[0]->updateAttributes($buttonAttr);
     $buttons[1]->updateAttributes($buttonAttr);
     $this->_form->addGroup($buttons, 'buttons', '', '&nbsp;', false);
     // default embedded progress element with look-and-feel
     $this->setProgressElement($bar);
     $str =& $this->_form->getElement('progressStatus');
     $str->setText('<div id="status" class="progressStatus">&nbsp;</div>');
 }
Example #23
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $choices = array();
     foreach ($this->_options as $key => $value) {
         $choices[serialize($value)] = $key;
     }
     if (isset($this->_anyvalue)) {
         $choices = array('0' => get_string('anyvalue', 'filters')) + $choices;
     }
     $mform->addElement('select', $this->_uniqueid, $this->_label, $choices);
     $data = $mform->exportValues($this->_uniqueid);
     // ELIS-3474,ELIS-3475: since called from definition_after_data()
     // we MUST check if data has been set or default will override!
     if ((!is_array($data) || $data[$this->_uniqueid] === '') && isset($this->_default)) {
         $value = $this->_default;
         if (is_array($value)) {
             $value = serialize($value);
         }
         $mform->setDefault($this->_uniqueid, $value);
     }
     $mform->setHelpButton($this->_uniqueid, $this->_filterhelp);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid);
     }
 }
Example #24
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $objs[] =& $mform->createElement('checkbox', $this->_name . '_sck', null, get_string('isafter', 'filters'));
     $objs[] =& $mform->createElement('date_selector', $this->_name . '_sdt', null);
     $objs[] =& $mform->createElement('static', $this->_name . '_break', null, '<br>');
     $objs[] =& $mform->createElement('checkbox', $this->_name . '_eck', null, get_string('isbefore', 'filters'));
     $objs[] =& $mform->createElement('date_selector', $this->_name . '_edt', null);
     $objs[] =& $mform->createElement('checkbox', $this->_name . '_never', null, get_string('includenever', 'filters'));
     $grp =& $mform->addElement('group', $this->_name . '_grp', $this->_label, $objs, '', false);
     $grp->setHelpButton(array('date', $this->_label, 'filters'));
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name . '_grp');
     }
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name . '_grp');
     }
     $mform->disabledIf($this->_name . '_sdt[day]', $this->_name . '_sck', 'notchecked');
     $mform->disabledIf($this->_name . '_sdt[month]', $this->_name . '_sck', 'notchecked');
     $mform->disabledIf($this->_name . '_sdt[year]', $this->_name . '_sck', 'notchecked');
     $mform->disabledIf($this->_name . '_edt[day]', $this->_name . '_eck', 'notchecked');
     $mform->disabledIf($this->_name . '_edt[month]', $this->_name . '_eck', 'notchecked');
     $mform->disabledIf($this->_name . '_edt[year]', $this->_name . '_eck', 'notchecked');
     $mform->disabledIf($this->_name . '_never', $this->_name . '_eck', 'notchecked');
 }
 /**
  * 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_unenrol', get_string('completiononunenrolment', 'completion'));
     if ($this->id) {
         $mform->setDefault('criteria_unenrol', 1);
     }
 }
Example #26
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform) {
     $obj = & $mform->addElement('select', $this->_name, $this->_label, $this->get_costcenter_list());
     $mform->setDefault($this->_name, 0);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name);
     }
 }
 /**
  * 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_role[' . $data->id . ']', $data->name);
     if ($this->id) {
         $mform->setDefault('criteria_role[' . $data->id . ']', 1);
     }
 }
Example #28
0
    /**
     * Add question-type specific form fields.
     *
     * @param object $mform the form being built.
     */
    protected function definition_inner($mform) {
        $mform->addElement('advcheckbox', 'shuffleanswers',
                get_string('shuffle', 'qtype_match'), null, null, array(0, 1));
        $mform->addHelpButton('shuffleanswers', 'shuffle', 'qtype_match');
        $mform->setDefault('shuffleanswers', 1);

        $mform->addElement('static', 'answersinstruct',
                get_string('availablechoices', 'qtype_match'),
                get_string('filloutthreeqsandtwoas', 'qtype_match'));
        $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);
    }
Example #29
0
 /**
  * The progress uploader class constructor
  *
  * @param      string    $formName      (optional) Name of monitor dialog box (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  *
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function HTML_Progress_Uploader($formName = 'ProgressUploader', $attributes = array())
 {
     $this->_package = 'HTML_Progress_Uploader';
     Error_Raise::initialize($this->_package, array('HTML_Progress', '_getErrorMessage'));
     if (!is_string($formName)) {
         return Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$formName', 'was' => gettype($formName), 'expected' => 'string', 'paramnum' => 1), PEAR_ERROR_TRIGGER);
     } elseif (!is_array($attributes)) {
         return Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2), PEAR_ERROR_TRIGGER);
     }
     parent::FTP_Upload();
     // checks all necessary dependencies
     $this->_form = new HTML_QuickForm($formName);
     $this->windowname = isset($attributes['title']) ? $attributes['title'] : 'Upload ...';
     $this->captionMask = isset($attributes['mask']) ? $attributes['mask'] : '%s';
     $this->buttonStart = isset($attributes['start']) ? $attributes['start'] : 'Start';
     $this->buttonCancel = isset($attributes['cancel']) ? $attributes['cancel'] : 'Cancel';
     $buttonAttr = isset($attributes['button']) ? $attributes['button'] : '';
     $this->_form->addElement('header', 'windowname', $this->windowname);
     $this->_form->addElement('static', 'progressBar');
     $this->_form->addElement('static', 'progressStatus');
     $style = $this->isStarted() ? array('disabled' => 'true') : null;
     $buttons[] =& $this->_form->createElement('submit', 'start', $this->buttonStart, $style);
     $buttons[] =& $this->_form->createElement('submit', 'cancel', $this->buttonCancel);
     $buttons[0]->updateAttributes($buttonAttr);
     $buttons[1]->updateAttributes($buttonAttr);
     $this->_form->addGroup($buttons, 'buttons', '', '&nbsp;', false);
     // default embedded progress element with look-and-feel
     $this->_progress = new HTML_Progress();
     $this->setProgressElement($this->_progress);
     $str =& $this->_form->getElement('progressStatus');
     $str->setText('<div id="status" class="progressStatus">&nbsp;</div>');
 }
 /**
  * definition_inner adds all specific fields to the form.
  * @param object $mform (the form being built).
  */
 protected function definition_inner($mform)
 {
     $mform->addElement('header', 'previewareaheader', get_string('previewareaheader', 'qtype_' . $this->qtype()));
     $mform->addElement('static', 'previewarea', get_string('previewarea', 'qtype_' . $this->qtype()), get_string('previewareamessage', 'qtype_' . $this->qtype()));
     $mform->registerNoSubmitButton('refresh');
     $mform->addElement('submit', 'refresh', get_string('refresh', 'qtype_' . $this->qtype()));
     $mform->closeHeaderBefore('refresh');
     list($itemrepeatsatstart, $imagerepeats) = $this->get_drag_item_repeats();
     $this->definition_drop_zones($mform, $imagerepeats);
     $mform->addElement('advcheckbox', 'shuffleanswers', ' ', get_string('shuffleimages', 'qtype_' . $this->qtype()));
     $mform->setDefault('shuffleanswers', 0);
     $mform->closeHeaderBefore('shuffleanswers');
     //add the draggable image fields to the form
     $this->definition_draggable_items($mform, $itemrepeatsatstart);
     $this->add_combined_feedback_fields(true);
     $this->add_interactive_settings(true, true);
 }