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


PHP question_engine::get_behaviour_options方法代码示例

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


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

示例1: definition

 public function definition()
 {
     $mform = $this->_form;
     $hiddenofvisible = array(question_display_options::HIDDEN => get_string('notshown', 'question'), question_display_options::VISIBLE => get_string('shown', 'question'));
     $mform->addElement('header', 'optionsheader', get_string('changeoptions', 'question'));
     $behaviours = question_engine::get_behaviour_options($this->_customdata['quba']->get_preferred_behaviour());
     $mform->addElement('select', 'behaviour', get_string('howquestionsbehave', 'question'), $behaviours);
     $mform->addHelpButton('behaviour', 'howquestionsbehave', 'question');
     $mform->addElement('text', 'maxmark', get_string('markedoutof', 'question'), array('size' => '5'));
     $mform->setType('maxmark', PARAM_NUMBER);
     if ($this->_customdata['maxvariant'] > 1) {
         $variants = range(1, $this->_customdata['maxvariant']);
         $mform->addElement('select', 'variant', get_string('questionvariant', 'question'), array_combine($variants, $variants));
     }
     $mform->setType('maxmark', PARAM_INT);
     $mform->addElement('select', 'correctness', get_string('whethercorrect', 'question'), $hiddenofvisible);
     $marksoptions = array(question_display_options::HIDDEN => get_string('notshown', 'question'), question_display_options::MAX_ONLY => get_string('showmaxmarkonly', 'question'), question_display_options::MARK_AND_MAX => get_string('showmarkandmax', 'question'));
     $mform->addElement('select', 'marks', get_string('marks', 'question'), $marksoptions);
     $mform->addElement('select', 'markdp', get_string('decimalplacesingrades', 'question'), question_engine::get_dp_options());
     $mform->addElement('select', 'feedback', get_string('specificfeedback', 'question'), $hiddenofvisible);
     $mform->addElement('select', 'generalfeedback', get_string('generalfeedback', 'question'), $hiddenofvisible);
     $mform->addElement('select', 'rightanswer', get_string('rightanswer', 'question'), $hiddenofvisible);
     $mform->addElement('select', 'history', get_string('responsehistory', 'question'), $hiddenofvisible);
     $mform->addElement('submit', 'submit', get_string('restartwiththeseoptions', 'question'), $hiddenofvisible);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:25,代码来源:previewlib.php

示例2: xmldb_qbehaviour_manualgraded_upgrade

/**
 * Manual graded question behaviour upgrade code.
 */
function xmldb_qbehaviour_manualgraded_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2013050200) {
        // Hide the manualgraded behaviour from the list of behaviours that users
        // can select in the user-interface. If a user accidentally chooses manual
        // graded behaviour for a quiz, there is no way to get the questions automatically
        // graded after the student has answered them. If teachers really want to do
        // this they can ask their admin to enable it on the manage behaviours
        // screen in the UI.
        $disabledbehaviours = get_config('question', 'disabledbehaviours');
        if (!empty($disabledbehaviours)) {
            $disabledbehaviours = explode(',', $disabledbehaviours);
        } else {
            $disabledbehaviours = array();
        }
        if (array_search('manualgraded', $disabledbehaviours) === false) {
            $disabledbehaviours[] = 'manualgraded';
            set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
        }
        // Manual graded question behaviour savepoint reached.
        upgrade_plugin_savepoint(true, 2013050200, 'qbehaviour', 'manualgraded');
    }
    if ($oldversion < 2013050800) {
        // Also, fix any other admin settings that currently select manualgraded behaviour.
        // Work out a sensible default alternative to manualgraded.
        require_once $CFG->libdir . '/questionlib.php';
        $behaviours = question_engine::get_behaviour_options('');
        if (array_key_exists('deferredfeedback', $behaviours)) {
            $defaultbehaviour = 'deferredfeedback';
        } else {
            reset($behaviours);
            $defaultbehaviour = key($behaviours);
        }
        // Fix the question preview default.
        if (get_config('question_preview', 'behaviour') == 'manualgraded') {
            set_config('behaviour', $defaultbehaviour, 'question_preview');
        }
        // Fix the quiz settings default.
        if (get_config('quiz', 'preferredbehaviour') == 'manualgraded') {
            set_config('preferredbehaviour', $defaultbehaviour, 'quiz');
        }
        // Manual graded question behaviour savepoint reached.
        upgrade_plugin_savepoint(true, 2013050800, 'qbehaviour', 'manualgraded');
    }
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:63,代码来源:upgrade.php

