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


PHP api_sort_by_first_name函数代码示例

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


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

示例1: ResultTable

 /**
  * Constructor
  */
 public function ResultTable($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false)
 {
     parent::__construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
     $this->datagen = new ResultsDataGenerator($evaluation, $results, true);
     $this->evaluation = $evaluation;
     $this->iscourse = $iscourse;
     $this->forprint = $forprint;
     if (isset($addparams)) {
         $this->set_additional_parameters($addparams);
     }
     $scoredisplay = ScoreDisplay::instance();
     $column = 0;
     if ($this->iscourse == '1') {
         $this->set_header($column++, '', false);
         $this->set_form_actions(array('delete' => get_lang('Delete')));
     }
     if (api_is_western_name_order()) {
         $this->set_header($column++, get_lang('FirstName'));
         $this->set_header($column++, get_lang('LastName'));
     } else {
         $this->set_header($column++, get_lang('LastName'));
         $this->set_header($column++, get_lang('FirstName'));
     }
     $this->set_header($column++, get_lang('Score'));
     if ($scoredisplay->is_custom()) {
         $this->set_header($column++, get_lang('Display'));
     }
     if (!$this->forprint) {
         $this->set_header($column++, get_lang('Modify'), false);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:34,代码来源:resulttable.class.php

示例2: search_users

 /**
  * Search users by username, firstname or lastname, based on the given
  * search string
  * @param string Search string
  * @param int Deprecated param
  * @return string Xajax response block
  * @assert () === false
  */
 public static function search_users($needle, $id)
 {
     global $tbl_user, $tbl_access_url_rel_user;
     $xajax_response = new XajaxResponse();
     $return = '';
     if (!empty($needle)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         // search users where username or firstname or lastname begins likes $needle
         $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
         $sql = 'SELECT u.user_id, username, lastname, firstname FROM ' . $tbl_user . ' u ' . ' WHERE (username LIKE "' . $needle . '%" ' . ' OR firstname LIKE "' . $needle . '%" ' . ' OR lastname LIKE "' . $needle . '%") ' . $order_clause . ' LIMIT 11';
         $rs = Database::query($sql);
         $i = 0;
         while ($user = Database::fetch_array($rs)) {
             $i++;
             if ($i <= 10) {
                 $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($user['user_id']) . '\',\'' . api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])) . ' (' . addslashes($user['username']) . ')' . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
             } else {
                 $return .= '...<br />';
             }
         }
     }
     $xajax_response->addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
     return $xajax_response;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:35,代码来源:access_url_edit_users_to_url_functions.lib.php

示例3: search_users

function search_users($needle, $type)
{
    global $_configuration, $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id;
    $xajax_response = new XajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        // xajax send utf8 datas... datas in db can be non-utf8 datas
        $charset = api_get_system_encoding();
        $needle = api_convert_encoding($needle, $charset, 'utf-8');
        $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
        $assigned_users_id = array_keys($assigned_users_to_hrm);
        $without_assigned_users = '';
        if (count($assigned_users_id) > 0) {
            $without_assigned_users = " AND user.user_id NOT IN(" . implode(',', $assigned_users_id) . ")";
        }
        if ($_configuration['multiple_access_urls']) {
            $sql = "SELECT user.user_id, username, lastname, firstname FROM {$tbl_user} user LEFT JOIN {$tbl_access_url_rel_user} au ON (au.user_id = user.user_id)\n\t\t\tWHERE  " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user.user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users} AND access_url_id = " . api_get_current_access_url_id() . "";
        } else {
            $sql = "SELECT user_id, username, lastname, firstname FROM {$tbl_user} user\n\t\t\tWHERE  " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users}";
        }
        $rs = Database::query($sql);
        $return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
        while ($user = Database::fetch_array($rs)) {
            $person_name = api_get_person_name($user['firstname'], $user['lastname']);
            $return .= '<option value="' . $user['user_id'] . '" title="' . htmlspecialchars($person_name, ENT_QUOTES) . '">' . $person_name . ' (' . $user['username'] . ')</option>';
        }
        $return .= '</select>';
        $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
    }
    return $xajax_response;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:dashboard_add_users_to_user.php

