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


PHP api_get_session_condition函数代码示例

本文整理汇总了PHP中api_get_session_condition函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_session_condition函数的具体用法?PHP api_get_session_condition怎么用?PHP api_get_session_condition使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     // Database table definition
     $this->tbl_wiki = Database::get_course_table(TABLE_WIKI);
     $this->tbl_wiki_discuss = Database::get_course_table(TABLE_WIKI_DISCUSS);
     $this->tbl_wiki_mailcue = Database::get_course_table(TABLE_WIKI_MAILCUE);
     $this->tbl_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
     $this->session_id = api_get_session_id();
     $this->condition_session = api_get_session_condition($this->session_id);
     $this->course_id = api_get_course_int_id();
     $this->group_id = api_get_group_id();
     if (!empty($this->group_id)) {
         $this->groupfilter = ' group_id="' . $this->group_id . '"';
     }
     $this->courseInfo = api_get_course_info();
     $this->url = api_get_path(WEB_CODE_PATH) . 'wiki/index.php?' . api_get_cidreq();
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:20,代码来源:wiki.inc.php

示例2: get_announcements

 private function get_announcements($username, $course_code, $announcement_id = 0)
 {
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id);
     $announcement_id = $announcement_id == 0 ? "" : "AND announcement.id=" . $announcement_id;
     $user_id = UserManager::get_user_id_from_username($username);
     //$listOfCourses = CourseManager::get_course_information_by_id($course_id);
     $course_info = CourseManager::get_course_information($course_code);
     $course_db = $course_info['db_name'];
     $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db);
     $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT, $course_db);
     $maximum = '12';
     $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id);
     if (api_get_group_id() == 0) {
         $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ")) ";
     } else {
         $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . api_get_group_id() . ")) ";
     }
     // the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
     if (is_array($group_memberships) && count($group_memberships) > 0) {
         $sql = "SELECT\n                            announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                            FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                            WHERE announcement.id = ip.ref\n                            AND ip.tool='announcement'\n                            AND ip.visibility='1'\n                            {$announcement_id}\n                            {$cond_user_id}\n                            {$condition_session}\n                            GROUP BY ip.ref\n                            ORDER BY display_order DESC\n                            LIMIT 0,{$maximum}";
     } else {
         // the user is not member of any group
         // this is an identified user => show the general announcements AND his personal announcements
         if ($user_id) {
             if (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
                 $cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0')) ";
             } else {
                 $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0') ";
             }
             $sql = "SELECT\n                                    announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                                    FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                                    WHERE announcement.id = ip.ref\n                                    AND ip.tool='announcement'\n                                    AND ip.visibility='1'\n                                    {$announcement_id}\n                                    {$cond_user_id}\n                                    {$condition_session}\n                                    GROUP BY ip.ref\n                                    ORDER BY display_order DESC\n                                    LIMIT 0,{$maximum}";
         } else {
             if (api_get_course_setting('allow_user_edit_announcement')) {
                 $cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ip.to_group_id='0') ";
             } else {
                 $cond_user_id = " AND ip.to_group_id='0' ";
             }
             // the user is not identiefied => show only the general announcements
             $sql = "SELECT\n                                    announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                                    FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                                    WHERE announcement.id = ip.ref\n                                    AND ip.tool='announcement'\n                                    AND ip.visibility='1'\n                                    AND ip.to_group_id='0'\n                                    {$announcement_id}\n                                    {$condition_session}\n                                    GROUP BY ip.ref\n                                    ORDER BY display_order DESC\n                                    LIMIT 0,{$maximum}";
         }
     }
     $result = Database::query($sql);
     return $result;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:44,代码来源:cm_webservice_announcements.php

