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


PHP MoodleQuickForm::createElement方法代码示例

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


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

示例1: other_preference_fields

 protected function other_preference_fields(MoodleQuickForm $mform)
 {
     $mform->addGroup(array($mform->createElement('advcheckbox', 'qtext', '', get_string('questiontext', 'quiz_responses')), $mform->createElement('advcheckbox', 'resp', '', get_string('response', 'quiz_responses')), $mform->createElement('advcheckbox', 'right', '', get_string('rightanswer', 'quiz_responses'))), 'coloptions', get_string('showthe', 'quiz_responses'), array(' '), false);
     $mform->disabledIf('qtext', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     $mform->disabledIf('resp', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     $mform->disabledIf('right', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:responses_form.php

示例2: array

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $menu = array(get_string('caseno', 'quiz'), get_string('caseyes', 'quiz'));
     $mform->addElement('select', 'usecase', get_string('casesensitive', 'quiz'), $menu);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), get_string('filloutoneanswer', 'quiz'));
     $mform->closeHeaderBefore('answersinstruct');
     $creategrades = get_grade_options();
     $gradeoptions = $creategrades->gradeoptions;
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerno', 'qtype_shortanswer', '{no}'));
     $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 54));
     $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
     $repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'), array('course' => $this->coursefilesid));
     if (isset($this->question->options)) {
         $countanswers = count($this->question->options->answers);
     } else {
         $countanswers = 0;
     }
     if ($this->question->formoptions->repeatelements) {
         $repeatsatstart = QUESTION_NUMANS_START > $countanswers + QUESTION_NUMANS_ADD ? QUESTION_NUMANS_START : $countanswers + QUESTION_NUMANS_ADD;
     } else {
         $repeatsatstart = $countanswers;
     }
     $repeatedoptions = array();
     $mform->setType('answer', PARAM_RAW);
     $repeatedoptions['fraction']['default'] = 0;
     $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreanswerblanks', 'qtype_shortanswer'));
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:33,代码来源:edit_shortanswer_form.php

