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


PHP api_get_multiple_access_url函数代码示例

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


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

示例1: LoginCheck

function LoginCheck($uid)
{
    $_course = api_get_course_info();
    $uid = (int) $uid;
    $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
    if (!empty($uid)) {
        $user_ip = '';
        if (!empty($_SERVER['REMOTE_ADDR'])) {
            $user_ip = Database::escape_string(api_get_real_ip());
        }
        $login_date = api_get_utc_datetime();
        $access_url_id = 1;
        if (api_get_multiple_access_url() && api_get_current_access_url_id() != -1) {
            $access_url_id = api_get_current_access_url_id();
        }
        $session_id = api_get_session_id();
        // if the $_course array exists this means we are in a course and we have to store this in the who's online table also
        // to have the x users in this course feature working
        if (is_array($_course) && count($_course) > 0 && !empty($_course['id'])) {
            $query = "REPLACE INTO " . $online_table . " (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)\n                      VALUES ({$uid},{$uid},'{$login_date}','{$user_ip}', '" . $_course['real_id'] . "' , '{$session_id}' , '{$access_url_id}' )";
        } else {
            $query = "REPLACE INTO " . $online_table . " (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)\n                      VALUES ({$uid},{$uid},'{$login_date}','{$user_ip}', 0, '{$session_id}', '{$access_url_id}')";
        }
        Database::query($query);
    }
}
开发者ID:daffef,项目名称:chamilo-lms,代码行数:26,代码来源:online.inc.php