示例3: get_all_links

 /**
  * Generate an array of all learnpaths available.
  * @return array 2-dimensional array - every element contains 2 subelements (id, name)
  */
 public function get_all_links()
 {
     if (empty($this->course_code)) {
         die('Error in get_not_created_links() : course code not set');
     }
     $session_id = api_get_session_id();
     if (empty($session_id)) {
         $session_condition = api_get_session_condition(0, true);
     } else {
         $session_condition = api_get_session_condition($session_id, true, true);
     }
     $sql = 'SELECT id, name FROM ' . $this->get_learnpath_table() . ' 
             WHERE c_id = ' . $this->course_id . ' ' . $session_condition . ' ';
     $result = Database::query($sql);
     $cats = array();
     while ($data = Database::fetch_array($result)) {
         $cats[] = array($data['id'], $data['name']);
     }
     return $cats;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:24,代码来源:learnpathlink.class.php

示例4: get_forums

/**
 * Retrieve all the forums (regardless of their category) or of only one.
 * The forums are sorted according to the forum_order.
 * Since it does not take the forum category into account there probably
 * will be two or more forums that have forum_order=1, ...
 * @param int $id forum id
 * @param string $course_code
 * @param bool $includeGroupsForum
 * @param int $sessionId
 * @return array an array containing all the information about the forums (regardless of their category)
 * @todo check $sql4 because this one really looks fishy.
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function get_forums($id = '', $course_code = '', $includeGroupsForum = true, $sessionId = 0)
{
    $course_info = api_get_course_info($course_code);
    $table_users = Database::get_main_table(TABLE_MAIN_USER);
    $table_forums = Database::get_course_table(TABLE_FORUM);
    $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
    $table_posts = Database::get_course_table(TABLE_FORUM_POST);
    $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
    // GETTING ALL THE FORUMS
    // Condition for the session
    if (empty($sessionId)) {
        $session_id = api_get_session_id();
    } else {
        $session_id = $sessionId;
    }
    $sessionIdLink = $session_id === 0 ? '' : 'AND threads.session_id = item_properties.session_id';
    $condition_session = api_get_session_condition($session_id, true, false, 'item_properties.session_id');
    $course_id = $course_info['real_id'];
    $forum_list = array();
    $includeGroupsForumSelect = "";
    if (!$includeGroupsForum) {
        $includeGroupsForumSelect = " AND forum_of_group = 0 ";
    }
    if ($id == '') {
        // Student
        // Select all the forum information of all forums (that are visible to students).
        $sql = "SELECT * FROM {$table_forums} forum\n                INNER JOIN " . $table_item_property . " item_properties\n                ON (\n                    forum.forum_id = item_properties.ref AND\n                    forum.c_id = item_properties.c_id\n                )\n                WHERE\n                    item_properties.visibility=1 AND\n                    item_properties.tool = '" . TOOL_FORUM . "'\n                    {$condition_session} AND\n                    forum.c_id = {$course_id} AND\n                    item_properties.c_id = {$course_id}\n                    {$includeGroupsForumSelect}\n                ORDER BY forum.forum_order ASC";
        // Select the number of threads of the forums (only the threads that are visible).
        $sql2 = "SELECT count(*) AS number_of_threads, threads.forum_id\n                FROM {$table_threads} threads\n                INNER JOIN " . $table_item_property . " item_properties\n                ON (\n                    threads.thread_id=item_properties.ref AND\n                    threads.c_id = item_properties.c_id \n                    {$sessionIdLink}\n                )\n                WHERE\n                    item_properties.visibility=1 AND\n                    item_properties.tool='" . TOOL_FORUM_THREAD . "' AND\n                    threads.c_id = {$course_id} AND\n                    item_properties.c_id = {$course_id}\n                GROUP BY threads.forum_id";
        // Select the number of posts of the forum (post that are visible and that are in a thread that is visible).
        $sql3 = "SELECT count(*) AS number_of_posts, posts.forum_id\n                FROM {$table_posts} posts, {$table_threads} threads, " . $table_item_property . " item_properties\n                WHERE\n                    posts.visible=1 AND\n                    posts.thread_id=threads.thread_id AND\n                    threads.thread_id=item_properties.ref AND\n                    threads.session_id = item_properties.session_id AND\n                    item_properties.visibility=1 AND\n                    item_properties.tool='" . TOOL_FORUM_THREAD . "' AND\n                    threads.c_id = {$course_id} AND\n                    posts.c_id = {$course_id} AND\n                    item_properties.c_id = {$course_id}\n                GROUP BY threads.forum_id";
        // Course Admin
        if (api_is_allowed_to_edit()) {
            // Select all the forum information of all forums (that are not deleted).
            $sql = "SELECT * FROM " . $table_forums . " forum\n                    INNER JOIN " . $table_item_property . " item_properties\n                    ON (\n                        forum.forum_id = item_properties.ref AND\n                        forum.c_id = item_properties.c_id\n                    )\n                    WHERE\n                        item_properties.visibility <> 2 AND\n                        item_properties.tool='" . TOOL_FORUM . "'\n                        {$condition_session} AND\n                        forum.c_id = {$course_id} AND\n                        item_properties.c_id = {$course_id}\n                        {$includeGroupsForumSelect}\n                    ORDER BY forum_order ASC";
            // Select the number of threads of the forums (only the threads that are not deleted).
            $sql2 = "SELECT count(*) AS number_of_threads, threads.forum_id\n                    FROM {$table_threads} threads\n                    INNER JOIN " . $table_item_property . " item_properties\n                    ON (\n                        threads.thread_id=item_properties.ref AND\n                        threads.c_id = item_properties.c_id \n                        {$sessionIdLink}\n                    )\n                    WHERE\n                        item_properties.visibility<>2 AND\n                        item_properties.tool='" . TOOL_FORUM_THREAD . "' AND\n                        threads.c_id = {$course_id} AND\n                        item_properties.c_id = {$course_id}\n                    GROUP BY threads.forum_id";
            // Select the number of posts of the forum.
            $sql3 = "SELECT count(*) AS number_of_posts, posts.forum_id\n                    FROM {$table_posts} posts, {$table_threads} threads, " . $table_item_property . " item_properties\n                    WHERE\n                        posts.thread_id=threads.thread_id AND\n                        threads.thread_id=item_properties.ref AND\n                        threads.session_id = item_properties.session_id AND\n                        item_properties.visibility=1 AND\n                        item_properties.tool='" . TOOL_FORUM_THREAD . "' AND\n                        posts.c_id = {$course_id} AND\n                        threads.c_id = {$course_id} AND\n                        item_properties.c_id = {$course_id}\n                    GROUP BY threads.forum_id";
        }
    } else {
        // GETTING ONE SPECIFIC FORUM
        /* We could do the splitup into student and course admin also but we want
           to have as much as information about a certain forum as possible
           so we do not take too much information into account. This function
            (or this section of the function) is namely used to fill the forms
           when editing a forum (and for the moment it is the only place where
           we use this part of the function) */
        // Select all the forum information of the given forum (that is not deleted).
        $sql = "SELECT * FROM {$table_forums} forum, " . $table_item_property . " item_properties\n                WHERE\n                    forum.forum_id=item_properties.ref AND\n                    forum_id = " . intval($id) . " AND\n                    item_properties.visibility<>2 AND\n                    item_properties.tool='" . TOOL_FORUM . "'\n                    {$condition_session} AND\n                    forum.c_id = {$course_id} AND\n                    item_properties.c_id = {$course_id}\n                ORDER BY forum_order ASC";
        // Select the number of threads of the forum.
        $sql2 = "SELECT count(*) AS number_of_threads, forum_id\n                FROM {$table_threads}\n                WHERE\n                    forum_id = " . intval($id) . " AND\n                    c_id = {$course_id}\n                GROUP BY forum_id";
        // Select the number of posts of the forum.
        $sql3 = "SELECT count(*) AS number_of_posts, forum_id\n                FROM {$table_posts}\n                WHERE\n                    forum_id = " . intval($id) . " AND\n                    c_id = {$course_id}\n                GROUP BY forum_id";
        // Select the last post and the poster (note: this is probably no longer needed).
        $sql4 = "SELECT\n                    post.post_id,\n                    post.forum_id,\n                    post.poster_id,\n                    post.poster_name,\n                    post.post_date,\n                    users.lastname,\n                    users.firstname\n                FROM {$table_posts} post, {$table_users} users\n                WHERE\n                    forum_id = " . intval($id) . " AND\n                    post.poster_id=users.user_id AND\n                    post.c_id = {$course_id}\n                GROUP BY post.forum_id\n                ORDER BY post.post_id ASC";
    }
    // Handling all the forum information.
    $result = Database::query($sql);
    while ($row = Database::fetch_array($result)) {
        if ($id == '') {
            $forum_list[$row['forum_id']] = $row;
        } else {
            $forum_list = $row;
        }
    }
    // Handling the thread count information.
    $result2 = Database::query($sql2);
    while ($row2 = Database::fetch_array($result2)) {
        if ($id == '') {
            $forum_list[$row2['forum_id']]['number_of_threads'] = $row2['number_of_threads'];
        } else {
            $forum_list['number_of_threads'] = $row2['number_of_threads'];
        }
    }
    // Handling the postcount information.
    $result3 = Database::query($sql3);
    while ($row3 = Database::fetch_array($result3)) {
        if ($id == '') {
            // This is needed because sql3 takes also the deleted forums into account.
            if (array_key_exists($row3['forum_id'], $forum_list)) {
                $forum_list[$row3['forum_id']]['number_of_posts'] = $row3['number_of_posts'];
            }
        } else {
            $forum_list['number_of_posts'] = $row3['number_of_posts'];
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:forumfunction.inc.php

示例5: display_blog_list

 /**
  * Blog admin | Returns table with blogs in this course
  */
 public static function display_blog_list()
 {
     global $charset;
     $_user = api_get_user_info();
     $course_id = api_get_course_int_id();
     // Init
     $counter = 0;
     $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
     //condition for the session
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id, false);
     $sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id\n\t\t\t\tFROM {$tbl_blogs} WHERE c_id = {$course_id}\n\t\t\t\tORDER BY date_creation DESC";
     $result = Database::query($sql);
     $list_info = array();
     if (Database::num_rows($result)) {
         while ($row_project = Database::fetch_row($result)) {
             $list_info[] = $row_project;
         }
     }
     $list_content_blog = array();
     $list_body_blog = array();
     $_user = api_get_user_info();
     if (is_array($list_info)) {
         foreach ($list_info as $key => $info_log) {
             // Validation when belongs to a session
             $session_img = api_get_session_image($info_log[4], $_user['status']);
             $url_start_blog = 'blog.php' . "?" . "blog_id=" . $info_log[3] . "&" . api_get_cidreq();
             $title = $info_log[0];
             $image = '<img src="../img/blog.gif" border="0" align="absmiddle" alt="' . $title . '">';
             $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="' . $url_start_blog . '">' . $image . '</a></div><a href="' . $url_start_blog . '">' . $title . '</a>' . $session_img;
             $list_body_blog[] = $list_name;
             $list_body_blog[] = $info_log[1];
             $visibility_icon = $info_log[2] == 0 ? 'invisible' : 'visible';
             $visibility_info = $info_log[2] == 0 ? 'Visible' : 'Invisible';
             $my_image = '<a href="' . api_get_self() . '?action=edit&blog_id=' . $info_log[3] . '">';
             $my_image .= '<img src="../img/edit.gif" border="0" title="' . get_lang('EditBlog') . '" />';
             $my_image .= "</a>\n";
             $my_image .= '<a href="' . api_get_self() . '?action=delete&blog_id=' . $info_log[3] . '" ';
             $my_image .= 'onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . '\')) return false;" >';
             $my_image .= '<img src="../img/delete.gif" border="0" title="' . get_lang('DeleteBlog') . '" />';
             $my_image .= "</a>\n";
             $my_image .= '<a href="' . api_get_self() . '?action=visibility&blog_id=' . $info_log[3] . '">';
             $my_image .= '<img src="../img/' . $visibility_icon . '.gif" border="0" title="' . get_lang($visibility_info) . '" />';
             $my_image .= "</a>\n";
             $list_body_blog[] = $my_image;
             $list_content_blog[] = $list_body_blog;
             $list_body_blog = array();
         }
         $parameters = '';
         //$parameters=array('action'=>Security::remove_XSS($_GET['action']));
         $table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project');
         //$table->set_additional_parameters($parameters);
         $table->set_header(0, get_lang('Title'));
         $table->set_header(1, get_lang('SubTitle'));
         $table->set_header(2, get_lang('Modify'));
         $table->display();
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:61,代码来源:blog.lib.php

示例6: get_links

 /**
  * Creates a link button to select links with contextual JS list with all the links in it
  *
  * @modified 2010.10.12 - adding css classes and simple a tag
  * @return string
  */
 function get_links()
 {
     global $charset;
     $tbl_link = Database::get_course_table(TABLE_LINK);
     $item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id, false);
     //	$sql_link = "SELECT * FROM $tbl_link $condition_session ORDER BY title ASC";
     $sql_link = "SELECT link.* FROM {$tbl_link} link,{$item_property} ip WHERE link.id = ip.ref AND ip.tool = 'link' AND ip.visibility != 2 AND link.session_id = {$session_id} ORDER BY title ASC";
     $res_link = Database::query($sql_link, __FILE__, __LINE__);
     $links_lang_var = api_convert_encoding(get_lang('LpLink'), $charset, api_get_system_encoding());
     $return = '<a href="#" onclick="javascript:popup(\'popUpDiv1\');" class="big_button four_buttons rounded grey_border link_button">' . $links_lang_var . '</a>';
     $links_lang_var = api_convert_encoding(get_lang('Links'), $charset, api_get_system_encoding());
     $close_lang_var = api_convert_encoding(get_lang('Close'), $charset, api_get_system_encoding());
     $linkadd_lang_var = api_convert_encoding(get_lang('LinkAdd'), $charset, api_get_system_encoding());
     $nolinks_lang_var = api_convert_encoding(get_lang('NoLinksAvailable'), $charset, api_get_system_encoding());
     $return .= '<div id="popUpDiv1" class="popUpDiv author_popup gradient rounded_10 grey_border" style="display:none;">' . '<span class="title">' . $links_lang_var . '</span>' . '<a href="#" class="close" onclick="popup(\'popUpDiv1\')">' . $close_lang_var . '</a>';
     $return .= '<div id="resDoc" class="content">';
     while ($row_link = Database::fetch_array($res_link)) {
         $return .= '<div class="lp_resource_element">';
         $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholderminiicon actiondocweb_16x16', 'style' => 'margin-right:5px;', 'title' => ''));
         $return .= '<a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_LINK . '&amp;file=' . $row_link['id'] . '&amp;lp_id=' . $this->lp_id . '">' . api_convert_encoding($row_link['title'], $charset, api_get_system_encoding()) . '</a>';
         $return .= '</div>';
     }
     $return .= '<div class="lp_resource_element">';
     $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholderminiicon actionnewdocweb', 'style' => 'margin-right:5px;', 'title' => ''));
     $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'link/link.php?' . api_get_cidreq() . '&action=addlink&lp_id=' . $this->lp_id . '" title="' . $linkadd_lang_var . '">' . $linkadd_lang_var . '</a>';
     $return .= '</div>';
     if (Database::num_rows($res_link) == 0) {
         $return .= '<div class="lp_resource_element">' . $nolinks_lang_var . '</div>';
     }
     $return .= '</div>';
     $return .= '</div>';
     // ending div#popUpDiv1
     return $return;
 }
开发者ID:Eidn,项目名称:shanghai,代码行数:42,代码来源:learnpath.class.php

示例7: get_all_links

    /**
     * Generate an array of all exercises available.
     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
     */
    public function get_all_links()
    {
        $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
        $TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
        $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course_code . "/document";
        if (empty($this->course_code)) {
            die('Error in get_not_created_links() : course code not set');
        }
        $session_id = api_get_session_id();
        if (empty($session_id)) {
            $session_condition = api_get_session_condition(0, true);
        } else {
            $session_condition = api_get_session_condition($session_id, true, true);
        }
        $sql = 'SELECT id,title from ' . $this->get_exercise_table() . ' 
				WHERE c_id = ' . $this->course_id . ' AND active=1  ' . $session_condition;
        $sql2 = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility, d.id\n                FROM {$TBL_DOCUMENT} d, {$TBL_ITEM_PROPERTY} ip\n                WHERE d.c_id = {$this->course_id} AND\n                      ip.c_id = {$this->course_id} AND\n                d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')AND (d.path LIKE '%HotPotatoes_files%')\n                AND   d.path  LIKE '" . Database::escape_string($uploadPath) . "/%/%' AND ip.visibility='1'";
        /*
        $sql = 'SELECT id,title from '.$this->get_exercise_table().' 
        				WHERE c_id = '.$this->course_id.' AND active=1 AND session_id='.api_get_session_id().'';
        */
        require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php';
        if (!$this->is_hp) {
            $result = Database::query($sql);
        } else {
            $result2 = Database::query($sql2);
        }
        $cats = array();
        if (isset($result)) {
            if (Database::num_rows($result) > 0) {
                while ($data = Database::fetch_array($result)) {
                    $cats[] = array($data['id'], $data['title']);
                }
            }
        }
        if (isset($result2)) {
            if (mysql_numrows($result2) > 0) {
                while ($row = Database::fetch_array($result2)) {
                    /*$path = $data['path'];
                               $fname = GetQuizName($path,$documentPath);
                    		$cats[] = array ($data['id'], $fname);*/
                    $attribute['path'][] = $row['path'];
                    $attribute['visibility'][] = $row['visibility'];
                    $attribute['comment'][] = $row['comment'];
                    $attribute['id'] = $row['id'];
                }
                if (isset($attribute['path']) && is_array($attribute['path'])) {
                    $hotpotatoes_exist = true;
                    while (list($key, $path) = each($attribute['path'])) {
                        $item = '';
                        $title = GetQuizName($path, $documentPath);
                        if ($title == '') {
                            $title = basename($path);
                        }
                        $cats[] = array($attribute['id'], $title . '(HP)');
                    }
                }
            }
        }
        return $cats;
    }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:65,代码来源:exerciselink.class.php

示例8: showlinksofcategory

 /**
  * Displays all the links of a given category.
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
 public static function showlinksofcategory($catid)
 {
     global $urlview, $up, $down, $_user, $token;
     $tbl_link = Database::get_course_table(TABLE_LINK);
     $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
     // Condition for the session.
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id, true, true, 'link.session_id');
     $catid = intval($catid);
     $course_id = api_get_course_int_id();
     $sqlLinks = "SELECT *, link.id FROM {$tbl_link} link\n                     INNER JOIN {$TABLE_ITEM_PROPERTY} itemproperties\n                     ON (link.id=itemproperties.ref AND link.c_id = itemproperties.c_id )\n                     WHERE\n                        itemproperties.tool='" . TOOL_LINK . "' AND\n                        link.category_id='" . $catid . "' AND\n                        (itemproperties.visibility='0' OR itemproperties.visibility='1')\n                        {$condition_session} AND\n                        link.c_id = " . $course_id . " AND\n                        itemproperties.c_id = " . $course_id . "\n                    ORDER BY link.display_order DESC";
     $result = Database::query($sqlLinks);
     $numberoflinks = Database::num_rows($result);
     if ($numberoflinks > 0) {
         echo '<table class="data_table" width="100%">';
         $i = 1;
         while ($myrow = Database::fetch_array($result)) {
             // Validation when belongs to a session.
             $session_img = api_get_session_image($myrow['session_id'], $_user['status']);
             $css_class = $i % 2 == 0 ? $css_class = 'row_odd' : ($css_class = 'row_even');
             $link_validator = '';
             if (api_is_allowed_to_edit(null, true)) {
                 $link_validator = Display::url(Display::return_icon('preview_view.png', get_lang('CheckURL'), array(), 16), '#', array('onclick' => "check_url('" . $myrow['id'] . "', '" . addslashes($myrow['url']) . "');"));
                 $link_validator .= Display::span('', array('id' => 'url_id_' . $myrow['id']));
             }
             if ($myrow['visibility'] == '1') {
                 echo '<tr class="' . $css_class . '">';
                 echo '<td align="center" valign="middle" width="5%">';
                 echo '<a href="link_goto.php?' . api_get_cidreq() . '&link_id=' . $myrow['id'] . '&link_url=' . urlencode($myrow['url']) . '" target="_blank">
                         <img src="../../main/img/link.gif" border="0" alt="' . get_lang('Link') . '"/></a>
                     </td>
                     <td width="80%" valign="top">
                     <a href="link_goto.php?' . api_get_cidreq() . '&link_id=' . $myrow['id'] . '&link_url=' . urlencode($myrow['url']) . '" target="' . $myrow['target'] . '">';
                 echo Security::remove_XSS($myrow['title']);
                 echo '</a>';
                 echo $link_validator;
                 echo $session_img;
                 echo '<br />' . $myrow['description'];
             } else {
                 if (api_is_allowed_to_edit(null, true)) {
                     echo '<tr class="' . $css_class . '">';
                     echo '<td align="center" valign="middle" width="5%">
                         <a href="link_goto.php?' . api_get_cidreq() . '&link_id=' . $myrow['id'] . "\n                            &link_url=" . urlencode($myrow['url']) . '"
                         target="_blank" class="invisible">';
                     echo Display::return_icon('link_na.gif', get_lang('Link')), '</a>';
                     echo '</td><td width="80%" valign="top">
                           <a href="link_goto.php?', api_get_cidreq(), '&link_id=', $myrow['id'], '&link_url=', urlencode($myrow['url']), '" target="', $myrow['target'], '"  class="invisible">';
                     echo Security::remove_XSS($myrow['title']);
                     echo "</a>";
                     echo $link_validator;
                     echo $session_img, '<br />', $myrow['description'];
                 }
             }
             if (api_is_allowed_to_edit(null, true)) {
                 echo '<td style="text-align:center;">';
                 if ($session_id == $myrow['session_id']) {
                     $url = api_get_self() . '?' . api_get_cidreq() . '&action=editlink&category=' . (!empty($category) ? $category : '') . '&id=' . $myrow['id'] . '&category_id=' . $myrow['id'];
                     echo '<a href="' . $url . '">' . Display::return_icon('edit.png', get_lang('Modify'), array(), ICON_SIZE_SMALL) . '</a>';
                     // DISPLAY MOVE UP COMMAND only if it is not the top link.
                     /* commented at least since 2014-10-11
                                             if ($i != 1) {
                                                 echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .  '&sec_token='.$token.'&urlview=' . $urlview . '&up=', $myrow[0], '" title="' . get_lang('Up') . '">' . Display :: return_icon('up.png', get_lang('Up'), array (), ICON_SIZE_SMALL) . '', "</a>\n";
                                             } else {
                                                 echo Display :: return_icon('up_na.png', get_lang('Up'), array (), ICON_SIZE_SMALL) . '</a>';
                                             }
                     
                                             // DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
                                             if ($i < $numberoflinks) {
                                                 echo '<a href="' . api_get_self() . '?' . api_get_cidreq() .  '&sec_token='.$token.'&urlview=' . $urlview . '&down=' . $myrow[0] . '" title="' . get_lang('Down') . '">' . Display :: return_icon('down.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '', "</a>\n";
                                             } else {
                                                 echo Display :: return_icon('down_na.png', get_lang('Down'), array (), ICON_SIZE_SMALL) . '', "</a>\n";
                                             }*/
                     if ($myrow['visibility'] == '1') {
                         echo '<a href="link.php?' . api_get_cidreq() . '&sec_token=' . $token . '&action=invisible&id=' . $myrow['id'] . '&scope=link&category_id=' . $myrow['category_id'] . '" title="' . get_lang('Hide') . '">' . Display::return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL) . '</a>';
                     }
                     if ($myrow['visibility'] == '0') {
                         echo ' <a href="link.php?' . api_get_cidreq() . '&sec_token=' . $token . '&action=visible&id=' . $myrow['id'] . '&scope=link&category_id=' . $myrow['category_id'] . '" title="' . get_lang('Show') . '">' . Display::return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL) . '</a>';
                     }
                     echo ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=deletelink&id=' . $myrow['id'] . '&category_id=' . $myrow['category_id'] . "\"\n                            onclick=\"javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "'))\n                            return false;\" title=\"" . get_lang('Delete') . '">' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
                 } else {
                     echo Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array(), ICON_SIZE_SMALL);
                     //get_lang('EditionNotAvailableFromSession');
                 }
                 echo '</td>';
             }
             echo '</tr>';
             $i++;
         }
         echo '</table>';
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:95,代码来源:link.lib.php