示例3: array

 /**
  * @param MoodleQuickForm $mform
  */
 function add_submit_buttons($mform)
 {
     $buttons = array();
     $buttons[] =& $mform->createElement('submit', 'submitbutton', get_string('filter', 'local_mr'));
     $buttons[] =& $mform->createElement('submit', 'resetbutton', get_string('reset', 'local_mr'));
     $mform->addGroup($buttons, 'buttons', '', array(' '), false);
     $mform->registerNoSubmitButton('reset');
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:11,代码来源:filter.php

示例4: create_cell_element

 /**
  * Create the form element used to define the weight of the cell
  * 
  * @param MoodleQuickForm   $form
  * @param int $row          row number
  * @param int $col          column number
  * @return object
  */
 public function create_cell_element($form, $row, $col, $multiple)
 {
     $cell_name = $this->cell_name($row, $col, $multiple);
     if ($multiple) {
         return $form->createElement('checkbox', $cell_name, 'label');
     } else {
         return $form->createElement('radio', $cell_name, '', '', $col);
     }
 }
开发者ID:sunilwebaccess,项目名称:moodle-question-matrix,代码行数:17,代码来源:qtype_matrix_grading.class.php

示例5: _createElements

 function _createElements()
 {
     $this->_elements = array();
     for ($i = 1; $i <= 31; $i++) {
         $days[$i] = $i;
     }
     for ($i = 1; $i <= 12; $i++) {
         $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
     }
     for ($i = $this->_options['startyear']; $i <= $this->_options['stopyear']; $i++) {
         $years[$i] = $i;
     }
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
     // If optional we add a checkbox which the user can use to turn if on
     if ($this->_options['optional']) {
         $this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'off', null, get_string('disable'), $this->getAttributes(), true);
     }
     foreach ($this->_elements as $element) {
         if (method_exists($element, 'setHiddenLabel')) {
             $element->setHiddenLabel(true);
         }
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:25,代码来源:dateselector.php

示例6: definition

 function definition()
 {
     $mform =& $this->_form;
     $qcreate = $this->_customdata['qcreate'];
     if ($qcreate->graderatio != 100) {
         //--------------------------------------------------------------------------------
         $mform->addElement('header', 'exportselection', get_string('exportselection', 'qcreate'));
         $menu = make_grades_menu($qcreate->grade);
         unset($menu[0]);
         $menu += array(0 => get_string('allquestions', 'qcreate'));
         $mform->addElement('select', 'betterthangrade', get_string('betterthangrade', 'qcreate'), $menu);
         $mform->setDefault('betterthangrade', 0);
     }
     $mform->addElement('header', 'exportnaming', get_string('exportnaming', 'qcreate'));
     $cbarray3 = array();
     $cbarray3[] =& MoodleQuickForm::createElement('checkbox', 'naming[other]', '', get_string('specifictext', 'qcreate'));
     $cbarray3[] =& MoodleQuickForm::createElement('text', 'naming[othertext]');
     $mform->addGroup($cbarray3, 'naming3', '', array(' '), false);
     $mform->disabledIf('naming3', 'naming[other]');
     $cbarray1 = array();
     $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[firstname]', '', get_string('firstname'));
     $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[lastname]', '', get_string('lastname'));
     $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[username]', '', get_string('username', 'qcreate'));
     $mform->addGroup($cbarray1, 'naming1', '', array(' '), false);
     $cbarray2 = array();
     $cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[activityname]', '', get_string('activityname', 'qcreate'));
     $cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[timecreated]', '', get_string('timecreated', 'qcreate'));
     $mform->addGroup($cbarray2, 'naming2', '', array(' '), false);
     parent::definition();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:30,代码来源:export_good_questions_form.php

示例7: definition

 function definition()
 {
     global $CFG, $USER;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $modcontext = $this->_customdata['modcontext'];
     $mform->addElement('header', 'general', get_string('export', 'quiz'));
     $mform->setHelpButton('general', array('export', get_string('export', 'quiz'), 'attforblock'));
     $groupmode = groups_get_activity_groupmode($cm);
     $groups = groups_get_activity_allowed_groups($cm, $USER->id);
     if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $modcontext)) {
         $grouplist[0] = get_string('allparticipants');
     }
     if ($groups) {
         foreach ($groups as $group) {
             $grouplist[$group->id] = $group->name;
         }
     }
     $mform->addElement('select', 'group', get_string('group'), $grouplist);
     $ident = array();
     $ident[] =& MoodleQuickForm::createElement('checkbox', 'id', '', get_string('studentid', 'attforblock'));
     $ident[] =& MoodleQuickForm::createElement('checkbox', 'uname', '', get_string('username'));
     $mform->addGroup($ident, 'ident', get_string('identifyby', 'attforblock'), array('<br />'), true);
     $mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true));
     $mform->addElement('checkbox', 'includenottaken', get_string('includenottaken', 'attforblock'), get_string('yes'));
     $mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod', 'attforblock'));
     $mform->disabledIf('sessionenddate', 'includenottaken', 'notchecked');
     $mform->addElement('select', 'format', get_string('format'), array('excel' => get_string('downloadexcel', 'attforblock'), 'ooo' => get_string('downloadooo', 'attforblock'), 'text' => get_string('downloadtext', 'attforblock')));
     // buttons
     $submit_string = get_string('ok');
     $this->add_action_buttons(false, $submit_string);
     $mform->addElement('hidden', 'id', $cm->id);
     //        $mform->addElement('hidden', 'action', 'add');
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:export_form.php

