本文整理汇总了PHP中Users::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::getAll方法的具体用法?PHP Users::getAll怎么用?PHP Users::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testThatFetchingDataFromDbWillStoreItInCacheForLaterUseUnderCacheIdContainingAtLeastMethodName
public function testThatFetchingDataFromDbWillStoreItInCacheForLaterUseUnderCacheIdContainingAtLeastMethodName()
{
$userModel = new Users(array('db' => $this->db, 'cache' => $this->cache));
$users = $userModel->getAll();
foreach ($userModel->getCache()->getIds() as $cacheId) {
// strpos will return boolean false if don't find Users__getAll substring in $cacheId
if (strpos($cacheId, 'Users__getAll') !== false) {
$this->assertEquals($users, $userModel->getCache()->load($cacheId));
break;
}
}
}
示例2: actionConfirm
public function actionConfirm()
{
$this->view->data['header'] = 'Договор';
$this->view->data['kyrjers'] = Users::getAll('fio', array('status' => 'kyrjer'));
$this->view->data['districts'] = Numbers::getAll('DISTINCT `district`');
$this->view->content = array('confirm');
if ($this->view->data['numbers'] = $this->model->confirmTable()) {
$this->view->notice['notice'] .= 'Номера извлечены. ';
} else {
$this->view->notice['error'] .= $this->model->error;
}
if (!empty($_GET['unload'])) {
$this->view->htmlResponse('unload', 'main');
} else {
$this->view->generate();
}
}
示例3: select_user
/**
* Render select user box
*
* @param integer $selected ID of selected user
* @param array $attributes Additional attributes
* @return string
*/
function select_user($name, $selected = null, $attributes = null)
{
$users = Users::getAll();
$options = array(option_tag(lang('none'), 0));
if (is_array($users)) {
foreach ($users as $user) {
$option_attributes = $user->getId() == $selected ? array('selected' => 'selected') : null;
$user_name = $user->getUsername();
if ($user->isAdministrator()) {
$user_name .= ' (' . lang('administrator') . ')';
}
$options[] = option_tag($user_name, $user->getId(), $option_attributes);
}
// foreach
}
// if
return select_box($name, $options, $attributes);
}
示例4: usersAction
/**
* Page
*/
public function usersAction()
{
$usersModel = new Users();
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
if (@$data['method'] == 'create') {
//CREATE NEW USER
unset($data['method']);
if ($data['email'] == '' || $data['password'] == '') {
$this->view->error = "Please complete all fields.";
$this->view->data = $data;
} else {
$data['password'] = sha1($data['password']);
$usersModel->insert($data);
$this->view->success = "New User Created.";
}
}
if (@$data['method'] == 'update') {
//UPDATE USER
unset($data['method']);
if ($data['password'] == '') {
unset($data['password']);
} else {
$data['password'] = sha1($data['password']);
}
$usersModel->updateRecord($data['id'], $data);
$this->view->success = "User Record Updated.";
}
if (@$data['method'] == 'delete') {
//DELETE USER
$where = "id=" . $data['id'];
$usersModel->delete($where);
}
}
$users = $usersModel->getAll();
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($users);
$paginator->setItemCountPerPage(20);
$paginator->setCurrentPageNumber($page);
$this->view->users = $paginator;
$locationsModel = new Locations();
$this->view->locations = $locationsModel->getAll();
}
示例5: get_index
public function get_index()
{
$users = Users::getAll();
return View::make('admin/users.index')->with('users', $users);
}
示例6: manageUsers
private function manageUsers()
{
/* Bail out if the user doesn't have SA permissions. */
if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) {
CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
return;
//$this->fatal(ERROR_NO_PERMISSION);
}
$users = new Users($this->_siteID);
$rs = $users->getAll();
$license = $users->getLicenseData();
foreach ($rs as $rowIndex => $row) {
$rs[$rowIndex]['successfulDate'] = DateUtility::fixZeroDate($rs[$rowIndex]['successfulDate'], 'Never');
$rs[$rowIndex]['unsuccessfulDate'] = DateUtility::fixZeroDate($rs[$rowIndex]['unsuccessfulDate'], 'Never');
// FIXME: The last test here might be redundant.
// FIXME: Put this in a private method. It is duplicated twice so far.
$siteIDPosition = strpos($row['username'], '@' . $_SESSION['CATS']->getSiteID());
if ($siteIDPosition !== false && substr($row['username'], $siteIDPosition) == '@' . $_SESSION['CATS']->getSiteID()) {
$rs[$rowIndex]['username'] = str_replace('@' . $_SESSION['CATS']->getSiteID(), '', $row['username']);
}
}
$this->_template->assign('active', $this);
$this->_template->assign('subActive', 'User Management');
$this->_template->assign('rs', $rs);
$this->_template->assign('license', $license);
$this->_template->display('./modules/settings/Users.tpl');
}
示例7: new_list_tasks
function new_list_tasks()
{
//load config options into cache for better performance
load_user_config_options_by_category_name('task panel');
// get query parameters, save user preferences if necessary
$status = array_var($_GET, 'status', null);
if (is_null($status) || $status == '') {
$status = user_config_option('task panel status', 2);
} else {
if (user_config_option('task panel status') != $status) {
set_user_config_option('task panel status', $status, logged_user()->getId());
}
}
$previous_filter = user_config_option('task panel filter', 'assigned_to');
$filter = array_var($_GET, 'filter');
if (is_null($filter) || $filter == '') {
$filter = user_config_option('task panel filter', 'assigned_to');
} else {
if (user_config_option('task panel filter') != $filter) {
set_user_config_option('task panel filter', $filter, logged_user()->getId());
}
}
if ($filter != 'no_filter') {
$filter_value = array_var($_GET, 'fval');
if (is_null($filter_value) || $filter_value == '') {
$filter_value = user_config_option('task panel filter value', logged_user()->getCompanyId() . ':' . logged_user()->getId());
set_user_config_option('task panel filter value', $filter_value, logged_user()->getId());
$filter = $previous_filter;
set_user_config_option('task panel filter', $filter, logged_user()->getId());
} else {
if (user_config_option('task panel filter value') != $filter_value) {
set_user_config_option('task panel filter value', $filter_value, logged_user()->getId());
}
}
}
$isJson = array_var($_GET, 'isJson', false);
if ($isJson) {
ajx_current("empty");
}
$project = active_project();
$tag = active_tag();
$template_condition = "`is_template` = 0 ";
//Get the task query conditions
$task_filter_condition = "";
switch ($filter) {
case 'assigned_to':
$assigned_to = explode(':', $filter_value);
$assigned_to_user = array_var($assigned_to, 1, 0);
$assigned_to_company = array_var($assigned_to, 0, 0);
if ($assigned_to_user > 0) {
$task_filter_condition = " AND (`assigned_to_user_id` = " . $assigned_to_user . " OR (`assigned_to_company_id` = " . $assigned_to_company . " AND `assigned_to_user_id` = 0)) ";
} else {
if ($assigned_to_company > 0) {
$task_filter_condition = " AND `assigned_to_company_id` = " . $assigned_to_company . " AND `assigned_to_user_id` = 0";
} else {
if ($assigned_to_company == -1 && $assigned_to_user == -1) {
$task_filter_condition = " AND `assigned_to_company_id` = 0 AND `assigned_to_user_id` = 0 ";
}
}
}
break;
case 'assigned_by':
if ($filter_value != 0) {
$task_filter_condition = " AND `assigned_by_id` = " . $filter_value . " ";
}
break;
case 'created_by':
if ($filter_value != 0) {
$task_filter_condition = " AND `created_by_id` = " . $filter_value . " ";
}
break;
case 'completed_by':
if ($filter_value != 0) {
$task_filter_condition = " AND `completed_by_id` = " . $filter_value . " ";
}
break;
case 'milestone':
$task_filter_condition = " AND `milestone_id` = " . $filter_value . " ";
break;
case 'priority':
$task_filter_condition = " AND `priority` = " . $filter_value . " ";
break;
case 'subtype':
if ($filter_value != 0) {
$task_filter_condition = " AND `object_subtype` = " . $filter_value . " ";
}
break;
case 'no_filter':
$task_filter_condition = "";
break;
default:
flash_error(lang('task filter criteria not recognised', $filter));
}
if ($project instanceof Project) {
$pids = $project->getAllSubWorkspacesQuery(true);
$projectstr = " AND " . ProjectTasks::getWorkspaceString($pids);
} else {
$pids = "";
$projectstr = "";
}
//.........这里部分代码省略.........
示例8:
Poslednjih 10 korisnika
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Ime</th>
<th>Telefon</th>
</tr>
</thead>
<tbody>
<?php
/**************************************************************************************************/
$last_ten_user = Users::getAll("ORDER BY user_id DESC LIMIT 10");
foreach ($last_ten_user as $user) {
echo "<tr> \n <td>{$user->user_id} </td>\n <td>{$user->user_name} {$user->user_surname}</td>\n <td>{$user->user_phone}</td>\n </tr>";
}
/******************************************************************************************************/
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- End Kitchen Sink -->
<!-- Kitchen Sink -->
<div class="col-md-6">
<div class="panel panel-default">
示例9: home
public function home()
{
$users = Users::getAll();
print_r($users);
require_once 'views/pages/home.php';
}
示例10: index
function index()
{
if (!can_manage_time(logged_user(), true)) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$tasksUserId = array_var($_GET, 'tu');
if (is_null($tasksUserId)) {
$tasksUserId = user_config_option('TM tasks user filter', logged_user()->getId());
} else {
if (user_config_option('TM tasks user filter') != $tasksUserId) {
set_user_config_option('TM tasks user filter', $tasksUserId, logged_user()->getId());
}
}
$timeslotsUserId = array_var($_GET, 'tsu');
if (is_null($timeslotsUserId)) {
$timeslotsUserId = user_config_option('TM user filter', 0);
} else {
if (user_config_option('TM user filter') != $timeslotsUserId) {
set_user_config_option('TM user filter', $timeslotsUserId, logged_user()->getId());
}
}
$showTimeType = array_var($_GET, 'stt');
if (is_null($showTimeType)) {
$showTimeType = user_config_option('TM show time type', 0);
} else {
if (user_config_option('TM show time type') != $showTimeType) {
set_user_config_option('TM show time type', $showTimeType, logged_user()->getId());
}
}
$start = array_var($_GET, 'start', 0);
$limit = 20;
$tasksUser = Users::findById($tasksUserId);
$timeslotsUser = Users::findById($timeslotsUserId);
//Active tasks view
$tasks = ProjectTasks::getOpenTimeslotTasks($tasksUser, logged_user());
ProjectTasks::populateData($tasks);
$tasks_array = array();
//Timeslots view
$total = 0;
switch ($showTimeType) {
case 0:
//Show only timeslots added through the time panel
$timeslots = Timeslots::getProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project(), $start, $limit);
$total = Timeslots::countProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project());
break;
case 1:
//Show only timeslots added through the tasks panel / tasks
throw new Error('not yet implemented' . $showTimeType);
/*if (active_project() instanceof Project){
$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
} else {
$workspacesCSV = logged_user()->getWorkspacesQuery();
}
$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
//break;
/*if (active_project() instanceof Project){
$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
} else {
$workspacesCSV = logged_user()->getWorkspacesQuery();
}
$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
//break;
case 2:
//Show timeslots added through both the time and tasks panel / tasks
throw new Error('not yet implemented' . $showTimeType);
//break;
//break;
default:
throw new Error('Unrecognised TM show time type: ' . $showTimeType);
}
//Get Users Info
if (logged_user()->isMemberOfOwnerCompany()) {
$users = Users::getAll();
} else {
$users = logged_user()->getCompany()->getUsers();
}
//Get Companies Info
if (logged_user()->isMemberOfOwnerCompany()) {
$companies = Companies::getCompaniesWithUsers();
} else {
$companies = array(logged_user()->getCompany());
}
tpl_assign('timeslots', $timeslots);
tpl_assign('tasks', $tasks);
tpl_assign('users', $users);
tpl_assign('start', $start);
tpl_assign('limit', $limit);
tpl_assign('total', $total);
tpl_assign('companies', $companies);
ajx_set_no_toolbar(true);
}
示例11: getOwnersByType
public function getOwnersByType($data)
{
$this->setResponseType('json');
$result = new stdclass();
$result->status = 'OK';
try {
switch ($data->type) {
case 'EVERYBODY':
$result->total = 0;
$result->owners = array();
break;
case 'USER':
require_once 'classes/model/Users.php';
$users = array();
$usersInstance = new Users();
$allUsers = $usersInstance->getAll();
foreach ($allUsers->data as $user) {
$users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
}
usort($users, function ($str1, $str2) {
return strcmp(strtolower($str1["OWNER_NAME"]), strtolower($str2["OWNER_NAME"]));
});
$result->total = $allUsers->totalCount;
$result->owners = $users;
break;
case 'DEPARTMENT':
require_once 'classes/model/Department.php';
require_once 'classes/model/Content.php';
$departments = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(DepartmentPeer::DEP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = DepartmentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = DepartmentPeer::doCount($criteria);
$result->owners = $departments;
break;
case 'GROUP':
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/Content.php';
$groups = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = GroupwfPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = GroupwfPeer::doCount($criteria);
$result->owners = $groups;
break;
}
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
示例12: getUsers
public function getUsers($params)
{
require_once 'classes/model/Users.php';
G::LoadClass('configuration');
$conf = new Configurations();
$search = isset($params['search']) ? $params['search'] : null;
$users = Users::getAll($params['start'], $params['limit'], $search);
foreach ($users->data as $i => $user) {
$users->data[$i]['USER'] = $conf->getEnvSetting('format', array('userName' => $user['USR_USERNAME'], 'firstName' => $user['USR_FIRSTNAME'], 'lastName' => $user['USR_LASTNAME']));
}
print G::json_encode($users);
}
示例13: setViewVariables
function setViewVariables($view_type, $user_filter, $status_filter)
{
//Get Users Info
if (logged_user()->isMemberOfOwnerCompany()) {
$users = Users::getAll();
} else {
$users = logged_user()->getCompany()->getUsers();
}
//Get Companies Info
if (logged_user()->isMemberOfOwnerCompany()) {
$companies = Companies::getCompaniesWithUsers();
} else {
$companies = array(logged_user()->getCompany());
}
$usr = Users::findById($user_filter);
$user_filter_comp = $usr != null ? $usr->getCompanyId() : 0;
tpl_assign('users', $users);
tpl_assign('companies', $companies);
tpl_assign('userPreferences', array('view_type' => $view_type, 'user_filter' => $user_filter, 'status_filter' => $status_filter, 'user_filter_comp' => $user_filter_comp));
}
示例14: tool_mass_mailer
/**
* Send multiple emails using this simple tool
*
* @param void
* @return null
*/
function tool_mass_mailer()
{
$tool = AdministrationTools::getByName('mass_mailer');
if (!$tool instanceof AdministrationTool) {
flash_error(lang('administration tool dnx', 'test_mail_settings'));
$this->redirectTo('administration', 'tools');
}
// if
$massmailer_data = array_var($_POST, 'massmailer');
tpl_assign('tool', $tool);
tpl_assign('grouped_users', Users::getGroupedByCompany());
tpl_assign('massmailer_data', $massmailer_data);
if (is_array($massmailer_data)) {
try {
$subject = trim(array_var($massmailer_data, 'subject'));
$message = trim(array_var($massmailer_data, 'message'));
$errors = array();
if ($subject == '') {
$errors[] = lang('massmailer subject required');
}
// if
if ($message == '') {
$errors[] = lang('massmailer message required');
}
// if
$users = Users::getAll();
$recipients = array();
if (is_array($users)) {
foreach ($users as $user) {
if (array_var($massmailer_data, 'user_' . $user->getId()) == 'checked') {
$recipients[] = Notifier::prepareEmailAddress($user->getEmail(), $user->getDisplayName());
}
// if
}
// foreach
}
// if
if (!count($recipients)) {
$errors[] = lang('massmailer select recipients');
}
// if
if (count($errors)) {
throw new FormSubmissionErrors($errors);
}
// if
if (Notifier::sendEmail($recipients, Notifier::prepareEmailAddress(logged_user()->getEmail(), logged_user()->getDisplayName()), $subject, $message)) {
flash_success(lang('success massmail'));
} else {
flash_error(lang('error massmail'));
}
// if
$this->redirectToUrl($tool->getToolUrl());
} catch (Exception $e) {
tpl_assign('error', $e);
}
// try
}
// if
}
示例15:
}
//print_r($_POST);
}
/***************************************************************************/
?>
<div class="form-group">
<h2 class="naslov"> Unesite podatke o dugovanju.</h2>
<br>
<form action="" method="POST">
<i class="fa fa-user"></i> <label for="user_id">Izaberite korisnika </label>
<select class="form-control" name="user_id" id="user_id">
<option value="-1">Izaberite korisnika:</option>
<?php
/************************************************************************/
$all_users = Users::getAll();
foreach ($all_users as $user) {
echo "<option value='{$user->user_id}'>{$user->user_id}. {$user->user_name} {$user->user_surname}</option>";
}
/**************************************************************************/
?>
</select>
<br>
<i class="fa fa-money"></i> <label for="how_much">Koliko:</label>
<select class="form-control" id="how_much" name="how_much">
<option value="-1">Izaberite koliko:</option>
<?php
/************************************************************************************************/
$all_prices = Prices::getAll();
foreach ($all_prices as $price) {
echo "<option value='{$price->price_id}'>{$price->price_name} {$price->price} din </option>";