示例2: create_session

 /**
  * Create a session
  * @author Carlos Vargas <carlos.vargas@beeznest.com>, from existing code
  * @param   string  $name
  * @param   string  $startDate (YYYY-MM-DD hh:mm:ss)
  * @param   string  $endDate (YYYY-MM-DD hh:mm:ss)
  * @param   string  $displayStartDate (YYYY-MM-DD hh:mm:ss)
  * @param   string  $displayEndDate (YYYY-MM-DD hh:mm:ss)
  * @param   string  $coachStartDate (YYYY-MM-DD hh:mm:ss)
  * @param   string  $coachEndDate (YYYY-MM-DD hh:mm:ss)
  * @param   mixed   $coachId If integer, this is the session coach id, if string, the coach ID will be looked for from the user table
  * @param   integer $sessionCategoryId ID of the session category in which this session is registered
  * @param   integer $visibility Visibility after end date (0 = read-only, 1 = invisible, 2 = accessible)
  * @param   bool    $fixSessionNameIfExists
  * @param   string  $duration
  * @param   string  $description Optional. The session description
  * @param   int     $showDescription Optional. Whether show the session description
  * @param   array   $extraFields
  * @param   int     $sessionAdminId Optional. If this sessions was created by a session admin, assign it to him
  * @param boolean $sendSubscritionNotification Optional.
  *          Whether send a mail notification to users being subscribed
  * @todo use an array to replace all this parameters or use the model.lib.php ...
  * @return mixed       Session ID on success, error message otherwise
  * */
 public static function create_session($name, $startDate, $endDate, $displayStartDate, $displayEndDate, $coachStartDate, $coachEndDate, $coachId, $sessionCategoryId, $visibility = 1, $fixSessionNameIfExists = false, $duration = null, $description = null, $showDescription = 0, $extraFields = array(), $sessionAdminId = 0, $sendSubscritionNotification = false)
 {
     global $_configuration;
     //Check portal limits
     $access_url_id = 1;
     if (api_get_multiple_access_url()) {
         $access_url_id = api_get_current_access_url_id();
     }
     if (is_array($_configuration[$access_url_id]) && isset($_configuration[$access_url_id]['hosting_limit_sessions']) && $_configuration[$access_url_id]['hosting_limit_sessions'] > 0) {
         $num = self::count_sessions();
         if ($num >= $_configuration[$access_url_id]['hosting_limit_sessions']) {
             api_warn_hosting_contact('hosting_limit_sessions');
             return get_lang('PortalSessionsLimitReached');
         }
     }
     $name = Database::escape_string(trim($name));
     $sessionCategoryId = intval($sessionCategoryId);
     $visibility = intval($visibility);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $startDate = Database::escape_string($startDate);
     $endDate = Database::escape_string($endDate);
     if (empty($name)) {
         $msg = get_lang('SessionNameIsRequired');
         return $msg;
     } elseif (empty($coachId)) {
         $msg = get_lang('CoachIsRequired');
         return $msg;
     } elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i') && !api_is_valid_date($startDate, 'Y-m-d H:i:s')) {
         $msg = get_lang('InvalidStartDate');
         return $msg;
     } elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i') && !api_is_valid_date($endDate, 'Y-m-d H:i:s')) {
         $msg = get_lang('InvalidEndDate');
         return $msg;
     } elseif (!empty($startDate) && !empty($endDate) && $startDate >= $endDate) {
         $msg = get_lang('StartDateShouldBeBeforeEndDate');
         return $msg;
     } else {
         $ready_to_create = false;
         if ($fixSessionNameIfExists) {
             $name = self::generateNextSessionName($name);
             if ($name) {
                 $ready_to_create = true;
             } else {
                 $msg = get_lang('SessionNameAlreadyExists');
                 return $msg;
             }
         } else {
             $rs = Database::query("SELECT 1 FROM {$tbl_session} WHERE name='" . $name . "'");
             if (Database::num_rows($rs)) {
                 $msg = get_lang('SessionNameAlreadyExists');
                 return $msg;
             }
             $ready_to_create = true;
         }
         if ($ready_to_create) {
             $sessionAdminId = !empty($sessionAdminId) ? $sessionAdminId : api_get_user_id();
             $values = array('name' => $name, 'id_coach' => $coachId, 'session_admin_id' => $sessionAdminId, 'visibility' => $visibility, 'description' => $description, 'show_description' => intval($showDescription), 'send_subscription_notification' => $sendSubscritionNotification);
             if (!empty($startDate)) {
                 $values['access_start_date'] = $startDate;
             }
             if (!empty($endDate)) {
                 $values['access_end_date'] = $endDate;
             }
             if (!empty($displayStartDate)) {
                 $values['display_start_date'] = $displayStartDate;
             }
             if (!empty($displayEndDate)) {
                 $values['display_end_date'] = $displayEndDate;
             }
             if (!empty($coachStartDate)) {
                 $values['coach_access_start_date'] = $coachStartDate;
             }
             if (!empty($coachEndDate)) {
                 $values['coach_access_end_date'] = $coachEndDate;
             }
             if (!empty($sessionCategoryId)) {
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:sessionmanager.lib.php

示例3: create_session

    /**
     * Create a session
     * @author Carlos Vargas <carlos.vargas@beeznest.com>, from existing code
     * @param	string 		name
     * @param 	integer		Start year (yyyy)
     * @param 	integer		Start month (mm)
     * @param 	integer		Start day (dd)
     * @param 	integer		End year (yyyy)
     * @param 	integer		End month (mm)
     * @param 	integer		End day (dd)
     * @param 	integer		Number of days that the coach can access the session before the start date
     * @param 	integer		Number of days that the coach can access the session after the end date
     * @param 	integer		If 1, means there are no date limits
     * @param 	mixed		If integer, this is the session coach id, if string, the coach ID will be looked for from the user table
     * @param 	integer		ID of the session category in which this session is registered
     * @param  integer     Visibility after end date (0 = read-only, 1 = invisible, 2 = accessible)
     * @param  string      Start limit = true if the start date has to be considered
     * @param  string      End limit = true if the end date has to be considered
     * @param  string $fix_name
     * @todo use an array to replace all this parameters or use the model.lib.php ...
     * @return mixed       Session ID on success, error message otherwise
     * */
    public static function create_session(
        $sname,
        $syear_start,
        $smonth_start,
        $sday_start,
        $syear_end,
        $smonth_end,
        $sday_end,
        $snb_days_acess_before,
        $snb_days_acess_after,
        $nolimit,
        $coach_username,
        $id_session_category,
        $id_visibility,
        $start_limit = true,
        $end_limit = true,
        $fix_name = false,
        $duration = null,
        $showDescription = null
    ) {
        global $_configuration;

        //Check portal limits
        $access_url_id = 1;

        if (api_get_multiple_access_url()) {
            $access_url_id = api_get_current_access_url_id();
        }

        if (is_array($_configuration[$access_url_id]) &&
            isset($_configuration[$access_url_id]['hosting_limit_sessions']) &&
            $_configuration[$access_url_id]['hosting_limit_sessions'] > 0
        ) {
            $num = self::count_sessions();
            if ($num >= $_configuration[$access_url_id]['hosting_limit_sessions']) {
                api_warn_hosting_contact('hosting_limit_sessions');
                return get_lang('PortalSessionsLimitReached');
            }
        }

        $name = Database::escape_string(trim($sname));
        $year_start = intval($syear_start);
        $month_start = intval($smonth_start);
        $day_start = intval($sday_start);
        $year_end = intval($syear_end);
        $month_end = intval($smonth_end);
        $day_end = intval($sday_end);
        $nb_days_acess_before = intval($snb_days_acess_before);
        $nb_days_acess_after = intval($snb_days_acess_after);
        $id_session_category = intval($id_session_category);
        $id_visibility = intval($id_visibility);
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

        if (is_int($coach_username)) {
            $id_coach = $coach_username;
        } else {
            $sql = 'SELECT user_id FROM ' . $tbl_user . ' WHERE username="' . Database::escape_string($coach_username) . '"';
            $rs = Database::query($sql);
            $id_coach = Database::result($rs, 0, 'user_id');
        }

        if (empty($nolimit)) {
            $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
            $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
        } else {
            $id_visibility = 1; // by default session visibility is read only
            $date_start = "0000-00-00";
            $date_end = "0000-00-00";
        }

        if (empty($end_limit)) {
            $date_end = "0000-00-00";
            $id_visibility = 1; // by default session visibility is read only
        }

        if (empty($start_limit)) {
            $date_start = "0000-00-00";
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:sessionmanager.lib.php

示例4: get_user_data

 /** Used by the widescale plugin */
 static function get_user_data($from, $number_of_items, $column, $direction, $get_count = false)
 {
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $select = "SELECT\n                     u.user_id,\n                     u.username,\n                     u.firstname,\n                     u.lastname,\n                     ufv1.field_value as exam_password\n                     ";
     if ($get_count) {
         $select = "SELECT count(u.user_id) as total_rows";
     }
     $sql = "{$select} FROM {$user_table} u ";
     // adding the filter to see the user's only of the current access_url
     if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
         $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $sql .= " INNER JOIN {$access_url_rel_user_table} url_rel_user ON (u.user_id=url_rel_user.user_id)";
     }
     $extra_fields = array('exam_password', 'exam_room', 'exam_schedule');
     $counter = 1;
     $where_condition = "";
     $and_conditions = array();
     foreach ($extra_fields as $keyword_extra_data) {
         $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
         $field_id = $extra_info['id'];
         $table_alias = "ufv{$counter}";
         $sql .= " INNER JOIN user_field_values {$table_alias} ON u.user_id = {$table_alias}.user_id AND {$table_alias}.field_id = {$field_id} ";
         $counter++;
         if ($keyword_extra_data == 'exam_password') {
             continue;
         }
         $keyword_extra_data_text = UserManager::get_extra_user_data_by_field(api_get_user_id(), $extra_info['field_variable']);
         $keyword_extra_data_text = $keyword_extra_data_text[$extra_info['field_variable']];
         if (!empty($keyword_extra_data_text)) {
             $and_conditions[] = " {$table_alias}.field_value LIKE '%" . trim($keyword_extra_data_text) . "%' ";
         }
     }
     if (!empty($and_conditions)) {
         $where_condition = implode(' AND ', $and_conditions);
     }
     if (!empty($where_condition)) {
         $sql .= " WHERE  {$where_condition} ";
     }
     $sql .= " AND u.user_id <> " . api_get_user_id();
     // adding the filter to see the user's only of the current access_url
     if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
         $sql .= " AND url_rel_user.access_url_id=" . api_get_current_access_url_id();
     }
     if (!in_array($direction, array('ASC', 'DESC'))) {
         $direction = 'ASC';
     }
     if (in_array($column, array('username', 'firstname', 'lastname'))) {
         $column = $column;
     }
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     //Returns counts and exits function
     if ($get_count) {
         $res = Database::query($sql);
         $user = Database::fetch_array($res);
         return $user['total_rows'];
     }
     $sql .= " ORDER BY {$column} {$direction} ";
     $sql .= " LIMIT {$from}, {$number_of_items}";
     $res = Database::query($sql);
     $users = array();
     while ($user = Database::fetch_array($res, 'ASSOC')) {
         $users[] = $user;
     }
     return $users;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:67,代码来源:usermanager.lib.php

示例5: who_is_online_count

 public static function who_is_online_count($time_limit = null, $friends = false)
 {
     if (empty($time_limit)) {
         $time_limit = api_get_setting('time_limit_whosonline');
     } else {
         $time_limit = intval($time_limit);
     }
     $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
     $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     $query = '';
     $online_time = time() - $time_limit * 60;
     $current_date = api_get_utc_datetime($online_time);
     if ($friends) {
         // 	who friends from social network is online
         $query = "SELECT DISTINCT count(login_user_id) as count\n                      FROM {$track_online_table} INNER JOIN {$friend_user_table} ON (friend_user_id = login_user_id)\n                      WHERE login_date >= '{$current_date}' AND friend_user_id <> '" . api_get_user_id() . "' AND relation_type='" . USER_RELATION_TYPE_FRIEND . "' AND user_id = '" . api_get_user_id() . "' ";
     } else {
         // All users online
         $query = "SELECT count(login_id) as count\n                      FROM {$track_online_table} track INNER JOIN {$table_user} u ON (u.user_id=track.login_user_id)\n                      WHERE u.status != " . ANONYMOUS . " AND login_date >= '{$current_date}'  ";
     }
     if (api_get_multiple_access_url()) {
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             if ($friends) {
                 // 	friends from social network is online
                 $query = "SELECT DISTINCT count(login_user_id) as count\n                                FROM {$track_online_table} track\n                                INNER JOIN {$friend_user_table} ON (friend_user_id = login_user_id)\n                                WHERE track.access_url_id = {$access_url_id} AND login_date >= '" . $current_date . "' AND friend_user_id <> '" . api_get_user_id() . "' AND relation_type='" . USER_RELATION_TYPE_FRIEND . "'  ";
             } else {
                 // all users online
                 $query = "SELECT count(login_id) as count FROM {$track_online_table} track\n                              INNER JOIN {$table_user} u ON (u.user_id=track.login_user_id)\n                              WHERE u.status != " . ANONYMOUS . " AND track.access_url_id =  {$access_url_id} AND login_date >= '{$current_date}' ";
             }
         }
     }
     //Dev purposes show all users online
     /*$table_user = Database::get_main_table(TABLE_MAIN_USER);
       $query = "SELECT count(*)  as count FROM ".$table_user ."   ";*/
     $result = Database::query($query);
     if (Database::num_rows($result) > 0) {
         $row = Database::fetch_array($result);
         return $row['count'];
     } else {
         return false;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:43,代码来源:online.inc.php

示例6: subscribeUsersToUser

 /**
  * Add subscribed users to a user by relation type
  * @param int $userId The user id
  * @param array $subscribedUsersId The id of suscribed users
  * @param action $relationType The relation type
  */
 public static function subscribeUsersToUser($userId, $subscribedUsersId, $relationType)
 {
     $userRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
     $userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
     $userId = intval($userId);
     $relationType = intval($relationType);
     $affectedRows = 0;
     if (api_get_multiple_access_url()) {
         //Deleting assigned users to hrm_id
         $sql = "SELECT s.user_id FROM {$userRelUserTable} s " . "INNER JOIN {$userRelAccessUrlTable} a ON (a.user_id = s.user_id) " . "WHERE friend_user_id = {$userId} " . "AND relation_type = {$relationType} " . "AND access_url_id = " . api_get_current_access_url_id() . "";
     } else {
         $sql = "SELECT user_id FROM {$userRelUserTable} " . "WHERE friend_user_id = {$userId} " . "AND relation_type = {$relationType}";
     }
     $result = Database::query($sql);
     if (Database::num_rows($result) > 0) {
         while ($row = Database::fetch_array($result)) {
             $sql = "DELETE FROM {$userRelUserTable} " . "WHERE user_id = {$row['user_id']} " . "AND friend_user_id = {$userId} " . "AND relation_type = {$relationType}";
             Database::query($sql);
         }
     }
     // Inserting new user list
     if (is_array($subscribedUsersId)) {
         foreach ($subscribedUsersId as $subscribedUserId) {
             $subscribedUserId = intval($subscribedUserId);
             $sql = "INSERT IGNORE INTO {$userRelUserTable}(user_id, friend_user_id, relation_type) " . "VALUES ({$subscribedUserId}, {$userId}, {$relationType})";
             $result = Database::query($sql);
             $affectedRows = Database::affected_rows($result);
         }
     }
     return $affectedRows;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:37,代码来源:usermanager.lib.php

示例7: prepare_user_sql_query

/**
 * Prepares the shared SQL query for the user table.
 * See get_user_data() and get_number_of_users().
 *
 * @param boolean $is_count Whether to count, or get data
 * @return string SQL query
 */
function prepare_user_sql_query($is_count)
{
    $sql = "";
    $user_table = Database::get_main_table(TABLE_MAIN_USER);
    $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
    if ($is_count) {
        $sql .= "SELECT COUNT(u.id) AS total_number_of_items FROM {$user_table} u";
    } else {
        $sql .= "SELECT u.id AS col0, u.official_code AS col2, ";
        if (api_is_western_name_order()) {
            $sql .= "u.firstname AS col3, u.lastname AS col4, ";
        } else {
            $sql .= "u.lastname AS col3, u.firstname AS col4, ";
        }
        $sql .= " u.username AS col5,\n                    u.email AS col6,\n                    u.status AS col7,\n                    u.active AS col8,\n                    u.id AS col9,\n                    u.registration_date AS col10,\n                    u.expiration_date AS exp,\n                    u.password\n                FROM {$user_table} u";
    }
    // adding the filter to see the user's only of the current access_url
    if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
        $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
        $sql .= " INNER JOIN {$access_url_rel_user_table} url_rel_user ON (u.id=url_rel_user.user_id)";
    }
    $keywordList = array('keyword_firstname', 'keyword_lastname', 'keyword_username', 'keyword_email', 'keyword_officialcode', 'keyword_status', 'keyword_active', 'check_easy_passwords');
    $keywordListValues = array();
    $atLeastOne = false;
    foreach ($keywordList as $keyword) {
        $keywordListValues[$keyword] = null;
        if (isset($_GET[$keyword]) && !empty($_GET[$keyword])) {
            $keywordListValues[$keyword] = $_GET[$keyword];
            $atLeastOne = true;
        }
    }
    if ($atLeastOne == false) {
        $keywordListValues = array();
    }
    if (isset($keyword_extra_data) && !empty($keyword_extra_data)) {
        $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
        $field_id = $extra_info['id'];
        $sql .= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id={$field_id} ";
    }
    if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
        $keywordFiltered = Database::escape_string("%" . $_GET['keyword'] . "%");
        $sql .= " WHERE (\n                    u.firstname LIKE '{$keywordFiltered}' OR\n                    u.lastname LIKE '{$keywordFiltered}' OR\n                    concat(u.firstname, ' ', u.lastname) LIKE '{$keywordFiltered}' OR\n                    concat(u.lastname,' ',u.firstname) LIKE '{$keywordFiltered}' OR\n                    u.username LIKE '{$keywordFiltered}' OR\n                    u.official_code LIKE '{$keywordFiltered}' OR\n                    u.email LIKE '{$keywordFiltered}'\n                )\n        ";
    } elseif (isset($keywordListValues) && !empty($keywordListValues)) {
        $query_admin_table = '';
        $keyword_admin = '';
        if (isset($keywordListValues['keyword_status']) && $keywordListValues['keyword_status'] == PLATFORM_ADMIN) {
            $query_admin_table = " , {$admin_table} a ";
            $keyword_admin = ' AND a.user_id = u.id ';
            $keywordListValues['keyword_status'] = '%';
        }
        $keyword_extra_value = '';
        if (isset($keyword_extra_data) && !empty($keyword_extra_data) && !empty($keyword_extra_data_text)) {
            $keyword_extra_value = " AND ufv.field_value LIKE '%" . trim($keyword_extra_data_text) . "%' ";
        }
        $sql .= " {$query_admin_table}\n                WHERE (\n                    u.firstname LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_firstname'] . "%") . "' AND\n                    u.lastname LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_lastname'] . "%") . "' AND\n                    u.username LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_username'] . "%") . "' AND\n                    u.email LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_email'] . "%") . "' AND\n                    u.official_code LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_officialcode'] . "%") . "' AND\n                    u.status LIKE '" . Database::escape_string($keywordListValues['keyword_status']) . "'\n                    {$keyword_admin}\n                    {$keyword_extra_value}\n                ";
        if (isset($keyword_active) && !isset($keyword_inactive)) {
            $sql .= " AND u.active='1'";
        } elseif (isset($keyword_inactive) && !isset($keyword_active)) {
            $sql .= " AND u.active='0'";
        }
        $sql .= " ) ";
    }
    // adding the filter to see the user's only of the current access_url
    if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
        $sql .= " AND url_rel_user.access_url_id=" . api_get_current_access_url_id();
    }
    return $sql;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:75,代码来源:user_list.php