示例3: add_settings_form_fields

 public static function add_settings_form_fields(mod_quiz_mod_form $quizform, MoodleQuickForm $mform)
 {
     $config = get_config('quizaccess_offlinemode');
     $mform->addElement('selectyesno', 'offlinemode_enabled', get_string('offlinemodeenabled', 'quizaccess_offlinemode'));
     $mform->addHelpButton('offlinemode_enabled', 'offlinemodeenabled', 'quizaccess_offlinemode');
     $mform->setDefault('offlinemode_enabled', !empty($config->defaultenabled));
     $mform->setAdvanced('offlinemode_enabled', !empty($config->defaultenabled_adv));
     foreach (question_engine::get_behaviour_options(null) as $behaviour => $notused) {
         if (!self::is_compatible_behaviour($behaviour)) {
             $mform->disabledIf('offlinemode_enabled', 'preferredbehaviour', 'eq', $behaviour);
         }
     }
 }
开发者ID:gurujiathome,项目名称:moodle-quizaccess_offlinemode,代码行数:13,代码来源:rule.php

示例4: load_choices

 /**
  * Load list of behaviours as choices
  * @return bool true => success, false => error.
  */
 public function load_choices()
 {
     global $CFG;
     require_once $CFG->dirroot . '/question/engine/lib.php';
     $this->choices = question_engine::get_behaviour_options('');
     return true;
 }
开发者ID:Alexbado,项目名称:moodle2,代码行数:11,代码来源:adminlib.php

示例5: definition


//.........这里部分代码省略.........
         $pageoptions[$i] = get_string('everynquestions', 'quiz', $i);
     }
     $pagegroup = array();
     $pagegroup[] = $mform->createElement('select', 'questionsperpage', get_string('newpage', 'quiz'), $pageoptions, array('id' => 'id_questionsperpage'));
     $mform->setDefault('questionsperpage', $quizconfig->questionsperpage);
     if (!empty($this->_cm)) {
         $pagegroup[] = $mform->createElement('checkbox', 'repaginatenow', '', get_string('repaginatenow', 'quiz'), array('id' => 'id_repaginatenow'));
         $mform->disabledIf('repaginatenow', 'shufflequestions', 'eq', 1);
         $PAGE->requires->js('/question/qengine.js');
         $module = array('name' => 'mod_quiz_edit', 'fullpath' => '/mod/quiz/edit.js', 'requires' => array('yui2-dom', 'yui2-event', 'yui2-container'), 'strings' => array(), 'async' => false);
         $PAGE->requires->js_init_call('quiz_settings_init', null, false, $module);
     }
     $mform->addGroup($pagegroup, 'questionsperpagegrp', get_string('newpage', 'quiz'), null, false);
     $mform->addHelpButton('questionsperpagegrp', 'newpage', 'quiz');
     $mform->setAdvanced('questionsperpagegrp', $quizconfig->questionsperpage_adv);
     // Navigation method.
     $mform->addElement('select', 'navmethod', get_string('navmethod', 'quiz'), quiz_get_navigation_options());
     $mform->addHelpButton('navmethod', 'navmethod', 'quiz');
     $mform->setAdvanced('navmethod', $quizconfig->navmethod_adv);
     $mform->setDefault('navmethod', $quizconfig->navmethod);
     // -------------------------------------------------------------------------------
     $mform->addElement('header', 'interactionhdr', get_string('questionbehaviour', 'quiz'));
     // Shuffle within questions.
     $mform->addElement('selectyesno', 'shuffleanswers', get_string('shufflewithin', 'quiz'));
     $mform->addHelpButton('shuffleanswers', 'shufflewithin', 'quiz');
     $mform->setAdvanced('shuffleanswers', $quizconfig->shuffleanswers_adv);
     $mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);
     // How questions behave (question behaviour).
     if (!empty($this->current->preferredbehaviour)) {
         $currentbehaviour = $this->current->preferredbehaviour;
     } else {
         $currentbehaviour = '';
     }
     $behaviours = question_engine::get_behaviour_options($currentbehaviour);
     $mform->addElement('select', 'preferredbehaviour', get_string('howquestionsbehave', 'question'), $behaviours);
     $mform->addHelpButton('preferredbehaviour', 'howquestionsbehave', 'question');
     $mform->setDefault('preferredbehaviour', $quizconfig->preferredbehaviour);
     // Each attempt builds on last.
     $mform->addElement('selectyesno', 'attemptonlast', get_string('eachattemptbuildsonthelast', 'quiz'));
     $mform->addHelpButton('attemptonlast', 'eachattemptbuildsonthelast', 'quiz');
     $mform->setAdvanced('attemptonlast', $quizconfig->attemptonlast_adv);
     $mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
     if ($this->get_max_attempts_for_any_override() < 2) {
         $mform->disabledIf('attemptonlast', 'attempts', 'eq', 1);
     }
     // -------------------------------------------------------------------------------
     $mform->addElement('header', 'reviewoptionshdr', get_string('reviewoptionsheading', 'quiz'));
     $mform->addHelpButton('reviewoptionshdr', 'reviewoptionsheading', 'quiz');
     // Review options.
     $this->add_review_options_group($mform, $quizconfig, 'during', mod_quiz_display_options::DURING, true);
     $this->add_review_options_group($mform, $quizconfig, 'immediately', mod_quiz_display_options::IMMEDIATELY_AFTER);
     $this->add_review_options_group($mform, $quizconfig, 'open', mod_quiz_display_options::LATER_WHILE_OPEN);
     $this->add_review_options_group($mform, $quizconfig, 'closed', mod_quiz_display_options::AFTER_CLOSE);
     foreach ($behaviours as $behaviour => $notused) {
         $unusedoptions = question_engine::get_behaviour_unused_display_options($behaviour);
         foreach ($unusedoptions as $unusedoption) {
             $mform->disabledIf($unusedoption . 'during', 'preferredbehaviour', 'eq', $behaviour);
         }
     }
     $mform->disabledIf('attemptduring', 'preferredbehaviour', 'neq', 'wontmatch');
     $mform->disabledIf('overallfeedbackduring', 'preferredbehaviour', 'neq', 'wontmatch');
     // -------------------------------------------------------------------------------
     $mform->addElement('header', 'display', get_string('display', 'form'));
     // Show user picture.
     $mform->addElement('select', 'showuserpicture', get_string('showuserpicture', 'quiz'), quiz_get_user_image_options());
     $mform->addHelpButton('showuserpicture', 'showuserpicture', 'quiz');
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:67,代码来源:mod_form.php

