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


PHP CourseManager::get_course_list方法代码示例

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


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

示例1: build_session_course

 public function build_session_course()
 {
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $list_course = CourseManager::get_course_list();
     $list = array();
     foreach ($list_course as $_course) {
         $this->course = new Course();
         $this->course->code = $_course['code'];
         $this->course->type = 'partial';
         $this->course->path = api_get_path(SYS_COURSE_PATH) . $_course['directory'] . '/';
         $this->course->backup_path = api_get_path(SYS_COURSE_PATH) . $_course['directory'];
         $this->course->encoding = api_get_system_encoding();
         //current platform encoding
         $code_course = $_course['code'];
         $courseId = $_course['real_id'];
         $sql_session = "SELECT s.id, name, c_id\n                FROM {$tbl_session_course} sc\n                INNER JOIN {$tbl_session} s\n                ON sc.session_id = s.id\n                WHERE sc.c_id = '{$courseId}' ";
         $query_session = Database::query($sql_session);
         while ($rows_session = Database::fetch_assoc($query_session)) {
             $session = new CourseSession($rows_session['id'], $rows_session['name']);
             $this->course->add_resource($session);
         }
         $list[] = $this->course;
     }
     return $list;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:CourseBuilder.class.php

示例2: fullexportspecial

function fullexportspecial()
{
    global $tbl_session, $tbl_session_course, $export;
    $FileZip = create_zip();
    $to_group_id = 0;
    $code_course = '';
    $list_course = array();
    $zip_folder = new PclZip($FileZip['TEMP_FILE_ZIP']);
    $list_course = CourseManager::get_course_list();
    $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
    $tbl_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
    $groupCondition = " props.to_group_id = {$to_group_id}";
    if (empty($to_group_id)) {
        $groupCondition = " (props.to_group_id = 0 OR props.to_group_id IS NULL)";
    }
    if (count($list_course) > 0) {
        foreach ($list_course as $_course) {
            if ($FileZip['PATH'] == '/') {
                $querypath = '';
                // to prevent ...path LIKE '//%'... in query
            } else {
                $querypath = $FileZip['PATH'];
            }
            $course_id = $_course['real_id'];
            //Add tem to the zip file course
            $sql = "SELECT path FROM {$tbl_document} AS docs, {$tbl_property} AS props\n                WHERE props.tool='" . TOOL_DOCUMENT . "'\n                    AND docs.id=props.ref\n                    AND docs.path LIKE '" . $querypath . "/%'\n                    AND docs.filetype='file'\n                    AND (docs.session_id = '0' OR docs.session_id IS NULL)\n                    AND props.visibility<>'2'\n                    AND {$groupCondition}\n                    AND docs.c_id = {$course_id}\n                    AND props.c_id = {$course_id}";
            $query = Database::query($sql);
            while ($rows_course_file = Database::fetch_assoc($query)) {
                $rows_course_file['path'];
                $zip_folder->add($FileZip['PATH_COURSE'] . $_course['directory'] . "/document" . $rows_course_file['path'], PCLZIP_OPT_ADD_PATH, $_course['directory'], PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'] . $_course['directory'] . "/document" . $FileZip['PATH_REMOVE']);
            }
            //Add tem to the zip file session course
            $code_course = $_course['code'];
            $sql_session = "SELECT s.id, name, c_id\n                            FROM {$tbl_session_course} sc\n                            INNER JOIN {$tbl_session}  s\n                            ON sc.session_id = s.id\n                            WHERE c_id = '{$course_id}' ";
            $query_session = Database::query($sql_session);
            while ($rows_session = Database::fetch_assoc($query_session)) {
                $session_id = $rows_session['id'];
                $sql_session_doc = "SELECT path FROM {$tbl_document} AS docs, {$tbl_property} AS props\n                    WHERE props.tool='" . TOOL_DOCUMENT . "'\n                        AND docs.id=props.ref\n                        AND docs.path LIKE '" . $querypath . "/%'\n                        AND docs.filetype='file'\n                        AND docs.session_id = '{$session_id}'\n                        AND props.visibility<>'2'\n                        AND {$groupCondition}\n                        AND docs.c_id = {$course_id}\n                        AND props.c_id = {$course_id} ";
                $query_session_doc = Database::query($sql_session_doc);
                while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
                    $zip_folder->add($FileZip['PATH_COURSE'] . $_course['directory'] . '/document' . $rows_course_session_file['path'], PCLZIP_OPT_ADD_PATH, $_course['directory'] . "/" . $rows_session['name'], PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'] . $_course['directory'] . '/document' . $FileZip['PATH_REMOVE']);
                }
            }
        }
        $name = rename_zip($FileZip);
        if ($name === false) {
            $export = false;
            return false;
        } else {
            $export = true;
            return $name;
        }
    } else {
        Display::display_error_message(get_lang('ErrorMsgSpecialExport'));
        //main API
        $export = false;
        return false;
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:59,代码来源:special_exports.php


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