示例8: _createElements

 function _createElements()
 {
     global $COURSE;
     $this->_elements = array();
     if (!is_array($this->getAttributes()) || !array_key_exists('size', $this->getAttributes())) {
         $this->updateAttributes(array('size' => 48));
     }
     $this->_elements[0] =& MoodleQuickForm::createElement('text', 'value', '', $this->getAttributes());
     $this->_elements[1] =& MoodleQuickForm::createElement('button', 'popup', get_string('chooseafile', 'resource') . ' ...');
     $button =& $this->_elements[1];
     if ($this->_options['courseid'] !== null) {
         $courseid = $this->_options['courseid'];
     } else {
         $courseid = $COURSE->id;
     }
     // first find out the text field id - this is a bit hacky, is there a better way?
     $choose = 'id_' . str_replace(array('[', ']'), array('_', ''), $this->getElementName(0));
     $url = "/files/index.php?id={$courseid}&choose=" . $choose;
     if ($this->_options['options'] == 'none') {
         $options = 'menubar=0,location=0,scrollbars,resizable,width=' . $this->_options['width'] . ',height=' . $this->_options['height'];
     } else {
         $options = $this->_options['options'];
     }
     $fullscreen = 0;
     $buttonattributes = array('title' => get_string("chooseafile", "resource"), 'onclick' => "return openpopup('{$url}', '" . $button->getName() . "', '{$options}', {$fullscreen});");
     $button->updateAttributes($buttonattributes);
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:27,代码来源:choosecoursefile.php

示例9: _createElements

 function _createElements()
 {
     global $CFG, $COURSE;
     $this->_elements = array();
     $this->_elements[0] =& MoodleQuickForm::createElement('text', 'value', '', array('size' => '48'));
     $this->_elements[1] =& MoodleQuickForm::createElement('button', 'popup', get_string('chooseafile', 'resource') . ' ...');
     $button =& $this->_elements[1];
     if ($this->_options['courseid'] !== null) {
         $courseid = $this->_options['courseid'];
     } else {
         $courseid = $COURSE->id;
     }
     // first find out the text field id - this is a bit hacky, is there a better way?
     $choose = 'id_' . str_replace(array('[', ']'), array('_', ''), $this->getElementName(0));
     $url = "/files/index.php?id={$courseid}&choose=" . $choose;
     if ($this->_options['options'] == 'none') {
         $options = 'menubar=0,location=0,scrollbars,resizable,width=' . $this->_options['width'] . ',height=' . $this->_options['height'];
     } else {
         $options = $this->_options['options'];
     }
     $fullscreen = 0;
     $buttonattributes = array('title' => get_string("chooseafile", "resource"), 'onclick' => "return openpopup('{$url}', '" . $button->getName() . "', '{$options}', {$fullscreen});");
     $button->updateAttributes($buttonattributes);
     /// With repository active, show the button to browse it
     if (isset($CFG->repositoryactivate) && $CFG->repositoryactivate) {
         $this->_elements[2] =& MoodleQuickForm::createElement('button', 'imsrepo', get_string('browserepository', 'resource'));
         $imsbutton =& $this->_elements[2];
         $url = "/mod/resource/type/ims/finder.php?directory=&choose=" . $choose;
         $buttonattributes = array('title' => get_string("browserepository", "resource"), 'onclick' => "return openpopup('{$url}', '" . $button->getName() . "', '{$options}', {$fullscreen});");
         $imsbutton->updateAttributes($buttonattributes);
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:32,代码来源:choosecoursefileorimsrepo.php

示例10: definition

 function definition()
 {
     global $CFG, $CHOICE_SHOWRESULTS, $CHOICE_PUBLISH, $CHOICE_DISPLAY, $DB;
     $mform =& $this->_form;
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('choicename', 'choice'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $this->add_intro_editor(true, get_string('chatintro', 'chat'));
     //-------------------------------------------------------------------------------
     $repeatarray = array();
     $repeatarray[] =& MoodleQuickForm::createElement('header', '', get_string('option', 'choice') . ' {no}');
     $repeatarray[] =& MoodleQuickForm::createElement('text', 'option', get_string('option', 'choice'));
     $repeatarray[] =& MoodleQuickForm::createElement('text', 'limit', get_string('limit', 'choice'));
     $repeatarray[] =& MoodleQuickForm::createElement('hidden', 'optionid', 0);
     $menuoptions = array();
     $menuoptions[0] = get_string('disable');
     $menuoptions[1] = get_string('enable');
     $mform->addElement('header', 'timerestricthdr', get_string('limit', 'choice'));
     $mform->addElement('select', 'limitanswers', get_string('limitanswers', 'choice'), $menuoptions);
     $mform->addHelpButton('limitanswers', 'limitanswers', 'choice');
     if ($this->_instance) {
         $repeatno = $DB->count_records('choice_options', array('choiceid' => $this->_instance));
         $repeatno += 2;
     } else {
         $repeatno = 5;
     }
     $repeateloptions = array();
     $repeateloptions['limit']['default'] = 0;
     $repeateloptions['limit']['disabledif'] = array('limitanswers', 'eq', 0);
     $mform->setType('limit', PARAM_INT);
     $repeateloptions['option']['helpbutton'] = array('choiceoptions', 'choice');
     $mform->setType('option', PARAM_CLEAN);
     $mform->setType('optionid', PARAM_INT);
     $this->repeat_elements($repeatarray, $repeatno, $repeateloptions, 'option_repeats', 'option_add_fields', 3);
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'timerestricthdr', get_string('timerestrict', 'choice'));
     $mform->addElement('checkbox', 'timerestrict', get_string('timerestrict', 'choice'));
     $mform->addElement('date_time_selector', 'timeopen', get_string("choiceopen", "choice"));
     $mform->disabledIf('timeopen', 'timerestrict');
     $mform->addElement('date_time_selector', 'timeclose', get_string("choiceclose", "choice"));
     $mform->disabledIf('timeclose', 'timerestrict');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'miscellaneoussettingshdr', get_string('miscellaneoussettings', 'form'));
     $mform->addElement('select', 'display', get_string("displaymode", "choice"), $CHOICE_DISPLAY);
     $mform->addElement('select', 'showresults', get_string("publish", "choice"), $CHOICE_SHOWRESULTS);
     $mform->addElement('select', 'publish', get_string("privacy", "choice"), $CHOICE_PUBLISH);
     $mform->disabledIf('publish', 'showresults', 'eq', 0);
     $mform->addElement('selectyesno', 'allowupdate', get_string("allowupdate", "choice"));
     $mform->addElement('selectyesno', 'showunanswered', get_string("showunanswered", "choice"));
     //-------------------------------------------------------------------------------
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     $this->add_action_buttons();
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:60,代码来源:mod_form.php

示例11: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $modcontext = $this->_customdata['modcontext'];
     $ids = $this->_customdata['ids'];
     $mform->addElement('header', 'general', get_string('changeduration', 'attforblock'));
     $mform->addElement('static', 'count', get_string('countofselected', 'attforblock'), count(explode('_', $ids)));
     for ($i = 0; $i <= 23; $i++) {
         $hours[$i] = sprintf("%02d", $i);
     }
     for ($i = 0; $i < 60; $i += 5) {
         $minutes[$i] = sprintf("%02d", $i);
     }
     $durselect[] =& MoodleQuickForm::createElement('select', 'hours', '', $hours);
     $durselect[] =& MoodleQuickForm::createElement('select', 'minutes', '', $minutes, false, true);
     $mform->addGroup($durselect, 'durtime', get_string('newduration', 'attforblock'), array(' '), true);
     $mform->addElement('hidden', 'ids', $ids);
     $mform->addElement('hidden', 'id', $cm->id);
     $mform->addElement('hidden', 'action', att_sessions_page_params::ACTION_CHANGE_DURATION);
     $mform->setDefaults(array('durtime' => array('hours' => 0, 'minutes' => 0)));
     //-------------------------------------------------------------------------------
     // buttons
     $submit_string = get_string('update', 'attforblock');
     $this->add_action_buttons(true, $submit_string);
     //        $mform->addElement('hidden', 'id', $cm->id);
     //        $mform->addElement('hidden', 'sessionid', $sessionid);
     //        $mform->addElement('hidden', 'action', 'changeduration');
 }
开发者ID:e-rasvet,项目名称:attforblockup,代码行数:31,代码来源:duration_form.php

示例12: array

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $QTYPES;
     $this->qtypeobj =& $QTYPES[$this->qtype()];
     $label = get_string("sharedwildcards", "qtype_datasetdependent");
     $mform->addElement('hidden', 'initialcategory', 1);
     $html2 = $this->qtypeobj->print_dataset_definitions_category($this->question);
     $mform->insertElementBefore($mform->createElement('static', 'listcategory', $label, $html2), 'name');
     $addfieldsname = 'updatecategory';
     $addstring = get_string("updatecategory", "qtype_calculated");
     $mform->registerNoSubmitButton($addfieldsname);
     $mform->insertElementBefore($mform->createElement('submit', $addfieldsname, $addstring), 'listcategory');
     $creategrades = get_grade_options();
     $this->add_per_answer_fields($mform, get_string('answerhdr', 'qtype_calculated', '{no}'), $creategrades->gradeoptions, 1, 1);
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
     $repeated[] =& $mform->createElement('text', 'unit', get_string('unit', 'quiz'));
     $mform->setType('unit', PARAM_NOTAGS);
     $repeated[] =& $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz'));
     $mform->setType('multiplier', PARAM_NUMBER);
     if (isset($this->question->options)) {
         $countunits = count($this->question->options->units);
     } else {
         $countunits = 0;
     }
     if ($this->question->formoptions->repeatelements) {
         $repeatsatstart = $countunits + 1;
     } else {
         $repeatsatstart = $countunits;
     }
     $this->repeat_elements($repeated, $repeatsatstart, array(), 'nounits', 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'));
     if ($mform->elementExists('multiplier[0]')) {
         $firstunit =& $mform->getElement('multiplier[0]');
         $firstunit->freeze();
         $firstunit->setValue('1.0');
         $firstunit->setPersistantFreeze(true);
     }
     //hidden elements
     $mform->addElement('hidden', 'synchronize', '');
     if (isset($this->question->options) && isset($this->question->options->synchronize)) {
         $mform->setDefault("synchronize", $this->question->options->synchronize);
     } else {
         $mform->setDefault("synchronize", 0);
     }
     $mform->addElement('hidden', 'wizard', 'datasetdefinitions');
     $mform->setType('wizard', PARAM_ALPHA);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:52,代码来源:edit_calculated_form.php

示例13: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     $defaultcategory = $this->_customdata['defaultcategory'];
     $contexts = $this->_customdata['contexts'];
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'fileformat', get_string('fileformat', 'quiz'));
     $fileformatnames = get_import_export_formats('import');
     $radioarray = array();
     foreach ($fileformatnames as $shortname => $fileformatname) {
         $radioelement =& MoodleQuickForm::createElement('radio', 'format', '', $fileformatname, $shortname);
         $radioelement->setHelpButton(array("{$shortname}", $fileformatname, "qformat_{$shortname}"));
         $radioarray[] = $radioelement;
     }
     $mform->addGroup($radioarray, 'format', '', array('<br />'), false);
     $mform->addRule('format', null, 'required', null, 'client');
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), compact('contexts'));
     $mform->setDefault('category', $defaultcategory);
     $mform->setHelpButton('category', array('importcategory', get_string('importcategory', 'quiz'), 'quiz'));
     $categorygroup = array();
     $categorygroup[] =& $mform->createElement('checkbox', 'catfromfile', '', get_string('getcategoryfromfile', 'question'));
     $categorygroup[] =& $mform->createElement('checkbox', 'contextfromfile', '', get_string('getcontextfromfile', 'question'));
     $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
     $mform->disabledIf('categorygroup', 'catfromfile', 'notchecked');
     $mform->setDefault('catfromfile', 1);
     $mform->setDefault('contextfromfile', 1);
     $matchgrades = array();
     $matchgrades['error'] = get_string('matchgradeserror', 'quiz');
     $matchgrades['nearest'] = get_string('matchgradesnearest', 'quiz');
     $mform->addElement('select', 'matchgrades', get_string('matchgrades', 'quiz'), $matchgrades);
     $mform->setHelpButton('matchgrades', array('matchgrades', get_string('matchgrades', 'quiz'), 'quiz'));
     $mform->setDefault('matchgrades', 'error');
     $mform->addElement('selectyesno', 'stoponerror', get_string('stoponerror', 'quiz'));
     $mform->setDefault('stoponerror', 1);
     $mform->setHelpButton('stoponerror', array('stoponerror', get_string('stoponerror', 'quiz'), 'quiz'));
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'importfileupload', get_string('importfileupload', 'quiz'));
     $mform->addElement('file', 'newfile', get_string('upload'));
     //--------------------------------------------------------------------------------
     $mform->addElement('submit', 'submitbutton', get_string('uploadthisfile'));
     //--------------------------------------------------------------------------------
     if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
         $mform->addElement('header', 'importfilearea', get_string('importfilearea', 'quiz'));
         $mform->addElement('choosecoursefile', 'choosefile', get_string('choosefile', 'quiz'));
         //--------------------------------------------------------------------------------
         $mform->addElement('submit', 'submitbutton', get_string('importfromthisfile', 'quiz'));
     }
     //--------------------------------------------------------------------------------
     $mform->addElement('static', 'dummy', '');
     $mform->closeHeaderBefore('dummy');
     // set a template for the format select elements
     $renderer =& $mform->defaultRenderer();
     $template = "{help} {element}\n";
     $renderer->setGroupElementTemplate($template, 'format');
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:58,代码来源:import_form.php

