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


PHP question_bank::fraction_options方法代码示例

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


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

示例1: definition_inner

 protected function definition_inner($mform)
 {
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_numerical', '{no}'), question_bank::fraction_options());
     $this->add_unit_options($mform);
     $this->add_unit_fields($mform);
     $this->add_interactive_settings();
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:7,代码来源:edit_numerical_form.php

示例2: definition_inner

 protected function definition_inner($mform)
 {
     global $PAGE, $CFG;
     $PAGE->requires->css('/question/type/easyoselectjs/easyoselectjs_styles.css');
     $marvinjsconfig = get_config('qtype_easyoselectjs_options');
     $marvinjspath = $marvinjsconfig->path;
     $protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/promise-0.1.1.min.js'));
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/marvinjslauncher.js'));
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_easyoselectjs'), get_string('filloutoneanswer', 'qtype_easyoselectjs'));
     $mform->closeHeaderBefore('answersinstruct');
     $mform->setType('structure', PARAM_RAW);
     $mform->addElement('hidden', 'structure', "", array('id' => 'id_structure'));
     $mform->addElement('html', html_writer::start_tag('div', array('id' => 'appletdiv', 'class' => 'easyomechjs resizable')));
     $mform->addElement('html', html_writer::start_tag('div', array('style' => 'float: left;font-style: italic ;')));
     $mform->addElement('html', html_writer::start_tag('small'));
     $easyoselectjshomeurl = 'http://www.chemaxon.com';
     $mform->addElement('html', html_writer::link($easyoselectjshomeurl, get_string('easyoselectjseditor', 'qtype_easyoselectjs')));
     $mform->addElement('html', html_writer::empty_tag('br'));
     $mform->addElement('html', html_writer::tag('span', get_string('author', 'qtype_easyoselectjs'), array('class' => 'easyoselectjsauthor')));
     $mform->addElement('html', html_writer::end_tag('small'));
     $mform->addElement('html', html_writer::end_tag('div'));
     $mform->addElement('html', html_writer::end_tag('div'));
     $marvinconfig = get_config('qtype_easyoselectjs_options');
     $marvinpath = $marvinconfig->path;
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.insert_applet', array($CFG->wwwroot, $marvinpath));
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_easyoselectjs', '{no}'), question_bank::fraction_options());
     $this->add_interactive_settings();
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_getanswerstring', array($CFG->version));
     $PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_viewanswerstring', array($CFG->version));
 }
开发者ID:Kathrin84,项目名称:moodle-qtype_easyoselectjs,代码行数:31,代码来源:edit_easyoselectjs_form.php

示例3: definition_inner

 protected function definition_inner($mform)
 {
     global $PAGE, $CFG;
     $PAGE->requires->js('/question/type/jme/jme_script.js');
     $PAGE->requires->css('/question/type/jme/styles.css');
     $mform->addElement('hidden', 'usecase', 1);
     $mform->setType('usecase', PARAM_INT);
     $optionscript = 'onClick = "setJSMEoptions()"';
     $label = get_string('jmeoptions', 'qtype_jme');
     $editoroptions[] = $mform->createElement('text', 'jmeoptions', '', array('size' => 50));
     $editoroptions[] = $mform->createElement('button', 'setoptions', get_string('setoptions', 'qtype_jme'), $optionscript);
     $mform->addElement('group', 'editoroptions', $label, $editoroptions, null, false);
     $mform->setDefault('jmeoptions', $CFG->qtype_jme_options);
     $mform->setType('jmeoptions', PARAM_RAW);
     $mform->addHelpButton('editoroptions', 'jmeoptions', 'qtype_jme');
     $mform->addElement('text', 'width', get_string('width', 'qtype_jme'), array('size' => 6));
     $mform->setDefault('width', QTYPE_JME_APPLET_WIDTH);
     $mform->setType('width', PARAM_INT);
     $mform->addElement('text', 'height', get_string('height', 'qtype_jme'), array('size' => 6));
     $mform->setDefault('height', QTYPE_JME_APPLET_HEIGHT);
     $mform->setType('height', PARAM_INT);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_jme'), get_string('filloutoneanswer', 'qtype_jme'));
     $mform->addElement('html', html_writer::tag('div', get_string('enablejavascript', 'qtype_jme'), array('class' => 'jme_applet', 'code' => 'JME.class', 'id' => 'jme1', 'name' => 'JME1', 'archive' => 'JME.jar', 'width' => '360', 'height' => '315', 'style' => 'margin: 1.5em auto')));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_jme', '{no}'), question_bank::fraction_options());
     $this->add_interactive_settings();
     // Include JSME loader script as an html tag.
     $jsmescript = $CFG->wwwroot . '/question/type/jme/jsme/jsme.nocache.js';
     $mform->addElement('html', html_writer::tag('script', '', array('src' => $jsmescript)));
 }
开发者ID:uofr,项目名称:moodle-qtype_jme,代码行数:30,代码来源:edit_jme_form.php

示例4: definition_inner

 protected function definition_inner($mform)
 {
     $menu = array(get_string('caseno', 'qtype_shortanswer'), get_string('caseyes', 'qtype_shortanswer'));
     $mform->addElement('select', 'usecase', get_string('casesensitive', 'qtype_shortanswer'), $menu);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_shortanswer'), get_string('filloutoneanswer', 'qtype_shortanswer'));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_shortanswer', '{no}'), question_bank::fraction_options());
     $this->add_interactive_settings();
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:9,代码来源:edit_shortanswer_form.php