示例4: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:32,代码来源:tutor_settings.php

示例5: get_course_users

/**
* this function gets all the users of the current course
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @return array: associative array where the key is the id of the user and the value is an array containing
 the first name, the last name, the user id
*/
function get_course_users()
{
    $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
    $tbl_courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
    // not 100% if this is necessary, this however prevents a notice
    if (!isset($courseadmin_filter)) {
        $courseadmin_filter = '';
    }
    //
    $order_clause = api_sort_by_first_name() ? ' ORDER BY u.firstname, u.lastname' : ' ORDER BY u.lastname, u.firstname';
    $sql = "SELECT u.user_id uid, u.lastname lastName, u.firstname firstName, u.username\n\t\t\tFROM {$tbl_user} as u, {$tbl_courseUser} as cu\n\t\t\tWHERE cu.c_id = '" . api_get_course_int_id() . "'\n\t\t\tAND cu.user_id = u.user_id {$courseadmin_filter}" . $order_clause;
    $result = Database::query($sql);
    while ($user = Database::fetch_array($result)) {
        $users[$user[0]] = $user;
    }
    $session_id = api_get_session_id();
    if (!empty($session_id)) {
        $users = array();
        $sql = "SELECT u.user_id uid, u.lastname lastName, u.firstName firstName, u.username\n\t\t\t\tFROM {$tbl_session_course_user} AS session_course_user\n\t\t\t\tINNER JOIN {$tbl_user} u ON u.user_id = session_course_user.id_user\n\t\t\t\tWHERE id_session = " . $session_id . "\n\t\t\t\tAND c_id  = '" . api_get_course_int_id() . "'";
        $result = Database::query($sql);
        while ($user = Database::fetch_array($result)) {
            $users[$user[0]] = $user;
        }
    }
    return $users;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:33,代码来源:agenda.inc.php

示例6: FlatViewTable

 /**
  * Constructor
  */
 function FlatViewTable($selectcat, $users = array(), $evals = array(), $links = array(), $limit_enabled = false, $offset = 0, $addparams = null)
 {
     parent::__construct('flatviewlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 1 : 0);
     $this->selectcat = $selectcat;
     $this->datagen = new FlatViewDataGenerator($users, $evals, $links, array('only_subcat' => $this->selectcat->get_id()));
     $this->limit_enabled = $limit_enabled;
     $this->offset = $offset;
     if (isset($addparams)) {
         $this->set_additional_parameters($addparams);
     }
     // step 2: generate rows: students
     $this->datagen->category = $this->selectcat;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:16,代码来源:flatviewtable.class.php

示例7: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    global $_configuration;
    if (isset($_configuration['order_user_list_by_official_code']) && $_configuration['order_user_list_by_official_code']) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:46,代码来源:member_settings.php

示例8: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('platform.order_user_list_by_official_code');
    if ($orderListByOfficialCode === 'true') {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:46,代码来源:member_settings.php

示例9: search_coachs

function search_coachs($needle)
{
    $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
    $xajax_response = new xajaxResponse();
    $return = '';
    if (!empty($needle)) {
        $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
        // search users where username or firstname or lastname begins likes $needle
        $sql = 'SELECT username, lastname, firstname
		        FROM ' . $tbl_user . ' user
				WHERE (username LIKE "' . $needle . '%"
				OR firstname LIKE "' . $needle . '%"
				OR lastname LIKE "' . $needle . '%")
				AND status=1' . $order_clause . ' LIMIT 10';
        if (api_is_multiple_url_enabled()) {
            $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
            $access_url_id = api_get_current_access_url_id();
            if ($access_url_id != -1) {
                $sql = 'SELECT username, lastname, firstname
                        FROM ' . $tbl_user . ' user
                        INNER JOIN ' . $tbl_user_rel_access_url . ' url_user
                        ON (url_user.user_id=user.user_id)
                        WHERE
                            access_url_id = ' . $access_url_id . '  AND
                            (
                                username LIKE "' . $needle . '%" OR
                                firstname LIKE "' . $needle . '%" OR
                                lastname LIKE "' . $needle . '%"
                            )
                            AND status=1' . $order_clause . '
                        LIMIT 10';
            }
        }
        $rs = Database::query($sql);
        while ($user = Database::fetch_array($rs)) {
            $return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\'' . $user['username'] . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
        }
    }
    $xajax_response->addAssign('ajax_list_coachs', 'innerHTML', api_utf8_encode($return));
    return $xajax_response;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:41,代码来源:session_add.php

示例10: get_users_in_course

/**
 * returns users within a course given by param
 * @param $course_id
 */
function get_users_in_course($courseId)
{
    $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
    $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
    $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname ASC' : ' ORDER BY lastname, firstname ASC';
    $current_session = api_get_session_id();
    $courseId = Database::escape_string($courseId);
    if (!empty($current_session)) {
        $sql = "SELECT user.user_id, user.username, lastname, firstname, official_code\n\t\t\t \tFROM {$tbl_session_course_user} as scru, {$tbl_user} as user\n\t\t\t \tWHERE scru.id_user=user.user_id\n                    AND scru.status=0\n                    AND scru.c_id ='{$courseId}' AND id_session = '{$current_session}'\n\t\t\t \t{$order_clause} ";
    } else {
        $sql = 'SELECT user.user_id, user.username, lastname, firstname, official_code
                FROM ' . $tbl_course_user . ' as course_rel_user, ' . $tbl_user . ' as user
                WHERE   course_rel_user.user_id=user.user_id AND
                        course_rel_user.status=' . STUDENT . ' AND
                        course_rel_user.c_id = ' . $courseId . '
                ' . $order_clause;
    }
    $result = Database::query($sql);
    return get_user_array_from_sql_result($result);
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:25,代码来源:gradebook_functions_users.inc.php

示例11: api_protect_course_script

$current_course_tool = TOOL_USER;
$this_section = SECTION_COURSES;
// notice for unauthorized people.
api_protect_course_script(true);
if (!api_is_platform_admin(true)) {
    if (!api_is_course_admin() && !api_is_coach()) {
        if (api_get_course_setting('allow_user_view_user_list') == 0) {
            api_not_allowed(true);
        }
    }
}
/* Constants and variables */
$course_code = Database::escape_string(api_get_course_id());
$sessionId = api_get_session_id();
$is_western_name_order = api_is_western_name_order();
$sort_by_first_name = api_sort_by_first_name();
$course_info = api_get_course_info();
$user_id = api_get_user_id();
$courseCode = $course_info['code'];
$courseId = $course_info['real_id'];
//Can't auto unregister from a session
if (!empty($sessionId)) {
    $course_info['unsubscribe'] = 0;
}
/* Unregistering a user section	*/
if (api_is_allowed_to_edit(null, true)) {
    if (isset($_POST['action'])) {
        switch ($_POST['action']) {
            case 'unsubscribe':
                // Make sure we don't unsubscribe current user from the course
                if (is_array($_POST['user'])) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user.php

示例12: search_users

function search_users($needle, $type)
{
    global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus;
    $xajax_response = new xajaxResponse();
    $return = '';
    if (!empty($needle) && !empty($type)) {
        $assigned_users_to_hrm = array();
        switch ($userStatus) {
            case DRH:
                //no break;
            //no break;
            case PLATFORM_ADMIN:
                $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
                break;
            case STUDENT_BOSS:
                $assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id);
                break;
        }
        $assigned_users_id = array_keys($assigned_users_to_hrm);
        $without_assigned_users = '';
        $westernOrder = api_is_western_name_order();
        if ($westernOrder) {
            $order_clause = " ORDER BY firstname, lastname";
        } else {
            $order_clause = " ORDER BY lastname, firstname";
        }
        if (count($assigned_users_id) > 0) {
            $without_assigned_users = " AND user.user_id NOT IN(" . implode(',', $assigned_users_id) . ")";
        }
        if (api_is_multiple_url_enabled()) {
            $sql = "SELECT user.user_id, username, lastname, firstname\n                    FROM {$tbl_user} user\n                    LEFT JOIN {$tbl_access_url_rel_user} au ON (au.user_id = user.user_id)\n                    WHERE\n                        " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND\n                        status NOT IN(" . DRH . ", " . SESSIONADMIN . ", " . STUDENT_BOSS . ") AND\n                        user.user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id})\n                        {$without_assigned_users} AND\n                        access_url_id = " . api_get_current_access_url_id() . "\n                    {$order_clause}\n                    ";
        } else {
            $sql = "SELECT user_id, username, lastname, firstname\n                    FROM {$tbl_user} user\n                    WHERE\n                        " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND\n                        status NOT IN(" . DRH . ", " . SESSIONADMIN . ", " . STUDENT_BOSS . ") AND\n                        user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id})\n                    {$without_assigned_users}\n                    {$order_clause}\n            ";
        }
        $rs = Database::query($sql);
        $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
        if ($type == 'single') {
            $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
            $access_url_id = api_get_current_access_url_id();
            $sql = 'SELECT user.user_id, username, lastname, firstname
                    FROM ' . $tbl_user . ' user
                    INNER JOIN ' . $tbl_user_rel_access_url . ' url_user ON (url_user.user_id=user.user_id)
                    WHERE
                        access_url_id = ' . $access_url_id . '  AND
                        (
                            username LIKE "' . $needle . '%" OR
                            firstname LIKE "' . $needle . '%" OR
                            lastname LIKE "' . $needle . '%"
                        ) AND ';
            switch ($userStatus) {
                case DRH:
                    $sql .= " user.status <> 6 AND user.status <> " . DRH;
                    break;
                case STUDENT_BOSS:
                    $sql .= " user.status <> 6 AND user.status <> " . STUDENT_BOSS;
                    break;
            }
            $sql .= " {$order_clause} LIMIT 11";
            $rs = Database::query($sql);
            $i = 0;
            while ($user = Database::fetch_array($rs)) {
                $i++;
                if ($i <= 10) {
                    $person_name = api_get_person_name($user['firstname'], $user['lastname']);
                    $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_user(\'' . $user['user_id'] . '\',\'' . $person_name . ' (' . $user['username'] . ')' . '\')">' . $person_name . ' (' . $user['username'] . ')</a><br />';
                } else {
                    $return .= '...<br />';
                }
            }
            $xajax_response->addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return));
        } else {
            $return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">';
            while ($user = Database::fetch_array($rs)) {
                $person_name = api_get_person_name($user['firstname'], $user['lastname']);
                $return .= '<option value="' . $user['user_id'] . '" title="' . htmlspecialchars($person_name, ENT_QUOTES) . '">' . $person_name . ' (' . $user['username'] . ')</option>';
            }
            $return .= '</select>';
            $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
        }
    }
    return $xajax_response;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:82,代码来源:dashboard_add_users_to_user.php

示例13: get_coaches_by_keyword

 static function get_coaches_by_keyword($tag)
 {
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
     $select = "SELECT user.user_id, lastname, firstname, username ";
     $sql = " {$select} FROM {$tbl_user} user WHERE status='1'";
     $tag = Database::escape_string($tag);
     $where_condition = array();
     if (!empty($tag)) {
         $condition = ' LIKE "%' . $tag . '%"';
         $where_condition = array("firstname {$condition}", "lastname {$condition}", "username {$condition}");
         $where_condition = ' AND  (' . implode(' OR ', $where_condition) . ') ';
     }
     if (api_is_multiple_url_enabled()) {
         $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $sql = $select . ' FROM ' . $tbl_user . ' user
                     INNER JOIN ' . $tbl_user_rel_access_url . ' url_user ON (url_user.user_id=user.user_id)
                     WHERE access_url_id = ' . $access_url_id . '  AND status = 1';
         }
     }
     $sql .= $where_condition . $order_clause;
     $result = Database::query($sql);
     return Database::store_result($result, 'ASSOC');
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:26,代码来源:sessionmanager.lib.php

示例14: sort_by_user

 function sort_by_user($item1, $item2)
 {
     $user1 = $item1['user'];
     $user2 = $item2['user'];
     if (api_sort_by_first_name()) {
         $result = api_strcmp($user1['firstname'], $user2['firstname']);
         if ($result == 0) {
             return api_strcmp($user1['lastname'], $user2['lastname']);
         }
     } else {
         $result = api_strcmp($user1['lastname'], $user2['lastname']);
         if ($result == 0) {
             return api_strcmp($user1['firstname'], $user2['firstname']);
         }
     }
     return $result;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:17,代码来源:evalform.class.php

示例15: get_invited_users

 /**
  * This function gets all the invited users for a given survey code.
  *
  * @param	string	Survey code
  * @param	string	optional - course database
  * @return 	array	Array containing the course users and additional users (non course users)
  *
  * @todo consider making $defaults['additional_users'] also an array
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @author Julio Montoya, adding c_id fixes - Dec 2012
  * @version January 2007
  */
 public static function get_invited_users($survey_code, $course_code = '', $session_id = 0)
 {
     if (!empty($course_code)) {
         $course_info = api_get_course_info($course_code);
         $course_id = $course_info['real_id'];
     } else {
         $course_id = api_get_course_int_id();
     }
     if (empty($session_id)) {
         $session_id = api_get_session_id();
     }
     $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     // Selecting all the invitations of this survey AND the additional emailaddresses (the left join)
     $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
     $sql = "SELECT user, group_id\n\t\t\t\tFROM {$table_survey_invitation} as table_invitation\n\t\t\t\tWHERE\n\t\t\t\t    table_invitation.c_id = {$course_id} AND\n                    survey_code='" . Database::escape_string($survey_code) . "' AND\n                    session_id = {$session_id}\n                ";
     $defaults = array();
     $defaults['course_users'] = array();
     $defaults['additional_users'] = array();
     // Textarea
     $defaults['users'] = array();
     // user and groups
     $result = Database::query($sql);
     while ($row = Database::fetch_array($result)) {
         if (is_numeric($row['user'])) {
             $defaults['course_users'][] = $row['user'];
             $defaults['users'][] = 'USER:' . $row['user'];
         } else {
             if (!empty($row['user'])) {
                 $defaults['additional_users'][] = $row['user'];
             }
         }
         if (isset($row['group_id']) && !empty($row['group_id'])) {
             $defaults['users'][] = 'GROUP:' . $row['group_id'];
         }
     }
     if (!empty($defaults['course_users'])) {
         $user_ids = implode("','", $defaults['course_users']);
         $sql = "SELECT user_id FROM {$table_user} WHERE user_id IN ('{$user_ids}') {$order_clause}";
         $result = Database::query($sql);
         $fixed_users = array();
         while ($row = Database::fetch_array($result)) {
             $fixed_users[] = $row['user_id'];
         }
         $defaults['course_users'] = $fixed_users;
     }
     if (!empty($defaults['additional_users'])) {
         $defaults['additional_users'] = implode(';', $defaults['additional_users']);
     }
     return $defaults;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:64,代码来源:survey.lib.php


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