示例14: standard_attempt_fields

 protected function standard_attempt_fields(MoodleQuickForm $mform)
 {
     $mform->addElement('select', 'attempts', get_string('reportattemptsfrom', 'quiz'), array(quiz_attempts_report::ENROLLED_WITH => get_string('reportuserswith', 'quiz'), quiz_attempts_report::ENROLLED_WITHOUT => get_string('reportuserswithout', 'quiz'), quiz_attempts_report::ENROLLED_ALL => get_string('reportuserswithorwithout', 'quiz'), quiz_attempts_report::ALL_WITH => get_string('reportusersall', 'quiz')));
     $stategroup = array($mform->createElement('advcheckbox', 'stateinprogress', '', get_string('stateinprogress', 'quiz')), $mform->createElement('advcheckbox', 'stateoverdue', '', get_string('stateoverdue', 'quiz')), $mform->createElement('advcheckbox', 'statefinished', '', get_string('statefinished', 'quiz')), $mform->createElement('advcheckbox', 'stateabandoned', '', get_string('stateabandoned', 'quiz')));
     $mform->addGroup($stategroup, 'stateoptions', get_string('reportattemptsthatare', 'quiz'), array(' '), false);
     $mform->setDefault('stateinprogress', 1);
     $mform->setDefault('stateoverdue', 1);
     $mform->setDefault('statefinished', 1);
     $mform->setDefault('stateabandoned', 1);
     $mform->disabledIf('stateinprogress', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     $mform->disabledIf('stateoverdue', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     $mform->disabledIf('statefinished', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     $mform->disabledIf('stateabandoned', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
     if (quiz_report_can_filter_only_graded($this->_customdata['quiz'])) {
         $gm = html_writer::tag('span', quiz_get_grading_option_name($this->_customdata['quiz']->grademethod), array('class' => 'highlight'));
         $mform->addElement('advcheckbox', 'onlygraded', get_string('reportshowonly', 'quiz'), get_string('optonlygradedattempts', 'quiz_overview', $gm));
         $mform->disabledIf('onlygraded', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT);
         $mform->disabledIf('onlygraded', 'statefinished', 'notchecked');
     }
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:20,代码来源:attemptsreport_form.php

示例15: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     $defaultcategory = $this->_customdata['defaultcategory'];
     $contexts = $this->_customdata['contexts'];
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'fileformat', get_string('fileformat', 'quiz'));
     $fileformatnames = get_import_export_formats('import');
     $radioarray = array();
     foreach ($fileformatnames as $id => $fileformatname) {
         $radioarray[] =& MoodleQuickForm::createElement('radio', 'format', '', $fileformatname, $id);
     }
     $mform->addGroup($radioarray, 'format', '', array('<br />'), false);
     $mform->addRule('format', null, 'required', null, 'client');
     $mform->setHelpButton('format', array('import', get_string('importquestions', 'quiz'), 'quiz'));
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), compact('contexts'));
     $mform->setDefault('category', $defaultcategory);
     $mform->setHelpButton('category', array('importcategory', get_string('importcategory', 'quiz'), 'quiz'));
     $categorygroup = array();
     $categorygroup[] =& $mform->createElement('checkbox', 'catfromfile', '', get_string('getcategoryfromfile', 'question'));
     $categorygroup[] =& $mform->createElement('checkbox', 'contextfromfile', '', get_string('getcontextfromfile', 'question'));
     $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
     $mform->disabledIf('categorygroup', 'catfromfile', 'notchecked');
     $mform->setDefault('catfromfile', 1);
     $mform->setDefault('contextfromfile', 1);
     $matchgrades = array();
     $matchgrades['error'] = get_string('matchgradeserror', 'quiz');
     $matchgrades['nearest'] = get_string('matchgradesnearest', 'quiz');
     $mform->addElement('select', 'matchgrades', get_string('matchgrades', 'quiz'), $matchgrades);
     $mform->setHelpButton('matchgrades', array('matchgrades', get_string('matchgrades', 'quiz'), 'quiz'));
     $mform->setDefault('matchgrades', 'error');
     $mform->addElement('selectyesno', 'stoponerror', get_string('stoponerror', 'quiz'));
     $mform->setDefault('stoponerror', 1);
     $mform->setHelpButton('stoponerror', array('stoponerror', get_string('stoponerror', 'quiz'), 'quiz'));
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'importfileupload', get_string('importfileupload', 'quiz'));
     $this->set_upload_manager(new upload_manager('newfile', true, false, $COURSE, false, 0, false, true, false));
     $mform->addElement('file', 'newfile', get_string('upload'));
     //--------------------------------------------------------------------------------
     $this->add_action_buttons(true, get_string('uploadthisfile'));
     //--------------------------------------------------------------------------------
     if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
         $mform->addElement('header', 'importfilearea', get_string('importfilearea', 'quiz'));
         $mform->addElement('choosecoursefile', 'choosefile', get_string('choosefile', 'quiz'));
         //--------------------------------------------------------------------------------
         $this->add_action_buttons(true, get_string('importfromthisfile', 'quiz'));
     }
     //--------------------------------------------------------------------------------
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:52,代码来源:import_form.php


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