示例5: test_fraction_options

 public function test_fraction_options()
 {
     $fractions = question_bank::fraction_options();
     $this->assertSame(get_string('none'), reset($fractions));
     $this->assertSame('0.0', key($fractions));
     $this->assertSame('5%', end($fractions));
     $this->assertSame('0.05', key($fractions));
     array_shift($fractions);
     array_pop($fractions);
     array_pop($fractions);
     $this->assertSame('100%', reset($fractions));
     $this->assertSame('1.0', key($fractions));
     $this->assertSame('11.11111%', end($fractions));
     $this->assertSame('0.1111111', key($fractions));
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:15,代码来源:questionbank_test.php

示例6: definition_inner

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     $strquestionlabel = $this->qtypeobj->comment_header($this->nonemptyanswer);
     $label = get_string("sharedwildcards", "qtype_calculated");
     $mform->addElement('hidden', 'synchronize', 0);
     $mform->addElement('hidden', 'initialcategory', 1);
     $mform->setType('synchronize', PARAM_BOOL);
     $mform->setType('initialcategory', PARAM_INT);
     $mform->addElement('hidden', 'reload', 1);
     $mform->setType('reload', PARAM_INT);
     $addfieldsname = 'updatequestion value';
     $addstring = get_string("updatecategory", "qtype_calculated");
     $mform->registerNoSubmitButton($addfieldsname);
     $this->add_per_answer_fields($mform, get_string('answerhdr', 'qtype_calculated', '{no}'), question_bank::fraction_options(), 1, 1);
     $this->add_unit_options($mform, $this);
     $this->add_unit_fields($mform, $this);
     $this->add_interactive_settings();
     $label = "<div class='mdl-align'></div><div class='mdl-align'>" . get_string('wildcardrole', 'qtype_calculatedsimple') . "</div>";
     $mform->addElement('html', "<div class='mdl-align'>&nbsp;</div>");
     // Explaining the role of datasets so other strings can be shortened.
     $mform->addElement('html', $label);
     $mform->addElement('submit', 'analyzequestion', get_string('findwildcards', 'qtype_calculatedsimple'));
     $mform->registerNoSubmitButton('analyzequestion');
     $mform->closeHeaderBefore('analyzequestion');
     $this->wizarddisplay = optional_param('analyzequestion', false, PARAM_BOOL);
     if ($this->maxnumber != -1) {
         $this->noofitems = $this->maxnumber;
     } else {
         $this->noofitems = 0;
     }
     if (!empty($this->datasetdefs)) {
         // So there are some datadefs.
         // We put them on the page.
         $key = 0;
         $mform->addElement('header', 'additemhdr', get_string('wildcardparam', 'qtype_calculatedsimple'));
         $idx = 1;
         if (!empty($this->datasetdefs)) {
             // Unnecessary test.
             $j = $this->noofitems * count($this->datasetdefs) + 1;
             //
             foreach ($this->datasetdefs as $defkey => $datasetdef) {
                 $mform->addElement('static', "na[{$j}]", get_string('param', 'qtype_calculated', $datasetdef->name));
                 $this->qtypeobj->custom_generator_tools_part($mform, $idx, $j);
                 $mform->addElement('hidden', "datasetdef[{$idx}]");
                 $mform->setType("datasetdef[{$idx}]", PARAM_RAW);
                 $mform->addElement('hidden', "defoptions[{$idx}]");
                 $mform->setType("defoptions[{$idx}]", PARAM_RAW);
                 $idx++;
                 $mform->addElement('static', "divider[{$j}]", '', '<hr />');
                 $j++;
             }
         }
         // This should be done before the elements are created and stored as $this->formdata.
         // Fill out all data sets and also the fields for the next item to add.
         /*Here we do already the values error analysis so that
          * we could force all wild cards values display if there is an error in values.
          * as using a , in a number */
         $this->numbererrors = array();
         if (!empty($this->datasetdefs)) {
             $j = $this->noofitems * count($this->datasetdefs);
             for ($itemnumber = $this->noofitems; $itemnumber >= 1; $itemnumber--) {
                 $data = array();
                 $numbererrors = array();
                 $comment = new stdClass();
                 $comment->stranswers = array();
                 $comment->outsidelimit = false;
                 $comment->answers = array();
                 foreach ($this->datasetdefs as $defid => $datasetdef) {
                     if (isset($datasetdef->items[$itemnumber])) {
                         $this->formdata["definition[{$j}]"] = $defid;
                         $this->formdata["itemid[{$j}]"] = $datasetdef->items[$itemnumber]->id;
                         $data[$datasetdef->name] = $datasetdef->items[$itemnumber]->value;
                         $this->formdata["number[{$j}]"] = $number = $datasetdef->items[$itemnumber]->value;
                         if (!is_numeric($number)) {
                             $a = new stdClass();
                             $a->name = '{' . $datasetdef->name . '}';
                             $a->value = $datasetdef->items[$itemnumber]->value;
                             if (stristr($number, ',')) {
                                 $this->numbererrors["number[{$j}]"] = get_string('nocommaallowed', 'qtype_calculated');
                                 $numbererrors .= $this->numbererrors['number[' . $j . ']'] . "<br />";
                             } else {
                                 $this->numbererrors["number[{$j}]"] = get_string('notvalidnumber', 'qtype_calculated', $a);
                                 $numbererrors .= $this->numbererrors['number[' . $j . ']'] . "<br />";
                             }
                         } else {
                             if (stristr($number, 'x')) {
                                 // Hexa will pass the test.
                                 $a = new stdClass();
                                 $a->name = '{' . $datasetdef->name . '}';
                                 $a->value = $datasetdef->items[$itemnumber]->value;
                                 $this->numbererrors['number[' . $j . ']'] = get_string('hexanotallowed', 'qtype_calculated', $a);
                                 $numbererrors .= $this->numbererrors['number[' . $j . ']'] . "<br />";
                             } else {
                                 if (is_nan($number)) {
                                     $a = new stdClass();
//.........这里部分代码省略.........
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:101,代码来源:edit_calculatedsimple_form.php

示例7: definition_inner

    /**
     * Add question-type specific form fields.
     *
     * @param MoodleQuickForm $mform the form being built.
     */
    protected function definition_inner($mform) {
        $this->qtypeobj = question_bank::get_qtype($this->qtype());
        $label = get_string('sharedwildcards', 'qtype_calculated');
        $mform->addElement('hidden', 'initialcategory', 1);
        $mform->addElement('hidden', 'reload', 1);
        $mform->setType('initialcategory', PARAM_INT);
        $html2 = $this->qtypeobj->print_dataset_definitions_category($this->question);
        $mform->insertElementBefore(
                $mform->createElement('static', 'listcategory', $label, $html2), 'name');
        if (isset($this->question->id)) {
            $mform->insertElementBefore($mform->createElement('static', 'initialname',
                    get_string('questionstoredname', 'qtype_calculated'),
                    $this->initialname), 'name');
        };
        $addfieldsname = 'updatecategory';
        $addstring = get_string('updatecategory', 'qtype_calculated');
        $mform->registerNoSubmitButton($addfieldsname);

        $mform->insertElementBefore(
                $mform->createElement('submit', $addfieldsname, $addstring), 'listcategory');
        $mform->registerNoSubmitButton('createoptionbutton');

        //editing as regular
        $mform->setType('single', PARAM_INT);

        $mform->addElement('hidden', 'shuffleanswers', '1');
        $mform->setType('shuffleanswers', PARAM_INT);
        $mform->addElement('hidden', 'answernumbering', 'abc');
        $mform->setType('answernumbering', PARAM_SAFEDIR);

        $this->add_per_answer_fields($mform, get_string('answerhdr', 'qtype_calculated', '{no}'),
                question_bank::fraction_options(), 1, 1);

        $repeated = array();

        $this->add_unit_options($mform, $this);
        $this->add_unit_fields($mform, $this);
        $this->add_interactive_settings();

        // Hidden elements
        $mform->addElement('hidden', 'synchronize', '');
        $mform->setType('synchronize', PARAM_INT);
        $mform->addElement('hidden', 'wizard', 'datasetdefinitions');
        $mform->setType('wizard', PARAM_ALPHA);
    }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:50,代码来源:edit_calculated_form.php

示例8: get_grade_options

/**
 * Returns list of 'allowed' grades for grade selection
 * formatted suitably for dropdown box function
 *
 * @deprecated since 2.1. Use {@link question_bank::fraction_options()} or
 * {@link question_bank::fraction_options_full()} instead.
 *
 * @return object ->gradeoptionsfull full array ->gradeoptions +ve only
 */
function get_grade_options()
{
    $grades = new stdClass();
    $grades->gradeoptions = question_bank::fraction_options();
    $grades->gradeoptionsfull = question_bank::fraction_options_full();
    return $grades;
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:16,代码来源:questionlib.php

示例9: add_penalty_fields

 /**
  * Adds the combobox to select penalty for each incorrectly selected area.
  * By default 12.5% (1/8) is selected 
  * 
  * @param MoodleQuickForm $mform
  */
 protected function add_penalty_fields($mform)
 {
     $fldname = 'vd_penalty';
     $mform->addElement('select', $fldname, get_string('penalty_per_wrong_area', 'qtype_vdmarker'), question_bank::fraction_options());
     $mform->setDefault($fldname, 1.0);
 }
开发者ID:roomlane,项目名称:moodle-qtype_vdmarker,代码行数:12,代码来源:edit_vdmarker_form.php

示例10: create_cell_element

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

示例11: definition_inner

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     global $CFG, $OUTPUT, $SESSION;
     require_once $CFG->dirroot . '/question/type/regexp/locallib.php';
     $this->showalternate = false;
     if ("" != optional_param('showalternate', '', PARAM_RAW)) {
         $this->showalternate = true;
         $this->questionid = optional_param('id', '', PARAM_NOTAGS);
         $this->usecase = optional_param('usecase', '', PARAM_NOTAGS);
         $this->studentshowalternate = optional_param('studentshowalternate', '', PARAM_NOTAGS);
         $this->fraction = optional_param_array('fraction', '', PARAM_RAW);
         $this->currentanswers = optional_param_array('answer', '', PARAM_NOTAGS);
         //$this->feedback = optional_param('feedback', '', PARAM_NOTAGS);
         // no longer works in moodle 2.2 and later see http://moodle.org/mod/forum/discuss.php?d=197118
         // so use data_submitted() instead
         $feedback = data_submitted()->feedback;
         // we only need to get the feedback text, for validation purposes when showalternate is requested
         foreach ($feedback as $key => $fb) {
             $this->feedback[$key]['text'] = clean_param($fb['text'], PARAM_NOTAGS);
         }
     }
     // JR added advanced settings to hide mostly unwanted hints and tags settings
     if ("" != optional_param('addhint', '', PARAM_RAW)) {
         $this->hints = optional_param('hint', '', PARAM_NOTAGS);
     } elseif (isset($this->question->hints)) {
         $this->hints = $this->question->hints;
     }
     $counthints = 0;
     if (isset($this->hints)) {
         $counthints = count($this->hints);
     }
     $mform->setAdvanced('tags');
     for ($i = 0; $i < $counthints; $i++) {
         $mform->setAdvanced("hint[{$i}]");
     }
     // hint mode :: None / Letter / Word
     $menu = array(get_string('none'), get_string('letter', 'qtype_regexp'), get_string('word', 'qtype_regexp'));
     $mform->addElement('select', 'usehint', get_string('usehint', 'qtype_regexp'), $menu);
     $mform->addHelpButton('usehint', 'usehint', 'qtype_regexp');
     // use case :: yes / no
     $menu = array(get_string('caseno', 'qtype_regexp'), get_string('caseyes', 'qtype_regexp'));
     $mform->addElement('select', 'usecase', get_string('casesensitive', 'qtype_regexp'), $menu);
     // display all correct alternate answers to student on review page :: yes / no
     $menu = array(get_string('no'), get_string('yes'));
     $mform->addElement('select', 'studentshowalternate', get_string('studentshowalternate', 'qtype_regexp'), $menu);
     $mform->addHelpButton('studentshowalternate', 'studentshowalternate', 'qtype_regexp');
     //$mform->closeHeaderBefore('answersinstruct');
     $mform->addElement('static', 'answersinstruct', 'Note.-', get_string('filloutoneanswer', 'qtype_regexp'));
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_shortanswer', '{no}'), question_bank::fraction_options(), $minoptions = 3, $addoptions = 1);
     $mform->addElement('header', 'showhidealternate', get_string('showhidealternate', 'qtype_regexp'));
     $mform->addHelpButton('showhidealternate', 'showhidealternate', 'qtype_regexp');
     $buttonarray = array();
     $buttonarray[] = $mform->createElement('submit', 'showalternate', get_string('showalternate', 'qtype_regexp'));
     $mform->registerNoSubmitButton('showalternate');
     if ($this->showalternate) {
         $qu = new stdClass();
         $qu->id = $this->questionid;
         $qu->answers = array();
         $i = 0;
         $this->fraction[0] = 1;
         $data = array();
         foreach ($this->currentanswers as $key => $answer) {
             $qu->answers[$i] = new stdClass();
             $qu->answers[$i]->answer = $answer;
             $qu->answers[$i]->fraction = $this->fraction[$i];
             // for sending $data to validation
             $data['answer'][$i] = $answer;
             $data['fraction'][$i] = $this->fraction[$i];
             $data['feedback'][$i] = $this->feedback[$i];
             $i++;
         }
         $moodle_val = $this->validation($data, '');
         if (is_array($moodle_val) && count($moodle_val) !== 0) {
             // non-empty array means errors
             foreach ($moodle_val as $element => $msg) {
                 $mform->setElementError($element, $msg);
             }
             // set to false in order to set hidealternate button to disabled
             $this->showalternate = false;
         } else {
             // we need to unset SESSION in case Answers have been edited since last call to get_alternateanswers()
             if (isset($SESSION->qtype_regexp_question->alternateanswers[$this->questionid])) {
                 unset($SESSION->qtype_regexp_question->alternateanswers[$this->questionid]);
             }
             $alternateanswers = get_alternateanswers($qu);
             $mform->addElement('html', '<div class="alternateanswers">');
             $alternatelist = '';
             foreach ($alternateanswers as $key => $alternateanswer) {
                 $mform->addElement('static', 'alternateanswer', get_string('answer') . ' ' . $key . ' (' . $alternateanswer['fraction'] . ')', '<span class="regexp">' . $alternateanswer['regexp'] . '</span>');
                 $list = '';
                 foreach ($alternateanswer['answers'] as $alternate) {
                     $list .= '<li>' . $alternate . '</li>';
                 }
                 $mform->addElement('static', 'alternateanswer', '', '<ul class="square">' . $list . '</ul>');
             }
//.........这里部分代码省略.........
开发者ID:rezeau,项目名称:moodle-qtype_regexp,代码行数:101,代码来源:edit_regexp_form.php


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