本文整理汇总了PHP中default_questiontype类的典型用法代码示例。如果您正苦于以下问题:PHP default_questiontype类的具体用法?PHP default_questiontype怎么用?PHP default_questiontype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了default_questiontype类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: save_question
function save_question($authorizedquestion, $form, $course)
{
wrsqz_presave_question('multianswer', 'wmansprom', $authorizedquestion, $form, $course);
global $CFG;
require_once $CFG->dirroot . '/wiris-quizzes/lib/libquestiontype.php';
$question = wrsqz_qtype_multianswer_extract_question($form);
if (isset($authorizedquestion->id)) {
$question->id = $authorizedquestion->id;
}
$question->category = $authorizedquestion->category;
$form->course = $course;
// To pass the course object to
// save_question_options, where it is
// needed to call type specific
// save_question methods.
$form->defaultgrade = $question->defaultgrade;
$form->questiontext = $question->questiontext;
// We do not force MOODLE_FORMAT: it is incoherent with default
// multianswer behavior, but MOODLE_FORMAT will introduce links,
// smileys and other undesired features, and it is coherent with
// default questiontype behavior.
// $form->questiontextformat = 0;
$form->options = clone $question->options;
unset($question->options);
return default_questiontype::save_question($question, $form, $course);
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:26,代码来源:questiontype.php
示例3:
function save_question($question, $form, $course)
{
// Make very sure that descriptions can'e be created with a grade of
// anything other than 0.
$form->defaultgrade = 0;
return parent::save_question($question, $form, $course);
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:7,代码来源:questiontype.php
示例4: notify
/**
* Loads the question type specific options for the question.
*
* @return boolean to indicate success or failure
*/
function get_question_options(&$question)
{
// Get additional information from database
// and attach it to the question object
if (!($question->options = get_record('question_imagedit', 'question', $question->id))) {
notify('Error: Missing question options!');
return false;
}
// Get data from question_answers (for feedback)
parent::get_question_options($question);
return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:questiontype.php
示例5: addslashes
function get_correct_responses(&$question, &$state)
{
$response = parent::get_correct_responses($question, $state);
if (is_array($response)) {
$response[''] = addslashes(str_replace('\\*', '*', stripslashes($response[''])));
}
return $response;
}
开发者ID:veritech,项目名称:pare-project,代码行数:8,代码来源:questiontype.php
示例6: 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 = "How old is the sun?";
$form->generalfeedback = "General feedback";
$form->penalty = 0.1;
$form->single = 1;
$form->shuffleanswers = 1;
$form->answernumbering = 'abc';
$form->noanswers = 3;
$form->answer = array('Ancient', '5 billion years old', '4.5 billion years old');
$form->fraction = array(0.3, 0.9, 1);
$form->feedback = array('True, but lacking in accuracy', 'Close, but no cigar!', 'Yep, that is it!');
$form->correctfeedback = 'Excellent!';
$form->incorrectfeedback = 'Nope!';
$form->partiallycorrectfeedback = 'Not bad';
if ($courseid) {
$course = get_record('course', 'id', $courseid);
}
return $this->save_question($question, $form, $course);
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:26,代码来源:questiontype.php
示例7: reset
function check_file_access($question, $state, $options, $contextid, $component, $filearea, $args)
{
if ($component == 'question' && $filearea == 'answerfeedback') {
$answerid = reset($args);
// itemid is answer id.
$answers =& $question->options->answers;
if (isset($state->responses[''])) {
$response = $state->responses[''];
} else {
$response = '';
}
return $options->feedback && !empty($response);
} else {
return parent::check_file_access($question, $state, $options, $contextid, $component, $filearea, $args);
}
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:16,代码来源:questiontype.php
示例8: foreach
function replace_file_links($question, $fromcourseid, $tocourseid, $url, $destination)
{
parent::replace_file_links($question, $fromcourseid, $tocourseid, $url, $destination);
// replace links in the question_match_sub table.
if (isset($question->options->subquestions)) {
foreach ($question->options->subquestions as $subquestion) {
$subquestionchanged = false;
$subquestion->questiontext = question_replace_file_links_in_html($subquestion->questiontext, $fromcourseid, $tocourseid, $url, $destination, $subquestionchanged);
if ($subquestionchanged) {
//need to update rec in db
if (!update_record('question_match_sub', addslashes_recursive($subquestion))) {
error('Couldn\'t update \'question_match_sub\' record ' . $subquestion->id);
}
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:17,代码来源:questiontype.php
示例9:
/**
* @desc Prints the questions buttons.
* @param $question object The question object.
* @param $state object The state object.
* @param $cmoptions object The quizzes or other mods options
* @param $options object The questions options.
*/
function print_question_submit_buttons(&$question, &$state, $cmoptions, $options)
{
$courseid = $cmoptions->course;
$seed = $state->responses['seed'];
$attempt = $state->attempt;
echo "<table><tr><td>";
parent::print_question_submit_buttons($question, $state, $cmoptions, $options);
echo "</td><td>";
if (!$options->readonly && $courseid != 1) {
echo link_to_popup_window('/question/type/webwork/emailinstructor.php?qid=' . $question->id . '&aid=' . $attempt, 'emailinstructor', "<input type=\"button\" value=\"Email Instructor\" class=\"submit btn\">", 600, 700, "Email Instructor");
}
echo "</td></tr></table>";
}
开发者ID:xiongchiamiov,项目名称:wwmqt-svn,代码行数:20,代码来源:questiontype.php
示例10:
/**
* If this question type requires extra CSS or JavaScript to function,
* then this method will return an array of <link ...> tags that reference
* those stylesheets. This function will also call require_js()
* from ajaxlib.php, to get any necessary JavaScript linked in too.
*
* The YUI libraries needed for dragdrop have been added to the default
* set of libraries.
*
* The two parameters match the first two parameters of print_question.
*
* @param object $question The question object.
* @param object $state The state object.
*
* @return an array of bits of HTML to add to the head of pages where
* this question is print_question-ed in the body. The array should use
* integer array keys, which have no significance.
*/
function get_html_head_contributions(&$question, &$state)
{
// Load YUI libraries
require_js("yui_yahoo");
require_js("yui_event");
require_js("yui_dom");
require_js("yui_dragdrop");
require_js("yui_animation");
$contributions = parent::get_html_head_contributions($question, $state);
return $contributions;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:29,代码来源:questiontype.php
示例11:
/**
* Add styles.css to the page's header
*/
function get_html_head_contributions(&$question, &$state)
{
return parent::get_html_head_contributions($question, $state);
}
开发者ID:sunilwebaccess,项目名称:moodle-question-matrix.1-9,代码行数:7,代码来源:questiontype.php
示例12: reset
function check_file_access($question, $state, $options, $contextid, $component, $filearea, $args)
{
$itemid = reset($args);
if ($component == 'question' && $filearea == 'answerfeedback') {
// check if answer id exists
$result = $options->feedback && array_key_exists($itemid, $question->options->answers);
if (!$result) {
return false;
}
// check response
if (!$this->check_response($question, $state)) {
return false;
}
return true;
} else {
if ($filearea == 'instruction') {
// TODO: should it be display all the time like questiontext?
// check if question id exists
if ($itemid != $question->id) {
return false;
} else {
return true;
}
} else {
if (in_array($filearea, array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback'))) {
// TODO: calculated type doesn't display question feedback yet
return false;
} else {
return parent::check_file_access($question, $state, $options, $contextid, $component, $filearea, $args);
}
}
}
}
开发者ID:vuchannguyen,项目名称:web,代码行数:33,代码来源:questiontype.php
示例13: switch
/**
* this version save the available data at the different steps of the question editing process
* without using global $SESSION as storage between steps
* at the first step $wizardnow = 'question'
* when creating a new question
* when modifying a question
* when copying as a new question
* the general parameters and answers are saved using parent::save_question
* then the datasets are prepared and saved
* at the second step $wizardnow = 'datasetdefinitions'
* the datadefs final type are defined as private, category or not a datadef
* at the third step $wizardnow = 'datasetitems'
* the datadefs parameters and the data items are created or defined
*
* @param object question
* @param object $form
* @param int $course
* @param PARAM_ALPHA $wizardnow should be added as we are coming from question2.php
*/
function save_question($question, $form, $course)
{
$wizardnow = optional_param('wizardnow', '', PARAM_ALPHA);
$id = optional_param('id', 0, PARAM_INT);
// question id
// in case 'question'
// for a new question $form->id is empty
// when saving as new question
// $question->id = 0, $form is $data from question2.php
// and $data->makecopy is defined as $data->id is the initial question id
// edit case. If it is a new question we don't necessarily need to
// return a valid question object
// See where we're coming from
switch ($wizardnow) {
case '':
case 'question':
// coming from the first page, creating the second
if (empty($form->id)) {
// for a new question $form->id is empty
$question = parent::save_question($question, $form, $course);
//prepare the datasets using default $questionfromid
$this->preparedatasets($form);
$form->id = $question->id;
$this->save_dataset_definitions($form);
} else {
if (!empty($form->makecopy)) {
$questionfromid = $form->id;
$question = parent::save_question($question, $form, $course);
//prepare the datasets
$this->preparedatasets($form, $questionfromid);
$form->id = $question->id;
$this->save_as_new_dataset_definitions($form, $questionfromid);
} else {
// editing a question
$question = parent::save_question($question, $form, $course);
//prepare the datasets
$this->preparedatasets($form, $question->id);
$form->id = $question->id;
$this->save_dataset_definitions($form);
}
}
break;
case 'datasetdefinitions':
$this->save_dataset_definitions($form);
break;
case 'datasetitems':
$this->save_dataset_items($question, $form);
break;
default:
error('Incorrect or no wizard page specified!');
break;
}
return $question;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:73,代码来源:abstractqtype.php
示例14: 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, $course);
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:17,代码来源:questiontype.php
示例15:
function display_question_editing_page(&$mform, $question, $wizardnow)
{
parent::display_question_editing_page($mform, $question, $wizardnow);
}
开发者ID:veritech,项目名称:pare-project,代码行数:4,代码来源:questiontype.php
示例16: 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 = "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 = get_record('course', 'id', $courseid);
}
return $this->save_question($question, $form, $course);
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:25,代码来源:questiontype.php
示例17:
function save_question($question, $form) {
$form->name = '';
// Name is not a required field for random questions, but parent::save_question
// Assumes that it is.
return parent::save_question($question, $form);
}
开发者ID:nfreear,项目名称:moodle,代码行数:6,代码来源:questiontype.php
示例18: foreach
function get_all_responses(&$question, &$state)
{
$result = parent::get_all_responses($question, $state);
foreach ($result->responses as $res) {
if ($res->credit == 1) {
return $result;
}
}
$r = new stdClass();
$r->answer = '100%';
$r->credit = 1;
$result->responses[0] = $r;
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:14,代码来源:questiontype.php
示例19: 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
示例20: 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
注:本文中的default_questiontype类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论