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


PHP SessionManager::orderCourseIsEnabled方法代码示例

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


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

示例1: show_user_progress

 /**
  * Shows the user progress (when clicking in the Progress tab)
  *
  * @param int $user_id
  * @param int $session_id
  * @param string $extra_params
  * @param bool $show_courses
  * @param bool $showAllSessions
  *
  * @return string
  */
 public static function show_user_progress($user_id, $session_id = 0, $extra_params = '', $show_courses = true, $showAllSessions = true)
 {
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $tbl_access_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
     $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $tbl_access_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
     $user_id = intval($user_id);
     $session_id = intval($session_id);
     if (api_is_multiple_url_enabled()) {
         $sql = "SELECT c.code, title\n                    FROM {$tbl_course_user} cu\n                    INNER JOIN {$tbl_course} c\n                    ON (cu.c_id = c.id)\n                    INNER JOIN {$tbl_access_rel_course} a\n                    ON (a.c_id = c.id)\n                    WHERE\n                        cu.user_id = {$user_id} AND\n                        relation_type<> " . COURSE_RELATION_TYPE_RRHH . " AND\n                        access_url_id = " . api_get_current_access_url_id() . "\n                    ORDER BY title";
     } else {
         $sql = "SELECT c.code, title\n                    FROM {$tbl_course_user} u\n                    INNER JOIN {$tbl_course} c ON (c_id = c.id)\n                    WHERE\n                        u.user_id= {$user_id} AND\n                        relation_type<>" . COURSE_RELATION_TYPE_RRHH . "\n                    ORDER BY title";
     }
     $rs = Database::query($sql);
     $courses = $course_in_session = $temp_course_in_session = array();
     while ($row = Database::fetch_array($rs, 'ASSOC')) {
         $courses[$row['code']] = $row['title'];
     }
     $orderBy = " ORDER BY name ";
     $extraInnerJoin = null;
     if (SessionManager::orderCourseIsEnabled() && !empty($session_id)) {
         $orderBy = " ORDER BY s.id, position ";
         $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
         $extraInnerJoin = " INNER JOIN {$tableSessionRelCourse} src\n                                ON (cu.c_id = src.c_id AND src.session_id = {$session_id}) ";
     }
     $sessionCondition = '';
     if (!empty($session_id)) {
         $sessionCondition = " AND s.id = {$session_id}";
     }
     // Get the list of sessions where the user is subscribed as student
     if (api_is_multiple_url_enabled()) {
         $sql = "SELECT DISTINCT c.code, s.id as session_id, name\n                    FROM {$tbl_session_course_user} cu\n                    INNER JOIN {$tbl_access_rel_session} a\n                    ON (a.session_id = cu.session_id)\n                    INNER JOIN {$tbl_session} s\n                    ON (s.id = a.session_id)\n                    INNER JOIN {$tbl_course} c\n                    ON (c.id = cu.c_id)\n                    {$extraInnerJoin}\n                    WHERE\n                        cu.user_id = {$user_id} AND\n                        access_url_id = " . api_get_current_access_url_id() . "\n                        {$sessionCondition}\n                    {$orderBy} ";
     } else {
         $sql = "SELECT DISTINCT c.code, s.id as session_id, name\n                    FROM {$tbl_session_course_user} cu\n                    INNER JOIN {$tbl_session} s\n                    ON (s.id = cu.session_id)\n                    INNER JOIN {$tbl_course} c\n                    ON (c.id = cu.c_id)\n                    {$extraInnerJoin}\n                    WHERE\n                        cu.user_id = {$user_id}\n                        {$sessionCondition}\n                    {$orderBy} ";
     }
     $rs = Database::query($sql);
     $simple_session_array = array();
     while ($row = Database::fetch_array($rs)) {
         $course_info = CourseManager::get_course_information($row['code']);
         $temp_course_in_session[$row['session_id']]['course_list'][$course_info['real_id']] = $course_info;
         $temp_course_in_session[$row['session_id']]['name'] = $row['name'];
         $simple_session_array[$row['session_id']] = $row['name'];
     }
     foreach ($simple_session_array as $my_session_id => $session_name) {
         $course_list = $temp_course_in_session[$my_session_id]['course_list'];
         $my_course_data = array();
         foreach ($course_list as $course_data) {
             $my_course_data[$course_data['id']] = $course_data['title'];
         }
         if (empty($session_id)) {
             $my_course_data = ArrayClass::utf8_sort($my_course_data);
         }
         $final_course_data = array();
         foreach ($my_course_data as $course_id => $value) {
             $final_course_data[$course_id] = $course_list[$course_id];
         }
         $course_in_session[$my_session_id]['course_list'] = $final_course_data;
         $course_in_session[$my_session_id]['name'] = $session_name;
     }
     $html = '';
     // Course list
     if ($show_courses) {
         if (!empty($courses)) {
             $html .= Display::page_subheader(Display::return_icon('course.png', get_lang('MyCourses'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('MyCourses'));
             $html .= '<table class="data_table" width="100%">';
             $html .= '<tr>
                       ' . Display::tag('th', get_lang('Course'), array('width' => '300px')) . '
                       ' . Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class' => 'head')) . '
                       ' . Display::tag('th', get_lang('Progress'), array('class' => 'head')) . '
                       ' . Display::tag('th', get_lang('Score') . Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class' => 'head')) . '
                       ' . Display::tag('th', get_lang('LastConnexion'), array('class' => 'head')) . '
                       ' . Display::tag('th', get_lang('Details'), array('class' => 'head')) . '
                     </tr>';
             foreach ($courses as $course_code => $course_title) {
                 $courseInfo = api_get_course_info($course_code);
                 $courseId = $courseInfo['real_id'];
                 $total_time_login = Tracking::get_time_spent_on_the_course($user_id, $courseId);
                 $time = api_time_to_hms($total_time_login);
                 $progress = Tracking::get_avg_student_progress($user_id, $course_code);
                 $percentage_score = Tracking::get_avg_student_score($user_id, $course_code, array());
                 $last_connection = Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo);
                 if (is_null($progress)) {
                     $progress = '0%';
                 } else {
                     $progress = $progress . '%';
                 }
                 if (isset($_GET['course']) && $course_code == $_GET['course'] && empty($_GET['session_id'])) {
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:tracking.lib.php

示例2: api_get_self

        $orderButtons = null;
        $upIcon = 'up.png';
        $urlUp = api_get_self() . '?id_session=' . $sessionId . '&course_id=' . $course->getId() . '&action=move_up';
        if ($count == 0) {
            $upIcon = 'up_na.png';
            $urlUp = '#';
        }
        $orderButtons = Display::url(Display::return_icon($upIcon, get_lang('MoveUp')), $urlUp);
        $downIcon = 'down.png';
        $downUrl = api_get_self() . '?id_session=' . $sessionId . '&course_id=' . $course->getId() . '&action=move_down';
        if ($count + 1 == count($courses)) {
            $downIcon = 'down_na.png';
            $downUrl = '#';
        }
        $orderButtons .= Display::url(Display::return_icon($downIcon, get_lang('MoveDown')), $downUrl);
        if (!SessionManager::orderCourseIsEnabled()) {
            $orderButtons = '';
        }
        $courseUrl = api_get_course_url($course->getCode(), $sessionId);
        // hide_course_breadcrumb the parameter has been added to hide the name
        // of the course, that appeared in the default $interbreadcrumb
        $courseItem .= '
		<tr>
			<td class="title">' . Display::url($course->getTitle() . ' (' . $course->getVisualCode() . ')', $courseUrl) . '</td>
			<td>' . $coach . '</td>
			<td>' . $numberOfUsers . '</td>
			<td>
                <a href="' . $courseUrl . '">' . Display::return_icon('course_home.gif', get_lang('Course')) . '</a>
                ' . $orderButtons . '
                <a href="session_course_user_list.php?id_session=' . $sessionId . '&course_code=' . $course->getCode() . '">' . Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>
                <a href="' . api_get_path(WEB_CODE_PATH) . '/user/user_import.php?action=import&cidReq=' . $course->getCode() . '&id_session=' . $sessionId . '">' . Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL) . '</a>
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:resume_session.php

示例3: get_course_list_by_session_id

 /**
  * Gets the list (or the count) of courses by session filtered by access_url
  * @param int $session_id The session id
  * @param string $course_name The course code
  * @param string $orderBy Field to order the data
  * @param boolean $getCount Optional. Count the session courses
  * @return array|int List of courses. Whether $getCount is true, return the count
  */
 public static function get_course_list_by_session_id($session_id, $course_name = '', $orderBy = null, $getCount = false)
 {
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $session_id = intval($session_id);
     $sqlSelect = "SELECT *";
     if ($getCount) {
         $sqlSelect = "SELECT COUNT(1)";
     }
     // select the courses
     $sql = "SELECT *, c.id, c.id as real_id\n                FROM {$tbl_course} c\n                INNER JOIN {$tbl_session_rel_course} src\n                ON c.id = src.c_id\n\t\t        WHERE src.session_id = '{$session_id}' ";
     if (!empty($course_name)) {
         $course_name = Database::escape_string($course_name);
         $sql .= " AND c.title LIKE '%{$course_name}%' ";
     }
     if (!empty($orderBy)) {
         $orderBy = Database::escape_string($orderBy);
         $orderBy = " ORDER BY {$orderBy}";
     } else {
         if (SessionManager::orderCourseIsEnabled()) {
             $orderBy .= " ORDER BY position ";
         } else {
             $orderBy .= " ORDER BY title ";
         }
     }
     $sql .= Database::escape_string($orderBy);
     $result = Database::query($sql);
     $num_rows = Database::num_rows($result);
     $courses = array();
     if ($num_rows > 0) {
         if ($getCount) {
             $count = Database::fetch_array($result);
             return intval($count[0]);
         }
         while ($row = Database::fetch_array($result, 'ASSOC')) {
             $courses[$row['real_id']] = $row;
         }
     }
     return $courses;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:48,代码来源:sessionmanager.lib.php

示例4: get_course_list_by_session_id

    /**
     * Gets the list of courses by session filtered by access_url
     * @param int $session_id
     * @param string $course_name
     * @return array list of courses
     */
    public static function get_course_list_by_session_id(
        $session_id,
        $course_name = '',
        $orderBy = null
    ) {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);

        $session_id = intval($session_id);

        // select the courses
        $sql = "SELECT * FROM $tbl_course c
                INNER JOIN $tbl_session_rel_course src
                ON c.code = src.course_code
		        WHERE src.id_session = '$session_id' ";

        if (!empty($course_name)) {
            $course_name = Database::escape_string($course_name);
            $sql .= " AND c.title LIKE '%$course_name%' ";
        }

        if (!empty($orderBy)) {
            $orderBy = Database::escape_string($orderBy);
            $orderBy = " ORDER BY $orderBy";
        } else {
            if (SessionManager::orderCourseIsEnabled()) {
                $orderBy .= " ORDER BY position ";
            } else {
                $orderBy .= " ORDER BY title ";
            }
        }

        $sql .= Database::escape_string($orderBy);
        $result = Database::query($sql);
        $num_rows = Database::num_rows($result);
        $courses = array();
        if ($num_rows > 0) {
            while ($row = Database::fetch_array($result,'ASSOC'))	{
                $courses[$row['id']] = $row;
            }
        }
        return $courses;
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:49,代码来源:sessionmanager.lib.php

示例5: getCoursesFollowedByUser

 /**
  * get courses followed by user
  * @param   int     $user_id
  * @param   int     $status
  * @param   int     $from
  * @param   int     $limit
  * @param   string  $column
  * @param   string  $direction
  * @param   boolean $getCount
  * @param   string  $keyword
  * @param   int     $sessionId
  * @param   boolean $showAllAssignedCourses
  * @return  array   courses
  */
 public static function getCoursesFollowedByUser($user_id, $status = null, $from = null, $limit = null, $column = null, $direction = null, $getCount = false, $keyword = null, $sessionId = null, $showAllAssignedCourses = false)
 {
     // Database Table Definitions
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $tbl_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
     $sessionId = intval($sessionId);
     $user_id = intval($user_id);
     $select = "SELECT DISTINCT *, id as real_id ";
     if ($getCount) {
         $select = "SELECT COUNT(DISTINCT id) as count";
     }
     $whereConditions = null;
     switch ($status) {
         case COURSEMANAGER:
             $whereConditions .= " AND cru.user_id = '{$user_id}'";
             if (!$showAllAssignedCourses) {
                 $whereConditions .= " AND status = " . COURSEMANAGER;
             } else {
                 $whereConditions .= " AND relation_type = " . COURSE_RELATION_TYPE_COURSE_MANAGER;
             }
             break;
         case DRH:
             $whereConditions .= " AND\n                    cru.user_id = '{$user_id}' AND\n                    status = " . DRH . " AND\n                    relation_type = '" . COURSE_RELATION_TYPE_RRHH . "'\n                ";
             break;
     }
     $keywordCondition = null;
     if (!empty($keyword)) {
         $keyword = Database::escape_string($keyword);
         $keywordCondition = " AND (c.code LIKE '%{$keyword}%' OR c.title LIKE '%{$keyword}%' ) ";
     }
     $orderBy = null;
     $extraInnerJoin = null;
     if (!empty($sessionId)) {
         if (!empty($sessionId)) {
             $courseList = SessionManager::get_course_list_by_session_id($sessionId);
             if (!empty($courseList)) {
                 $courseListToString = implode("','", array_keys($courseList));
                 $whereConditions .= " AND c.id IN ('" . $courseListToString . "')";
             }
         }
         if (SessionManager::orderCourseIsEnabled() && !empty($sessionId)) {
             $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
             $orderBy = ' ORDER BY position';
             $extraInnerJoin = " INNER JOIN {$tableSessionRelCourse} src\n                                    ON (c.code = src.course_code AND id_session = {$sessionId}) ";
         }
     }
     $whereConditions .= $keywordCondition;
     $sql = "{$select}\n                FROM {$tbl_course} c\n                    INNER JOIN {$tbl_course_rel_user} cru ON (cru.course_code = c.code)\n                    INNER JOIN {$tbl_course_rel_access_url} a ON (a.course_code = c.code)\n                    {$extraInnerJoin}\n                WHERE\n                    access_url_id = " . api_get_current_access_url_id() . "\n                    {$whereConditions}\n                {$orderBy}\n                ";
     if (isset($from) && isset($limit)) {
         $from = intval($from);
         $limit = intval($limit);
         $sql .= " LIMIT {$from}, {$limit}";
     }
     $result = Database::query($sql);
     if ($getCount) {
         $row = Database::fetch_array($result);
         return $row['count'];
     }
     $courses = array();
     if (Database::num_rows($result) > 0) {
         while ($row = Database::fetch_array($result)) {
             $courses[$row['code']] = $row;
         }
     }
     return $courses;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:81,代码来源:course.lib.php

示例6: get_courses_list_by_session

    /**
     * Gives a list of courses for the given user in the given session
     * @param integer $user_id
     * @param integer $session_id
     * @return array  list of statuses (session_id-course_code => status)
     */
    public static function get_courses_list_by_session($user_id, $session_id)
    {
        // Database Table Definitions
        $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
        $tableCourse = Database :: get_main_table(TABLE_MAIN_COURSE);
        $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
        $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);

        $user_id = intval($user_id);
        $session_id = intval($session_id);
        //we filter the courses from the URL
        $join_access_url = $where_access_url = '';

        if (api_get_multiple_access_url()) {
            $access_url_id = api_get_current_access_url_id();
            if ($access_url_id != -1) {
                $tbl_url_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
                $join_access_url = " ,  $tbl_url_session url_rel_session ";
                $where_access_url = " AND access_url_id = $access_url_id AND url_rel_session.session_id = $session_id ";
            }
        }

        $personal_course_list = array();
        $courses = array();

        /* This query is very similar to the above query,but it will check the
        session_rel_course_user table if there are courses registered
        to our user or not*/

        $sql = "SELECT DISTINCT
                    scu.course_code as code, c.visibility, c.id as real_id
                FROM $tbl_session_course_user as scu
                INNER JOIN $tbl_session_course sc
                ON (scu.id_session = sc.id_session AND scu.course_code = sc.course_code)
                INNER JOIN $tableCourse as c
                ON (scu.course_code = c.code)
                $join_access_url
                WHERE
                    scu.id_user = $user_id AND
                    scu.id_session = $session_id
                    $where_access_url";

        $orderBy = " ORDER BY code ";
        if (SessionManager::orderCourseIsEnabled()) {
            $orderBy =  ' ORDER BY position';
        }
        $sql .= $orderBy;

        $result = Database::query($sql);

        if (Database::num_rows($result) > 0) {
            while ($result_row = Database::fetch_array($result)) {
                $result_row['status'] = 5;
                if (!in_array($result_row['code'], $courses)) {
                    $personal_course_list[] = $result_row;
                    $courses[] = $result_row['code'];
                }
            }
        }

        if (api_is_allowed_to_create_course()) {
            $sql = "SELECT DISTINCT
                        scu.course_code as code, c.visibility, c.id as real_id
                    FROM $tbl_session_course_user as scu
                    INNER JOIN $tbl_session as s
                    ON (scu.id_session = s.id)
                    INNER JOIN $tbl_session_course sc
                    ON (scu.id_session = sc.id_session AND scu.course_code = sc.course_code)
                    INNER JOIN $tableCourse as c
                    ON (scu.course_code = c.code)
                    $join_access_url
                    WHERE
                      s.id = $session_id AND
                      (
                        (scu.id_user=$user_id AND scu.status=2) OR
                        s.id_coach = $user_id
                      )
                    $where_access_url
                    $orderBy";
            $result = Database::query($sql);

            if (Database::num_rows($result) > 0) {
                while ($result_row = Database::fetch_array($result)) {
                    $result_row['status'] = 2;
                    if (!in_array($result_row['code'], $courses)) {
                        $personal_course_list[] = $result_row;
                        $courses[] = $result_row['code'];
                    }
                }
            }
        }

        if (api_is_drh()) {
            $session_list = SessionManager::get_sessions_followed_by_drh($user_id);
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:usermanager.lib.php


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