示例8: api_protect_global_admin_script

<?php

/* For licensing terms, see /license.txt */
/**
 * 	@package chamilo.admin
 * 	@author Julio Montoya <gugli100@gmail.com>
 */
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_global_admin_script();
if (!api_get_multiple_access_url()) {
    header('Location: index.php');
    exit;
}
// Create the form
$form = new FormValidator('add_url');
if ($form->validate()) {
    $check = Security::check_token('post');
    if ($check) {
        $url_array = $form->getSubmitValues();
        $url = Security::remove_XSS($url_array['url']);
        $description = Security::remove_XSS($url_array['description']);
        $active = intval($url_array['active']);
        $url_id = $url_array['id'];
        $url_to_go = 'access_urls.php';
        if ($url_id != '') {
            //we can't change the status of the url with id=1
            if ($url_id == 1) {
                $active = 1;
            }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:access_url_edit.php

示例9: check_user

 /**
  * Validates the received active connection data with the database
  * @return	bool	Return the loginFailed variable value to local.inc.php
  */
 public function check_user()
 {
     global $_user;
     $loginFailed = false;
     //change the way we recover the cookie depending on how it is formed
     $sso = $this->decode_cookie($_GET['sso_cookie']);
     //get token that should have been used and delete it
     //from session since it can only be used once
     $sso_challenge = '';
     if (isset($_SESSION['sso_challenge'])) {
         $sso_challenge = $_SESSION['sso_challenge'];
         unset($_SESSION['sso_challenge']);
     }
     //lookup the user in the main database
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $sql = "SELECT id, username, password, auth_source, active, expiration_date, status\n                FROM {$user_table}\n                WHERE username = '" . trim(Database::escape_string($sso['username'])) . "'";
     $result = Database::query($sql);
     if (Database::num_rows($result) > 0) {
         $uData = Database::fetch_array($result);
         //Check the user's password
         if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
             if ($sso['secret'] === sha1($uData['username'] . $sso_challenge . api_get_security_key()) && $sso['username'] == $uData['username']) {
                 //Check if the account is active (not locked)
                 if ($uData['active'] == '1') {
                     // check if the expiration date has not been reached
                     if (empty($uData['expiration_date']) or $uData['expiration_date'] > date('Y-m-d H:i:s') or $uData['expiration_date'] == '0000-00-00 00:00:00') {
                         //If Multiple URL is enabled
                         if (api_get_multiple_access_url()) {
                             //Check the access_url configuration setting if the user is registered in the access_url_rel_user table
                             //Getting the current access_url_id of the platform
                             $current_access_url_id = api_get_current_access_url_id();
                             // my user is subscribed in these
                             //sites: $my_url_list
                             $my_url_list = api_get_access_url_from_user($uData['id']);
                         } else {
                             $current_access_url_id = 1;
                             $my_url_list = array(1);
                         }
                         $my_user_is_admin = UserManager::is_admin($uData['id']);
                         if ($my_user_is_admin === false) {
                             if (is_array($my_url_list) && count($my_url_list) > 0) {
                                 if (in_array($current_access_url_id, $my_url_list)) {
                                     // the user has permission to enter at this site
                                     $_user['user_id'] = $uData['id'];
                                     $_user = api_get_user_info($_user['user_id']);
                                     $_user['uidReset'] = true;
                                     Session::write('_user', $_user);
                                     Event::event_login($_user['user_id']);
                                     // Redirect to homepage
                                     $sso_target = '';
                                     if (!empty($sso['ruri'])) {
                                         //The referrer URI is *only* used if
                                         // the user credentials are OK, which
                                         // should be protection enough
                                         // against evil URL spoofing...
                                         $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']);
                                     } else {
                                         $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php';
                                     }
                                     header('Location: ' . $sso_target);
                                     exit;
                                 } else {
                                     // user does not have permission for this site
                                     $loginFailed = true;
                                     Session::erase('_uid');
                                     header('Location: ' . api_get_path(WEB_PATH) . 'index.php?loginFailed=1&error=access_url_inactive');
                                     exit;
                                 }
                             } else {
                                 // there is no URL in the multiple
                                 // urls list for this user
                                 $loginFailed = true;
                                 Session::erase('_uid');
                                 header('Location: ' . api_get_path(WEB_PATH) . 'index.php?loginFailed=1&error=access_url_inactive');
                                 exit;
                             }
                         } else {
                             //Only admins of the "main" (first) Chamilo
                             // portal can login wherever they want
                             if (in_array(1, $my_url_list)) {
                                 //Check if this admin is admin on the
                                 // principal portal
                                 $_user['user_id'] = $uData['id'];
                                 $_user = api_get_user_info($_user['user_id']);
                                 $is_platformAdmin = $uData['status'] == COURSEMANAGER;
                                 Session::write('is_platformAdmin', $is_platformAdmin);
                                 Session::write('_user', $_user);
                                 Event::event_login($_user['user_id']);
                             } else {
                                 //Secondary URL admin wants to login
                                 // so we check as a normal user
                                 if (in_array($current_access_url_id, $my_url_list)) {
                                     $_user['user_id'] = $uData['user_id'];
                                     $_user = api_get_user_info($_user['user_id']);
                                     Session::write('_user', $_user);
                                     Event::event_login($_user['user_id']);
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:sso.Drupal.class.php

示例10: loadAdminMenu

 /**
  * Move in template.lib
  */
 private function loadAdminMenu()
 {
     $template = $this->get('template');
     // Access restrictions.
     api_protect_admin_script(true);
     // @todo fix register/check version
     $message = null;
     if (!empty($_POST['Register'])) {
         register_site();
         $message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
     }
     $blocks = array();
     $adminUrl = api_get_path(WEB_CODE_PATH) . 'admin/';
     /* Users */
     $blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
     $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
     if (api_is_platform_admin()) {
         $search_form = $this->getSearchForm($adminUrl . 'user_list.php')->return_form();
         $blocks['users']['search_form'] = $search_form;
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
         }
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
         $items[] = array('url' => api_get_path(WEB_PUBLIC_PATH) . 'admin/administrator/roles', 'label' => get_lang('Roles'));
     } else {
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
     }
     $blocks['users']['items'] = $items;
     $blocks['users']['extra'] = null;
     if (api_is_platform_admin()) {
         /* Courses */
         $blocks['courses']['icon'] = \Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
         $search_form = $this->getSearchForm($adminUrl . 'course_list.php')->return_form();
         $blocks['courses']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'course_list.php', 'label' => get_lang('CourseList'));
         if (api_get_setting('course_validation') != 'true') {
             $items[] = array('url' => $adminUrl . 'course_add.php', 'label' => get_lang('AddCourse'));
         } else {
             $items[] = array('url' => $adminUrl . 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
         }
         $items[] = array('url' => $adminUrl . 'course_export.php', 'label' => get_lang('ExportCourses'));
         $items[] = array('url' => $adminUrl . 'course_import.php', 'label' => get_lang('ImportCourses'));
         $items[] = array('url' => $adminUrl . 'course_category.php', 'label' => get_lang('AdminCategories'));
         $items[] = array('url' => $adminUrl . 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
         if (api_get_setting('gradebook_enable_grade_model') == 'true') {
             $items[] = array('url' => $adminUrl . 'grade_models.php', 'label' => get_lang('GradeModel'));
         }
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
         }
         $blocks['courses']['items'] = $items;
         $blocks['courses']['extra'] = null;
         /* Platform */
         $blocks['platform']['icon'] = \Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
         $form = $this->getSearchForm($adminUrl . 'settings.php');
         $form->addElement('hidden', 'category', 'search_setting');
         $search_form = $form->return_form();
         $blocks['platform']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'settings.php', 'label' => get_lang('PlatformConfigSettings'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Plugins', 'label' => get_lang('Plugins'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Regions', 'label' => get_lang('Regions'));
         $items[] = array('url' => $adminUrl . 'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
         $items[] = array('url' => $adminUrl . 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
         $items[] = array('url' => $adminUrl . 'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
         $items[] = array('url' => $adminUrl . 'statistics/index.php', 'label' => get_lang('Statistics'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'mySpace/company_reports.php', 'label' => get_lang('Reports'));
         /* Event settings */
         if (api_get_setting('activate_email_template') == 'true') {
             $items[] = array('url' => $adminUrl . 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
         }
         if (api_get_multiple_access_url()) {
             if (api_is_global_platform_admin()) {
                 $items[] = array('url' => $adminUrl . 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
             }
         }
         if (api_get_setting('allow_reservation') == 'true') {
             //$items[] = array('url' => $adminUrl.'../reservation/m_category.php', 	'label' => get_lang('BookingSystem'));
         }
         if (api_get_setting('allow_terms_conditions') == 'true') {
             $items[] = array('url' => $adminUrl . 'legal_add.php', 'label' => get_lang('TermsAndConditions'));
         }
         $blocks['platform']['items'] = $items;
         $blocks['platform']['extra'] = null;
     }
     /* Sessions */
     $blocks['sessions']['icon'] = \Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:AdminController.php

示例11: whoIsOnline

 /**
  * Gives a list of people online now (and in the last $valid minutes)
  * @return  array       For each line, a list of user IDs and login dates, or FALSE on error or empty results
  */
 public static function whoIsOnline($from, $number_of_items, $column = null, $direction = null, $time_limit = null, $friends = false)
 {
     // Time limit in seconds?
     if (empty($time_limit)) {
         $time_limit = api_get_setting('display.time_limit_whosonline');
     } else {
         $time_limit = intval($time_limit);
     }
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     if (empty($column)) {
         $column = 'picture_uri';
         if ($friends) {
             $column = 'login_date';
         }
     }
     if (empty($direction)) {
         $direction = 'DESC';
     } else {
         if (!in_array(strtolower($direction), array('asc', 'desc'))) {
             $direction = 'DESC';
         }
     }
     $online_time = time() - $time_limit * 60;
     $current_date = api_get_utc_datetime($online_time);
     $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
     $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     if ($friends) {
         // 	who friends from social network is online
         $query = "SELECT DISTINCT login_user_id, login_date\n\t\t\t\t  FROM {$track_online_table} INNER JOIN {$friend_user_table}\n\t\t\t\t  ON (friend_user_id = login_user_id)\n\t\t\t\t  WHERE\n\t\t\t\t    login_date >= '" . $current_date . "' AND\n                    friend_user_id <> '" . api_get_user_id() . "' AND\n                    relation_type='" . USER_RELATION_TYPE_FRIEND . "' AND\n                    user_id = '" . api_get_user_id() . "'\n                  ORDER BY {$column} {$direction}\n                  LIMIT {$from}, {$number_of_items}";
     } else {
         $query = "SELECT DISTINCT login_user_id, login_date\n                    FROM " . $track_online_table . " e\n\t\t            INNER JOIN " . $table_user . " u ON (u.id = e.login_user_id)\n                  WHERE u.status != " . ANONYMOUS . " AND login_date >= '" . $current_date . "'\n                  ORDER BY {$column} {$direction}\n                  LIMIT {$from}, {$number_of_items}";
     }
     if (api_get_multiple_access_url()) {
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             if ($friends) {
                 // 	friends from social network is online
                 $query = "SELECT distinct login_user_id, login_date\n\t\t\t\t\t\t\tFROM {$track_online_table} track INNER JOIN {$friend_user_table}\n\t\t\t\t\t\t\tON (friend_user_id = login_user_id)\n\t\t\t\t\t\t\tWHERE   track.access_url_id =  {$access_url_id} AND\n                                    login_date >= '" . $current_date . "' AND\n                                    friend_user_id <> '" . api_get_user_id() . "' AND\n                                    relation_type='" . USER_RELATION_TYPE_FRIEND . "'\n                            ORDER BY {$column} {$direction}\n                            LIMIT {$from}, {$number_of_items}";
             } else {
                 // all users online
                 $query = "SELECT login_user_id, login_date\n\t\t\t\t\t\t  FROM " . $track_online_table . " track\n                          INNER JOIN " . $table_user . " u\n                          ON (u.id=track.login_user_id)\n\t\t\t\t\t\t  WHERE u.status != " . ANONYMOUS . " AND track.access_url_id =  {$access_url_id} AND\n                                login_date >= '" . $current_date . "'\n                          ORDER BY {$column} {$direction}\n                          LIMIT {$from}, {$number_of_items}";
             }
         }
     }
     //This query will show all registered users. Only for dev purposes.
     /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ."  e , $table_user u
       GROUP by u.id
       ORDER BY $column $direction
       LIMIT $from, $number_of_items";*/
     $result = Database::query($query);
     if ($result) {
         $users_online = array();
         while (list($login_user_id, $login_date) = Database::fetch_row($result)) {
             $users_online[] = $login_user_id;
         }
         return $users_online;
     } else {
         return false;
     }
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:66,代码来源:usermanager.lib.php

示例12: returnMenu

 /**
  * @return null|string
  */
 public function returnMenu()
 {
     return null;
     $navigation = $this->navigation_array;
     $navigation = $navigation['navigation'];
     // Displaying the tabs
     $lang = api_get_user_language();
     // Preparing home folder for multiple urls
     if (api_get_multiple_access_url()) {
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $url_info = api_get_current_access_url_info();
             $url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
             $clean_url = api_replace_dangerous_char($url);
             $clean_url = str_replace('/', '-', $clean_url);
             $clean_url .= '/';
             $homep = $this->app['path.data'] . 'home/' . $clean_url;
             //homep for Home Path
             //we create the new dir for the new sites
             if (!is_dir($homep)) {
                 mkdir($homep, api_get_permissions_for_new_directories());
             }
         }
     } else {
         $homep = $this->app['path.data'] . 'home/';
     }
     $ext = '.html';
     $menutabs = 'home_tabs';
     $home_top = '';
     if (is_file($homep . $menutabs . '_' . $lang . $ext) && is_readable($homep . $menutabs . '_' . $lang . $ext)) {
         $home_top = @(string) file_get_contents($homep . $menutabs . '_' . $lang . $ext);
     } elseif (is_file($homep . $menutabs . $lang . $ext) && is_readable($homep . $menutabs . $lang . $ext)) {
         $home_top = @(string) file_get_contents($homep . $menutabs . $lang . $ext);
     }
     $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
     $open = str_replace('{rel_path}', $this->app['path.data'], $home_top);
     $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
     $lis = '';
     if (!empty($open)) {
         if (strpos($open, 'show_menu') === false) {
             if (api_is_anonymous()) {
                 $navigation[SECTION_CAMPUS] = null;
             }
         } else {
             $lis .= $open;
         }
     }
     if (count($navigation) > 0 || !empty($lis)) {
         $pre_lis = '';
         foreach ($navigation as $section => $navigation_info) {
             if (isset($GLOBALS['this_section'])) {
                 $current = $section == $GLOBALS['this_section'] ? ' id="current" class="active" ' : '';
             } else {
                 $current = '';
             }
             if (!empty($navigation_info['title'])) {
                 $pre_lis .= '<li' . $current . ' ><a  href="' . $navigation_info['url'] . '" target="_top">' . $navigation_info['title'] . '</a></li>';
             }
         }
         $lis = $pre_lis . $lis;
     }
     $menu = null;
     if (!empty($lis)) {
         $menu .= $lis;
     }
     return $menu;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:70,代码来源:Template.php

示例13: elseif

                <td><button type="submit" class="<?php 
        echo $class;
        ?>
" value="<?php 
        echo $text;
        ?>
" ><?php 
        echo $text;
        ?>
</button></td>
            </tr>
        </table>
    </form>

<?php 
    } elseif (api_get_multiple_access_url() && api_get_current_access_url_id() != 1) {
        Display::display_error_message(get_lang('CourseCategoriesAreGlobal'));
    }
} else {
    if ($delError == 0) {
        ?>
    <div class="actions">
                <?php 
        if (!empty($category) && empty($action)) {
            $myquery = "SELECT parent_id FROM {$tbl_category} WHERE code='{$category}'";
            $result = Database::query($myquery);
            $parent_id = 0;
            if (Database::num_rows($result) > 0) {
                $parent_id = Database::fetch_array($result);
            }
            $parent_id['parent_id'] ? $link = ' (' . $parent_id['parent_id'] . ')' : ($link = '');
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:course_category.php

示例14: getCourseParamsForDisplay

 /**
  * Return tab of params to display a course title in the My Courses tab
  * Check visibility, right, and notification icons, and load_dirs option
  * @param $courseId
  * @param bool $loadDirs
  * @return array
  */
 public static function getCourseParamsForDisplay($courseId, $loadDirs = false)
 {
     $user_id = api_get_user_id();
     // Table definitions
     $TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
     $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
     $current_url_id = api_get_current_access_url_id();
     // Get course list auto-register
     $special_course_list = self::get_special_course_list();
     $without_special_courses = '';
     if (!empty($special_course_list)) {
         $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
     }
     //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
     $sql = "SELECT course.id, course.title, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,\n                course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat\n                FROM    {$TABLECOURS}      course,\n                        {$TABLECOURSUSER}  course_rel_user, " . $TABLE_ACCESS_URL_REL_COURSE . " url\n                WHERE   course.id=" . intval($courseId) . "\n                        AND course.id = course_rel_user.c_id\n                        AND url.c_id = course.id\n                        AND course_rel_user.user_id = " . intval($user_id) . "\n                        {$without_special_courses} ";
     // If multiple URL access mode is enabled, only fetch courses
     // corresponding to the current URL.
     if (api_get_multiple_access_url() && $current_url_id != -1) {
         $sql .= " AND url.course_code=course.code AND access_url_id=" . intval($current_url_id);
     }
     // Use user's classification for courses (if any).
     $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
     $result = Database::query($sql);
     // Browse through all courses. We can only have one course because of the  course.id=".intval($courseId) in sql query
     $course = Database::fetch_array($result);
     $course_info = api_get_course_info($course['code']);
     //$course['id_session'] = null;
     $course_info['id_session'] = null;
     $course_info['status'] = $course['status'];
     // For each course, get if there is any notification icon to show
     // (something that would have changed since the user's last visit).
     $show_notification = Display::show_notification($course_info);
     // New code displaying the user's status in respect to this course.
     $status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
     $params = array();
     $params['right_actions'] = '';
     if (api_is_platform_admin()) {
         if ($loadDirs) {
             $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
             $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
             $params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
         } else {
             $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
         }
         if ($course_info['status'] == COURSEMANAGER) {
             //echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
         }
     } else {
         if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
             if ($loadDirs) {
                 $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
                 $params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
             } else {
                 if ($course_info['status'] == COURSEMANAGER) {
                     $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
                 }
             }
         }
     }
     $course_title_url = '';
     if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
         $course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=0';
         $course_title = Display::url($course_info['title'], $course_title_url);
     } else {
         $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
     }
     // Start displaying the course block itself
     if (api_get_setting('display_coursecode_in_courselist') == 'true') {
         $course_title .= ' (' . $course_info['visual_code'] . ') ';
     }
     $teachers = '';
     if (api_get_setting('display_teacher_in_courselist') == 'true') {
         $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], self::USER_SEPARATOR, true);
     }
     $params['link'] = $course_title_url;
     $params['icon'] = $status_icon;
     $params['title'] = $course_title;
     $params['teachers'] = $teachers;
     if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
         $params['notifications'] = $show_notification;
     }
     return $params;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:91,代码来源:course.lib.php

示例15: api_get_home_path

/**
 * Get home path
 * @return string
 */
function api_get_home_path()
{
    $home = 'app/home/';
    if (api_get_multiple_access_url()) {
        $access_url_id = api_get_current_access_url_id();
        $url_info = api_get_access_url($access_url_id);
        $url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
        $clean_url = api_replace_dangerous_char($url);
        $clean_url = str_replace('/', '-', $clean_url);
        $clean_url .= '/';
        $home = 'app/home/' . $clean_url;
    }
    return $home;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:18,代码来源:api.lib.php


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