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


PHP Exercise::getQuestionWithCategories方法代码示例

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


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

示例1: getListOfCategoriesIDForTest

 /**
  * return the list of different categories ID for a test
  * @param int exercise id
  * @param bool group category
  * @return array of category id (integer)
  * @author hubert.borderiou 07-04-2011, Julio Montoya
  */
 public static function getListOfCategoriesIDForTest($exercise_id, $grouped_by_category = true)
 {
     // parcourir les questions d'un test, recup les categories uniques dans un tableau
     $categories_in_exercise = array();
     $exercise = new Exercise();
     $exercise->read($exercise_id, false);
     $categories_in_exercise = $exercise->getQuestionWithCategories();
     $categories = array();
     if (!empty($categories_in_exercise)) {
         foreach ($categories_in_exercise as $category) {
             $category['id'] = $category['iid'];
             $categories[$category['iid']] = $category;
         }
     }
     return $categories;
     /*
     		// the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ???
             foreach ($question_list as $question_id) {
                 $category_list = Testcategory::getCategoryForQuestion($question_id);
                 if (!empty($category_list)) {
                     $categories_in_exercise = array_merge($categories_in_exercise, $category_list);
                 }
             }
             if (!empty($categories_in_exercise)) {
                 $categories_in_exercise = array_unique(array_filter($categories_in_exercise));
             }
             return $categories_in_exercise;*/
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:35,代码来源:testcategory.class.php

示例2: getListOfCategoriesIDForTest

 /**
  * Return the list of differents categories ID for a test in the current course
  * input : test_id
  * return : array of category id (integer)
  * hubert.borderiou 07-04-2011
  * @param int $exerciseId
  */
 public static function getListOfCategoriesIDForTest($exerciseId)
 {
     // parcourir les questions d'un test, recup les categories uniques dans un tableau
     $exercise = new Exercise();
     $exercise->read($exerciseId, false);
     $categoriesInExercise = $exercise->getQuestionWithCategories();
     // the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ???
     $categories = array();
     if (!empty($categoriesInExercise)) {
         foreach ($categoriesInExercise as $category) {
             //$category['id'] = $category['iid'];
             $categories[$category['id']] = $category;
         }
     }
     return $categories;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:23,代码来源:TestCategory.php


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