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


PHP CourseManager::get_users_count_in_course方法代码示例

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


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

示例1: WSListCourses

function WSListCourses($params)
{
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $course_field_name = isset($params['original_course_id_name']) ? $params['original_course_id_name'] : '';
    $courses_result = array();
    $category_names = array();
    $courses = CourseManager::get_courses_list();
    foreach ($courses as $course) {
        $course_tmp = array();
        $course_tmp['id'] = $course['id'];
        $course_tmp['code'] = $course['code'];
        $course_tmp['title'] = $course['title'];
        $course_tmp['language'] = $course['course_language'];
        $course_tmp['visibility'] = $course['visibility'];
        // Determining category name
        if (!empty($course['category_code']) && $category_names[$course['category_code']]) {
            $course_tmp['category_name'] = $category_names[$course['category_code']];
        } else {
            $category = CourseManager::get_course_category($course['category_code']);
            $category_names[$course['category_code']] = $category['name'];
            $course_tmp['category_name'] = $category['name'];
        }
        // Determining number of students registered in course
        $course_tmp['number_students'] = CourseManager::get_users_count_in_course($course['code']);
        // Determining external course id
        $externalCourseId = '';
        if ($course_field_name) {
            $externalCourseId = CourseManager::get_course_extra_field_value($course_field_name, $course['code']);
        }
        $course_tmp['external_course_id'] = $externalCourseId;
        $courses_result[] = $course_tmp;
    }
    return $courses_result;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:36,代码来源:registration.soap.php

示例2: get_number_of_users

/**
 *  * Get the users to display on the current page.
 */
function get_number_of_users()
{
    $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : null;
    return CourseManager::get_users_count_in_course(api_get_course_id(), api_get_session_id(), null, null, null, $keyword);
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:user.php

示例3: browseCoursesInCategory

 /**
  * @param string $category_code
  * @param int $random_value
  * @param array $limit will be used if $random_value is not set.
  * This array should contains 'start' and 'length' keys
  * @return array
  */
 function browseCoursesInCategory($category_code, $random_value = null, $limit = array())
 {
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $specialCourseList = CourseManager::get_special_course_list();
     $without_special_courses = '';
     if (!empty($specialCourseList)) {
         $without_special_courses = ' AND course.code NOT IN (' . implode(',', $specialCourseList) . ')';
     }
     $visibilityCondition = null;
     $hidePrivate = api_get_setting('platform.course_catalog_hide_private');
     if ($hidePrivate === 'true') {
         $courseInfo = api_get_course_info();
         $courseVisibility = $courseInfo['visibility'];
         $visibilityCondition = ' AND course.visibility <> 1';
     }
     if (!empty($random_value)) {
         $random_value = intval($random_value);
         $sql = "SELECT COUNT(*) FROM {$tbl_course}";
         $result = Database::query($sql);
         list($num_records) = Database::fetch_row($result);
         if (api_is_multiple_url_enabled()) {
             $url_access_id = api_get_current_access_url_id();
             $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
             $sql = "SELECT COUNT(*) FROM {$tbl_course} course\n                        INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                        ON (url_rel_course.c_id = course.id)\n                        WHERE access_url_id = {$url_access_id} ";
             $result = Database::query($sql);
             list($num_records) = Database::fetch_row($result);
             $sql = "SELECT course.id FROM {$tbl_course} course\n                        INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                        ON (url_rel_course.c_id = course.id)\n                        WHERE\n                            access_url_id = {$url_access_id} AND\n                            RAND()*{$num_records}< {$random_value}\n                            {$without_special_courses} {$visibilityCondition}\n                        ORDER BY RAND()\n                        LIMIT 0, {$random_value}";
         } else {
             $sql = "SELECT id FROM {$tbl_course} course\n                        WHERE RAND()*{$num_records}< {$random_value} {$without_special_courses} {$visibilityCondition}\n                        ORDER BY RAND()\n                        LIMIT 0, {$random_value}";
         }
         $result = Database::query($sql);
         $id_in = null;
         while (list($id) = Database::fetch_row($result)) {
             if ($id_in) {
                 $id_in .= ",{$id}";
             } else {
                 $id_in = "{$id}";
             }
         }
         if ($id_in === null) {
             return array();
         }
         $sql = "SELECT * FROM {$tbl_course} WHERE id IN({$id_in})";
     } else {
         $limitFilter = self::getLimitFilterFromArray($limit);
         $category_code = Database::escape_string($category_code);
         if (empty($category_code) || $category_code == "ALL") {
             $sql = "SELECT * FROM {$tbl_course}\n                        WHERE\n                            1=1\n                            {$without_special_courses}\n                            {$visibilityCondition}\n                        ORDER BY title {$limitFilter} ";
         } else {
             if ($category_code == 'NONE') {
                 $category_code = '';
             }
             $sql = "SELECT * FROM {$tbl_course}\n                        WHERE\n                            category_code='{$category_code}'\n                            {$without_special_courses}\n                            {$visibilityCondition}\n                        ORDER BY title {$limitFilter} ";
         }
         //showing only the courses of the current Chamilo access_url_id
         if (api_is_multiple_url_enabled()) {
             $url_access_id = api_get_current_access_url_id();
             $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
             if ($category_code != "ALL") {
                 $sql = "SELECT * FROM {$tbl_course} as course\n                            INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                            ON (url_rel_course.c_id = course.id)\n                            WHERE\n                                access_url_id = {$url_access_id} AND\n                                category_code='{$category_code}'\n                                {$without_special_courses}\n                                {$visibilityCondition}\n                            ORDER BY title {$limitFilter}";
             } else {
                 $sql = "SELECT * FROM {$tbl_course} as course\n                            INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                            ON (url_rel_course.c_id = course.id)\n                            WHERE\n                                access_url_id = {$url_access_id}\n                                {$without_special_courses}\n                                {$visibilityCondition}\n                            ORDER BY title {$limitFilter}";
             }
         }
     }
     $result = Database::query($sql);
     $courses = array();
     while ($row = Database::fetch_array($result)) {
         $row['registration_code'] = !empty($row['registration_code']);
         $count_users = CourseManager::get_users_count_in_course($row['code']);
         $count_connections_last_month = Tracking::get_course_connections_count($row['id'], 0, api_get_utc_datetime(time() - 30 * 86400));
         if ($row['tutor_name'] == '0') {
             $row['tutor_name'] = get_lang('NoManager');
         }
         $point_info = CourseManager::get_course_ranking($row['id'], 0);
         $courses[] = array('real_id' => $row['id'], 'point_info' => $point_info, 'code' => $row['code'], 'directory' => $row['directory'], 'visual_code' => $row['visual_code'], 'title' => $row['title'], 'tutor' => $row['tutor_name'], 'subscribe' => $row['subscribe'], 'unsubscribe' => $row['unsubscribe'], 'registration_code' => $row['registration_code'], 'creation_date' => $row['creation_date'], 'visibility' => $row['visibility'], 'count_users' => $count_users, 'count_connections' => $count_connections_last_month);
     }
     return $courses;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:86,代码来源:course_category.lib.php

示例4: browseCoursesInCategory

/**
 * @param string $category_code
 * @param int $random_value
 * @param array $limit will be used if $random_value is not set.
 * This array should contains 'start' and 'length' keys
 * @return array
 */
function browseCoursesInCategory($category_code, $random_value = null, $limit = array())
{
    global $_configuration;
    $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
    $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
    $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
    // Get course list auto-register
    $sql = "SELECT course_code\n            FROM {$TABLE_COURSE_FIELD_VALUE} tcfv\n            INNER JOIN {$TABLE_COURSE_FIELD} tcf ON tcfv.field_id = tcf.id\n            WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 ";
    $special_course_result = Database::query($sql);
    if (Database::num_rows($special_course_result) > 0) {
        $special_course_list = array();
        while ($result_row = Database::fetch_array($special_course_result)) {
            $special_course_list[] = '"' . $result_row['course_code'] . '"';
        }
    }
    $without_special_courses = '';
    if (!empty($special_course_list)) {
        $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')';
    }
    $visibilityCondition = null;
    if (isset($_configuration['course_catalog_hide_private'])) {
        if ($_configuration['course_catalog_hide_private'] == true) {
            $courseInfo = api_get_course_info();
            $courseVisibility = $courseInfo['visibility'];
            $visibilityCondition = ' AND course.visibility <> 1';
        }
    }
    if (!empty($random_value)) {
        $random_value = intval($random_value);
        $sql = "SELECT COUNT(*) FROM {$tbl_course}";
        $result = Database::query($sql);
        list($num_records) = Database::fetch_row($result);
        if (api_is_multiple_url_enabled()) {
            $url_access_id = api_get_current_access_url_id();
            $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
            $sql = "SELECT COUNT(*) FROM {$tbl_course} course\n                    INNER JOIN {$tbl_url_rel_course} as url_rel_course ON (url_rel_course.course_code=course.code)\n                    WHERE access_url_id = {$url_access_id} ";
            $result = Database::query($sql);
            list($num_records) = Database::fetch_row($result);
            $sql = "SELECT course.id FROM {$tbl_course} course INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                        ON (url_rel_course.course_code=course.code)\n                        WHERE   access_url_id = {$url_access_id} AND\n                                RAND()*{$num_records}< {$random_value}\n                                {$without_special_courses} {$visibilityCondition}\n                     ORDER BY RAND() LIMIT 0, {$random_value}";
        } else {
            $sql = "SELECT id FROM {$tbl_course} course\n                    WHERE RAND()*{$num_records}< {$random_value} {$without_special_courses} {$visibilityCondition}\n                    ORDER BY RAND() LIMIT 0, {$random_value}";
        }
        $result = Database::query($sql);
        $id_in = null;
        while (list($id) = Database::fetch_row($result)) {
            if ($id_in) {
                $id_in .= ",{$id}";
            } else {
                $id_in = "{$id}";
            }
        }
        $sql = "SELECT * FROM {$tbl_course} WHERE id IN({$id_in})";
    } else {
        $limitFilter = getLimitFilterFromArray($limit);
        $category_code = Database::escape_string($category_code);
        if (empty($category_code) || $category_code == "ALL") {
            $sql = "SELECT * FROM {$tbl_course}\n                    WHERE 1=1 {$without_special_courses} {$visibilityCondition}\n                    ORDER BY title {$limitFilter} ";
        } else {
            if ($category_code == 'NONE') {
                $category_code = '';
            }
            $sql = "SELECT * FROM {$tbl_course}\n                    WHERE category_code='{$category_code}' {$without_special_courses} {$visibilityCondition}\n                    ORDER BY title {$limitFilter} ";
        }
        //showing only the courses of the current Chamilo access_url_id
        if (api_is_multiple_url_enabled()) {
            $url_access_id = api_get_current_access_url_id();
            $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
            if ($category_code != "ALL") {
                $sql = "SELECT * FROM {$tbl_course} as course INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                    ON (url_rel_course.course_code=course.code)\n                    WHERE access_url_id = {$url_access_id} AND category_code='{$category_code}' {$without_special_courses} {$visibilityCondition}\n                    ORDER BY title {$limitFilter}";
            } else {
                $sql = "SELECT * FROM {$tbl_course} as course INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                    ON (url_rel_course.course_code=course.code)\n                    WHERE access_url_id = {$url_access_id} {$without_special_courses} {$visibilityCondition}\n                    ORDER BY title {$limitFilter}";
            }
        }
    }
    $result = Database::query($sql);
    $courses = array();
    while ($row = Database::fetch_array($result)) {
        $row['registration_code'] = !empty($row['registration_code']);
        $count_users = CourseManager::get_users_count_in_course($row['code']);
        $count_connections_last_month = Tracking::get_course_connections_count($row['code'], 0, api_get_utc_datetime(time() - 30 * 86400));
        if ($row['tutor_name'] == '0') {
            $row['tutor_name'] = get_lang('NoManager');
        }
        $point_info = CourseManager::get_course_ranking($row['id'], 0);
        $courses[] = array('real_id' => $row['id'], 'point_info' => $point_info, 'code' => $row['code'], 'directory' => $row['directory'], 'db' => $row['db_name'], 'visual_code' => $row['visual_code'], 'title' => $row['title'], 'tutor' => $row['tutor_name'], 'subscribe' => $row['subscribe'], 'unsubscribe' => $row['unsubscribe'], 'registration_code' => $row['registration_code'], 'creation_date' => $row['creation_date'], 'visibility' => $row['visibility'], 'count_users' => $count_users, 'count_connections' => $count_connections_last_month);
    }
    return $courses;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:95,代码来源:course_category.lib.php


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