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


PHP Question::to_student方法代码示例

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


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

示例1: to_student

 public function to_student($show_level = true, $show_topics = true)
 {
     $qd = parent::to_student($show_level, $show_topics);
     $answers = array_map(function ($a) {
         return array('text' => $a['text'], 'hex_id' => $a['hex_id']);
     }, $this->answers);
     shuffle($answers);
     $qd['fields'] = $answers;
     return $qd;
 }
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:10,代码来源:QuestionFS.class.php

示例2: to_student

 public function to_student($show_level = true, $show_topics = true)
 {
     $qd = parent::to_student($show_level, $show_topics);
     // nothing to add...
     return $qd;
 }
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:6,代码来源:QuestionES.class.php

示例3: to_student

 public function to_student($show_level = true, $show_topics = true)
 {
     $qd = parent::to_student($show_level, $show_topics);
     $func = function ($a) {
         return array('text' => $a['text'], 'hex_id' => $a['hex_id']);
     };
     $left_column = array_map($func, $this->left_column);
     $right_column = array_map($func, $this->right_column);
     if ($this->shuffle_left) {
         shuffle($left_column);
     }
     if ($this->shuffle_right) {
         shuffle($right_column);
     }
     $qd['leftColumn'] = $left_column;
     $qd['rightColumn'] = $right_column;
     $qd['reorderLeft'] = $this->shuffle_left;
     $qd['reorderRight'] = $this->shuffle_right;
     return $qd;
 }
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:20,代码来源:QuestionMA.class.php

示例4: to_student

 public function to_student($show_level = true, $show_topics = true)
 {
     $qd = parent::to_student($show_level, $show_topics);
     $qd['min_answers'] = $this->min_answers;
     $qd['max_answers'] = $this->max_answers;
     $n = count($this->answers);
     $nonfixed = [];
     $shuffled_answers = array_fill(0, $n, null);
     foreach ($this->answers as $i => $a) {
         $answer = array('hex_id' => $a['hex_id'], 'text' => $a['text']);
         if ($a['fixed']) {
             $shuffled_answers[$i] = $answer;
         } else {
             $nonfixed[$i] = $answer;
         }
     }
     shuffle($nonfixed);
     for ($i = 0; $i < $n; $i++) {
         if ($shuffled_answers[$i] === null) {
             $shuffled_answers[$i] = array_shift($nonfixed);
         }
     }
     $qd['answers'] = $shuffled_answers;
     return $qd;
 }
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:25,代码来源:QuestionMC.class.php


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