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


PHP question_bank::get_qtype方法代码示例

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


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

示例1: definition_inner

 protected function definition_inner($mform)
 {
     $qtype = question_bank::get_qtype('poodllrecording');
     $mform->addElement('select', 'responseformat', get_string('responseformat', 'qtype_poodllrecording'), $qtype->response_formats());
     $mform->setDefault('responseformat', 'editor');
     $mform->addElement('editor', 'graderinfo', get_string('graderinfo', 'qtype_poodllrecording'), array('rows' => 10), $this->editoroptions);
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:7,代码来源:edit_poodllrecording_form.php

示例2: validation

 public function validation($data, $files)
 {
     global $DB;
     $errors = parent::validation($data, $files);
     if (isset($data->categorymoveto)) {
         list($category) = explode(',', $data['categorymoveto']);
     } else {
         list($category) = explode(',', $data['category']);
     }
     $saquestions = question_bank::get_qtype('randomsamatch')->get_sa_candidates($category);
     $numberavailable = count($saquestions);
     if ($saquestions === false) {
         $a = new stdClass();
         $a->catname = $DB->get_field('question_categories', 'name', array('id' => $category));
         $errors['choose'] = get_string('nosaincategory', 'qtype_randomsamatch', $a);
     } else {
         if ($numberavailable < $data['choose']) {
             $a = new stdClass();
             $a->catname = $DB->get_field('question_categories', 'name', array('id' => $category));
             $a->nosaquestions = $numberavailable;
             $errors['choose'] = get_string('notenoughsaincategory', 'qtype_randomsamatch', $a);
         }
     }
     return $errors;
 }
开发者ID:helenagarcia90,项目名称:moodle,代码行数:25,代码来源:edit_randomsamatch_form.php

示例3: definition_inner

 protected function definition_inner($mform)
 {
     global $DB, $question;
     $loaded_initialy = optional_param('reloaded_initialy', 1, PARAM_INT);
     $qtype = question_bank::get_qtype('javaunittest');
     $definitionoptions = $this->_customdata['definitionoptions'];
     $attachmentoptions = $this->_customdata['attachmentoptions'];
     // -------------------------- feedback options
     $mform->addElement('select', 'feedbacklevel', get_string('feedbacklevel', 'qtype_javaunittest'), $qtype->feedback_levels());
     $mform->setDefault('feedbacklevel', FEEDBACK_ONLY_TIMES);
     // -------------------------- size of the response field
     $mform->addElement('select', 'responsefieldlines', get_string('responsefieldlines', 'qtype_javaunittest'), $qtype->response_sizes());
     $mform->setDefault('responsefieldlines', 15);
     // -------------------------- "Given Code" Text-Area
     $mform->addElement('textarea', 'givencode', get_string('givencode', 'qtype_javaunittest'), array('cols' => 80, 'rows' => 20));
     $mform->setType('givencode', PARAM_RAW);
     $mform->addHelpButton('givencode', 'givencode', 'qtype_javaunittest');
     // -------------------------- "Test class" Text-Area
     $mform->addElement('textarea', 'testclassname', get_string('testclassname', 'qtype_javaunittest'), array('cols' => 80, 'rows' => 1));
     $mform->setType('testclassname', PARAM_ALPHANUMEXT);
     $mform->addRule('testclassname', null, 'required');
     $mform->addHelpButton('testclassname', 'testclassname', 'qtype_javaunittest');
     $mform->addElement('textarea', 'junitcode', get_string('uploadtestclass', 'qtype_javaunittest'), array('cols' => 80, 'rows' => 20));
     $mform->setType('junitcode', PARAM_RAW);
     $mform->addRule('junitcode', null, 'required');
     $mform->addHelpButton('junitcode', 'uploadtestclass', 'qtype_javaunittest');
 }
开发者ID:printz81,项目名称:javaunittest,代码行数:27,代码来源:edit_javaunittest_form.php

示例4: definition_inner

    protected function definition_inner($mform) {
        $qtype = question_bank::get_qtype('essay');

        $mform->addElement('editor', 'graderinfo', get_string('graderinfo', 'qtype_essay'),
                array('rows' => 10), $this->editoroptions);

        $mform->addElement('header', 'responseheader', get_string('responseheader', 'qtype_essay'));

        $mform->addElement('select', 'responseformat',
                get_string('responseformat', 'qtype_essay'), $qtype->response_formats());
        $mform->setDefault('responseformat', 'editor');

        $mform->addElement('select', 'responsefieldlines',
                get_string('responsefieldlines', 'qtype_essay'), $qtype->response_sizes());
        $mform->setDefault('responsefieldlines', 15);

        $mform->addElement('select', 'attachments',
                get_string('allowattachments', 'qtype_essay'), $qtype->attachment_options());
        $mform->setDefault('attachments', 0);

        $mform->addElement('select', 'responselimitpolicy',
                get_string('responselimitpolicy', 'qtype_essay'), $qtype->response_limit_policies());
        $mform->addHelpButton('responselimitpolicy', 'responselimitpolicy', 'qtype_essay');

        $mform->addElement('text', 'wordlimit', get_string('wordlimit', 'qtype_essay'), array('size' => 3));
        $mform->disabledIf('wordlimit', 'responselimitpolicy', 'eq', 0);
        $mform->setType('wordlimit', PARAM_INT);

        $mform->addElement('text', 'charlimit', get_string('charlimit', 'qtype_essay'), array('size' => 3));
        $mform->disabledIf('charlimit', 'responselimitpolicy', 'eq', 0);
        $mform->setType('charlimit', PARAM_INT);
    }
开发者ID:nickkoeppen,项目名称:moodle,代码行数:32,代码来源:edit_essay_form.php

示例5: define_question_plugin_structure

 /**
  * Returns the qtype information to attach to question element.
  */
 protected function define_question_plugin_structure()
 {
     $qtypeobj = question_bank::get_qtype($this->pluginname);
     // Define the virtual plugin element with the condition to fulfill.
     $plugin = $this->get_plugin_element(null, '../../qtype', $qtypeobj->name());
     // Create one standard named plugin element (the visible container).
     $pluginwrapper = new backup_nested_element($this->get_recommended_name());
     // Connect the visible container ASAP.
     $plugin->add_child($pluginwrapper);
     // This qtype uses standard question_answers, add them here
     // to the tree before any other information that will use them.
     $this->add_question_question_answers($pluginwrapper);
     $answers = $pluginwrapper->get_child('answers');
     $answer = $answers->get_child('answer');
     // Extra question fields.
     $extraquestionfields = $qtypeobj->extra_question_fields();
     if (!empty($extraquestionfields)) {
         $tablename = array_shift($extraquestionfields);
         $child = new backup_nested_element($qtypeobj->name(), array('id'), $extraquestionfields);
         $pluginwrapper->add_child($child);
         $child->set_source_table($tablename, array($qtypeobj->questionid_column_name() => backup::VAR_PARENTID));
     }
     // Extra answer fields.
     $extraanswerfields = $qtypeobj->extra_answer_fields();
     if (!empty($extraanswerfields)) {
         $tablename = array_shift($extraanswerfields);
         $child = new backup_nested_element('extraanswerdata', array('id'), $extraanswerfields);
         $answer->add_child($child);
         $child->set_source_table($tablename, array('answerid' => backup::VAR_PARENTID));
     }
     // Don't need to annotate ids nor files.
     return $plugin;
 }
开发者ID:saylordotorg,项目名称:moodle-qtype_poasquestion,代码行数:36,代码来源:backup_poasquestion_plugin.class.php

示例6: get_questions_category

/**
* Function to read all questions for category into big array
*
* @param int $category category number
* @param bool $noparent if true only questions with NO parent will be selected
* @param bool $recurse include subdirectories
* @param bool $export set true if this is called by questionbank export
*/
function get_questions_category($category, $noparent = false, $recurse = true, $export = true)
{
    global $DB;
    // Build sql bit for $noparent
    $npsql = '';
    if ($noparent) {
        $npsql = " and parent='0' ";
    }
    // Get list of categories
    if ($recurse) {
        $categorylist = question_categorylist($category->id);
    } else {
        $categorylist = array($category->id);
    }
    // Get the list of questions for the category
    list($usql, $params) = $DB->get_in_or_equal($categorylist);
    $questions = $DB->get_records_select('question', "category {$usql} {$npsql}", $params, 'qtype, name');
    // Iterate through questions, getting stuff we need
    $qresults = array();
    foreach ($questions as $key => $question) {
        $question->export_process = $export;
        $qtype = question_bank::get_qtype($question->qtype, false);
        if ($export && $qtype->name() == 'missingtype') {
            // Unrecognised question type. Skip this question when exporting.
            continue;
        }
        $qtype->get_question_options($question);
        $qresults[] = $question;
    }
    return $qresults;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:39,代码来源:editlib.php

示例7: __construct

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 public function __construct($submiturl, $question, $regenerate)
 {
     global $SESSION, $CFG, $DB;
     $this->regenerate = $regenerate;
     $this->question = $question;
     $this->qtypeobj = question_bank::get_qtype($this->question->qtype);
     // Validate the question category.
     if (!($category = $DB->get_record('question_categories', array('id' => $question->category)))) {
         print_error('categorydoesnotexist', 'question', $returnurl);
     }
     $this->category = $category;
     $this->categorycontext = context::instance_by_id($category->contextid);
     // Get the dataset defintions for this question.
     if (empty($question->id)) {
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, $SESSION->calculated->definitionform->dataset);
     } else {
         if (empty($question->options)) {
             $this->get_question_options($question);
         }
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, array());
     }
     foreach ($this->datasetdefs as $datasetdef) {
         // Get maxnumber.
         if ($this->maxnumber == -1 || $datasetdef->itemcount < $this->maxnumber) {
             $this->maxnumber = $datasetdef->itemcount;
         }
     }
     foreach ($this->datasetdefs as $defid => $datasetdef) {
         if (isset($datasetdef->id)) {
             $this->datasetdefs[$defid]->items = $this->qtypeobj->get_database_dataset_items($datasetdef->id);
         }
     }
     parent::__construct($submiturl);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:39,代码来源:datasetitems_form.php

示例8: make_question

 public static function make_question($type, $answers = array("cat", "mat"))
 {
     question_bank::load_question_definition_classes($type);
     $question = new qtype_gapfill_question();
     test_question_maker::initialise_a_question($question);
     $question->qtype = question_bank::get_qtype('gapfill');
     $question->name = 'Gapfill Test Question';
     $question->questiontext = "The [cat] sat on the [mat]";
     $question->textfragments = array('The ', ' sat on the ');
     $question->displayanswers = '1';
     $question->casesensitive = '1';
     $question->generalfeedback = 'congratulations on your knowledge of pets and floor covering';
     $question->places[1] = $answers[0];
     $question->places[2] = $answers[1];
     $answer1 = new question_answer(43, $answers[0], 4, 1, 1);
     $answer2 = new question_answer(44, $answers[1], 4, 1, 1);
     $question->answers = array($answer1, $answer2);
     $question->options = new stdClass();
     $question->options->showanswers = false;
     $question->options->delimitchars = "[]";
     $question->options->casesensitive = false;
     $question->options->correctfeedback = "";
     $question->options->correctfeedbackformat = "";
     $question->options->partiallycorrectfeedback = "";
     $question->options->partiallycorrectfeedbackformat = "";
     $question->options->incorrectfeedback = "";
     $question->options->incorrectfeedbackformat = "";
     $question->options->shuffledanswers = "mat,cat";
     $question->options->wronganswers = "bat,dog";
     $question->shuffledanswers = "mat,cat,bat,dog";
     $answers = new stdClass();
     $question->options->answers = array($answer1, $answer2);
     $question->hints = array(new question_hint(1, 'This is the first hint.', FORMAT_HTML), new question_hint(2, 'This is the second hint.', FORMAT_HTML));
     return $question;
 }
开发者ID:dthies,项目名称:moodle-qtype_gapfill,代码行数:35,代码来源:helper.php

示例9: readquestions

 public function readquestions($lines)
 {
     question_bank::get_qtype('multianswer');
     // Ensure the multianswer code is loaded.
     // For this class the method has been simplified as
     // there can never be more than one question for a
     // multianswer import.
     $questions = array();
     $questiontext = array();
     $questiontext['text'] = implode('', $lines);
     $questiontext['format'] = FORMAT_MOODLE;
     $questiontext['itemid'] = '';
     $question = qtype_multianswer_extract_question($questiontext);
     $question->questiontext = $question->questiontext['text'];
     $question->questiontextformat = 0;
     $question->qtype = 'multianswer';
     $question->generalfeedback = '';
     $question->generalfeedbackformat = FORMAT_MOODLE;
     $question->length = 1;
     $question->penalty = 0.3333333;
     if (!empty($question)) {
         $question->name = $this->create_default_question_name($question->questiontext, get_string('questionname', 'question'));
         $questions[] = $question;
     }
     return $questions;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:26,代码来源:format.php

示例10: test_grading_rounding_three_right

    public function test_grading_rounding_three_right() {
        question_bank::load_question_definition_classes('multichoice');
        $mc = new qtype_multichoice_multi_question();
        test_question_maker::initialise_a_question($mc);
        $mc->name = 'Odd numbers';
        $mc->questiontext = 'Which are the odd numbers?';
        $mc->generalfeedback = '1, 3 and 5 are the odd numbers.';
        $mc->qtype = question_bank::get_qtype('multichoice');

        $mc->shuffleanswers = 0;
        $mc->answernumbering = 'abc';

        test_question_maker::set_standard_combined_feedback_fields($mc);

        $mc->answers = array(
            11 => new question_answer(11, '1', 0.3333333, '', FORMAT_HTML),
            12 => new question_answer(12, '2', -1, '', FORMAT_HTML),
            13 => new question_answer(13, '3', 0.3333333, '', FORMAT_HTML),
            14 => new question_answer(14, '4', -1, '', FORMAT_HTML),
            15 => new question_answer(15, '5', 0.3333333, '', FORMAT_HTML),
            16 => new question_answer(16, '6', -1, '', FORMAT_HTML),
        );

        $mc->start_attempt(new question_attempt_step(), 1);

        list($grade, $state) = $mc->grade_response(
                array('choice0' => 1, 'choice2' => 1, 'choice4' => 1));
        $this->assertEquals(1, $grade, '', 0.000001);
        $this->assertEquals(question_state::$gradedright, $state);
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:question_test.php

示例11: definition_inner

 protected function definition_inner($mform)
 {
     $qtype = question_bank::get_qtype('essay');
     $mform->addElement('header', 'responseoptions', get_string('responseoptions', 'qtype_essay'));
     $mform->setExpanded('responseoptions');
     $mform->addElement('select', 'responseformat', get_string('responseformat', 'qtype_essay'), $qtype->response_formats());
     $mform->setDefault('responseformat', 'editor');
     $mform->addElement('select', 'responserequired', get_string('responserequired', 'qtype_essay'), $qtype->response_required_options());
     $mform->setDefault('responserequired', 1);
     $mform->disabledIf('responserequired', 'responseformat', 'eq', 'noinline');
     $mform->addElement('select', 'responsefieldlines', get_string('responsefieldlines', 'qtype_essay'), $qtype->response_sizes());
     $mform->setDefault('responsefieldlines', 15);
     $mform->disabledIf('responsefieldlines', 'responseformat', 'eq', 'noinline');
     $mform->addElement('select', 'attachments', get_string('allowattachments', 'qtype_essay'), $qtype->attachment_options());
     $mform->setDefault('attachments', 0);
     $mform->addElement('select', 'attachmentsrequired', get_string('attachmentsrequired', 'qtype_essay'), $qtype->attachments_required_options());
     $mform->setDefault('attachmentsrequired', 0);
     $mform->addHelpButton('attachmentsrequired', 'attachmentsrequired', 'qtype_essay');
     $mform->disabledIf('attachmentsrequired', 'attachments', 'eq', 0);
     $mform->addElement('header', 'responsetemplateheader', get_string('responsetemplateheader', 'qtype_essay'));
     $mform->addElement('editor', 'responsetemplate', get_string('responsetemplate', 'qtype_essay'), array('rows' => 10), array_merge($this->editoroptions, array('maxfiles' => 0)));
     $mform->addHelpButton('responsetemplate', 'responsetemplate', 'qtype_essay');
     $mform->addElement('header', 'graderinfoheader', get_string('graderinfoheader', 'qtype_essay'));
     $mform->setExpanded('graderinfoheader');
     $mform->addElement('editor', 'graderinfo', get_string('graderinfo', 'qtype_essay'), array('rows' => 10), $this->editoroptions);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:26,代码来源:edit_essay_form.php

示例12: make_calculated_question_sum

    /**
     * Makes a calculated question about summing two numbers.
     * @return qtype_calculated_question
     */
    public function make_calculated_question_sum() {
        question_bank::load_question_definition_classes('calculated');
        $q = new qtype_calculated_question();
        test_question_maker::initialise_a_question($q);
        $q->name = 'Simple sum';
        $q->questiontext = 'What is {a} + {b}?';
        $q->generalfeedback = 'Generalfeedback: {={a} + {b}} is the right answer.';

        $q->answers = array(
            13 => new qtype_numerical_answer(13, '{a} + {b}', 1.0, 'Very good.', FORMAT_HTML, 0),
            14 => new qtype_numerical_answer(14, '{a} - {b}', 0.0, 'Add. not subtract!.',
                    FORMAT_HTML, 0),
            17 => new qtype_numerical_answer(17, '*', 0.0, 'Completely wrong.', FORMAT_HTML, 0),
        );
        foreach ($q->answers as $answer) {
            $answer->correctanswerlength = 2;
            $answer->correctanswerformat = 1;
        }

        $q->qtype = question_bank::get_qtype('calculated');
        $q->unitdisplay = qtype_numerical::UNITNONE;
        $q->unitgradingtype = 0;
        $q->unitpenalty = 0;
        $q->ap = new qtype_numerical_answer_processor(array());
        $q->synchronised = false;

        $q->datasetloader = new qtype_calculated_test_dataset_loader(0, array(
            array('a' => 1, 'b' => 5),
            array('a' => 3, 'b' => 4),
        ));

        return $q;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:37,代码来源:helper.php

示例13: run_all_tests_for_context

 /**
  * Run all the question tests for all variants of all questions belonging to
  * a given context.
  *
  * Does output as we go along.
  *
  * @param context $context the context to run the tests for.
  * @return array with two elements:
  *              bool true if all the tests passed, else false.
  *              array of messages relating to the questions with failures.
  */
 public function run_all_tests_for_context(context $context)
 {
     global $DB, $OUTPUT;
     // Load the necessary data.
     $categories = question_category_options(array($context));
     $categories = reset($categories);
     $questiontestsurl = new moodle_url('/question/type/stack/questiontestrun.php');
     if ($context->contextlevel == CONTEXT_COURSE) {
         $questiontestsurl->param('courseid', $context->instanceid);
     } else {
         if ($context->contextlevel == CONTEXT_MODULE) {
             $questiontestsurl->param('cmid', $context->instanceid);
         }
     }
     $allpassed = true;
     $failingtests = array();
     foreach ($categories as $key => $category) {
         list($categoryid) = explode(',', $key);
         echo $OUTPUT->heading($category, 3);
         $questionids = $DB->get_records_menu('question', array('category' => $categoryid, 'qtype' => 'stack'), 'name', 'id,name');
         if (!$questionids) {
             continue;
         }
         echo html_writer::tag('p', stack_string('replacedollarscount', count($questionids)));
         foreach ($questionids as $questionid => $name) {
             $tests = question_bank::get_qtype('stack')->load_question_tests($questionid);
             if (!$tests) {
                 echo $OUTPUT->heading(html_writer::link(new moodle_url($questiontestsurl, array('questionid' => $questionid)), format_string($name)), 4);
                 echo html_writer::tag('p', stack_string('bulktestnotests'));
                 continue;
             }
             $question = question_bank::load_question($questionid);
             $questionname = format_string($name);
             $previewurl = new moodle_url($questiontestsurl, array('questionid' => $questionid));
             if (empty($question->deployedseeds)) {
                 $questionnamelink = html_writer::link($previewurl, $questionname);
                 echo $OUTPUT->heading($questionnamelink, 4);
                 list($ok, $message) = $this->qtype_stack_test_question($question, $tests);
                 if (!$ok) {
                     $allpassed = false;
                     $failingtests[] = $questionnamelink . ': ' . $message;
                 }
             } else {
                 echo $OUTPUT->heading(format_string($name), 4);
                 foreach ($question->deployedseeds as $seed) {
                     $previewurl->param('seed', $seed);
                     $questionnamelink = html_writer::link($previewurl, stack_string('seedx', $seed));
                     echo $OUTPUT->heading($questionnamelink, 4);
                     list($ok, $message) = $this->qtype_stack_test_question($question, $tests, $seed);
                     if (!$ok) {
                         $allpassed = false;
                         $failingtests[] = $questionname . ' ' . $questionnamelink . ': ' . $message;
                     }
                 }
             }
         }
     }
     return array($allpassed, $failingtests);
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:70,代码来源:bulktester.class.php

示例14: test_walkthrough_from_csv

 /**
  * Create a quiz add questions to it, walk through quiz attempts and then check results.
  *
  * @param PHPUnit_Extensions_Database_DataSet_ITable[] of data read from csv file "questionsXX.csv",
  *                                                                                  "stepsXX.csv" and "resultsXX.csv".
  * @dataProvider get_data_for_walkthrough
  */
 public function test_walkthrough_from_csv($quizsettings, $csvdata)
 {
     // CSV data files for these tests were generated using :
     // https://github.com/jamiepratt/moodle-quiz-tools/tree/master/responsegenerator
     $this->resetAfterTest(true);
     question_bank::get_qtype('random')->clear_caches_before_testing();
     $this->create_quiz($quizsettings, $csvdata['questions']);
     $attemptids = $this->walkthrough_attempts($csvdata['steps']);
     $this->check_attempts_results($csvdata['results'], $attemptids);
     $this->report = new quiz_statistics_report();
     $whichattempts = QUIZ_GRADEAVERAGE;
     $groupstudents = array();
     $questions = $this->report->load_and_initialise_questions_for_calculations($this->quiz);
     list($quizstats, $questionstats, $subquestionstats) = $this->report->get_quiz_and_questions_stats($this->quiz, $whichattempts, $groupstudents, $questions);
     $qubaids = quiz_statistics_qubaids_condition($this->quiz->id, $groupstudents, $whichattempts);
     // We will create some quiz and question stat calculator instances and some response analyser instances, just in order
     // to check the time of the
     $quizcalc = new quiz_statistics_calculator();
     // Should not be a delay of more than one second between the calculation of stats above and here.
     $this->assertTimeCurrent($quizcalc->get_last_calculated_time($qubaids));
     $qcalc = new \core_question\statistics\questions\calculator($questions);
     $this->assertTimeCurrent($qcalc->get_last_calculated_time($qubaids));
     foreach ($questions as $question) {
         if (!question_bank::get_qtype($question->qtype, false)->can_analyse_responses()) {
             continue;
         }
         $responesstats = new \core_question\statistics\responses\analyser($question);
         $this->assertTimeCurrent($responesstats->get_last_analysed_time($qubaids));
     }
     // These quiz stats and the question stats found in qstats00.csv were calculated independently in spreadsheet which is
     // available in open document or excel format here :
     // https://github.com/jamiepratt/moodle-quiz-tools/tree/master/statsspreadsheet
     $quizstatsexpected = array('median' => 4.5, 'firstattemptsavg' => 4.617333332, 'allattemptsavg' => 4.617333332, 'firstattemptscount' => 25, 'allattemptscount' => 25, 'standarddeviation' => 0.8117265554, 'skewness' => -0.092502502, 'kurtosis' => -0.7073968557, 'cic' => -87.22309355420001, 'errorratio' => 136.8294900795, 'standarderror' => 1.1106813066);
     foreach ($quizstatsexpected as $statname => $statvalue) {
         $this->assertEquals($statvalue, $quizstats->{$statname}, $quizstats->{$statname}, abs($statvalue) * 1.5E-5);
     }
     for ($rowno = 0; $rowno < $csvdata['qstats']->getRowCount(); $rowno++) {
         $slotqstats = $csvdata['qstats']->getRow($rowno);
         foreach ($slotqstats as $statname => $slotqstat) {
             if ($statname !== 'slot') {
                 switch ($statname) {
                     case 'covariance':
                     case 'discriminationindex':
                     case 'discriminativeefficiency':
                     case 'effectiveweight':
                         $precision = 1.0E-5;
                         break;
                     default:
                         $precision = 1.0E-6;
                 }
                 $slot = $slotqstats['slot'];
                 $delta = abs($slotqstat) * $precision;
                 $actual = $questionstats[$slot]->{$statname};
                 $this->assertEquals(floatval($slotqstat), $actual, "{$statname} for slot {$slot}", $delta);
             }
         }
     }
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:65,代码来源:stats_from_steps_walkthrough_test.php

示例15: __construct

 public function __construct($plugintype, $pluginname, $step)
 {
     parent::__construct($plugintype, $pluginname, $step);
     $this->qtypeobj = question_bank::get_qtype($this->pluginname);
     $this->oldquestionid = -1;
     $this->newquestionid = -1;
     $this->questioncreated = false;
     $this->currentanswer = null;
 }
开发者ID:saylordotorg,项目名称:moodle-qtype_poasquestion,代码行数:9,代码来源:restore_poasquestion_plugin.class.php


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