本文整理汇总了PHP中get_grade_options函数 的典型用法代码示例。如果您正苦于以下问题:PHP get_grade_options函数的具体用法?PHP get_grade_options怎么用?PHP get_grade_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_grade_options函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
$mform->addElement('header', 'globalvarshdr', get_string('globalvarshdr', 'qtype_coordinates'));
$mform->removeElement('defaultgrade');
$mform->addElement('hidden', 'defaultgrade');
$mform->setType('defaultgrade', PARAM_RAW);
$mform->removeElement('penalty');
$mform->addElement('hidden', 'penalty');
$mform->setType('penalty', PARAM_NUMBER);
$mform->setDefault('penalty', 0.1);
$mform->addElement('static', 'help_coordinates', get_string('help'), get_string('helponquestionoptions', 'qtype_coordinates'));
$mform->addElement('textarea', 'varsrandom', get_string('varsrandom', 'qtype_coordinates'), array('rows' => 4, 'cols' => 70, 'course' => $this->coursefilesid));
$mform->addElement('textarea', 'varsglobal', get_string('varsglobal', 'qtype_coordinates'), array('rows' => 6, 'cols' => 70, 'course' => $this->coursefilesid));
$mform->addElement('select', 'showperanswermark', get_string('showperanswermark', 'qtype_coordinates'), array(get_string('choiceno', 'qtype_coordinates'), get_string('choiceyes', 'qtype_coordinates')));
$mform->setDefault('showperanswermark', 1);
$mform->addElement('select', 'peranswersubmit', get_string('peranswersubmit', 'qtype_coordinates'), array(get_string('choiceno', 'qtype_coordinates'), get_string('choiceyes', 'qtype_coordinates')));
$mform->setDefault('peranswersubmit', 1);
$mform->addElement('text', 'retrymarkseq', get_string('retrymarkseq', 'qtype_coordinates'), array('size' => 30));
$show_group = array();
$show_group[] =& $mform->createElement('checkbox', 'vars2', '', get_string('vars2', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'vars2\', this.checked)"');
$show_group[] =& $mform->createElement('checkbox', 'preunit', '', get_string('preunit', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'preunit\', this.checked)"');
$show_group[] =& $mform->createElement('checkbox', 'otherrule', '', get_string('otherrule', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'otherrule\', this.checked)"');
//$show_group[] =& $mform->createElement('checkbox','subqtext','',get_string('subqtext','qtype_coordinates'),
// 'onclick="coordinates_form_display(\'subqtext\', this.checked)"');
//$show_group[] =& $mform->createElement('checkbox','feedback','',get_string('feedback','qtype_coordinates'),
// 'onclick="coordinates_form_display(\'feedback\', this.checked)"');
$show_group[] =& $mform->createElement('checkbox', 'correctnessraw', '', get_string('correctnessraw', 'qtype_coordinates'), 'onclick="coordinates_form_correctness(this.checked)"');
$mform->addGroup($show_group, 'showoptions', get_string('showoptions', 'qtype_coordinates'), array(' '), true);
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_coordinates', '{no}'), $creategrades->gradeoptions, 1, 1);
}
开发者ID:hmatulis, 项目名称:RTL-BIDI-Hebrew-Moodle-Plugins, 代码行数:36, 代码来源:edit_coordinates_form.php
示例2: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
//------------------------------------------------------------------------------------------
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_numerical', '{no}'), $creategrades->gradeoptions);
//------------------------------------------------------------------------------------------
$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 + 2;
} else {
$repeatsatstart = $countunits;
}
$this->repeat_elements($repeated, $repeatsatstart, array(), 'nounits', 'addunits', 2, get_string('addmoreunitblanks', 'qtype_numerical'));
if ($mform->elementExists('multiplier[0]')) {
/// Does not exist when this form is used in 'move to another category'
/// mode with a qusetion that has no units. This was leading to errors.
$firstunit =& $mform->getElement('multiplier[0]');
$firstunit->freeze();
$firstunit->setValue('1.0');
$firstunit->setPersistantFreeze(true);
}
}
开发者ID:JackCanada, 项目名称:moodle-hacks, 代码行数:37, 代码来源:edit_numerical_form.php
示例3: definition_inner
/**
* 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
示例4: definition_inner
/**
* Add question-type specific form fields.
*
* @param object $mform the form being built.
*/
function definition_inner(&$mform)
{
global $QTYPES;
$menu = array(get_string('answersingleno', 'qtype_multichoice'), get_string('answersingleyes', 'qtype_multichoice'));
$mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_multichoice'), $menu);
$mform->setDefault('single', 1);
$mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
$mform->setHelpButton('shuffleanswers', array('multichoiceshuffle', get_string('shuffleanswers', 'qtype_multichoice'), 'quiz'));
$mform->setDefault('shuffleanswers', 1);
$numberingoptions = $QTYPES[$this->qtype()]->get_numbering_styles();
$menu = array();
foreach ($numberingoptions as $numberingoption) {
$menu[$numberingoption] = get_string('answernumbering' . $numberingoption, 'qtype_multichoice');
}
$mform->addElement('select', 'answernumbering', get_string('answernumbering', 'qtype_multichoice'), $menu);
$mform->setDefault('answernumbering', 'abc');
/* $mform->addElement('static', 'answersinstruct', get_string('choices', 'qtype_multichoice'), get_string('fillouttwochoices', 'qtype_multichoice'));
$mform->closeHeaderBefore('answersinstruct');
*/
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), $creategrades->gradeoptionsfull, max(5, QUESTION_NUMANS_START));
$mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'qtype_multichoice'));
foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $feedbackname) {
$mform->addElement('htmleditor', $feedbackname, get_string($feedbackname, 'qtype_multichoice'), array('course' => $this->coursefilesid));
$mform->setType($feedbackname, PARAM_RAW);
}
}
开发者ID:JackCanada, 项目名称:moodle-hacks, 代码行数:32, 代码来源:edit_multichoice_form.php
示例5: definition_inner
/**
* 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');
$repeated = array();
$repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerhdr', 'qtype_calculated', '{no}'));
$repeated[] =& $mform->createElement('text', 'answers', get_string('correctanswerformula', 'quiz') . '=', array('size' => 50));
$repeatedoptions['answers']['type'] = PARAM_NOTAGS;
$creategrades = get_grade_options();
$gradeoptions = $creategrades->gradeoptions;
$repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
$repeatedoptions['fraction']['default'] = 0;
$repeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated'));
$repeatedoptions['tolerance']['type'] = PARAM_NUMBER;
$repeatedoptions['tolerance']['default'] = 0.01;
$repeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types());
$repeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
$repeatedoptions['correctanswerlength']['default'] = 2;
$answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz'));
$repeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
$repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'));
$repeatedoptions['feedback']['type'] = PARAM_RAW;
if (isset($this->question->options)) {
$count = count($this->question->options->answers);
} else {
$count = 0;
}
$repeatsatstart = $count + 1;
$this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', 1, get_string('addmoreanswerblanks', 'qtype_calculated'));
$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;
}
$repeatsatstart = $countunits + 1;
$this->repeat_elements($repeated, $repeatsatstart, array(), 'nounits', 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'));
$firstunit =& $mform->getElement('multiplier[0]');
$firstunit->freeze();
$firstunit->setValue('1.0');
$firstunit->setPersistantFreeze(true);
//hidden elements
$mform->addElement('hidden', 'wizard', 'datasetdefinitions');
$mform->setType('wizard', PARAM_ALPHA);
}
开发者ID:veritech, 项目名称:pare-project, 代码行数:63, 代码来源:edit_calculated_form.php
示例6: definition_inner
/**
* 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();
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_shortanswer', '{no}'), $creategrades->gradeoptions);
}
开发者ID:nicolasconnault, 项目名称:moodle2.0, 代码行数:14, 代码来源:edit_shortanswer_form.php
示例7: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
global $QTYPES;
//------------------------------------------------------------------------------------------
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_numerical', '{no}'), $creategrades->gradeoptions);
//------------------------------------------------------------------------------------------
$QTYPES['numerical']->add_units_options($mform, $this);
$QTYPES['numerical']->add_units_elements($mform, $this);
}
开发者ID:vuchannguyen, 项目名称:web, 代码行数:15, 代码来源:edit_numerical_form.php
示例8: round_to_nearest_grade
public static function round_to_nearest_grade($value)
{
$options = get_grade_options();
$grades = $options->gradeoptionsfull;
$result = 0;
foreach ($grades as $grade => $name) {
if (abs($grade - $value) < abs($result - $value)) {
$result = $grade;
}
}
return $result;
}
开发者ID:jmvedrine, 项目名称:moodle-qformat_imsqti21, 代码行数:12, 代码来源:moodle_util.class.php
示例9: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
$mform->removeElement('image');
$mform->addElement('static', 'help_multinumerical', get_string('help'), get_string('helponquestionoptions', 'qtype_multinumerical'));
$mform->addElement('text', 'parameters', get_string('parameters', 'qtype_multinumerical'), array('size' => 30));
$mform->addElement('textarea', 'conditions', get_string('conditions', 'qtype_multinumerical'), array('rows' => 5, 'cols' => 60, 'course' => $this->coursefilesid));
$mform->addElement('textarea', 'feedbackperconditions', get_string('feedbackperconditions', 'qtype_multinumerical'), array('rows' => 5, 'cols' => 60, 'course' => $this->coursefilesid));
$colorfboptions = array(0 => get_string('no'), 1 => get_string('yes'));
$mform->addElement('select', 'usecolorforfeedback', get_string("usecolorforfeedback", "qtype_multinumerical"), $colorfboptions);
$displaycalcoptions = array(0 => get_string('no'), 1 => get_string('yes'), 2 => get_string('onlyforcalculations', 'qtype_multinumerical'));
$mform->addElement('select', 'displaycalc', get_string("displaycalc", "qtype_multinumerical"), $displaycalcoptions);
$binarygradeoptions = array(0 => get_string('gradefractional', 'qtype_multinumerical'), 1 => get_string('gradebinary', 'qtype_multinumerical'));
$mform->addElement('select', 'binarygrade', get_string("binarygrade", "qtype_multinumerical"), $binarygradeoptions);
$creategrades = get_grade_options();
}
开发者ID:hmatulis, 项目名称:RTL-BIDI-Hebrew-Moodle-Plugins, 代码行数:20, 代码来源:edit_multinumerical_form.php
示例10: definition_inner
/**
* 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();
$gradeoptions = $creategrades->gradeoptionsfull;
$repeated = array();
$repeated[] =& $mform->createElement('header', 'choicehdr', get_string('choiceno', 'qtype_multichoice', '{no}'));
$repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50));
$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 = max(5, QUESTION_NUMANS_START, $countanswers + QUESTION_NUMANS_ADD);
} else {
$repeatsatstart = $countanswers;
}
$repeatedoptions = array();
$repeatedoptions['fraction']['default'] = 0;
$mform->setType('answer', PARAM_RAW);
$this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmorechoiceblanks', 'qtype_multichoice'));
$mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'qtype_multichoice'));
$mform->addElement('htmleditor', 'correctfeedback', get_string('correctfeedback', 'qtype_multichoice'), array('course' => $this->coursefilesid));
$mform->setType('correctfeedback', PARAM_RAW);
$mform->addElement('htmleditor', 'partiallycorrectfeedback', get_string('partiallycorrectfeedback', 'qtype_multichoice'), array('course' => $this->coursefilesid));
$mform->setType('partiallycorrectfeedback', PARAM_RAW);
$mform->addElement('htmleditor', 'incorrectfeedback', get_string('incorrectfeedback', 'qtype_multichoice'), array('course' => $this->coursefilesid));
$mform->setType('incorrectfeedback', PARAM_RAW);
}
开发者ID:BackupTheBerlios, 项目名称:samouk-svn, 代码行数:53, 代码来源:edit_multichoice_form.php
示例11: definition
function definition()
{
global $CFG, $COURSE, $cm, $id;
$mform =& $this->_form;
// Don't forget the underscore!
$repeatarray = array();
$repeatarray[] =& $mform->createElement('header', 'testcases', get_string('testcases', 'assignment_onlinejudge') . '{no}');
require_once $CFG->dirroot . '/lib/questionlib.php';
//for get_grade_options()
$choices = get_grade_options()->gradeoptions;
// Steal from question lib
$repeatarray[] =& $mform->createElement('select', 'subgrade', get_string('subgrade', 'assignment_onlinejudge'), $choices);
$repeatarray[] =& $mform->createElement('checkbox', 'usefile', get_string('usefile', 'assignment_onlinejudge'));
$repeatarray[] =& $mform->createElement('textarea', 'input', get_string('input', 'assignment_onlinejudge'), 'wrap="virtual" rows="5" cols="50"');
$repeatarray[] =& $mform->createElement('textarea', 'output', get_string('output', 'assignment_onlinejudge'), 'wrap="virtual" rows="5" cols="50"');
$repeatarray[] =& $mform->createElement('filemanager', 'inputfile', get_string('inputfile', 'assignment_onlinejudge'), null, array('subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => array('plaintext')));
$repeatarray[] =& $mform->createElement('filemanager', 'outputfile', get_string('outputfile', 'assignment_onlinejudge'), null, array('subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => array('plaintext')));
$repeatarray[] =& $mform->createElement('text', 'feedback', get_string('feedback', 'assignment_onlinejudge'), array('size' => 50));
$repeatarray[] =& $mform->createElement('hidden', 'caseid', -1);
$repeateloptions = array();
$repeateloptions['input']['type'] = PARAM_RAW;
$repeateloptions['output']['type'] = PARAM_RAW;
$repeateloptions['feedback']['type'] = PARAM_RAW;
$repeateloptions['inputfile']['type'] = PARAM_FILE;
$repeateloptions['outputfile']['type'] = PARAM_FILE;
$repeateloptions['caseid']['type'] = PARAM_INT;
$repeateloptions['testcases']['helpbutton'] = array('testcases', 'assignment_onlinejudge');
$repeateloptions['input']['helpbutton'] = array('input', 'assignment_onlinejudge');
$repeateloptions['output']['helpbutton'] = array('output', 'assignment_onlinejudge');
$repeateloptions['inputfile']['helpbutton'] = array('inputfile', 'assignment_onlinejudge');
$repeateloptions['outputfile']['helpbutton'] = array('outputfile', 'assignment_onlinejudge');
$repeateloptions['subgrade']['helpbutton'] = array('subgrade', 'assignment_onlinejudge');
$repeateloptions['feedback']['helpbutton'] = array('feedback', 'assignment_onlinejudge');
$repeateloptions['subgrade']['default'] = 0;
$repeateloptions['inputfile']['disabledif'] = array('usefile', 'notchecked');
$repeateloptions['outputfile']['disabledif'] = array('usefile', 'notchecked');
$repeateloptions['input']['disabledif'] = array('usefile', 'checked');
$repeateloptions['output']['disabledif'] = array('usefile', 'checked');
$repeatnumber = max($this->testcasecount + 1, 5);
$this->repeat_elements($repeatarray, $repeatnumber, $repeateloptions, 'boundary_repeats', 'add_testcases', 1, get_string('addtestcases', 'assignment_onlinejudge', 1), true);
$buttonarray = array();
$buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges'));
$buttonarray[] =& $mform->createElement('cancel');
$mform->addElement('hidden', 'id', $id);
$mform->setType('id', PARAM_INT);
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$mform->closeHeaderBefore('buttonar');
}
开发者ID:boychunli, 项目名称:moodle-local_onlinejudge, 代码行数:48, 代码来源:testcase_form.php
示例12: definition_inner
/**
* 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: _initialize
public function _initialize()
{
parent::_initialize();
//各页面下拉选项列表
$school_year_options = D('SchoolYear')->getOptions($this->school_year);
$town_id_options = get_town_options($this->town_id);
$school_code_options = get_school_options($this->school_year, $this->town_id, $this->school_code);
$this->assign('school_year_options', $school_year_options);
$this->assign('town_id_options', $town_id_options);
$this->assign('school_code_options', $school_code_options);
//判断是否需要为模版年级和班级下拉框赋值
if (in_array(ACTION_NAME, array('template', 'receipt', 'cshedu')) && !IS_AJAX) {
$school_grade_options = get_grade_options($this->school_year, $this->town_id, $this->school_code, $this->school_grade, 'school_code');
$class_num_options = get_class_options($this->school_year, $this->town_id, $this->school_code, $this->school_grade, $this->class_num);
$this->assign('school_grade_options', $school_grade_options);
$this->assign('class_num_options', $class_num_options);
}
}
开发者ID:allendhy, 项目名称:tizhi_new.cc, 代码行数:18, 代码来源:DownController.class.php
示例14: definition_inner
/**
* Add question-type specific form fields.
*
* @param object $mform the form being built.
*/
function definition_inner(&$mform)
{
$creategrades = get_grade_options();
$gradeoptions = $creategrades->gradeoptionsfull;
$repeated = array();
$repeated[] =& $mform->createElement('header', 'choicehdr', get_string('choiceno', 'qtype_multichoice', '{no}'));
$repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'));
$repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
$repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'));
if (isset($this->question->options)) {
$countanswers = count($this->question->options->answers);
} else {
$countanswers = 0;
}
$repeatsatstart = QUESTION_NUMANS_START > $countanswers + QUESTION_NUMANS_ADD ? QUESTION_NUMANS_START : $countanswers + QUESTION_NUMANS_ADD;
$repeatedoptions = array();
$repeatedoptions['fraction']['default'] = 0;
$mform->setType('answer', PARAM_NOTAGS);
$this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmorechoiceblanks', 'qtype_multichoice'));
}
开发者ID:veritech, 项目名称:pare-project, 代码行数:25, 代码来源:edit_missingtype_form.php
示例15: importprocess
/**
* Process the file
* This method should not normally be overidden
* @return boolean success
*/
function importprocess()
{
global $USER;
// reset the timer in case file upload was slow
@set_time_limit();
// STAGE 1: Parse the file
notify(get_string('parsingquestions', 'quiz'));
if (!($lines = $this->readdata($this->filename))) {
notify(get_string('cannotread', 'quiz'));
return false;
}
if (!($questions = $this->readquestions($lines))) {
// Extract all the questions
notify(get_string('noquestionsinfile', 'quiz'));
return false;
}
// STAGE 2: Write data to database
notify(get_string('importingquestions', 'quiz', $this->count_questions($questions)));
// check for errors before we continue
if ($this->stoponerror and $this->importerrors > 0) {
notify(get_string('importparseerror', 'quiz'));
return true;
}
// get list of valid answer grades
$grades = get_grade_options();
$gradeoptionsfull = $grades->gradeoptionsfull;
// check answer grades are valid
// (now need to do this here because of 'stop on error': MDL-10689)
$gradeerrors = 0;
$goodquestions = array();
foreach ($questions as $question) {
if (!empty($question->fraction) and is_array($question->fraction)) {
$fractions = $question->fraction;
$answersvalid = true;
// in case they are!
foreach ($fractions as $key => $fraction) {
$newfraction = match_grade_options($gradeoptionsfull, $fraction, $this->matchgrades);
if ($newfraction === false) {
$answersvalid = false;
} else {
$fractions[$key] = $newfraction;
}
}
if (!$answersvalid) {
notify(get_string('matcherror', 'quiz'));
++$gradeerrors;
continue;
} else {
$question->fraction = $fractions;
}
}
$goodquestions[] = $question;
}
$questions = $goodquestions;
// check for errors before we continue
if ($this->stoponerror and $gradeerrors > 0) {
return false;
}
// count number of questions processed
$count = 0;
foreach ($questions as $question) {
// Process and store each question
// reset the php timeout
@set_time_limit();
// check for category modifiers
if ($question->qtype == 'category') {
if ($this->catfromfile) {
// find/create category object
$catpath = $question->category;
$newcategory = $this->create_category_path($catpath, '/');
if (!empty($newcategory)) {
$this->category = $newcategory;
}
}
continue;
}
$count++;
echo "<hr /><p><b>{$count}</b>. " . $this->format_question_text($question) . "</p>";
$question->category = $this->category->id;
$question->stamp = make_unique_id_code();
// Set the unique code (not to be changed)
$question->createdby = $USER->id;
$question->timecreated = time();
if (!($question->id = insert_record("question", $question))) {
error(get_string('cannotinsert', 'quiz'));
}
$this->questionids[] = $question->id;
// Now to save all the answers and type-specific options
global $QTYPES;
$result = $QTYPES[$question->qtype]->save_question_options($question);
if (!empty($result->error)) {
notify($result->error);
return false;
}
if (!empty($result->notice)) {
//.........这里部分代码省略.........
开发者ID:kai707, 项目名称:ITSA-backup, 代码行数:101, 代码来源:format.php
示例16: get_grade_options
<td>Full Name</td>
<td>Grade</td>
<td>Camp</td>
<td>T-Shirt Size</td>
<td></td>
</tr>
<?php
if (!isset($woocommerce->session->player_info)) {
?>
<tr>
<td><input type="text" class="input-text" name="camper[1][name]" value="" /></td>
<td id="grades">
<select name="camper[1][grade]" class="grade">
<option value="">-</option>
<?php
get_grade_options();
?>
</select>
</td>
<?php
$camps = get_terms(array('camp'), array('hide_empty' => false));
?>
<td id="camps">
<select name="camper[1][camp]" class="grade">
<option value="">-</option>
<?php
foreach ($camps as $camp) {
?>
<option value="<?php
echo $camp->slug;
?>
开发者ID:sniezekjp, 项目名称:blue-ridge-theme, 代码行数:31, 代码来源:content-registration.php
示例17: definition_inner
/**
* Add question-type specific form fields.
*
* @param object $mform the form being built.
*/
function definition_inner(&$mform)
{
$creategrades = get_grade_options();
$this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), $creategrades->gradeoptionsfull);
}
开发者ID:vuchannguyen, 项目名称:web, 代码行数:10, 代码来源:edit_missingtype_form.php
示例18: setup_elements
/**
* Print the form for this assignment type
*
* @param $mform object Allready existant form
*/
function setup_elements(&$mform)
{
global $CFG, $COURSE;
$add = optional_param('add', '', PARAM_ALPHA);
$update = optional_param('update', 0, PARAM_INT);
// Get course module instance
$cm = null;
$onlinejudge = null;
if (!empty($update)) {
$cm = get_record('course_modules', 'id', $update);
$onlinejudge = get_record('assignment_oj', 'assignment', $cm->instance);
}
$ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
// Programming languages
$choices = $this->get_languages();
$mform->addElement('select', 'lang', get_string('assignmentlangs', 'assignment_onlinejudge'), $choices);
$mform->setDefault('lang', $onlinejudge ? $onlinejudge->language : 'c');
// Presentation error grade ratio
unset($choices);
$choices = get_grade_options()->gradeoptions;
// Steal from question lib
$mform->addElement('select', 'ratiope', get_string('ratiope', 'assignment_onlinejudge'), $choices);
$mform->setHelpButton('ratiope', array('ratiope', get_string('descratiope', 'assignment_onlinejudge'), 'assignment_onlinejudge'));
$mform->setDefault('ratiope', $onlinejudge ? $onlinejudge->ratiope : 0);
// Max. CPU time
unset($choices);
$choices = $this->get_max_cpu_times($CFG->assignment_oj_max_cpu);
$mform->addElement('select', 'cpulimit', get_string('cpulimit', 'assignment_onlinejudge'), $choices);
$mform->setDefault('cpulimit', $onlinejudge ? $onlinejudge->cpulimit : 1);
// Max. memory usage
unset($choices);
$choices = $this->get_max_memory_usages($CFG->assignment_oj_max_mem);
$mform->addElement('select', 'memlimit', get_string('memlimit', 'assignment_onlinejudge'), $choices);
$mform->setDefault('memlimit', $onlinejudge ? $onlinejudge->memlimit : $CFG->assignment_oj_max_mem);
// Allow resubmit
$mform->addElement('select', 'resubmit', get_string('allowresubmit', 'assignment'), $ynoptions);
$mform->setHelpButton('resubmit', array('resubmit', get_string('allowresubmit', 'assignment'), 'assignment'));
$mform->setDefault('resubmit', 1);
// Compile only?
$mform->addElement('select', 'compileonly', get_string('compileonly', 'assignment_onlinejudge'), $ynoptions);
$mform->setHelpButton('compileonly', array('compileonly', get_string('compileonly', 'assignment_onlinejudge'), 'assignment_onlinejudge'));
$mform->setDefault('compileonly', $onlinejudge ? $onlinejudge->compileonly : 0);
// Email teachers
$mform->addElement('select', 'emailteachers', get_string('emailteachers', 'assignment'), $ynoptions);
$mform->setHelpButton('emailteachers', array('emailteachers', get_string('emailteachers', 'assignment'), 'assignment'));
$mform->setDefault('emailteachers', 0);
// Submission max bytes
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[1] = get_string('uploadnotallowed');
$choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
$mform->addElement('select', 'maxbytes', get_string('maximumfilesize', 'assignment_onlinejudge'), $choices);
$mform->setDefault('maxbytes', $CFG->assignment_maxbytes);
}
开发者ID:hit-moodle, 项目名称:onlinejudge, 代码行数:58, 代码来源:assignment.class.php
An issue was discovered in Bentley MicroStation before 10.17.0.x and Bentley Vie
阅读:568| 2022-07-29
oerpub/mathconverter: Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML
阅读:530| 2022-08-12
krishnaik06/Machine-Learning-in-90-days
阅读:1119| 2022-08-18
armancodv/building-energy-model-matlab: It is a small software which is develope
阅读:1167| 2022-08-17
在美元的英文“dollar”里面明明没有字母“s”,为什么美元的符号($)是一条竖线穿过字
阅读:1120| 2022-11-06
FGRibreau/import-tweets-to-mastodon: How to import tweets to mastodon (e.g. http
阅读:973| 2022-08-17
tboronczyk/localization-middleware: PSR-15 middleware to assist primarily with l
阅读:521| 2022-08-16
blundell/release-android-library: Remote script to create a maven compatible rel
阅读:731| 2022-08-15
长沙城南,有一所以“环保”为名的学校,从1979年创立以来,四易归属、五更其名。 这
阅读:818| 2022-11-06
heinrichreimer/material-intro: A simple material design app intro with cool anim
阅读:427| 2022-08-17
请发表评论