示例6: definition


//.........这里部分代码省略.........
        $pagegroup[] = $mform->createElement('select', 'questionsperpage',
                get_string('newpage', 'quiz'), $pageoptions, array('id' => 'id_questionsperpage'));
        $mform->setDefault('questionsperpage', $quizconfig->questionsperpage);

        if (!empty($this->_cm)) {
            $pagegroup[] = $mform->createElement('checkbox', 'repaginatenow', '',
                    get_string('repaginatenow', 'quiz'), array('id' => 'id_repaginatenow'));
            $mform->disabledIf('repaginatenow', 'shufflequestions', 'eq', 1);
            $PAGE->requires->yui2_lib('event');
            $PAGE->requires->js('/mod/quiz/edit.js');
            $PAGE->requires->js_init_call('quiz_settings_init');
        }

        $mform->addGroup($pagegroup, 'questionsperpagegrp',
                get_string('newpage', 'quiz'), null, false);
        $mform->addHelpButton('questionsperpagegrp', 'newpage', 'quiz');
        $mform->setAdvanced('questionsperpagegrp', $quizconfig->questionsperpage_adv);

        //-------------------------------------------------------------------------------
        $mform->addElement('header', 'interactionhdr', get_string('questionbehaviour', 'quiz'));

        // Shuffle within questions.
        $mform->addElement('selectyesno', 'shuffleanswers', get_string('shufflewithin', 'quiz'));
        $mform->addHelpButton('shuffleanswers', 'shufflewithin', 'quiz');
        $mform->setAdvanced('shuffleanswers', $quizconfig->shuffleanswers_adv);
        $mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);

        // How questions behave (question behaviour).
        if (!empty($this->current->preferredbehaviour)) {
            $currentbehaviour = $this->current->preferredbehaviour;
        } else {
            $currentbehaviour = '';
        }
        $behaviours = question_engine::get_behaviour_options($currentbehaviour);
        $mform->addElement('select', 'preferredbehaviour',
                get_string('howquestionsbehave', 'question'), $behaviours);
        $mform->addHelpButton('preferredbehaviour', 'howquestionsbehave', 'question');
        $mform->setDefault('preferredbehaviour', $quizconfig->preferredbehaviour);

        // Each attempt builds on last.
        $mform->addElement('selectyesno', 'attemptonlast',
                get_string('eachattemptbuildsonthelast', 'quiz'));
        $mform->addHelpButton('attemptonlast', 'eachattemptbuildsonthelast', 'quiz');
        $mform->setAdvanced('attemptonlast', $quizconfig->attemptonlast_adv);
        $mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
        $mform->disabledIf('attemptonlast', 'attempts', 'eq', 1);

        //-------------------------------------------------------------------------------
        $mform->addElement('header', 'reviewoptionshdr',
                get_string('reviewoptionsheading', 'quiz'));
        $mform->addHelpButton('reviewoptionshdr', 'reviewoptionsheading', 'quiz');

        // Review options.
        $this->add_review_options_group($mform, $quizconfig, 'during',
                mod_quiz_display_options::DURING);
        $this->add_review_options_group($mform, $quizconfig, 'immediately',
                mod_quiz_display_options::IMMEDIATELY_AFTER);
        $this->add_review_options_group($mform, $quizconfig, 'open',
                mod_quiz_display_options::LATER_WHILE_OPEN);
        $this->add_review_options_group($mform, $quizconfig, 'closed',
                mod_quiz_display_options::AFTER_CLOSE);

        foreach ($behaviours as $behaviour => $notused) {
            $unusedoptions = question_engine::get_behaviour_unused_display_options($behaviour);
            foreach ($unusedoptions as $unusedoption) {
                $mform->disabledIf($unusedoption . 'during', 'preferredbehaviour',
开发者ID:nigeldaley,项目名称:moodle,代码行数:67,代码来源:mod_form.php


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