本文整理汇总了PHP中Project::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getUser方法的具体用法?PHP Project::getUser怎么用?PHP Project::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ChangeIndexTabsAction
public function ChangeIndexTabsAction()
{
$userModel = new UserModel();
$user = Project::getUser()->getDbUser();
$request = Project::getRequest();
$tabs_map = $this->tabs_map;
$checkBoxes = $request->checkBoxes;
if ($user) {
$old_selected_tabs = unserialize($user->tabs_map);
foreach ($checkBoxes as $tabActiveId) {
$tabs_map['selected_tabs'][] = array('id' => $tabActiveId, 'selected' => true);
}
foreach ($old_selected_tabs as $old_tab) {
if (!in_array($old_tab['id'], $checkBoxes)) {
$tabs_map['selected_tabs'][] = array('id' => $old_tab['id'], 'selected' => false);
}
}
if (!$checkBoxes) {
$tabs_map['selected_tabs'][0]['selected'] = true;
}
$userModel->saveUserTabsMap($user->id, $tabs_map['selected_tabs']);
} else {
return;
}
$message['tabs_map'] = $tabs_map;
$message['user_id'] = $user->id;
$this->_view->returnTabs($message);
$this->_view->ajax();
}
示例2: init
function init($autorization)
{
if ($autorization->needAutorization() === true) {
$type = Project::getUser()->getDbUser()->getUserType();
} else {
$this->_guest = true;
$type = new UserTypeModel();
}
// TODO:: need adding cache
$right_model = new UserRightModel();
$list = $right_model->loadByUserType($type->id);
foreach ($list as $item) {
$controller_id = (int) $item['controller_id'];
$action_id = (int) $item['action_id'];
$subaction_id = (int) $item['subaction_id'];
if (!isset($this->_accessList[$controller_id])) {
$this->_accessList[$controller_id] = array();
}
if (!isset($this->_accessList[$controller_id][$action_id]) && $subaction_id === 0 && (int) $item['access'] > 0) {
$this->_accessList[$controller_id][$action_id] = true;
}
if ($subaction_id > 0) {
if (!isset($this->_subactions[$action_id])) {
$this->_subactions[$action_id] = array();
}
if ((int) $item['access'] > 0) {
$this->_subactions[$action_id][$subaction_id] = true;
}
}
}
}
示例3: getTabsPages
public function getTabsPages($tabs_map)
{
$user = Project::getUser()->getDbUser();
$htmlStr = "";
foreach ($tabs_map['selected_tabs'] as $tab) {
$tab_id = $tab['id'];
$tab_name = $tabs_map['main_tabs'][$tab_id]['name'];
switch ($tab_id) {
case 0:
$htmlPage = $this->viewNewsPage($user->id);
break;
case 1:
$htmlPage = $this->viewArticlePage($user->id);
break;
case 2:
$htmlPage = $this->viewAlbumPage($user->id);
break;
case 3:
$htmlPage = $this->viewQuestionPage($user->id);
break;
default:
$htmlPage = "";
break;
}
$htmlStr .= '
<div id="page' . $tab_id . '" class="tab-page">
' . $htmlPage . '
</div>
';
}
return $htmlStr;
}
示例4: run
public function run()
{
$autorize = Project::getSecurityManager()->getAutorize();
$controller_class = $autorize->getController()->name;
$controller = new $controller_class();
$controller->init($autorize->getController(), $autorize->getAction());
$action_function = $autorize->getAction()->name . 'Action';
setcookie('PHPSESSID', session_id(), null, null, Project::getUser()->getDbUser()->login . '.next24.ru');
$controller->{$action_function}();
$this->_request_complete = true;
// Сохраняем время пользователя на серваке
$user = Project::getUser()->getDbUser();
if ($user->id) {
$userModel = new UserModel();
$userModel->refreshUsersOnline();
if (!$userModel->isUserOnline($user->id)) {
$userModel->addUserOnline($user->id);
} else {
$userModel->updateUserOnline($user->id);
}
$userModel = new UserModel();
$user = $userModel->getUserById($user->id);
$userModel->checkForUserBans($user);
}
// END Сохраняем время пользователя на серваке
return $controller;
}
示例5: add
function add($user_id, $cause)
{
if (strlen(trim($cause))) {
$userModel = new UserModel();
$currentUser = Project::getUser()->getDbUser();
$userModel->load($user_id);
if ($userModel->id) {
$banHistoryModel = new BanHistoryModel();
$paramModel = new ParamModel();
$n_warnings_to_ban = $paramModel->getParam("UserController", "N_WARNINGS_TO_BAN");
$t_ban_time_sec = $paramModel->getParam("UserController", "T_BAN_TIME_SEC");
$count_user_warnings = $this->getUserWarningCount($user_id);
$this->clear();
$this->user_id = (int) $user_id;
$this->cause = $cause;
$warning_id = $this->save();
if ($userModel->warnings_fromlast_ban + 1 >= $n_warnings_to_ban) {
// пора банить
$subject = "Ваш аккаун заблокирован в системе Next24.ru";
$userModel->warnings_fromlast_ban = 0;
$userModel->banned = 1;
$userModel->banned_date = time();
$banHistoryModel->ban($user_id, $currentUser->id, $warning_id, date("Y-m-d H:i:s", time() + $t_ban_time_sec));
} else {
$userModel->warnings_fromlast_ban = $userModel->warnings_fromlast_ban + 1;
$subject = "Администратор Next24.ru установил Вам предупреждение";
}
$userModel->save();
$url_referer = $_SERVER['HTTP_REFERER'];
$this->sendMessage((int) $user_id, $subject, $cause, $url_referer);
return $warning_id;
}
}
return 0;
}
示例6: __construct
public function __construct()
{
$view_class = "GroupsView";
parent::__construct($view_class);
$this->request = Project::getRequest()->getKeys();
$this->session = Project::getSession()->getKeys();
$this->current_user_id = Project::getUser()->getDbUser()->id;
}
示例7: SaveAction
function SaveAction()
{
$request = Project::getRequest();
$user_id = (int) Project::getUser()->getDbUser()->id;
$model = new UserModel();
$model->load($request->id);
$do_save = true;
$this->_view->clearFlashMessages();
if (!strlen(trim($request->login))) {
$this->_view->addFlashMessage(FM::ERROR, "Не заполнено поле логин");
$do_save = false;
}
if ($request->unbann) {
$ban_model = new BanHistoryModel();
$ban_model->unban($request->id, $user_id);
}
if ($request->bann) {
if (strlen($request->warning)) {
$ban_date = $request->ban_date;
if (strlen($ban_date) && strtotime($ban_date) > time()) {
$warning_model = new WarningModel();
$warning_id = $warning_model->add($request->id, $request->warning);
$ban_model = new BanHistoryModel();
$ban_model->ban($request->id, $user_id, $warning_id, $request->ban_date);
} else {
$this->_view->addFlashMessage(FM::ERROR, "Неверная дата бана");
$do_save = false;
}
} else {
$this->_view->addFlashMessage(FM::ERROR, "Не заполнено предупреждение");
$do_save = false;
}
}
if ($do_save) {
$this->_view->clearFlashMessages();
$model->login = $request->login;
$model->user_type_id = $request->user_group;
if ($request->bann) {
$model->banned = 1;
$model->banned_date = strtotime($request->ban_date);
} else {
$model->banned = 0;
}
$ban_date = $request->ban_date;
if (strlen($ban_date)) {
//$ban_model = new Ban
}
$id = $model->save();
$model = new UserTypeModel();
$info = array();
$info['group_list'] = $model->loadAll();
$info['edit_controller'] = null;
$info['edit_action'] = 'Edit';
$this->makeUserList($info);
$this->_view->AjaxList($info);
}
$this->_view->ajax();
}
示例8: BaseAdminData
protected function BaseAdminData()
{
$router = Project::getRequest();
// TODO:: hardcoded menu
$this->_view->assign('main_menu', array(array('link' => $router->createUrl('Admin', 'Desktop'), 'name' => 'Рабочий стол'), array('link' => $router->createUrl('AdminParameter', 'GroupList'), 'name' => 'Параметры системы'), array('link' => $router->createUrl('AdminUser', 'List'), 'name' => 'Пользователи'), array('link' => $router->createUrl('UserType', 'List'), 'name' => 'Группы и права доступа'), array('link' => $router->createUrl('BlogAdmin', 'CatalogList'), 'name' => 'Блоги')));
$this->_view->assign('title', $this->_action_model->page_title);
$this->_view->assign('current_user', Project::getUser()->getDbUser());
// TODO:: read logged user information
}
示例9: __construct
function __construct($view_class = null)
{
if ($view_class === null) {
$view_class = "PlacesView";
}
$this->session = Project::getSession();
parent::__construct($view_class);
$this->_view->assign('tab_list', TabController::getOwnTabs(true));
$this->user = Project::getUser()->getShowedUser();
$this->_view->assign('user_profile', $this->user->data());
$this->_view->assign('session', $this->session);
$this->_view->assign('user_default_avatar', $this->user->getUserAvatar($this->user->id));
}
示例10: __construct
function __construct()
{
$user = Project::getUser()->getShowedUser();
$this->assign('showed_user_profile', $user->data());
$this->_base_dir = 'site';
// $this -> _js_files=array('sys.js', 'tab.js','jquery-1.3.2.js','ui.core.js','ui.draggable.js','ui.droppable.js','dropdown.js');
// $this -> _js_files=array('jquery-1.3.2.js','ui.core.js','ui.draggable.js','ui.droppable.js');
// $this -> _js_files=array('dropdown.js');
// $this -> _js_files=array('sys.js');
// $this -> _js_files=array('jquery.js','dropdown.js');
// $this -> _js_files=array('sys.js', 'tab.js','jquery-1.3.2.min.js','ui.core.js','ui.draggable.js','ui.droppable.js','dropdown.js');
$this->_js_files = array('jquery.min.js', 'dropdown.js');
$this->_css_files = array('screen.css');
parent::__construct();
}
示例11: viewSelectSecureUserList
public function viewSelectSecureUserList($name, $key, $section, $style = '')
{
$user_id = Project::getUser()->getDbUser()->id;
$users = $this->_stack['users'];
$result = '<form ' . $style . ' name="usr_list' . $key . '" method="post" action="' . Project::getRequest()->createUrl('GTD', 'GTDAddSecureUser') . '">';
$result .= '<select name="' . $name . '" onchange="usr_list' . $key . '.submit();">';
$result .= '<option>Добавить пользователя...</option>';
foreach ($users as $id => $user) {
if ($id != $user_id) {
$result .= '<option value="' . $id . '">' . $user['full_name'] . '</option>';
}
}
$result .= '</select><input type="hidden" name="id" value="' . $key . '" />
<input type="hidden" name="section" value="' . $section . '" />
<input type="hidden" name="cid" value="' . $this->category_id . '" />
<input type="hidden" name="fid" value="' . $this->folder_id . '" /></form>';
return $result;
}
示例12: showUserAvator
public function showUserAvator($userAvator, $imgUrl)
{
$user = Project::getUser()->getDbUser()->getUserById($userAvator['user_id']);
echo '<div class="avatar">';
echo '<a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '">';
if ($userAvator['path'] && $userAvator['path'] != 'no.png') {
$src = $userAvator['path'] ? $imgUrl . 'avatar/' . $userAvator['path'] : $imgUrl . 'avatar/' . $userAvator['sys_path'];
echo '<img src="' . $src . '" />';
} else {
echo '<img src="' . $imgUrl . 'avatar/no90.jpg" />';
}
echo '<span class="member-name">' . $user['login'] . '</span>';
echo '</a>';
echo '</div>';
echo '<ul class="controll clearfix">
<li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Написать сообщение"><i class="icon mail-icon"></i></a></li>
<li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Статьи"><i class="icon mbook-icon"></i></a></li>
<li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Добавить"><i class="icon adduser-icon"></i></a></li>
<li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Комментарии"><i class="icon mcomm-icon"></i></a></li>
</ul>';
}
示例13: AddComplaintAction
public function AddComplaintAction()
{
$messagesModel = new MessagesModel();
$user = Project::getUser()->getDbUser();
$userModel = new UserModel();
$arbitrationModel = new ArbitrationModel();
$request = Project::getRequest();
$user_login = $request->user_login;
$complaint_on_user = $userModel->getUserByLogin($user_login);
if ($complaint_on_user) {
$arbitrationModel->load(0);
$arbitrationModel->user_id = $user->id;
$arbitrationModel->complaint_on_user = $complaint_on_user['id'];
$arbitrationModel->complaint_text = $_SERVER['HTTP_REFERER'] . " " . htmlspecialchars($request->complaint_text);
$arbitrationModel->arbitration_group_id = $request->arbitration_group_id;
$arbitrationModel->save();
$message['item_id'] = (int) $request->item_id;
$this->_view->returnArbitrationAdded($message);
$this->_view->ajax();
}
}
示例14: loadAll
function loadAll($userid, $logged_user_id, $sortName = 'a.creation_date', $sortOrder = 'DESC', $defaultSortName = "id", $filter_ids = array())
{
$userid = (int) $userid;
if (is_null($sortName)) {
$sortName = $defaultSortName;
}
$DE = Project::getDatabase();
$this->checkPager();
$sortOrder = $this->getSortDirection($sortOrder);
if ($userid > 0) {
$om = 1;
} else {
$om = "a.is_onmain = 1";
}
if ($userid > 0) {
$u = "a.user_id = " . $userid;
} else {
$u = 1;
}
$sql = "SELECT " . "a.id as id," . "a.name as name," . "a.creation_date as creation_date," . "u.login as login," . "p.thumbnail as thumbnail," . "IF (rate.voices > 0, rate.rating/rate.voices, 0) as album_rating," . "a.user_id as user_id," . "a.access as access," . "a.is_onmain as is_onmain " . " FROM album as a " . " LEFT JOIN users u ON u.id=a.user_id " . " LEFT JOIN photo p ON p.id=a.thumbnail_id AND p.album_id=a.id " . " LEFT JOIN photo rate ON rate.album_id = a.id AND rate.is_rating > 0 " . " WHERE " . " " . $om . " " . " AND " . $u . " " . " AND ( (a.access=" . ACCESS::ALL . ") OR (?d AND a.access=" . ACCESS::FRIEND . ") OR (a.user_id=?d AND a.access=" . ACCESS::MYSELF . ") )" . " GROUP BY id " . " ORDER BY {$sortName} {$sortOrder} LIMIT ?d, ?d ";
$result = $DE->selectPage($this->_countRecords, $sql, (int) Project::getUser()->isFriend(), $logged_user_id, $this->_pager->getStartLimit(), $this->_pager->getPageSize());
$this->updatePagerAmount();
return $result;
}
示例15: createGroupsTree
public function createGroupsTree()
{
$groups = $this->_stack['groups'];
$current_user_id = Project::getUser()->getDbUser()->id;
foreach ($groups as $group) {
if ($group['access_rule']) {
if ($group['access_read']) {
if ($group['id_user'] == $current_user_id) {
$result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a> <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '"> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a>
<br />Метка группы : ' . $group['group_name'] . '<br />';
} else {
$result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a>
<br />Метка группы : ' . $group['group_name'] . '<br />';
}
} else {
if ($group['id_user'] == $current_user_id) {
$result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a> <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '"> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a>
<br />Метка группы : ' . $group['group_name'] . '<br />';
} else {
$result .= '<br />' . $group['full_name'] . ' <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">подать заявку</a>
<br />Метка группы : ' . $group['group_name'] . '<br />';
}
}
} else {
$result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a>';
if ($group['id_user'] == $current_user_id) {
$result .= ' <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a>';
}
$result .= '<br />Метка группы : ' . $group['group_name'] . '<br />';
}
}
return $result;
}