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


PHP CourseManager::get_course_list_of_user_as_course_admin方法代码示例

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


在下文中一共展示了CourseManager::get_course_list_of_user_as_course_admin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: foreach

foreach ($sessionList as $item) {
    $session_select_list[$item['session_id']] = $item['session_name'];
}
$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
echo Display::form_row($labelFormRow, $select_session_html);
// Course list, get course list of session, or for course where user is admin
if (!empty($session_id) && $session_id != '-1' && !empty($sessionList)) {
    $sessionInfo = array();
    foreach ($sessionList as $session) {
        if ($session['session_id'] == $session_id) {
            $sessionInfo = $session;
        }
    }
    $course_list = $sessionInfo['courses'];
} else {
    $course_list = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
    // Admin fix, add the current course in the question pool.
    if (api_is_platform_admin()) {
        $courseInfo = api_get_course_info();
        if (!empty($course_list)) {
            $courseIdList = array_keys($course_list);
            if (!in_array($courseInfo['real_id'], $courseIdList)) {
                $course_list = array_merge($course_list, array($courseInfo));
            }
        } else {
            $course_list = array($courseInfo);
        }
    }
}
$course_select_list = array();
foreach ($course_list as $item) {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:question_pool.php

示例3: get_course_list_as_coach

 /**
  * Get course list as coach
  *
  * @param int $user_id
  * @param bool $include_courses_in_sessions
  * @return array Course list
  *
  **/
 public static function get_course_list_as_coach($user_id, $include_courses_in_sessions = false)
 {
     // 1. Getting courses as teacher (No session)
     $courses_temp = CourseManager::get_course_list_of_user_as_course_admin($user_id);
     $courseList = array();
     if (!empty($courses_temp)) {
         foreach ($courses_temp as $course_item) {
             $courseList[0][$course_item['code']] = $course_item['code'];
         }
     }
     //2. Include courses in sessions
     if ($include_courses_in_sessions) {
         $sessions = Tracking::get_sessions_coached_by_user($user_id);
         if (!empty($sessions)) {
             foreach ($sessions as $session_item) {
                 $courses = Tracking::get_courses_followed_by_coach($user_id, $session_item['id']);
                 if (is_array($courses)) {
                     foreach ($courses as $course_item) {
                         $courseList[$session_item['id']][$course_item] = $course_item;
                     }
                 }
             }
         }
     }
     return $courseList;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:34,代码来源:course.lib.php

示例4: api_not_allowed

            api_not_allowed(true);
        } else {
            $show_import_icon = true;
        }
    }
}
Display::display_header($nameTools);
$a_courses = array();
if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
    $title = '';
    if (empty($id_session)) {
        if (isset($_GET['user_id'])) {
            $user_id = intval($_GET['user_id']);
            $user_info = api_get_user_info($user_id);
            $title = get_lang('AssignedCoursesTo') . ' ' . api_get_person_name($user_info['firstname'], $user_info['lastname']);
            $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
        } else {
            $title = get_lang('YourCourseList');
            $courses = CourseManager::get_courses_followed_by_drh($_user['user_id']);
        }
    } else {
        $session_name = api_get_session_name($id_session);
        $title = api_htmlentities($session_name, ENT_QUOTES, $charset) . ' : ' . get_lang('CourseListInSession');
        $courses = Tracking::get_courses_list_from_session($id_session);
    }
    $a_courses = array_keys($courses);
    if (!api_is_session_admin()) {
        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php");
        $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents");
        $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
        $menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:course.php

示例5: intval

			  </div></div>';
    }
    echo Display::page_subheader($page_title);
    if (isset($_GET['id_coach'])) {
        $coach_id = intval($_GET['id_coach']);
    } else {
        $coach_id = api_get_user_id();
    }
    if (api_is_drh()) {
        $page_title = get_lang('YourStudents');
        if (empty($session_id)) {
            if (isset($_GET['user_id'])) {
                $user_id = intval($_GET['user_id']);
                $user_info = api_get_user_info($user_id);
                $page_title = api_get_person_name($user_info['firstname'], $user_info['lastname']) . ' : ' . get_lang('Students');
                $courses_by_teacher = CourseManager::get_course_list_of_user_as_course_admin($user_id);
                $students_by_course = array();
                if (!empty($courses_by_teacher)) {
                    foreach ($courses_by_teacher as $course) {
                        $students_by_course = array_keys(CourseManager::get_student_list_from_course_code($course['real_id']));
                        if (count($students_by_course) > 0) {
                            foreach ($students_by_course as $student_by_course) {
                                $students[] = $student_by_course;
                            }
                        }
                    }
                }
                if (!empty($students)) {
                    $students = array_unique($students);
                }
            } else {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:student.php

示例6: json_encode

         }
         echo json_encode($list);
     }
     break;
 case 'search_course':
     if (api_is_teacher()) {
         if (!empty($_GET['session_id']) && intval($_GET['session_id'])) {
             //if session is defined, lets find only courses of this session
             $courseList = SessionManager::get_course_list_by_session_id($_GET['session_id'], $_GET['q']);
         } else {
             //if session is not defined lets search all courses STARTING with $_GET['q']
             //TODO change this function to search not only courses STARTING with $_GET['q']
             if (api_is_platform_admin()) {
                 $courseList = CourseManager::get_courses_list(0, 0, 1, 'ASC', -1, $_GET['q'], null, true);
             } elseif (api_is_teacher()) {
                 $courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id(), $_GET['q']);
             }
         }
         $results = array();
         if (empty($courseList)) {
             echo json_encode([]);
             break;
         }
         foreach ($courseList as $course) {
             $title = $course['title'];
             if (!empty($course['category_code'])) {
                 $parents = CourseCategory::getParentsToString($course['category_code']);
                 $title = $parents . $course['title'];
             }
             $results['items'][] = array('id' => $course['id'], 'text' => $title);
         }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course.ajax.php


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