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


PHP ExerciseLib::get_all_exercises_for_course_id方法代码示例

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


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

示例1: getRules

 /**
  * @param string $courseCode
  * @param array $rules
  * @param array $columns
  * @param array $column_model
  * @return array
  */
 public static function getRules($courseCode, &$rules, &$columns, &$column_model, $questionFields, $checkFields = false)
 {
     // sessions
     // course
     // categories
     // exercises
     // difficult
     // type
     if (empty($courseCode)) {
         // Session.
         $sessionList = SessionManager::get_sessions_by_general_coach(api_get_user_id());
         $fields = array();
         if (!empty($sessionList)) {
             $new_options = array();
             $new_options[] = "-1:" . get_lang('All');
             foreach ($sessionList as $session) {
                 $new_options[] = "{$session['id']}:{$session['name']}";
             }
             $string = implode(';', $new_options);
             $fields[] = array('field_display_text' => get_lang('Session'), 'field_variable' => 'session_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
         }
     } else {
         // $courseList = array(api_get_course_info());
         //$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
     }
     // Courses.
     $courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
     if (!empty($courseList)) {
         $new_options = array();
         $new_options[] = "-1:" . get_lang('All');
         foreach ($courseList as $course) {
             $new_options[] = "{$course['id']}:{$course['title']}";
         }
         $string = implode(';', $new_options);
         $fields[] = array('field_display_text' => get_lang('Course'), 'field_variable' => 'c_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
     }
     // Categories.
     $string = null;
     if (!empty($courseList)) {
         $new_options = array();
         $new_options[] = "-1:" . get_lang('All');
         // Global categories
         // @todo use tree view
         $categories = Testcategory::getCategoriesIdAndName(0);
         if (!empty($categories)) {
             foreach ($categories as $id => $category) {
                 if (!empty($id)) {
                     $new_options[] = "{$id}:[Global] - " . $category;
                 }
             }
         }
         foreach ($courseList as $course) {
             $categories = Testcategory::getCategoriesIdAndName($course['real_id']);
             if (!empty($categories)) {
                 foreach ($categories as $id => $category) {
                     if (!empty($id)) {
                         $new_options[] = "{$id}:" . $course['title'] . " - " . $category;
                     }
                 }
             }
         }
         $string = implode(';', $new_options);
         $fields[] = array('field_display_text' => get_lang('Category'), 'field_variable' => 'category_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
     }
     $course = api_get_course_int_id();
     $sessionId = api_get_session_id();
     // Exercises.
     $exerciseList = ExerciseLib::get_all_exercises_for_course_id($sessionId, $course);
     if (!empty($exerciseList)) {
         $new_options = array();
         $new_options[] = "-1:" . get_lang('All');
         $new_options[] = "0:" . get_lang('Orphan');
         foreach ($exerciseList as $exercise) {
             $new_options[] = "{$exercise['iid']}:{$exercise['title']}";
         }
         $string = implode(';', $new_options);
         $fields[] = array('field_display_text' => get_lang('Exercise'), 'field_variable' => 'exercise_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
     }
     // Question type.
     $questionList = Question::get_question_type_list();
     if (!empty($questionList)) {
         $new_options = array();
         $new_options[] = "-1:" . get_lang('All');
         foreach ($questionList as $key => $question) {
             $new_options[] = "{$key}:" . get_lang($question['1']);
         }
         $string = implode(';', $new_options);
         $fields[] = array('field_display_text' => get_lang('AnswerType'), 'field_variable' => 'question_type', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
     }
     // Difficult.
     $levels = Question::get_default_levels();
     if (!empty($levels)) {
         $new_options = array();
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:question.class.php

示例2: HotPotGCt

// Tool introduction
Display::display_introduction_section(TOOL_QUIZ);
if (!empty($errorXmlExport)) {
    echo $errorXmlExport;
}
HotPotGCt($documentPath, 1, $userId);
// Only for administrator
if ($is_allowedToEdit) {
    if (!empty($choice)) {
        // All test choice, clean all test's results
        if ($choice == 'clean_all_test') {
            $check = Security::check_token('get');
            if ($check) {
                // list of exercises in a course/session
                // we got variable $courseId $courseInfo session api_get_session_id()
                $exerciseList = ExerciseLib::get_all_exercises_for_course_id($courseInfo, api_get_session_id(), $courseId, false);
                $quantity_results_deleted = 0;
                foreach ($exerciseList as $exeItem) {
                    // delete result for test, if not in a gradebook
                    $exercise_action_locked = api_resource_is_locked_by_gradebook($exeItem['id'], LINK_EXERCISE);
                    if ($exercise_action_locked == false) {
                        $objExerciseTmp = new Exercise();
                        if ($objExerciseTmp->read($exeItem['id'])) {
                            $quantity_results_deleted += $objExerciseTmp->clean_results(true);
                        }
                    }
                }
                Display::display_confirmation_message(sprintf(get_lang('XResultsCleaned'), $quantity_results_deleted));
            }
        }
        // single exercise choice
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:exercise.php

示例3: array

//Redefining table calls
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER);
$TBL_CATEGORY = Database::get_course_table(TABLE_QUIZ_CATEGORY);
// hub 13-10-2011
$TBL_COURSE_REL_CATEGORY = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
// hub 13-10-2011
// Get course categories for the selected course
// get category list for the course $selected_course
$tabCatList = Testcategory::getCategoriesIdAndName($selected_course);
$selectCourseCateogry = Display::select('courseCategoryId', $tabCatList, $courseCategoryId, array('class' => 'chzn-select', 'onchange' => 'submit_form(this);'), false);
echo Display::form_row(get_lang("QuestionCategory"), $selectCourseCateogry);
// Get exercice list for this course
$exercise_list = ExerciseLib::get_all_exercises_for_course_id($session_id, $selected_course);
//Exercise List
$my_exercise_list = array();
$my_exercise_list['0'] = get_lang('AllExercises');
$my_exercise_list['-1'] = get_lang('OrphanQuestions');
if (is_array($exercise_list)) {
    foreach ($exercise_list as $row) {
        $my_exercise_list[$row['iid']] = "";
        if ($row['iid'] == $fromExercise && $selected_course == api_get_course_int_id()) {
            $my_exercise_list[$row['iid']] = ">    ";
            // hub 13-10-2011
        }
        $my_exercise_list[$row['iid']] .= $row['title'];
    }
}
if ($exercice_id_changed == 1) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:question_pool.php

示例4: HotPotGCt

// Tool introduction
Display::display_introduction_section(TOOL_QUIZ);
if (!empty($errorXmlExport)) {
    echo $errorXmlExport;
}
HotPotGCt($documentPath, 1, $userId);
// Only for administrator
if ($is_allowedToEdit) {
    if (!empty($choice)) {
        // All test choice, clean all test's results
        if ($choice == 'clean_all_test') {
            $check = Security::check_token('get');
            if ($check) {
                // list of exercises in a course/session
                // we got variable $courseId $courseInfo session api_get_session_id()
                $exerciseList = ExerciseLib::get_all_exercises_for_course_id($courseInfo, $sessionId, $courseId, false);
                $quantity_results_deleted = 0;
                foreach ($exerciseList as $exeItem) {
                    // delete result for test, if not in a gradebook
                    $exercise_action_locked = api_resource_is_locked_by_gradebook($exeItem['id'], LINK_EXERCISE);
                    if ($exercise_action_locked == false) {
                        $objExerciseTmp = new Exercise();
                        if ($objExerciseTmp->read($exeItem['id'])) {
                            $quantity_results_deleted += $objExerciseTmp->clean_results(true);
                        }
                    }
                }
                Display::display_confirmation_message(sprintf(get_lang('XResultsCleaned'), $quantity_results_deleted));
            }
        }
        // single exercise choice
开发者ID:daffef,项目名称:chamilo-lms,代码行数:31,代码来源:exercise.php


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