示例9: get_group_list

 /**
  * Get list of groups for current course.
  * @param int $category The id of the category from which the groups are
  * requested
  * @param string $course_code Default is current course
  * @return array An array with all information about the groups.
  */
 public static function get_group_list($category = null, $course_code = null)
 {
     $my_user_id = api_get_user_id();
     $course_info = api_get_course_info($course_code);
     $course_id = $course_info['real_id'];
     $table_group_user = Database::get_course_table(TABLE_GROUP_USER);
     $table_group = Database::get_course_table(TABLE_GROUP);
     //condition for the session
     $session_id = api_get_session_id();
     $my_status_of_user_in_course = CourseManager::get_user_in_course_status($my_user_id, $course_info['code']);
     $is_student_in_session = false;
     if (is_null($my_status_of_user_in_course) || $my_status_of_user_in_course == '') {
         if ($session_id > 0) {
             $is_student_in_session = true;
         }
     }
     // COURSEMANAGER or STUDENT
     if ($my_status_of_user_in_course == COURSEMANAGER || api_is_allowed_to_edit(null, true) || api_is_drh()) {
         $can_see_groups = 1;
         $sql = "SELECT g.iid,\n                        g.name,\n                        g.description,\n                        g.category_id,\n                        g.max_student maximum_number_of_members,\n                        g.secret_directory,\n                        g.self_registration_allowed,\n                        g.self_unregistration_allowed,\n                        g.session_id\n                    FROM {$table_group} g ";
     } elseif ($my_status_of_user_in_course == STUDENT || $is_student_in_session === true || $_SESSION['studentview'] == 'studentview') {
         $can_see_groups = 1;
         $sql = "SELECT g.iid,\n                        g.name,\n                        g.description,\n                        g.category_id,\n                        g.max_student maximum_number_of_members,\n                        g.secret_directory,\n                        g.self_registration_allowed,\n                        g.self_unregistration_allowed,\n                        g.session_id,\n                        ug.user_id is_member\n                    FROM {$table_group} g\n                    LEFT JOIN {$table_group_user} ug\n                    ON (ug.group_id = g.iid AND ug.user_id = '" . api_get_user_id() . "' AND ug.c_id = {$course_id} AND g.c_id = {$course_id})";
     }
     $sql .= " WHERE 1=1 ";
     if ($category != null) {
         $sql .= "  AND g.category_id = '" . Database::escape_string($category) . "' ";
         $session_condition = api_get_session_condition($session_id);
         if (!empty($session_condition)) {
             $sql .= $session_condition;
         }
     } else {
         $session_condition = api_get_session_condition($session_id, true);
     }
     $sql .= " AND g.c_id = {$course_id} ";
     if (!empty($session_condition)) {
         $sql .= $session_condition;
     }
     $sql .= " GROUP BY g.iid ORDER BY UPPER(g.name)";
     if ($can_see_groups == 1) {
         $groupList = Database::query($sql);
     } else {
         return array();
     }
     $groups = array();
     while ($thisGroup = Database::fetch_array($groupList)) {
         $thisGroup['id'] = $thisGroup['iid'];
         $thisGroup['is_member'] = self::is_subscribed($my_user_id, $thisGroup['id']);
         $thisGroup['number_of_members'] = count(self::get_subscribed_users($thisGroup['id']));
         if ($thisGroup['session_id'] != 0) {
             $sql = 'SELECT name FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . '
                     WHERE id=' . $thisGroup['session_id'];
             $rs_session = Database::query($sql);
             if (Database::num_rows($rs_session) > 0) {
                 $thisGroup['session_name'] = Database::result($rs_session, 0, 0);
             }
         }
         $groups[] = $thisGroup;
     }
     return $groups;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:68,代码来源:groupmanager.lib.php

示例10: get_data_by_id

 /**
  * @param int $id
  * @param string $course_code
  * @param int $session_id
  *
  * @return array
  */
 public function get_data_by_id($id, $course_code = '', $session_id = null)
 {
     $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
     $course_id = api_get_course_int_id();
     if (!isset($session_id)) {
         $session_id = $this->session_id;
     }
     $condition_session = api_get_session_condition($session_id);
     if (!empty($course_code)) {
         $course_info = api_get_course_info($course_code);
         $course_id = $course_info['real_id'];
     }
     $id = intval($id);
     $sql = "SELECT * FROM {$tbl_course_description}\n\t\t        WHERE c_id = {$course_id} AND id='{$id}' {$condition_session} ";
     $rs = Database::query($sql);
     $data = array();
     if ($description = Database::fetch_array($rs)) {
         $data['description_type'] = $description['description_type'];
         $data['description_title'] = $description['title'];
         $data['description_content'] = $description['content'];
         $data['progress'] = $description['progress'];
     }
     return $data;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:course_description.lib.php

示例11: autolaunch

 /**
  * @return array
  */
 private function autolaunch()
 {
     $showAutoLaunchExerciseWarning = false;
     // Exercise auto-launch
     $auto_launch = api_get_course_setting('enable_exercise_auto_launch');
     if (!empty($auto_launch)) {
         $session_id = api_get_session_id();
         //Exercise list
         if ($auto_launch == 2) {
             if (api_is_platform_admin() || api_is_allowed_to_edit()) {
                 $showAutoLaunchExerciseWarning = true;
             } else {
                 $session_key = 'exercise_autolunch_' . $session_id . '_' . api_get_course_int_id() . '_' . api_get_user_id();
                 if (!isset($_SESSION[$session_key])) {
                     //redirecting to the Exercise
                     $url = api_get_path(WEB_CODE_PATH) . 'exercice/exercice.php?' . api_get_cidreq() . '&id_session=' . $session_id;
                     $_SESSION[$session_key] = true;
                     header("Location: {$url}");
                     exit;
                 }
             }
         } else {
             $table = \Database::get_course_table(TABLE_QUIZ_TEST);
             $course_id = api_get_course_int_id();
             $condition = '';
             if (!empty($session_id)) {
                 $condition = api_get_session_condition($session_id);
                 $sql = "SELECT iid FROM {$table} WHERE c_id = {$course_id} AND autolaunch = 1 {$condition} LIMIT 1";
                 $result = \Database::query($sql);
                 //If we found nothing in the session we just called the session_id =  0 autolaunch
                 if (\Database::num_rows($result) == 0) {
                     $condition = '';
                 } else {
                     //great, there is an specific auto lunch for this session we leave the $condition
                 }
             }
             $sql = "SELECT iid FROM {$table} WHERE c_id = {$course_id} AND autolaunch = 1 {$condition} LIMIT 1";
             $result = \Database::query($sql);
             if (\Database::num_rows($result) > 0) {
                 $data = \Database::fetch_array($result, 'ASSOC');
                 if (!empty($data['iid'])) {
                     if (api_is_platform_admin() || api_is_allowed_to_edit()) {
                         $showAutoLaunchExerciseWarning = true;
                     } else {
                         $session_key = 'exercise_autolunch_' . $session_id . '_' . api_get_course_int_id() . '_' . api_get_user_id();
                         if (!isset($_SESSION[$session_key])) {
                             //redirecting to the LP
                             $url = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . api_get_cidreq() . '&exerciseId=' . $data['iid'];
                             $_SESSION[$session_key] = true;
                             header("Location: {$url}");
                             exit;
                         }
                     }
                 }
             }
         }
     }
     /* Auto launch code */
     $showAutoLaunchLpWarning = false;
     $auto_launch = api_get_course_setting('enable_lp_auto_launch');
     if (!empty($auto_launch)) {
         $session_id = api_get_session_id();
         //LP list
         if ($auto_launch == 2) {
             if (api_is_platform_admin() || api_is_allowed_to_edit()) {
                 $showAutoLaunchLpWarning = true;
             } else {
                 $session_key = 'lp_autolunch_' . $session_id . '_' . api_get_course_int_id() . '_' . api_get_user_id();
                 if (!isset($_SESSION[$session_key])) {
                     //redirecting to the LP
                     $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&id_session=' . $session_id;
                     $_SESSION[$session_key] = true;
                     header("Location: {$url}");
                     exit;
                 }
             }
         } else {
             $lp_table = \Database::get_course_table(TABLE_LP_MAIN);
             $course_id = api_get_course_int_id();
             $condition = '';
             if (!empty($session_id)) {
                 $condition = api_get_session_condition($session_id);
                 $sql = "SELECT id FROM {$lp_table} WHERE c_id = {$course_id} AND autolunch = 1 {$condition} LIMIT 1";
                 $result = \Database::query($sql);
                 //If we found nothing in the session we just called the session_id =  0 autolunch
                 if (\Database::num_rows($result) == 0) {
                     $condition = '';
                 } else {
                     //great, there is an specific auto lunch for this session we leave the $condition
                 }
             }
             $sql = "SELECT id FROM {$lp_table} WHERE c_id = {$course_id} AND autolunch = 1 {$condition} LIMIT 1";
             $result = \Database::query($sql);
             if (\Database::num_rows($result) > 0) {
                 $lp_data = \Database::fetch_array($result, 'ASSOC');
                 if (!empty($lp_data['id'])) {
                     if (api_is_platform_admin() || api_is_allowed_to_edit()) {
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:CourseHomeController.php

示例12: api_get_course_int_id

     } else {
         $session_key = 'lp_autolaunch_' . $session_id . '_' . api_get_course_int_id() . '_' . api_get_user_id();
         if (!isset($_SESSION[$session_key])) {
             //redirecting to the LP
             $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&id_session=' . $session_id;
             $_SESSION[$session_key] = true;
             header("Location: {$url}");
             exit;
         }
     }
 } else {
     $lp_table = Database::get_course_table(TABLE_LP_MAIN);
     $course_id = api_get_course_int_id();
     $condition = '';
     if (!empty($session_id)) {
         $condition = api_get_session_condition($session_id);
         $sql = "SELECT id FROM {$lp_table}\n                    WHERE c_id = {$course_id} AND autolaunch = 1 {$condition}\n                    LIMIT 1";
         $result = Database::query($sql);
         //If we found nothing in the session we just called the session_id =  0 autolaunch
         if (Database::num_rows($result) == 0) {
             $condition = '';
         } else {
             //great, there is an specific auto launch for this session we leave the $condition
         }
     }
     $sql = "SELECT id FROM {$lp_table}\n                WHERE c_id = {$course_id} AND autolaunch = 1 {$condition}\n                LIMIT 1";
     $result = Database::query($sql);
     if (Database::num_rows($result) > 0) {
         $lp_data = Database::fetch_array($result, 'ASSOC');
         if (!empty($lp_data['id'])) {
             if (api_is_platform_admin() || api_is_allowed_to_edit()) {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:course_home.php

示例13: get_total_folder_size

/**
 * Calculates the total size of a directory by adding the sizes (that
 * are stored in the database) of all files & folders in this directory.
 *
 * @param 	string  $path
 * @param 	boolean $can_see_invisible
 * @return 	int Total size
 */
function get_total_folder_size($path, $can_see_invisible = false)
{
    $table_itemproperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
    $table_document = Database::get_course_table(TABLE_DOCUMENT);
    $tool_document = TOOL_DOCUMENT;
    $course_id = api_get_course_int_id();
    $session_id = api_get_session_id();
    $session_condition = api_get_session_condition($session_id, true, true, 'props.session_id');
    $visibility_rule = ' props.visibility ' . ($can_see_invisible ? '<> 2' : '= 1');
    $sql = "SELECT SUM(table1.size) FROM (\n                SELECT size\n                FROM {$table_itemproperty} AS props, {$table_document} AS docs\n                WHERE\n                    docs.c_id \t= {$course_id} AND\n                    docs.id \t= props.ref AND\n                    docs.path LIKE '{$path}/%' AND\n                    props.c_id \t= {$course_id} AND\n                    props.tool \t= '{$tool_document}' AND\n                    {$visibility_rule}\n                    {$session_condition}\n                GROUP BY ref\n            ) as table1";
    $result = Database::query($sql);
    if ($result && Database::num_rows($result) != 0) {
        $row = Database::fetch_row($result);
        return $row[0] == null ? 0 : $row[0];
    } else {
        return 0;
    }
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:26,代码来源:fileDisplay.lib.php

示例14: get_thematic_list

 /**
  * get thematic list
  * @param	int		Thematic id (optional), get list by id
  * @return	array	Thematic data
  */
 public static function get_thematic_list($thematic_id = null, $course_code = null, $session_id = null)
 {
     // set current course and session
     $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
     $course_info = api_get_course_info($course_code);
     $course_id = $course_info['real_id'];
     if (isset($session_id)) {
         $session_id = intval($session_id);
     } else {
         $session_id = api_get_session_id();
     }
     $data = array();
     if (isset($thematic_id)) {
         $thematic_id = intval($thematic_id);
         $condition = " WHERE id = {$thematic_id} AND active = 1 ";
     } else {
         if (empty($session_id)) {
             $condition_session = api_get_session_condition(0);
         } else {
             $condition_session = api_get_session_condition($session_id, true, true);
         }
         $condition = " WHERE active = 1 {$condition_session} ";
     }
     $sql = "SELECT * FROM {$tbl_thematic} {$condition} AND c_id = {$course_id}\n                ORDER BY display_order ";
     $res = Database::query($sql);
     if (Database::num_rows($res) > 0) {
         if (!empty($thematic_id)) {
             $data = Database::fetch_array($res, 'ASSOC');
         } else {
             while ($row = Database::fetch_array($res, 'ASSOC')) {
                 $data[$row['id']] = $row;
             }
         }
     }
     return $data;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:41,代码来源:thematic.lib.php

示例15: get_glossary_data

 /**
  * Get all the data of a glossary
  *
  * @param integer From which item
  * @param integer Number of items to collect
  * @param string  Name of column on which to order
  * @param string  Whether to sort in ascending (ASC) or descending (DESC)
  * @return unknown
  *
  * @author Patrick Cool <patrick.cool@ugent.be>
  * @author Julio Montoya fixing this function, adding intvals
  * @version januari 2009, dokeos 1.8.6
  */
 public static function get_glossary_data($from, $number_of_items, $column, $direction)
 {
     global $_user;
     // Database table definition
     $t_glossary = Database::get_course_table(TABLE_GLOSSARY);
     $t_item_propery = Database::get_course_table(TABLE_ITEM_PROPERTY);
     if (api_is_allowed_to_edit(null, true)) {
         $col2 = " glossary.glossary_id\tas col2, ";
     } else {
         $col2 = " ";
     }
     //condition for the session
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id, true, true);
     $column = intval($column);
     if (!in_array($direction, array('DESC', 'ASC'))) {
         $direction = 'ASC';
     }
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     $sql = "SELECT glossary.name \t\t\tas col0,\n\t\t\t\t\t   glossary.description \tas col1,\n\t\t\t\t\t   {$col2}\n\t\t\t\t\t   glossary.session_id as session_id\n\t\t\t\tFROM {$t_glossary} glossary, {$t_item_propery} ip\n\t\t\t\tWHERE \tglossary.glossary_id = ip.ref AND\n\t\t\t\t\t\ttool = '" . TOOL_GLOSSARY . "' {$condition_session} AND\n\t\t\t\t\t\tglossary.c_id = " . api_get_course_int_id() . " AND\n\t\t\t\t\t\tip.c_id = " . api_get_course_int_id() . "\n\t\t        ORDER BY col{$column} {$direction}\n\t\t        LIMIT {$from},{$number_of_items}";
     $res = Database::query($sql);
     $return = array();
     $array = array();
     while ($data = Database::fetch_array($res)) {
         //validacion when belongs to a session
         $session_img = api_get_session_image($data['session_id'], $_user['status']);
         $array[0] = $data[0] . $session_img;
         if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') {
             $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
         } else {
             $array[1] = $data[1];
         }
         if (api_is_allowed_to_edit(null, true)) {
             // Date treatment for timezones
             /*if (!empty($data[2])  && $data[2] != '0000-00-00 00:00:00:') {
                   $array[2] = api_get_local_time($data[2], null, date_default_timezone_get());
               }
               if (!empty($data[3])  && $data[3] != '0000-00-00 00:00:00:') {
                   $array[3] = api_get_local_time($data[3], null, date_default_timezone_get());
               }*/
             $array[2] = $data[2];
         }
         $return[] = $array;
     }
     return $return;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:60,代码来源:glossary.lib.php


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