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


PHP question_engine_data_mapper::in_summary_state_test方法代码示例

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


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

示例1: get_usage_ids_where_question_in_state

 /**
  * Get a list of usage ids where the question with slot $slot, and optionally
  * also with question id $questionid, is in summary state $summarystate. Also
  * return the total count of such states.
  *
  * Only a subset of the ids can be returned by using $orderby, $limitfrom and
  * $limitnum. A special value 'random' can be passed as $orderby, in which case
  * $limitfrom is ignored.
  *
  * @param int $slot The slot for the questions you want to konw about.
  * @param int $questionid (optional) Only return attempts that were of this specific question.
  * @param string $summarystate 'all', 'needsgrading', 'autograded' or 'manuallygraded'.
  * @param string $orderby 'random', 'date', 'student' or 'idnumber'.
  * @param int $page implements paging of the results.
  *      Ignored if $orderby = random or $pagesize is null.
  * @param int $pagesize implements paging of the results. null = all.
  */
 protected function get_usage_ids_where_question_in_state($summarystate, $slot, $questionid = null, $orderby = 'random', $page = 0, $pagesize = null)
 {
     global $CFG, $DB;
     $dm = new question_engine_data_mapper();
     if ($pagesize && $orderby != 'random') {
         $limitfrom = $page * $pagesize;
     } else {
         $limitfrom = 0;
     }
     $qubaids = $this->get_qubaids_condition();
     $params = array();
     if ($orderby == 'date') {
         list($statetest, $params) = $dm->in_summary_state_test('manuallygraded', false, 'mangrstate');
         $orderby = "(\n                    SELECT MAX(sortqas.timecreated)\n                    FROM {question_attempt_steps} sortqas\n                    WHERE sortqas.questionattemptid = qa.id\n                        AND sortqas.state {$statetest}\n                    )";
     } else {
         if ($orderby == 'studentfirstname' || $orderby == 'studentlastname' || $orderby == 'idnumber') {
             $qubaids->from .= " JOIN {user} u ON quiza.userid = u.id ";
             // For name sorting, map orderby form value to
             // actual column names; 'idnumber' maps naturally
             switch ($orderby) {
                 case "studentlastname":
                     $orderby = "u.lastname, u.firstname";
                     break;
                 case "studentfirstname":
                     $orderby = "u.firstname, u.lastname";
                     break;
             }
         }
     }
     return $dm->load_questions_usages_where_question_in_state($qubaids, $summarystate, $slot, $questionid, $orderby, $params, $limitfrom, $pagesize);
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:48,代码来源:report.php

示例2: get_usage_ids_where_question_in_state

    /**
     * Get a list of usage ids where the question with slot $slot, and optionally
     * also with question id $questionid, is in summary state $summarystate. Also
     * return the total count of such states.
     *
     * Only a subset of the ids can be returned by using $orderby, $limitfrom and
     * $limitnum. A special value 'random' can be passed as $orderby, in which case
     * $limitfrom is ignored.
     *
     * @param int $slot The slot for the questions you want to konw about.
     * @param int $questionid (optional) Only return attempts that were of this specific question.
     * @param string $summarystate 'all', 'needsgrading', 'autograded' or 'manuallygraded'.
     * @param string $orderby 'random', 'date', 'student' or 'idnumber'.
     * @param int $page implements paging of the results.
     *      Ignored if $orderby = random or $pagesize is null.
     * @param int $pagesize implements paging of the results. null = all.
     */
    protected function get_usage_ids_where_question_in_state($summarystate, $slot,
            $questionid = null, $orderby = 'random', $page = 0, $pagesize = null) {
        global $CFG, $DB;
        $dm = new question_engine_data_mapper();

        if ($pagesize && $orderby != 'random') {
            $limitfrom = $page * $pagesize;
        } else {
            $limitfrom = 0;
        }

        $qubaids = $this->get_qubaids_condition();

        $params = array();
        if ($orderby == 'date') {
            list($statetest, $params) = $dm->in_summary_state_test(
                    'manuallygraded', false, 'mangrstate');
            $orderby = "(
                    SELECT MAX(sortqas.timecreated)
                    FROM {question_attempt_steps} sortqas
                    WHERE sortqas.questionattemptid = qa.id
                        AND sortqas.state $statetest
                    )";
        } else if ($orderby == 'student' || $orderby == 'idnumber') {
            $qubaids->from .= " JOIN {user} u ON quiza.userid = u.id ";
            if ($orderby == 'student') {
                $orderby = $DB->sql_fullname('u.firstname', 'u.lastname');
            }
        }

        return $dm->load_questions_usages_where_question_in_state($qubaids, $summarystate,
                $slot, $questionid, $orderby, $params, $limitfrom, $pagesize);
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:50,代码来源:report.php


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