本文整理汇总了PHP中Exercise::getQuestionOrderedListByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::getQuestionOrderedListByName方法的具体用法?PHP Exercise::getQuestionOrderedListByName怎么用?PHP Exercise::getQuestionOrderedListByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::getQuestionOrderedListByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListOfCategoriesIDForTestObject
public static function getListOfCategoriesIDForTestObject(Exercise $exercise_obj)
{
// parcourir les questions d'un test, recup les categories uniques dans un tableau
$categories_in_exercise = array();
// $question_list = $exercise_obj->getQuestionList();
$question_list = $exercise_obj->getQuestionOrderedListByName();
// the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ???
foreach ($question_list as $questionInfo) {
$question_id = $questionInfo['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: isset
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
$exercise_id = isset($_GET['exerciseId']) && !empty($_GET['exerciseId']) ? intval($_GET['exerciseId']) : 0;
$objExercise = new Exercise();
$result = $objExercise->read($exercise_id);
if (!$result) {
api_not_allowed(true);
}
$session_id = api_get_session_id();
if (empty($session_id)) {
$students = CourseManager::get_student_list_from_course_code(api_get_course_int_id(), false);
} else {
$students = CourseManager::get_student_list_from_course_code(api_get_course_int_id(), true, $session_id);
}
$count_students = count($students);
$question_list = $objExercise->getQuestionOrderedListByName();
$data = array();
//Question title # of students who tool it Lowest score Average Highest score Maximum score
$headers = array(get_lang('Question'), get_lang('QuestionType'), get_lang('NumberStudentWhoSelectedIt'), get_lang('LowestScore'), get_lang('AverageScore'), get_lang('HighestScore'), get_lang('Weighting'));
if (!empty($question_list)) {
foreach ($question_list as $row) {
$question_id = $row['question_id'];
$question_obj = Question::read($question_id);
$exercise_stats = ExerciseLib::get_student_stats_by_question($question_id, $exercise_id, api_get_course_int_id(), api_get_session_id());
$count_users = ExerciseLib::get_number_students_question_with_answer_count($question_id, $exercise_id, api_get_course_int_id(), api_get_session_id());
$data[$question_id]['name'] = Text::cut($question_obj->question, 100);
$data[$question_id]['type'] = $question_obj->get_question_type_name();
$percentage = 0;
if ($count_students) {
$percentage = $count_users / $count_students * 100;
}