本文整理汇总了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;*/
}
示例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;
}