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


PHP progress_trace::end_progress方法代码示例

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


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

示例1: calculate

 /**
  * Calculate the stats.
  *
  * @param \qubaid_condition $qubaids Which question usages to calculate the stats for?
  * @return all_calculated_for_qubaid_condition The calculated stats.
  */
 public function calculate($qubaids)
 {
     $this->progress->start_progress('', 6);
     list($lateststeps, $summarks) = $this->get_latest_steps($qubaids);
     if ($lateststeps) {
         $this->progress->start_progress('', count($lateststeps), 1);
         // Compute the statistics of position, and for random questions, work
         // out which questions appear in which positions.
         foreach ($lateststeps as $step) {
             $this->progress->increment_progress();
             $israndomquestion = $step->questionid != $this->stats->for_slot($step->slot)->questionid;
             $breakdownvariants = !$israndomquestion && $this->stats->for_slot($step->slot)->break_down_by_variant();
             // If this is a variant we have not seen before create a place to store stats calculations for this variant.
             if ($breakdownvariants && is_null($this->stats->for_slot($step->slot, $step->variant))) {
                 $question = $this->stats->for_slot($step->slot)->question;
                 $this->stats->initialise_for_slot($step->slot, $question, $step->variant);
                 $this->stats->for_slot($step->slot, $step->variant)->randomguessscore = $this->get_random_guess_score($question);
             }
             // Step data walker for main question.
             $this->initial_steps_walker($step, $this->stats->for_slot($step->slot), $summarks, true, $breakdownvariants);
             // If this is a random question do the calculations for sub question stats.
             if ($israndomquestion) {
                 if (is_null($this->stats->for_subq($step->questionid))) {
                     $this->stats->initialise_for_subq($step);
                 } else {
                     if ($this->stats->for_subq($step->questionid)->maxmark != $step->maxmark) {
                         $this->stats->for_subq($step->questionid)->differentweights = true;
                     }
                 }
                 // If this is a variant of this subq we have not seen before create a place to store stats calculations for it.
                 if (is_null($this->stats->for_subq($step->questionid, $step->variant))) {
                     $this->stats->initialise_for_subq($step, $step->variant);
                 }
                 $this->initial_steps_walker($step, $this->stats->for_subq($step->questionid), $summarks, false);
                 // Extra stuff we need to do in this loop for subqs to keep track of where they need to be displayed later.
                 $number = $this->stats->for_slot($step->slot)->question->number;
                 $this->stats->for_subq($step->questionid)->usedin[$number] = $number;
                 // Keep track of which random questions are actually selected from each pool of questions that random
                 // questions are pulled from.
                 $randomselectorstring = $this->stats->for_slot($step->slot)->random_selector_string();
                 if (!isset($this->randomselectors[$randomselectorstring])) {
                     $this->randomselectors[$randomselectorstring] = array();
                 }
                 $this->randomselectors[$randomselectorstring][$step->questionid] = $step->questionid;
             }
         }
         $this->progress->end_progress();
         foreach ($this->randomselectors as $key => $notused) {
             ksort($this->randomselectors[$key]);
             $this->randomselectors[$key] = implode(',', $this->randomselectors[$key]);
         }
         $this->stats->subquestions = question_load_questions($this->stats->get_all_subq_ids());
         // Compute the statistics for sub questions, if there are any.
         $this->progress->start_progress('', count($this->stats->subquestions), 1);
         foreach ($this->stats->subquestions as $qid => $subquestion) {
             $this->progress->increment_progress();
             $subquestion->maxmark = $this->stats->for_subq($qid)->maxmark;
             $this->stats->for_subq($qid)->question = $subquestion;
             $this->stats->for_subq($qid)->randomguessscore = $this->get_random_guess_score($subquestion);
             if ($variants = $this->stats->for_subq($qid)->get_variants()) {
                 foreach ($variants as $variant) {
                     $this->stats->for_subq($qid, $variant)->question = $subquestion;
                     $this->stats->for_subq($qid, $variant)->randomguessscore = $this->get_random_guess_score($subquestion);
                 }
                 $this->stats->for_subq($qid)->sort_variants();
             }
             $this->initial_question_walker($this->stats->for_subq($qid));
             if ($this->stats->for_subq($qid)->usedin) {
                 sort($this->stats->for_subq($qid)->usedin, SORT_NUMERIC);
                 $this->stats->for_subq($qid)->positions = implode(',', $this->stats->for_subq($qid)->usedin);
             } else {
                 $this->stats->for_subq($qid)->positions = '';
             }
         }
         $this->progress->end_progress();
         // Finish computing the averages, and put the sub-question data into the
         // corresponding questions.
         // This cannot be a foreach loop because we need to have both
         // $question and $nextquestion available, but apart from that it is
         // foreach ($this->questions as $qid => $question).
         $slots = $this->stats->get_all_slots();
         $this->progress->start_progress('', count($slots), 1);
         while (list(, $slot) = each($slots)) {
             $this->stats->for_slot($slot)->sort_variants();
             $this->progress->increment_progress();
             $nextslot = current($slots);
             $this->initial_question_walker($this->stats->for_slot($slot));
             // The rest of this loop is to finish working out where randomly selected question stats should be displayed.
             if ($this->stats->for_slot($slot)->question->qtype == 'random') {
                 $randomselectorstring = $this->stats->for_slot($slot)->random_selector_string();
                 if ($nextslot && $randomselectorstring == $this->stats->for_slot($nextslot)->random_selector_string()) {
                     continue;
                     // Next loop iteration.
                 }
//.........这里部分代码省略.........
开发者ID:evltuma,项目名称:moodle,代码行数:101,代码来源:calculator.php


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