當前位置: 首頁>>代碼示例>>PHP>>正文


PHP default_questiontype::generate_test方法代碼示例

本文整理匯總了PHP中default_questiontype::generate_test方法的典型用法代碼示例。如果您正苦於以下問題:PHP default_questiontype::generate_test方法的具體用法?PHP default_questiontype::generate_test怎麽用?PHP default_questiontype::generate_test使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在default_questiontype的用法示例。


在下文中一共展示了default_questiontype::generate_test方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: list

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     list($form, $question) = parent::generate_test($name, $courseid);
     $form->questiontext = "What is the purpose of life?";
     $form->feedback = "feedback";
     $form->generalfeedback = "General feedback";
     $form->fraction = 0;
     $form->penalty = 0;
     if ($courseid) {
         $course = get_record('course', 'id', $courseid);
     }
     return $this->save_question($question, $form, $course);
 }
開發者ID:edwinphillips,項目名稱:moodle-485cb39,代碼行數:17,代碼來源:questiontype.php

示例2: list

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     global $DB;
     list($form, $question) = parent::generate_test($name, $courseid);
     $form->shuffleanswers = 1;
     $form->noanswers = 3;
     $form->subquestions = array('cat', 'dog', 'cow');
     $form->subanswers = array('feline', 'canine', 'bovine');
     if ($courseid) {
         $course = $DB->get_record('course', array('id' => $courseid));
     }
     return $this->save_question($question, $form);
 }
開發者ID:esyacelga,項目名稱:sisadmaca,代碼行數:17,代碼來源:questiontype.php

示例3: list

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     list($form, $question) = parent::generate_test($name, $courseid);
     $question->category = $form->category;
     $form->questiontext = "This question consists of some text with an answer embedded right here {1:MULTICHOICE:Wrong answer#Feedback for this wrong answer~Another wrong answer#Feedback for the other wrong answer~=Correct answer#Feedback for correct answer~%50%Answer that gives half the credit#Feedback for half credit answer} and right after that you will have to deal with this short answer {1:SHORTANSWER:Wrong answer#Feedback for this wrong answer~=Correct answer#Feedback for correct answer~%50%Answer that gives half the credit#Feedback for half credit answer} and finally we have a floating point number {2:NUMERICAL:=23.8:0.1#Feedback for correct answer 23.8~%50%23.8:2#Feedback for half credit answer in the nearby region of the correct answer}.\n\nNote that addresses like www.moodle.org and smileys :-) all work as normal:\n a) How good is this? {:MULTICHOICE:=Yes#Correct~No#We have a different opinion}\n b) What grade would you give it? {3:NUMERICAL:=3:2}\n\nGood luck!\n";
     $form->feedback = "feedback";
     $form->generalfeedback = "General feedback";
     $form->fraction = 0;
     $form->penalty = 0.1;
     $form->versioning = 0;
     if ($courseid) {
         $course = get_record('course', 'id', $courseid);
     }
     return $this->save_question($question, $form, $course);
 }
開發者ID:JackCanada,項目名稱:moodle-hacks,代碼行數:19,代碼來源:questiontype.php

示例4: list

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     global $DB;
     list($form, $question) = parent::generate_test($name, $courseid);
     $form->feedback = 1;
     $form->multiplier = array(1, 1);
     $form->shuffleanswers = 1;
     $form->noanswers = 1;
     $form->qtype = 'calculated';
     $question->qtype = 'calculated';
     $form->answers = array('{a} + {b}');
     $form->fraction = array(1);
     $form->tolerance = array(0.01);
     $form->tolerancetype = array(1);
     $form->correctanswerlength = array(2);
     $form->correctanswerformat = array(1);
     $form->questiontext = "What is {a} + {b}?";
     if ($courseid) {
         $course = $DB->get_record('course', array('id' => $courseid));
     }
     $new_question = $this->save_question($question, $form, $course);
     $dataset_form = new stdClass();
     $dataset_form->nextpageparam["forceregeneration"] = 1;
     $dataset_form->calcmin = array(1 => 1.0, 2 => 1.0);
     $dataset_form->calcmax = array(1 => 10.0, 2 => 10.0);
     $dataset_form->calclength = array(1 => 1, 2 => 1);
     $dataset_form->number = array(1 => 5.4, 2 => 4.9);
     $dataset_form->itemid = array(1 => '', 2 => '');
     $dataset_form->calcdistribution = array(1 => 'uniform', 2 => 'uniform');
     $dataset_form->definition = array(1 => "1-0-a", 2 => "1-0-b");
     $dataset_form->nextpageparam = array('forceregeneration' => false);
     $dataset_form->addbutton = 1;
     $dataset_form->selectadd = 1;
     $dataset_form->courseid = $courseid;
     $dataset_form->cmid = 0;
     $dataset_form->id = $new_question->id;
     $this->save_dataset_items($new_question, $dataset_form);
     return $new_question;
 }
開發者ID:nicolasconnault,項目名稱:moodle2.0,代碼行數:43,代碼來源:questiontype.php

示例5: list

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     global $DB;
     list($form, $question) = parent::generate_test($name, $courseid);
     $question->category = $form->category;
     $form->questiontext = "What is the purpose of life, the universe, and everything";
     $form->generalfeedback = "Congratulations, you may have solved my biggest problem!";
     $form->penalty = 0.1;
     $form->usecase = false;
     $form->defaultgrade = 1;
     $form->noanswers = 3;
     $form->answer = array('42', 'who cares?', 'Be happy');
     $form->fraction = array(1, 0.6, 0.8);
     $form->feedback = array('True, but what does that mean?', 'Well you do, dont you?', 'Yes, but thats not funny...');
     $form->correctfeedback = 'Excellent!';
     $form->incorrectfeedback = 'Nope!';
     $form->partiallycorrectfeedback = 'Not bad';
     if ($courseid) {
         $course = $DB->get_record('course', array('id' => $courseid));
     }
     return $this->save_question($question, $form);
 }
開發者ID:vuchannguyen,項目名稱:web,代碼行數:26,代碼來源:questiontype.php

示例6: generate_test

 /**
  * Runs all the code required to set up and save an essay question for testing purposes.
  * Alternate DB table prefix may be used to facilitate data deletion.
  */
 function generate_test($name, $courseid = null)
 {
     global $DB;
     list($form, $question) = default_questiontype::generate_test($name, $courseid);
     $question->category = $form->category;
     $form->questiontext = "What is 674 * 36?";
     $form->generalfeedback = "Thank you";
     $form->penalty = 0.1;
     $form->defaultgrade = 1;
     $form->noanswers = 3;
     $form->answer = array('24264', '24264', '1');
     $form->tolerance = array(10, 100, 0);
     $form->fraction = array(1, 0.5, 0);
     $form->nounits = 2;
     $form->unit = array(0 => null, 1 => null);
     $form->multiplier = array(1, 0);
     $form->feedback = array('Very good', 'Close, but not quite there', 'Well at least you tried....');
     if ($courseid) {
         $course = $DB->get_record('course', array('id' => $courseid));
     }
     return $this->save_question($question, $form);
 }
開發者ID:esyacelga,項目名稱:sisadmaca,代碼行數:26,代碼來源:questiontype.php


注:本文中的default_questiontype::generate_test方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。