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


PHP question_bank::get_all_qtypes方法代码示例

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


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

示例1: __construct

 /**
  * Constructor.
  * @param \qubaid_condition $qubaids the usages to consider when counting previous uses of each question.
  * @param array $usedquestions questionid => number of times used count. If we should allow for
  *      further existing uses of a question in addition to the ones in $qubaids.
  */
 public function __construct(\qubaid_condition $qubaids, array $usedquestions = array())
 {
     $this->qubaids = $qubaids;
     $this->recentlyusedquestions = $usedquestions;
     foreach (\question_bank::get_all_qtypes() as $qtype) {
         if (!$qtype->is_usable_by_random()) {
             $this->excludedqtypes[] = $qtype->name();
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:random_question_loader.php

示例2: try_importing_using_qtypes

    /**
     * Import for questiontype plugins
     * Do not override.
     * @param data mixed The segment of data containing the question
     * @param question object processed (so far) by standard import code if appropriate
     * @param extra mixed any additional format specific data that may be passed by the format
     * @param qtypehint hint about a question type from format
     * @return object question object suitable for save_options() or false if cannot handle
     */
    public function try_importing_using_qtypes($data, $question = null, $extra = null,
            $qtypehint = '') {

        // work out what format we are using
        $formatname = substr(get_class($this), strlen('qformat_'));
        $methodname = "import_from_$formatname";

        //first try importing using a hint from format
        if (!empty($qtypehint)) {
            $qtype = question_bank::get_qtype($qtypehint, false);
            if (is_object($qtype) && method_exists($qtype, $methodname)) {
                $question = $qtype->$methodname($data, $question, $this, $extra);
                if ($question) {
                    return $question;
                }
            }
        }

        // loop through installed questiontypes checking for
        // function to handle this question
        foreach (question_bank::get_all_qtypes() as $qtype) {
            if (method_exists($qtype, $methodname)) {
                if ($question = $qtype->$methodname($data, $question, $this, $extra)) {
                    return $question;
                }
            }
        }
        return false;
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:38,代码来源:format.php

示例3: search

 /**
  * Search question types for the specified string
  *
  * @param string $query The string to search for in question types
  * @return array
  */
 public function search($query)
 {
     global $CFG;
     if ($result = parent::search($query)) {
         return $result;
     }
     $found = false;
     $textlib = textlib_get_instance();
     require_once $CFG->dirroot . '/question/engine/bank.php';
     foreach (question_bank::get_all_qtypes() as $qtype) {
         if (strpos($textlib->strtolower($qtype->local_name()), $query) !== false) {
             $found = true;
             break;
         }
     }
     if ($found) {
         $result = new stdClass();
         $result->page = $this;
         $result->settings = array();
         return array($this->name => $result);
     } else {
         return array();
     }
 }
开发者ID:raymondAntonio,项目名称:moodle,代码行数:30,代码来源:adminlib.php

示例4: init_qtype_lists

 /**
  * This method needs to be called before the ->excludedqtypes and
  *      ->manualqtypes fields can be used.
  */
 protected function init_qtype_lists() {
     if (!is_null($this->excludedqtypes)) {
         return; // Already done.
     }
     $excludedqtypes = array();
     $manualqtypes = array();
     foreach (question_bank::get_all_qtypes() as $qtype) {
         $quotedname = "'" . $qtype->name() . "'";
         if (!$qtype->is_usable_by_random()) {
             $excludedqtypes[] = $quotedname;
         } else if ($qtype->is_manual_graded()) {
             $manualqtypes[] = $quotedname;
         }
     }
     $this->excludedqtypes = implode(',', $excludedqtypes);
     $this->manualqtypes = implode(',', $manualqtypes);
 }
开发者ID:nottmoo,项目名称:moodle,代码行数:21,代码来源:questiontype.php

示例5: dirname

 * @copyright  2008 Tim Hunt
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../config.php';
require_once $CFG->libdir . '/questionlib.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->libdir . '/pluginlib.php';
require_once $CFG->libdir . '/tablelib.php';
// Check permissions.
require_login();
$systemcontext = context_system::instance();
require_capability('moodle/question:config', $systemcontext);
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
admin_externalpage_setup('manageqtypes');
$thispageurl = new moodle_url('/admin/qtypes.php');
$qtypes = question_bank::get_all_qtypes();
$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql("\n        SELECT qtype, COUNT(1) as numquestions, SUM(hidden) as numhidden\n        FROM {question} GROUP BY qtype", array());
$needed = array();
foreach ($qtypes as $qtypename => $qtype) {
    if (!isset($counts[$qtypename])) {
        $counts[$qtypename] = new stdClass();
        $counts[$qtypename]->numquestions = 0;
        $counts[$qtypename]->numhidden = 0;
    }
    $needed[$qtypename] = $counts[$qtypename]->numquestions > 0 || $pluginmanager->other_plugins_that_require($qtype->plugin_name());
    $counts[$qtypename]->numquestions -= $counts[$qtypename]->numhidden;
}
$needed['missingtype'] = true;
// The system needs the missing question type.
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:qtypes.php

示例6: get_all_response_file_areas

 /**
  * @return array all the file area names that may contain response files.
  */
 public static function get_all_response_file_areas()
 {
     $variables = array();
     foreach (question_bank::get_all_qtypes() as $qtype) {
         $variables += $qtype->response_file_areas();
     }
     $areas = array();
     foreach (array_unique($variables) as $variable) {
         $areas[] = 'response_' . $variable;
     }
     return $areas;
 }
开发者ID:mongo0se,项目名称:moodle,代码行数:15,代码来源:lib.php

示例7: initialise_editing_javascript

 /**
  * Initialise the JavaScript for the general editing. (JavaScript for popups
  * is handled with the specific code for those.)
  *
  * @param \stdClass $course the course settings from the database.
  * @param \stdClass $quiz the quiz settings from the database.
  * @param structure $structure object containing the structure of the quiz.
  * @param \question_edit_contexts $contexts the relevant question bank contexts.
  * @param array $pagevars the variables from {@link \question_edit_setup()}.
  * @param \moodle_url $pageurl the canonical URL of this page.
  * @return bool Always returns true
  */
 protected function initialise_editing_javascript($course, $quiz, structure $structure, \question_edit_contexts $contexts, array $pagevars, \moodle_url $pageurl)
 {
     $config = new \stdClass();
     $config->resourceurl = '/mod/quiz/edit_rest.php';
     $config->sectionurl = '/mod/quiz/edit_rest.php';
     $config->pageparams = array();
     $config->questiondecimalpoints = $quiz->questiondecimalpoints;
     $config->pagehtml = $this->new_page_template($structure, $contexts, $pagevars, $pageurl);
     $config->addpageiconhtml = $this->add_page_icon_template($structure, $quiz);
     $this->page->requires->yui_module('moodle-mod_quiz-toolboxes', 'M.mod_quiz.init_resource_toolbox', array(array('courseid' => $course->id, 'quizid' => $quiz->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)));
     unset($config->pagehtml);
     unset($config->addpageiconhtml);
     $this->page->requires->yui_module('moodle-mod_quiz-toolboxes', 'M.mod_quiz.init_section_toolbox', array(array('courseid' => $course->id, 'quizid' => $quiz->id, 'format' => $course->format, 'ajaxurl' => $config->sectionurl, 'config' => $config)));
     $this->page->requires->yui_module('moodle-mod_quiz-dragdrop', 'M.mod_quiz.init_section_dragdrop', array(array('courseid' => $course->id, 'quizid' => $quiz->id, 'ajaxurl' => $config->sectionurl, 'config' => $config)), null, true);
     $this->page->requires->yui_module('moodle-mod_quiz-dragdrop', 'M.mod_quiz.init_resource_dragdrop', array(array('courseid' => $course->id, 'quizid' => $quiz->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)), null, true);
     // Require various strings for the command toolbox.
     $this->page->requires->strings_for_js(array('clicktohideshow', 'deletechecktype', 'deletechecktypename', 'edittitle', 'edittitleinstructions', 'emptydragdropregion', 'hide', 'markedthistopic', 'markthistopic', 'move', 'movecontent', 'moveleft', 'movesection', 'page', 'question', 'selectall', 'show', 'tocontent'), 'moodle');
     $this->page->requires->strings_for_js(array('addpagebreak', 'confirmremovequestion', 'dragtoafter', 'dragtostart', 'numquestionsx', 'removepagebreak'), 'quiz');
     foreach (\question_bank::get_all_qtypes() as $qtype => $notused) {
         $this->page->requires->string_for_js('pluginname', 'qtype_' . $qtype);
     }
     return true;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:35,代码来源:edit_renderer.php

示例8: action

 function action($action)
 {
     $qtypes = question_bank::get_all_qtypes();
     if (!isset($qtypes[$this->plugin])) {
         return get_string('unknownquestiontype', 'question', $this->plugin);
     }
     switch ($action) {
         case 'enable':
             unset_config($this->plugin . '_disabled', 'question');
             break;
         case 'disable':
             set_config($this->plugin . '_disabled', 1, 'question');
             break;
     }
     return 0;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:16,代码来源:pluginscontrolslib.php

示例9: __construct

 /**
  * @global core_renderer $OUTPUT
  * @param string $name
  * @param string $visiblename
  * @param string $description
  * @param array $defaultsetting
  */
 public function __construct($name, $visiblename, $description, $defaultsetting = null)
 {
     global $OUTPUT;
     $choices = array();
     $icons = array();
     $qtypes = question_bank::get_all_qtypes();
     // some qtypes do not need workaround
     unset($qtypes['missingtype']);
     unset($qtypes['random']);
     // question_bank::sort_qtype_array() expects array(name => local_name)
     $qtypenames = array_map(function ($qtype) {
         return $qtype->local_name();
     }, $qtypes);
     foreach (question_bank::sort_qtype_array($qtypenames) as $name => $label) {
         $choices[$name] = $label;
         $icons[$name] = ' ' . $OUTPUT->pix_icon('icon', '', $qtypes[$name]->plugin_name()) . ' ';
     }
     parent::__construct($name, $visiblename, $description, $defaultsetting, $choices, $icons);
 }
开发者ID:edurenye,项目名称:sharing_cart,代码行数:26,代码来源:settingslib.php

示例10: initialise_editing_javascript

    /**
     * Initialise the JavaScript for the general editing. (JavaScript for popups
     * is handled with the specific code for those.)
     *
     * @param \stdClass $course the course settings from the database.
     * @param \stdClass $quiz the quiz settings from the database.
     * @return bool Always returns true
     */
    protected function initialise_editing_javascript($course, $quiz) {

        $config = new \stdClass();
        $config->resourceurl = '/mod/quiz/edit_rest.php';
        $config->sectionurl = '/mod/quiz/edit_rest.php';
        $config->pageparams = array();
        $config->questiondecimalpoints = $quiz->questiondecimalpoints;

        // Include toolboxes.
        $this->page->requires->yui_module('moodle-mod_quiz-toolboxes',
                'M.mod_quiz.init_resource_toolbox',
                array(array(
                        'courseid' => $course->id,
                        'quizid' => $quiz->id,
                        'ajaxurl' => $config->resourceurl,
                        'config' => $config,
                ))
        );
        $this->page->requires->yui_module('moodle-mod_quiz-toolboxes',
                'M.mod_quiz.init_section_toolbox',
                array(array(
                        'courseid' => $course->id,
                        'quizid' => $quiz->id,
                        'format' => $course->format,
                        'ajaxurl' => $config->sectionurl,
                        'config' => $config,
                ))
        );

        // Include course dragdrop.
        $this->page->requires->yui_module('moodle-mod_quiz-dragdrop', 'M.mod_quiz.init_section_dragdrop',
                array(array(
                        'courseid' => $course->id,
                        'quizid' => $quiz->id,
                        'ajaxurl' => $config->sectionurl,
                        'config' => $config,
                )), null, true);

        $this->page->requires->yui_module('moodle-mod_quiz-dragdrop', 'M.mod_quiz.init_resource_dragdrop',
                array(array(
                        'courseid' => $course->id,
                        'quizid' => $quiz->id,
                        'ajaxurl' => $config->resourceurl,
                        'config' => $config,
                )), null, true);

        // Require various strings for the command toolbox.
        $this->page->requires->strings_for_js(array(
                'moveleft',
                'deletechecktype',
                'deletechecktypename',
                'edittitle',
                'edittitleinstructions',
                'show',
                'hide',
                'clicktochangeinbrackets',
                'markthistopic',
                'markedthistopic',
                'move',
                'movesection',
                'movecontent',
                'selectall',
                'tocontent',
                'emptydragdropregion'
        ), 'moodle');

        $this->page->requires->strings_for_js(array(
                'confirmremovequestion',
                'dragtoafter',
                'dragtostart',
        ), 'quiz');

        foreach (\question_bank::get_all_qtypes() as $qtype => $notused) {
            $this->page->requires->string_for_js('pluginname', 'qtype_' . $qtype);
        }

        return true;
    }
开发者ID:jtibbetts,项目名称:moodle,代码行数:86,代码来源:edit_renderer.php


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