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


PHP get_users_listing函数代码示例

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


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

示例1: list

if ($CFG->fullnamedisplay == 'firstname lastname' or $CFG->fullnamedisplay == 'firstname' or $CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname') {
    $fullnamedisplay = "{$firstname} / {$lastname}";
    if ($sort == "name") {
        // If sort has already been set to something else then ignore.
        $sort = "firstname";
    }
} else {
    // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname').
    $fullnamedisplay = "{$lastname} / {$firstname}";
    if ($sort == "name") {
        // This should give the desired sorting based on fullnamedisplay.
        $sort = "lastname";
    }
}
list($extrasql, $params) = $ufiltering->get_sql_filter();
$users = get_users_listing($sort, $dir, $page * $perpage, $perpage, '', '', '', $extrasql, $params, $context);
$usercount = get_users(false);
$usersearchcount = get_users(false, '', false, null, "", '', '', '', '', '*', $extrasql, $params);
if ($extrasql !== '') {
    echo $OUTPUT->heading("{$usersearchcount} / {$usercount} " . get_string('users'));
    $usercount = $usersearchcount;
} else {
    echo $OUTPUT->heading("{$usercount} " . get_string('users'));
}
$strall = get_string('all');
$baseurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
flush();
if (!$users) {
    $match = array();
    echo $OUTPUT->heading(get_string('nousersfound'));
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:31,代码来源:user.php

示例2: validateas

function validateas($value, $validatename, $lineno, $fieldname = '')
{
    // Validates each field based on information in the $validate array
    global $USER;
    global $validate;
    $fieldname == '' and $fieldname = $validatename;
    isset($validate[$validatename]) or csverror('Coding Error: Unvalidated field type: "' . $validatename . '"', 'uploadcourse.php?sesskey=' . $USER->sesskey);
    $format = $validate[$validatename];
    switch ($format[0]) {
        case 1:
            // String
            if (($maxlen = $format[1]) != 0) {
                // Max length?
                strlen($value) <= $format[1] or csverror('Invalid value for field ' . $fieldname . ' (length &gt; ' . $format[1] . '). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            if ($format[2] == 1) {
                // Not null?
                checkisstring($value) or csverror('Invalid value for field ' . $fieldname . ' (only spaces or missing). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            break;
        case 2:
            // Integer
            checkisint($value) or csverror('Invalid value for field ' . $fieldname . ' (not an integer). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            if (($max = $format[1]) != 0) {
                // Max value?
                $value <= $max or csverror('Invalid value for field ' . $fieldname . ' (&gt; ' . $max . '). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            $min = $format[2];
            // Min value
            $value >= $min or csverror('Invalid value for field ' . $fieldname . ' (&lt; ' . $min . '). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            break;
        case 3:
            // Timestamp - validates and converts to Unix Time
            if (($value = strtotime($value)) < 1) {
                csverror('Invalid value for field ' . $fieldname . ' (Bad Timestamp). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            break;
        case 4:
            // Domain
            $validvalues = explode(',', $format[1]);
            if (array_search($value, $validvalues) === false) {
                csverror('Invalid value for field ' . $fieldname . ' (Must be one of {' . $format[1] . '}). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            break;
        case 5:
            // Category
            if (checkisint($value)) {
                // It's a Category ID Number
                categoryexists_ex($value) or csverror('Invalid value for field ' . $fieldname . ' (No Category with ID ' . $value . '). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            } elseif (checkisstring($value)) {
                // It's a Category Path string
                $value = trim(str_replace('\\', '/', $value), " \t\n\r\v/");
                // Clean path, ensuring all slashes are forward ones
                strlen($value) > 0 or csverror('Invalid value for field ' . $fieldname . ' (Path string not set). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                unset($cats);
                $cats = explode('/', $value);
                // Break up path into array
                count($cats) > 0 or csverror('Invalid value for field ' . $fieldname . ' (Path string "' . $value . '" invalid - not delimited correctly). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                foreach ($cats as $n => $item) {
                    // Validate the path
                    $item = trim($item);
                    // Remove whitespace
                    strlen($item) <= 30 or csverror('Invalid value for field ' . $fieldname . ' (Category name "' . $item . '" length &gt; 30). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                    checkisstring($item) or csverror('Invalid value for field ' . $fieldname . ' (Path string "' . $value . '" invalid - category name at position ' . ($n + 1) . ' as shown is invalid). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                }
                $value = $cats;
                // Return the array
                unset($cats);
            } else {
                csverror('Invalid value for field ' . $fieldname . ' (not an integer or string). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            }
            break;
        case 6:
            // User ID or Name (Search String)
            $value = trim($value);
            if (checkisint($value)) {
                // User ID
                userexists_ex($value) or csverror('Invalid value for field ' . $fieldname . ' (No User with ID ' . $value . '). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
            } elseif (checkisstring($value)) {
                // User Search String
                // Only PHP5 supports named arguments
                $usersearch = get_users_listing('lastaccess', 'ASC', 0, 99999, mysql_real_escape_string($value), '', '');
                if (isset($usersearch) and $usersearch !== false and is_array($usersearch) and ($ucount = count($usersearch)) > 0) {
                    $ucount == 1 or csverror('Invalid value for field ' . $fieldname . ' (Search string ambiguous; returned multiple [' . $ucount . '] results). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                    reset($usersearch);
                    $uid = key($usersearch);
                    checkisint($uid) && userexists_ex($uid) or csverror('Invalid value for field ' . $fieldname . ' (Search string returned a nonexistent user ?!). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                    $value = $uid;
                    // Return found user id
                } else {
                    csverror('Invalid value for field ' . $fieldname . ' (Search string returned no results). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                }
            } else {
                if ($format[2] == 1) {
                    // Not null?
                    csverror('Invalid value for field ' . $fieldname . ' (only spaces or missing). ' . get_string('erroronline', 'error', $lineno) . ". " . get_string('processingstops', 'error'), 'uploadcourse.php?sesskey=' . $USER->sesskey);
                }
            }
            break;
        default:
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:uploadcourse.php

示例3: urlencode

    }
    ${$column} = "<a href=\"user.php?sort={$column}&amp;dir={$columndir}&amp;search=" . urlencode(stripslashes($search)) . "&amp;firstinitial={$firstinitial}&amp;lastinitial={$lastinitial}\">" . $string[$column] . "</a>{$columnicon}";
}
if ($sort == "name") {
    $sort = "firstname";
}
// tell the query which users we are looking at (local, remote, or both)
$remotewhere = '';
if ($mnet_auth_users && ($localusers xor $remoteusers)) {
    if ($localusers) {
        $remotewhere .= " and mnethostid = {$CFG->mnet_localhost_id} ";
    } else {
        $remotewhere .= " and mnethostid <> {$CFG->mnet_localhost_id} ";
    }
}
$users = get_users_listing($sort, $dir, $page * $perpage, $perpage, $search, $firstinitial, $lastinitial, $remotewhere, false);
$usercount = get_users(false);
$usersearchcount = get_users(false, $search, true, "", "", $firstinitial, $lastinitial);
if ($search or $firstinitial or $lastinitial) {
    print_heading("{$usersearchcount} / {$usercount} " . get_string('users'));
    $usercount = $usersearchcount;
} else {
    print_heading("{$usercount} " . get_string('users'));
}
$alphabet = explode(',', get_string('alphabet'));
$strall = get_string('all');
/// Bar of first initials
echo "<p style=\"text-align:center\">";
echo get_string("firstname") . " : ";
if ($firstinitial) {
    echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&amp;" . "perpage={$perpage}&amp;lastinitial={$lastinitial}\">{$strall}</a> ";
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:user.php

示例4: array

$usersArr = array();
//$users = get_records("user", "confirmed", 1 , "deleted", 0);
//Role
$sql = "SELECT * FROM {$CFG->prefix}role_assignments WHERE userid =" . $USER->id;
$role_assignment = get_record_sql($sql);
$sql2 = "SELECT * FROM {$CFG->prefix}role WHERE id = " . $role_assignment->roleid;
$role_obj = get_record_sql($sql2);
$role = $role_obj->shortname;
//Users...
if ($role == 'admin') {
    //Users
    $usersArr = array();
    //$sql = "SELECT * FROM {$CFG->prefix}user";
    //$sql = "SELECT * FROM {$CFG->prefix}user WHERE username NOT IN('Guest')";
    //$users = get_records_sql($sql);
    $users = get_users_listing("username");
    // Added by SMS: 8/7/2011
    // To provide admin with the view of schedules for all the students.
    array_push($usersArr, "ALL_STUDENTS");
    foreach ($users as $user) {
        array_push($usersArr, $user->username);
    }
    $users_str = implode(",", $usersArr);
}
?>




</script>
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:30,代码来源:view.php

示例5: in

    $sqlsearch .= " AND id not in (" . implode(',', array_keys($assignedusers)) . ") ";
}
// Strip out no course users.
$sqlsearch .= " AND id IN ( SELECT userid from {course_completions} WHERE course = " . $event->course . ") ";
// Get the user records.
$userrecords = $DB->get_fieldset_select('user', 'id', $sqlsearch);
$userlist = "";
foreach ($userrecords as $userrecord) {
    if (!empty($userlist)) {
        $userlist .= " OR id={$userrecord} ";
    } else {
        $userlist .= " id={$userrecord} ";
    }
}
if (!empty($userlist)) {
    $users = get_users_listing($sort, $dir, $page * $perpage, $perpage, '', '', '', $userlist);
} else {
    $users = array();
}
$usercount = count($userrecords);
echo $OUTPUT->heading("{$usercount} " . get_string('users'));
$alphabet = explode(',', get_string('alphabet', 'block_iomad_company_admin'));
$strall = get_string('all');
$baseurl = new moodle_url('editusers.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
flush();
if (!$users) {
    $match = array();
    echo $OUTPUT->heading(get_string('nousersfound'));
    $table = null;
} else {
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:searchusers.php

示例6: get_users_listing

         }
     } else {
         $columndir = $dir == "ASC" ? "DESC" : "ASC";
         if ($column == "lastaccess") {
             $columnicon = $dir == "ASC" ? "up" : "down";
         } else {
             $columnicon = $dir == "ASC" ? "down" : "up";
         }
         $columnicon = " <img src=\"{$CFG->pixpath}/t/{$columnicon}.gif\" alt=\"\" />";
     }
     ${$column} = "<a href=\"user.php?sort={$column}&amp;dir={$columndir}\">" . $string[$column] . "</a>{$columnicon}";
 }
 if ($sort == "name") {
     $sort = "firstname";
 }
 $users = get_users_listing($sort, $dir, $page * $perpage, $perpage, '', '', '', $extrasql);
 $usersearchcount = get_users(false, '', true, "", "", '', '', '', '', '*', $extrasql);
 $alphabet = explode(',', get_string('alphabet'));
 $strall = get_string('all');
 print_paging_bar($usersearchcount, $page, $perpage, "user.php?sort={$sort}&amp;dir={$dir}&amp;perpage={$perpage}&amp;");
 flush();
 if (!$users) {
     $match = array();
     $table = NULL;
     print_heading(get_string('nousersfound'));
 } else {
     $countries = get_list_of_countries();
     if (empty($mnethosts)) {
         $mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
     }
     foreach ($users as $key => $user) {
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:managegroup.php

示例7: list

            // MARSUPIAL ************ MODIFICAT -> Deprecated code in Moodle 2.x
            // 2012.12.14 @abertranb
            $context_course = context_course::instance($course->id);
            list($esqljoin, $eparams) = get_enrolled_sql($context_course);
            //$params = array_merge($params, $eparams);
            $sql = "SELECT u.id,u.firstname,u.lastname,u.email\n\t\t\t                      FROM {user} u\n\t\t\t                      JOIN ({$esqljoin}) euj ON euj.id = u.id\n\t\t\t                     WHERE u.id <> " . $CFG->siteguest . "\n\t\t\t                     AND u.id not in\n\t\t\t                     \t(SELECT DISTINCT euserid FROM {rcommon_user_credentials} WHERE isbn = '" . $book->isbn . "')\n\t\t\t                           AND u.deleted = 0\n\t\t\t                  ORDER BY u.lastname ASC";
            $users_to_show = $DB->get_records_sql($sql, $eparams);
            // ************ MODIFICAT
            //$users_to_show = get_course_users($course->id, '', "SELECT DISTINCT euserid FROM {$CFG->prefix}rcommon_user_credentials WHERE isbn = '{$book->isbn}'", 'u.id, u.firstname, u.lastname, u.idnumber, u.email');
            // ************ FI
        }
    } else {
        // MARSUPIAL ************ MODIFICAT -> Deprecated code in Moodle 2.x
        // 2012.12.14 @abertranb
        $extrasql = 'id <> ' . $CFG->siteguest . ' AND id not in (SELECT DISTINCT euserid FROM {rcommon_user_credentials} WHERE isbn = \'' . $book->isbn . '\')';
        $users_to_show = get_users_listing('', '', 0, 0, '', '', '', $extrasql, null, $context);
        // ************ MODIFICAT
        //$users_to_show = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.idnumber", false, "SELECT DISTINCT euserid FROM {$CFG->prefix}rcommon_user_credentials WHERE isbn = '{$book->isbn}'");
        // ************ FI
    }
}
$user_to_show_cnt = is_array($users_to_show) ? count($users_to_show) : 0;
//echo '<hr>users_to_show: ' . serialize($users_to_show) . '<hr>';
echo '<p>' . get_string('keymanager_selected_for_assign', 'local_rcommon', $ids_cnt) . '<br>' . get_string('keymanager_no_assigned_user', 'local_rcommon', $already_unassigned) . '</p>';
echo '<script type="text/javascript">
	function check_max_users(){
	 	var max_users = "' . $already_unassigned . '";
	 	var select_cre = document.getElementById("addselect").options;
	 	cnt_selecteds = "0";

	 	for (var i = 0; i < select_cre.length; i++){
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:31,代码来源:credentials_bulk.php

示例8: print_spacer

            }
            $row[] = $user->city;
            $row[] = $user->country;
            $row[] = $strlastaccess;
            $table->data[] = $row;
        }
    }
    // add filters
    //$ufiltering->display_add();
    //$ufiltering->display_active();
    if (!empty($table)) {
        echo html_writer::table($table);
        echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
    }
    print_spacer(30);
    if ($users = get_users_listing($sort, $dir, 0, 0, '', '', '', $extrasql, $params, $context)) {
        foreach ($users as $user) {
            echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'users[' . $user->id . ']', 'value' => $user->username));
        }
    }
    $SESSION->user_filtering = array();
} else {
    echo $OUTPUT->heading(get_string('no_pick_students', 'block_pick_students'));
}
echo html_writer::start_tag('div');
if ($courseid != SITEID) {
    $assignableroles = get_assignable_roles(get_context_instance(CONTEXT_COURSE, $courseid));
    echo html_writer::start_tag('p');
    echo get_string('role');
    choose_from_menu($assignableroles, 'assign_roleid_course', '', 'choose', '', '0', false, false, 0, 'assign_roleid_course');
    echo html_writer::end_tag('p');
开发者ID:stepsgithub,项目名称:moodle-block_pick_students,代码行数:31,代码来源:pick.php

示例9: array

         $filters = @unserialize($log_message->mailto);
         if ($filters !== false && is_array($filters) && (empty($_POST['addfilter']) && empty($_POST['removeselected']))) {
             $SESSION->user_filtering = $filters;
         }
     }
 }
 // Get Our users
 $fields = array('realname' => 1, 'lastname' => 1, 'firstname' => 1, 'email' => 1, 'city' => 1, 'country' => 1, 'confirmed' => 1, 'suspended' => 1, 'profile' => 1, 'courserole' => 0, 'systemrole' => 0, 'username' => 0, 'cohort' => 1, 'firstaccess' => 1, 'lastaccess' => 0, 'neveraccessed' => 1, 'timemodified' => 1, 'nevermodified' => 1, 'auth' => 1, 'mnethostid' => 1, 'language' => 1, 'firstnamephonetic' => 1, 'lastnamephonetic' => 1, 'middlename' => 1, 'alternatename' => 1);
 $ufiltering = new user_filtering($fields, null, $filterparams);
 list($sql, $params) = $ufiltering->get_sql_filter();
 $usersearchcount = get_users(false, '', true, null, '', '', '', '', '', '*', $sql, $params);
 if ($fmid == 1) {
     $sql = 'id IN (' . $log_message->failuserids . ')';
 }
 $display_users = empty($sql) ? array() : get_users_listing($sort, $direction, $page * $perpage, $perpage, '', '', '', $sql, $params);
 $users = empty($sql) ? array() : get_users_listing($sort, $direction, 0, 0, '', '', '', $sql, $params);
 $editor_options = array('trusttext' => true, 'subdirs' => 1, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'accepted_types' => '*', 'context' => $context);
 $form = new admin_email_form(null, array('editor_options' => $editor_options));
 // Process data submission
 if ($form->is_cancelled()) {
     unset($SESSION->user_filtering);
     redirect(new moodle_url('/blocks/quickmail/admin_email.php'));
 } else {
     if ($data = $form->get_data()) {
         $message = new Message($data, array_keys($users));
         // @todo refactor so that we're not building two similar structures, namely: $data and $message.
         $data->courseid = SITEID;
         $data->userid = $USER->id;
         $data->mailto = isset($SESSION->user_filtering) ? serialize($SESSION->user_filtering) : "unknown filter";
         $data->format = $data->message_editor['format'];
         $data->message = $data->message_editor['text'];
开发者ID:amunguia,项目名称:block_quickmail,代码行数:31,代码来源:admin_email.php


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