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


PHP object::disabledIf方法代码示例

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


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

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

示例2: setupForm

 /**
  * 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');
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:29,代码来源:date.php

示例3: setupForm

 /**
  * 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');
     }
 }
开发者ID:benavidesrobert,项目名称:elis.base,代码行数:30,代码来源:date.php

示例4: setupForm

 /**
  * 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('select', $this->_name.'_op', null, $this->getOperators());
     $objs[] =& $mform->createElement('text', $this->_name, null);
     $grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
     $mform->disabledIf($this->_name, $this->_name.'_op', 'eq', 5);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name.'_grp');
     }
 }
开发者ID:Burick,项目名称:moodle,代码行数:14,代码来源:text.php

示例5: setupForm

 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     if (is_array($this->_fields)) {
         $objs[] =& $mform->createElement('select', $this->_name . '_fld', null, $this->_fields);
     }
     $objs[] =& $mform->createElement('checkbox', $this->_name . '_sck', null, get_string('isafter', 'filters'));
     $objs[] =& $mform->createElement('date_selector', $this->_name . '_sdt', null);
     $objs[] =& $mform->createElement('checkbox', $this->_name . '_eck', null, get_string('isbefore', 'filters'));
     $objs[] =& $mform->createElement('date_selector', $this->_name . '_edt', null);
     $grp =& $mform->addElement('group', $this->_name . '_grp', $this->_label, $objs, '', false);
     $grp->setHelpButton(array('date', '', 'filters'));
     $mform->setDefault($this->_name . '_sck', !empty($this->_value));
     $mform->setDefault($this->_name . '_eck', !empty($this->_value2));
     $mform->setDefault($this->_name . '_sdt', $this->_value);
     $mform->setDefault($this->_name . '_edt', $this->_value2);
     if (is_array($this->_fields)) {
         $mform->setDefault($this->_name . '_fld', $this->_field);
     }
     $mform->disabledIf($this->_name . '_sdt', $this->_name . '_sck');
     $mform->disabledIf($this->_name . '_edt', $this->_name . '_eck');
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:26,代码来源:date.php

示例6: setupForm

 /**
  * 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('select', $this->_name . '_op', null, $this->get_operators());
     $objs[] =& $mform->createElement('select', $this->_name, null, $this->_options);
     $grp =& $mform->addElement('group', $this->_name . '_grp', $this->_label, $objs, '', false);
     $mform->disabledIf($this->_name, $this->_name . '_op', 'eq', 0);
     if (!is_null($this->_default)) {
         $mform->setDefault($this->_name, $this->_default);
     }
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name . '_grp');
     }
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:18,代码来源:select.php

示例7: setupForm

 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 public function setupForm(&$mform)
 {
     $objs = array();
     $objs['select'] = $mform->createElement('select', $this->_name . '_op', null, $this->getOperators());
     $objs['text'] = $mform->createElement('text', $this->_name, null);
     $objs['select']->setLabel(get_string('limiterfor', 'filters', $this->_label));
     $objs['text']->setLabel(get_string('valuefor', 'filters', $this->_label));
     $grp =& $mform->addElement('group', $this->_name . '_grp', $this->_label, $objs, '', false);
     $mform->setType($this->_name, PARAM_RAW);
     $mform->disabledIf($this->_name, $this->_name . '_op', 'eq', 5);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name . '_grp');
     }
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:18,代码来源:text.php

示例8: setupForm

 /**
  * 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('select', $this->_uniqueid . '_op', null, $this->getOperators());
     $objs[] =& $mform->createElement('text', $this->_uniqueid, null);
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $mform->setType($this->_uniqueid, PARAM_RAW);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     $mform->disabledIf($this->_uniqueid, $this->_uniqueid . '_op', 'eq', 5);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:18,代码来源:text.php

示例9: setupForm

 /**
  * 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('select', $this->_uniqueid . '_op', null, $this->get_operators());
     $objs[] =& $mform->createElement('select', $this->_uniqueid, null, $this->_options);
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     $mform->disabledIf($this->_uniqueid, $this->_uniqueid . '_op', 'eq', 0);
     if (!is_null($this->_default)) {
         $mform->setDefault($this->_uniqueid, $this->_default);
     }
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:20,代码来源:equalityselect.php

示例10: definition_inner

 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 public function definition_inner($mform)
 {
     // cache this plugins name
     $plugin = 'qtype_ordering';
     // selecttype
     $name = 'selecttype';
     $label = get_string($name, $plugin);
     $options = array(0 => get_string('selectall', $plugin), 1 => get_string('selectrandom', $plugin), 2 => get_string('selectcontiguous', $plugin));
     $mform->addElement('select', $name, $label, $options);
     $mform->addHelpButton($name, $name, $plugin);
     $mform->setDefault($name, 0);
     // selectcount
     $name = 'selectcount';
     $label = get_string($name, $plugin);
     $options = array(0 => get_string('all'));
     for ($i = 3; $i <= 20; $i++) {
         $options[$i] = $i;
     }
     $mform->addElement('select', $name, $label, $options);
     $mform->disabledIf($name, 'selecttype', 'eq', 0);
     $mform->addHelpButton($name, $name, $plugin);
     $mform->setDefault($name, 0);
     // answers (=items)
     $elements = array();
     $name = 'answerheader';
     $label = get_string($name, $plugin);
     $elements[] =& $mform->createElement('header', $name, $label);
     $name = 'answer';
     $label = get_string($name, $plugin);
     $options = array('rows' => self::NUM_ANS_ROWS, 'cols' => self::NUM_ANS_COLS);
     $elements[] =& $mform->createElement('textarea', $name, $label, $options);
     if (empty($this->question->options)) {
         $start = 0;
     } else {
         $start = count($this->question->options->answers);
     }
     if ($start < self::NUM_ANS_START) {
         $start = self::NUM_ANS_START;
     }
     $options = array('answerheader' => array('expanded' => true));
     $buttontext = get_string('addmoreanswers', $plugin, self::NUM_ANS_ADD);
     $this->repeat_elements($elements, $start, $options, 'countanswers', 'addanswers', self::NUM_ANS_ADD, $buttontext);
     // feedback
     $this->add_ordering_feedback_fields();
 }
开发者ID:Kathrin84,项目名称:moodle-qtype_ordering,代码行数:50,代码来源:edit_ordering_form.php

示例11: onQuickFormEvent

 /**
  * Called by HTML_QuickForm whenever form event is made on this element
  *
  * @param string $event Name of event
  * @param mixed $arg event arguments
  * @param object $caller calling object
  * @return bool
  */
 function onQuickFormEvent($event, $arg, &$caller)
 {
     switch ($event) {
         case 'updateValue':
             // Constant values override both default and submitted ones
             // default values are overriden by submitted.
             $value = $this->_findValue($caller->_constantValues);
             if (null === $value) {
                 // If no boxes were checked, then there is no value in the array
                 // yet we don't want to display default value in this case.
                 if ($caller->isSubmitted()) {
                     $value = $this->_findValue($caller->_submitValues);
                 } else {
                     $value = $this->_findValue($caller->_defaultValues);
                 }
             }
             $requestvalue = $value;
             if ($value == 0) {
                 $value = time();
             }
             if (!is_array($value)) {
                 $calendartype = \core_calendar\type_factory::get_calendar_instance();
                 $currentdate = $calendartype->timestamp_to_date_array($value, $this->_options['timezone']);
                 $value = array('day' => $currentdate['mday'], 'month' => $currentdate['mon'], 'year' => $currentdate['year']);
                 // If optional, default to off, unless a date was provided.
                 if ($this->_options['optional']) {
                     $value['enabled'] = $requestvalue != 0;
                 }
             } else {
                 $value['enabled'] = isset($value['enabled']);
             }
             if (null !== $value) {
                 $this->setValue($value);
             }
             break;
         case 'createElement':
             // Optional is an optional param, if its set we need to add a disabledIf rule.
             // If its empty or not specified then its not an optional dateselector.
             if (!empty($arg[2]['optional']) && !empty($arg[0])) {
                 // When using the function addElement, rather than createElement, we still
                 // enter this case, making this check necessary.
                 if ($this->_usedcreateelement) {
                     $caller->disabledIf($arg[0] . '[day]', $arg[0] . '[enabled]');
                     $caller->disabledIf($arg[0] . '[month]', $arg[0] . '[enabled]');
                     $caller->disabledIf($arg[0] . '[year]', $arg[0] . '[enabled]');
                 } else {
                     $caller->disabledIf($arg[0], $arg[0] . '[enabled]');
                 }
             }
             return parent::onQuickFormEvent($event, $arg, $caller);
             break;
         case 'addElement':
             $this->_usedcreateelement = false;
             return parent::onQuickFormEvent($event, $arg, $caller);
             break;
         default:
             return parent::onQuickFormEvent($event, $arg, $caller);
     }
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:67,代码来源:dateselector.php

示例12: get_form_elements_module

 /**
  * hook to add plagiarism specific settings to a module settings page
  * @param object $mform  - Moodle form
  * @param object $context - current context
  */
 public function get_form_elements_module($mform, $context)
 {
     global $DB;
     $plagiarismsettings = (array) get_config('plagiarism');
     if (!empty($plagiarismsettings['crot_use'])) {
         $cmid = optional_param('update', 0, PARAM_INT);
         //there doesn't seem to be a way to obtain the current cm a better way - $this->_cm is not available here.
         if (!empty($cmid)) {
             $plagiarismvalues = $DB->get_records_menu('plagiarism_crot_config', array('cm' => $cmid), '', 'name,value');
         }
         $plagiarismelements = $this->config_options();
         $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
         $mform->addElement('header', 'crotdesc', get_string('crot', 'plagiarism_crot'));
         $mform->addHelpButton('crotdesc', 'crot', 'plagiarism_crot');
         $mform->addElement('select', 'crot_use', get_string("usecrot", "plagiarism_crot"), $ynoptions);
         $mform->addElement('select', 'crot_local', get_string("comparestudents", "plagiarism_crot"), $ynoptions);
         $mform->disabledIf('crot_local', 'crot_use', 'eq', 0);
         $mform->setDefault('crot_local', '1');
         $mform->addElement('select', 'crot_global', get_string("compareinternet", "plagiarism_crot"), $ynoptions);
         $mform->disabledIf('crot_global', 'crot_use', 'eq', 0);
         foreach ($plagiarismelements as $element) {
             if (isset($plagiarismvalues[$element])) {
                 $mform->setDefault($element, $plagiarismvalues[$element]);
             }
         }
     }
     //Add elements to form using standard mform like:
     //$mform->addElement('hidden', $element);
     //$mform->disabledIf('plagiarism_draft_submit', 'var4', 'eq', 0);
 }
开发者ID:abgreeve,项目名称:moodle-plagiarism_crot,代码行数:35,代码来源:lib.php

示例13: setupForm

 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $options = array('optional' => false);
     if (!empty($this->_timezone)) {
         $options['timezone'] = $this->_timezone;
     }
     if (!empty($this->_startyear)) {
         $options['startyear'] = $this->_startyear;
     }
     if (!empty($this->_stopyear)) {
         $options['stopyear'] = $this->_stopyear;
     }
     $date_elem = $this->_inctime ? 'date_time_selector' : 'date_selector';
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_sck', null, get_string('isafter', 'filters'));
     $objs[] =& $mform->createElement($date_elem, $this->_uniqueid . '_sdt', null, $options);
     $objs[] =& $mform->createElement('static', $this->_uniqueid . '_break', null, '<br/>');
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_eck', null, get_string('isbefore', 'filters'));
     $objs[] =& $mform->createElement($date_elem, $this->_uniqueid . '_edt', null, $options);
     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);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
     $mform->disabledIf($this->_uniqueid . '_sdt[day]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_sdt[month]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_sdt[year]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[day]', $this->_uniqueid . '_eck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[month]', $this->_uniqueid . '_eck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[year]', $this->_uniqueid . '_eck', 'notchecked');
     if ($this->_inctime) {
         $mform->disabledIf($this->_uniqueid . '_sdt[hour]', $this->_uniqueid . '_sck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_sdt[minute]', $this->_uniqueid . '_sck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_edt[hour]', $this->_uniqueid . '_eck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_edt[minute]', $this->_uniqueid . '_eck', 'notchecked');
     }
     if ($this->_never_included) {
         $mform->disabledIf($this->_uniqueid . '_never', $this->_uniqueid . '_eck', '0');
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:48,代码来源:date.php

示例14: onQuickFormEvent

 /**
  * Called by HTML_QuickForm whenever form event is made on this element
  *
  * @param     string    $event  Name of event
  * @param     mixed     $arg    event arguments
  * @param     object    $caller calling object
  * @since     1.0
  * @access    public
  * @return    void
  */
 function onQuickFormEvent($event, $arg, &$caller)
 {
     switch ($event) {
         case 'updateValue':
             // constant values override both default and submitted ones
             // default values are overriden by submitted
             $value = $this->_findValue($caller->_constantValues);
             if (null === $value) {
                 // if no boxes were checked, then there is no value in the array
                 // yet we don't want to display default value in this case
                 if ($caller->isSubmitted()) {
                     $value = $this->_findValue($caller->_submitValues);
                 } else {
                     $value = $this->_findValue($caller->_defaultValues);
                 }
             }
             $requestvalue = $value;
             if ($value == 0) {
                 $value = time();
             }
             if (!is_array($value)) {
                 $currentdate = usergetdate($value, $this->_options['timezone']);
                 // Round minutes to the previous multiple of step.
                 $currentdate['minutes'] -= $currentdate['minutes'] % $this->_options['step'];
                 $value = array('minute' => $currentdate['minutes'], 'hour' => $currentdate['hours']);
                 // If optional, default to off, unless a date was provided
                 if ($this->_options['optional']) {
                     $value['off'] = $requestvalue == 0 ? true : false;
                 }
             } else {
                 $value['off'] = isset($value['off']) ? true : false;
             }
             if (null !== $value) {
                 $this->setValue($value);
             }
             break;
         case 'createElement':
             if (isset($arg[2]['checked']) and 0 == strcmp('checked', $arg[2]['checked'])) {
                 $caller->setDefault($arg[0] . '[timeenable]', true);
             }
             if (!empty($arg[2]['optional'])) {
                 $caller->disabledIf($arg[0], $arg[0] . '[timeenable]', 'checked');
             }
             if (!empty($arg[2]['display_12h'])) {
                 $this->display_12h = true;
             }
             return parent::onQuickFormEvent($event, $arg, $caller);
             break;
         default:
             return parent::onQuickFormEvent($event, $arg, $caller);
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:62,代码来源:timeselector.php

示例15: turnitin_get_form_elements

/**
 * adds the list of plagiarism settings to a form
 *
 * @param object $mform - Moodle form object
 */
function turnitin_get_form_elements($mform)
{
    $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
    $tiishowoptions = array(PLAGIARISM_TII_SHOW_NEVER => get_string("never"), PLAGIARISM_TII_SHOW_ALWAYS => get_string("always"), PLAGIARISM_TII_SHOW_CLOSED => get_string("showwhenclosed", "plagiarism_turnitin"));
    $tiidraftoptions = array(PLAGIARISM_TII_DRAFTSUBMIT_IMMEDIATE => get_string("submitondraft", "plagiarism_turnitin"), PLAGIARISM_TII_DRAFTSUBMIT_FINAL => get_string("submitonfinal", "plagiarism_turnitin"));
    $reportgenoptions = array(0 => get_string('reportgenimmediate', 'plagiarism_turnitin'), 1 => get_string('reportgenimmediateoverwrite', 'plagiarism_turnitin'), 2 => get_string('reportgenduedate', 'plagiarism_turnitin'));
    $excludetype = array(0 => get_string('no'), 1 => get_string('wordcount', 'plagiarism_turnitin'), 2 => get_string('percentage', 'plagiarism_turnitin'));
    $mform->addElement('header', 'plagiarismdesc');
    $mform->addElement('select', 'use_turnitin', get_string("useturnitin", "plagiarism_turnitin"), $ynoptions);
    $mform->addElement('select', 'plagiarism_show_student_score', get_string("showstudentsscore", "plagiarism_turnitin"), $tiishowoptions);
    $mform->addHelpButton('plagiarism_show_student_score', 'showstudentsscore', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_show_student_report', get_string("showstudentsreport", "plagiarism_turnitin"), $tiishowoptions);
    $mform->addHelpButton('plagiarism_show_student_report', 'showstudentsreport', 'plagiarism_turnitin');
    if ($mform->elementExists('var4')) {
        $mform->addElement('select', 'plagiarism_draft_submit', get_string("draftsubmit", "plagiarism_turnitin"), $tiidraftoptions);
    }
    $mform->addElement('select', 'plagiarism_compare_student_papers', get_string("comparestudents", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_student_papers', 'comparestudents', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_compare_internet', get_string("compareinternet", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_internet', 'compareinternet', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_compare_journals', get_string("comparejournals", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_journals', 'comparejournals', 'plagiarism_turnitin');
    if (get_config('plagiarism', 'turnitin_institutionnode')) {
        $mform->addElement('select', 'plagiarism_compare_institution', get_string("compareinstitution", "plagiarism_turnitin"), $ynoptions);
        $mform->addHelpButton('plagiarism_compare_institution', 'compareinstitution', 'plagiarism_turnitin');
    }
    $mform->addElement('select', 'plagiarism_report_gen', get_string("reportgen", "plagiarism_turnitin"), $reportgenoptions);
    $mform->addHelpButton('plagiarism_report_gen', 'reportgen', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_biblio', get_string("excludebiblio", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_exclude_biblio', 'excludebiblio', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_quoted', get_string("excludequoted", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_exclude_quoted', 'excludequoted', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_matches', get_string("excludematches", "plagiarism_turnitin"), $excludetype);
    $mform->addHelpButton('plagiarism_exclude_matches', 'excludematches', 'plagiarism_turnitin');
    $mform->addElement('text', 'plagiarism_exclude_matches_value', '');
    $mform->addRule('plagiarism_exclude_matches_value', null, 'numeric', null, 'client');
    $mform->disabledIf('plagiarism_exclude_matches_value', 'plagiarism_exclude_matches', 'eq', 0);
    $mform->addElement('select', 'plagiarism_anonymity', get_string("anonymity", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_anonymity', 'anonymity', 'plagiarism_turnitin');
}
开发者ID:rrusso,项目名称:moodle-plagiarism_turnitin,代码行数:45,代码来源:lib.php


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