本文整理汇总了PHP中user::getAllUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP user::getAllUsers方法的具体用法?PHP user::getAllUsers怎么用?PHP user::getAllUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::getAllUsers方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controlToHTML
function controlToHTML($name)
{
// First, grab the data for the users
$users = array();
foreach (user::getAllUsers() as $u) {
$users[$u->id] = $u->firstname . " " . $u->lastname . ' (' . $u->username . ')';
}
uasort($users, 'strnatcmp');
$html = "<script type='text/javascript' src='" . PATH_RELATIVE . "js/ContactControl.js'></script>";
$html .= "<table cellpadding='0' cellspacing='0' border='0'><tr><td>";
$html .= '<input class="contactcontrol" type="radio" id="r_' . $name . '_users" name="' . $name . '_type" value="0" onclick="activateContactControl(0,\'' . $name . '\');" />User:';
$html .= '<select name="' . $name . '[0]" id="' . $name . '_users">';
foreach ($users as $id => $uname) {
$html .= '<option ';
if ($this->default == $id && $this->type == 0) {
$html .= 'selected ';
}
$html .= 'value="' . $id . '">' . $uname . '</option>';
}
$html .= '</select>';
$html .= '</td></tr><tr><td>';
$html .= '<input class="contactcontrol" type="radio" id="r_' . $name . '_email" name="' . $name . '_type" value="1" onclick="activateContactControl(1,\'' . $name . '\');" />Email:';
$html .= '<input class="contactcontrol" type="text" name="' . $name . '[1]" id="' . $name . '_email" ';
if ($this->type == 1) {
$html .= 'value="' . $this->default . '" ';
}
$html .= '/>';
$html .= '</td></tr></table>';
$html .= '<script type="text/javascript">activateContactControl(' . $this->type . ',"' . $name . '");</script>';
return $html;
}
示例2: lister
public function lister()
{
$user = new user();
$allUsers = $user->getAllUsers();
$success = $this->success;
$msg = $this->msg;
require_once 'view/user_lister_view.php';
}
示例3: form
function form($object)
{
global $db;
$tag_collections = $db->selectObjects("tag_collections");
foreach ($tag_collections as $tag_collections => $collection) {
$tc_list[$collection->id] = $collection->name;
}
//eDebug($all_calendars);
$form = new form();
if (!isset($object->id)) {
// $object->enable_categories = 0;
$object->enable_feedback = 0;
$object->reminder_notify = serialize(array());
$object->email_title_reminder = "Calendar Reminder";
$object->email_from_reminder = "Calendar Manager";
$object->email_address_reminder = "calendar@" . HOSTNAME;
$object->email_reply_reminder = "calendar@" . HOSTNAME;
$object->email_showdetail = 0;
$object->email_signature = "--\nThanks, Webmaster";
$object->aggregate = array();
$object->enable_rss = false;
$object->enable_ical = true;
$object->feed_title = "";
$object->feed_desc = "";
$object->rss_limit = 365;
$object->rss_cachetime = 60;
// $object->enable_tags = false;
// $object->collections = array();
// $object->group_by_tags = false;
// $object->show_tags = array();
} else {
$form->meta('id', $object->id);
// $cols = unserialize($object->collections);
// $object->collections = array();
// $available_tags = array();
// if (!empty($cols)) {
// foreach ($cols as $col_id) {
// $collection = $db->selectObject('tag_collections', 'id='.$col_id);
// $object->collections[$collection->id] = $collection->name;
// //while we're here we will get the list of available tags.
// $tmp_tags = $db->selectObjects('tags', 'collection_id='.$col_id);
// foreach ($tmp_tags as $tag) {
// $available_tags[$tag->id] = $tag->name;
// }
// }
// }
// //Get the tags the user chose to show in the group by views
// $stags = unserialize($object->show_tags);
// $object->show_tags = array();
// // if (is_array($stags)) {
// if (!empty($stags)) {
// foreach ($stags as $stag_id) {
// $show_tag = $db->selectObject('tags', 'id='.$stag_id);
// $object->show_tags[$show_tag->id] = $show_tag->name;
// }
// }
}
// setup the listbuilder arrays for calendar aggregation.
$loc = unserialize($object->location_data);
$calendars = expModules::listInstalledControllers('calendarmodule');
$saved_aggregates = empty($object->aggregate) ? array() : unserialize($object->aggregate);
$all_calendars = array();
$selected_calendars = array();
foreach ($calendars as $src => $cal) {
$calendar_name = (empty($cal->title) ? 'Untitled' : $cal->title) . ' on page ' . $cal->section;
if ($src != $loc->src) {
if (in_array($src, $saved_aggregates)) {
$selected_calendars[$src] = $calendar_name;
} else {
$all_calendars[$src] = $calendar_name;
}
}
}
// setup the config form
$form->register(null, '', new htmlcontrol('<h3>' . gt('General Configuration') . '</h3><hr size="1" />'));
// $form->register('enable_categories',gt('Enable Categories'),new checkboxcontrol($object->enable_categories,true));
$form->register('enable_feedback', gt('Enable Feedback'), new checkboxcontrol($object->enable_feedback, true));
$form->register(null, '', new htmlcontrol('<h3>' . gt('Events Reminder Email') . '</h3><hr size="1" />'));
// Get original style user lists
// $selected_users = array();
// foreach(unserialize($object->reminder_notify) as $i) {
// $selected_users[$i] = $db->selectValue('user', 'firstname', 'id='.$i) . ' ' . $db->selectValue('user', 'lastname', 'id='.$i) . ' (' . $db->selectValue('user', 'username', 'id='.$i) . ')';
// }
// $userlist = array();
// $list = user::getAllUsers();
// foreach ($list as $i) {
// if(!array_key_exists($i->id, $selected_users)) {
// $userlist[$i->id] = $i->firstname . ' ' . $i->lastname . ' (' . $i->username . ')';
// }
// }
// $form->register('reminder_notify',gt('Who should be reminded of events?'),new listbuildercontrol($selected_users, $userlist));
// Get User list
$defaults = array();
$userlist = array();
$users = user::getAllUsers();
foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . ' and user_id != 0') as $address) {
$locuser = user::getUserById($address->user_id);
$defaults[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')';
}
foreach ($users as $locuser) {
//.........这里部分代码省略.........
示例4: template
$template = new template('common', '_userpermissions', $loc);
} else {
//TODO
//ADK - I hard coded the common module name into the new template declaration since the path resolver
// can't seem to figure out that we are in the common module and not the module that call this action.
//$template = new template($loc->mod,'_userpermissions',$loc);
$template = new template('common', '_userpermissions', $loc);
}
$template->assign('user_form', 1);
$users = array();
$modulename = expModules::controllerExists($loc->mod) ? expModules::getControllerClassName($loc->mod) : $loc->mod;
$modclass = $modulename;
$mod = new $modclass();
$perms = $mod->permissions($loc->int);
$have_users = 0;
foreach (user::getAllUsers(false) as $u) {
$have_users = 1;
foreach ($perms as $perm => $name) {
$var = 'perms_' . $perm;
if (expPermissions::checkUser($u, $perm, $loc, true)) {
$u->{$perm} = 1;
} else {
if (expPermissions::checkUser($u, $perm, $loc)) {
$u->{$perm} = 2;
} else {
$u->{$perm} = 0;
}
}
}
$users[] = $u;
}
示例5: user
$msgs = $msg->getProjectMessages($proj["ID"]);
// write those to arrays
if (!empty($msgs)) {
array_push($messages, $msgs);
}
if (!empty($task)) {
array_push($tasks, $task);
}
$cou = $cou + 1;
}
}
$myClosedProjects = $project->getMyProjects($userid, 0);
// If the user is allowed to add projects, also get all users to assign to those projects
if ($userpermissions["projects"]["add"]) {
$user = new user();
$users = $user->getAllUsers(1000000);
$template->assign("users", $users);
$company = new company();
$companies = $company->getAllCompanies();
$template->assign("customers", $companies);
}
// by default the arrays have a level for each project, whcih contains arrays for each message/task . reduce array flattens this to have all messages/tasks of all projects in one structure
if (!empty($messages)) {
$messages = reduceArray($messages);
}
$etasks = reduceArray($tasks);
// Create sort array for multisort by adding the daysleft value to a sort array
$sort = array();
foreach ($etasks as $etask) {
array_push($sort, $etask["daysleft"]);
}
示例6: elseif
$template->display("error.tpl");
die;
}
$template->display("install2.tpl");
} elseif ($action == "step3") {
mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/");
mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/avatar/", 0777);
mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/ics/", 0777);
require CL_ROOT . "/config/" . CL_CONFIG . "/config.php";
// Start database connection
$conn = new PDO("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_pass);
$user = $_POST['name'];
$pass = $_POST['pass'];
// create the first user
$usr = new user();
$installChk = $usr->getAllUsers();
if ($installChk) {
// There already are users. abort install.
die("Collabtive seems to be already installed.<br />If this is an error, please clear your database.");
}
$usrid = $usr->add($user, "", 0, $pass);
if (!$usrid) {
$template->assign("errortext", "Error: Failed to create first user.");
$template->display("error.tpl");
die;
}
// insert default roles
$rolesobj = new roles();
$adminrid = $rolesobj->add("Admin", array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 1, "view" => 1), array("add" => 1), array("add" => 1));
$userrid = $rolesobj->add("User", array("add" => 1, "edit" => 1, "del" => 0, "close" => 0, "view" => 1), array("add" => 1, "edit" => 1, "del" => 0, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 0, "view" => 1), array("add" => 1), array("add" => 0));
$clientrid = $rolesobj->add("Client", array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0), array("add" => 0, "edit" => 0, "del" => 0, "read" => 0), array("add" => 0), array("add" => 0));
示例7: array
//check if the user is an admin
if (!$userpermissions["admin"]["add"] and $action != "addpro") {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "{$errtxt}<br>{$noperm}");
$template->display("error.tpl");
die;
}
//Administration of users
if ($action == "users") {
// Set the users tab active
$classes = array("overview" => "overview", "system" => "system", "users" => "active");
$template->assign("classes", $classes);
$roleobj = (object) new roles();
// Get 25 users
$users = $user->getAllUsers(25);
// Get All Projects
$projects = $project->getProjects(1, 10000);
$roles = $roleobj->getAllRoles();
$i2 = 0;
if (!empty($users)) {
foreach ($users as $usr) {
$i = 0;
// Check if a user is assigned to a project
if (!empty($projects)) {
foreach ($projects as $pro) {
if (chkproject($usr["ID"], $pro["ID"])) {
$chk = 1;
} else {
$chk = 0;
}
示例8: manage_group_memberships
public function manage_group_memberships()
{
global $db, $user;
expHistory::set('manageable', $this->params);
$memb = $db->selectObject('groupmembership', 'member_id=' . $user->id . ' AND group_id=' . $this->params['id'] . ' AND is_admin=1');
$perm_level = 0;
if ($memb) {
$perm_level = 1;
}
if (expPermissions::check('user_management', expCore::makeLocation('administrationmodule'))) {
$perm_level = 2;
}
$group = $db->selectObject('group', 'id=' . $this->params['id']);
$users = user::getAllUsers(0);
$members = array();
$admins = array();
foreach ($db->selectObjects('groupmembership', 'group_id=' . $group->id) as $m) {
$members[] = $m->member_id;
if ($m->is_admin == 1) {
$admins[] = $m->member_id;
}
}
for ($i = 0; $i < count($users); $i++) {
if (in_array($users[$i]->id, $members)) {
$users[$i]->is_member = 1;
} else {
$users[$i]->is_member = 0;
}
if (in_array($users[$i]->id, $admins)) {
$users[$i]->is_admin = 1;
} else {
$users[$i]->is_admin = 0;
}
}
//$limit = empty($this->config['limit']) ? 10 : $this->config['limit'];
$order = empty($this->config['order']) ? 'username' : $this->config['order'];
$page = new expPaginator(array('records' => $users, 'where' => 1, 'limit' => 9999, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Username' => 'username', 'First Name' => 'firstname', 'Last Name' => 'lastname', 'Is Member' => 'is_member', 'Is Admin' => 'is_admin')));
assign_to_template(array('page' => $page, 'group' => $group, 'users' => $users, 'canAdd' => count($members) < count($users) ? 1 : 0, 'hasMember' => count($members) > 0 ? 1 : 0, 'perm_level' => $perm_level));
}
示例9: form
static function form($object)
{
global $db;
//global $user;
$form = new form();
if (!isset($object->id)) {
$object->name = '';
$object->description = '';
$object->is_email = 0;
$object->is_saved = 1;
$object->response = gt('Your form has been submitted');
$object->resetbtn = gt('Reset');
$object->submitbtn = gt('Submit');
$object->subject = gt('Submitted form from site');
} else {
$form->meta('id', $object->id);
}
$form->register('name', gt('Name'), new textcontrol($object->name));
$form->register('description', gt('Description'), new texteditorcontrol($object->description));
$form->register('response', gt('Response'), new htmleditorcontrol($object->response));
$form->register(null, '', new htmlcontrol('<h3>' . gt('Button Settings') . '</h3><hr size="1" />'));
$form->register('submitbtn', gt('Submit Button Text'), new textcontrol($object->submitbtn));
$form->register('resetbtn', gt('Reset Button Text'), new textcontrol($object->resetbtn));
$form->register(null, '', new htmlcontrol('<h3>' . gt('Email Settings') . '</h3><hr size="1" />'));
$form->register('is_email', gt('Email Form'), new checkboxcontrol($object->is_email, false));
// Get User list
$userlist = array();
$defaults = array();
$users = user::getAllUsers();
foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . ' and user_id != 0') as $address) {
$locuser = user::getUserById($address->user_id);
$defaults[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')';
}
foreach ($users as $locuser) {
if (!array_key_exists($locuser->id, $defaults)) {
$userlist[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')';
}
}
$form->register('users', gt('Users'), new listbuildercontrol($defaults, $userlist));
// Get Group list
$grouplist = array();
$defaults = array();
$groups = group::getAllGroups();
if ($groups != null) {
foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . ' and group_id != 0') as $address) {
$group = group::getGroupById($address->group_id);
$defaults[$group->id] = $group->name;
}
foreach ($groups as $group) {
if (!array_key_exists($group->id, $defaults)) {
$grouplist[$group->id] = $group->name;
}
}
$form->register('groups', gt('Groups'), new listbuildercontrol($defaults, $grouplist));
}
// Get free-form address list
$defaults = array();
foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . " and email != ''") as $address) {
$defaults[$address->email] = $address->email;
}
$form->register('addresses', gt('Other Addresses'), new listbuildercontrol($defaults, null));
$form->register('subject', gt('Email Subject'), new textcontrol($object->subject));
$form->register(null, '', new htmlcontrol('<h3>' . gt('Database Settings') . '</h3><hr size="1" /><br />'));
$form->register('is_saved', gt('Save Submissions to the Database'), new checkboxcontrol($object->is_saved, false));
$form->register(null, '', new htmlcontrol(' ' . gt('To help prevent data loss, you cannot remove a form\'s database table once it has been added.') . '<br />'));
if ($object->is_saved == 1) {
$form->controls['is_saved']->disabled = true;
$form->meta('is_saved', '1');
}
// $form->register(null,'', new htmlcontrol('<br /><br /><br />'));
$form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));
return $form;
}
示例10: array
if (!$userpermissions["admin"]["add"] and $action != "addpro") {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "{$errtxt}<br>{$noperm}");
$template->display("error.tpl");
die;
}
if ($action == "index") {
$classes = array("overview" => "overview_active", "system" => "system", "users" => "users");
$template->assign("classes", $classes);
$title = $langfile['admin'];
$template->display("admin.tpl");
} elseif ($action == "users") {
$classes = array("overview" => "overview", "system" => "system", "users" => "active");
$template->assign("classes", $classes);
$users = $user->getAllUsers(14);
$projects = $project->getProjects(1, 10000);
$roleobj = (object) new roles();
$roles = $roleobj->getAllRoles();
$i2 = 0;
if (!empty($users)) {
foreach ($users as $usr) {
$i = 0;
// $projects = $project->getProjects(1, 10000);
if (!empty($projects)) {
foreach ($projects as $pro) {
if (chkproject($usr["ID"], $pro["ID"])) {
$chk = 1;
} else {
$chk = 0;
}