本文整理汇总了PHP中Project::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getSession方法的具体用法?PHP Project::getSession怎么用?PHP Project::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getSession方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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;
}
示例2: setIsLogged
function setIsLogged($dbUser)
{
$session = Project::getSession();
$session->add('logged', true);
$session->add('logged_user_id', (int) $dbUser->id);
$this->_guest = false;
$this->_dbUser = $dbUser;
}
示例3: __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));
}
示例4: initialize
function initialize(IConfigParameter $configuration)
{
$this->_autorization = new AppAutorization();
$this->_autorization->initialize($configuration);
$user_class = $configuration->get('user', false);
if (!$user_class) {
$user_class = 'AppUser';
}
Project::getSession()->open();
Project::setUser(new $user_class($this->_autorization));
$this->_auth = new AppAuth($this->_autorization);
Project::setSecurityManager($this);
$this->_autorization->procees($this->_auth);
}
示例5: include
<?php include($this -> _include('../header.tpl.php')); ?>
<?php
$v_session = Project::getSession();
$qpp = $v_session->getKey('qpp');
?>
<div class="columns-page clearfix">
<div class="main"><div class="wrap">
<?php if($this->current_user && $this->current_user->id > 0) { ?>
<div class="content-header">
<h1>Задать вопрос<i class="icon ask-icon"></i></h1>
<form action="<?=$this->createUrl('QuestionAnswer', 'ManagedQuestion', array($this->question['id']))?>" method="post" class="ask-form">
<table>
<tr class="textarea-field">
<td colspan="5"><textarea name="question_text" rows="5" cols="20"><?=$this->question['q_text']?></textarea></td>
</tr>
<tr>
<td class="label-field">
<label for="f1">Категория</label>
</td>
<td class="select-field">
<select id="f1" name="cat_id">
<?foreach ($this->question_cat as $cat):?>
<option value="<?=$cat['id']?>" <?if($cat['id']==$this->question['questions_cat_id']) { ?> selected <? } ?>><?=$cat['name']?></option>
<?endforeach;?>
</select>
</td>
<td class="label-field">
<label for="f2">Tэги</label>
</td>
<?php $i = 0;
foreach ($this->question_tag_list as $v) {
示例6: createUrl
public function createUrl($service = null, $action = null, $parameters = null, $user = null)
{
if ($service === null) {
$service = $this->_current_controller;
}
if ($action === null) {
$action = $this->_current_action;
}
// TODO:: need cache to service+action for getting request key!
$controller_model = new ControllerModel();
$controller_model->loadByKey($service);
if ((int) $controller_model->id <= 0) {
throw new InvalidValueException("Can't create url, controller is not exists");
}
$action_model = new ActionModel();
$action_model->loadByKey($controller_model->id, $action);
if ((int) $action_model->id <= 0) {
throw new InvalidValueException("Can't create url, action is not exists");
}
if (!strlen($action_model->request_key)) {
throw new InvalidValueException(__METHOD__ . "::" . __LINE__ . ":: Bad request key: controller - " . $controller_model->name . "; action - " . $action_model->name . ";action ID=" . $action_model->id);
}
// Default user controller action ----------
if ($service == 'User' && $action_model->default && $this->getUsername()) {
$action_model->request_key = '';
}
// -----------------------------------------
if (!$this->_rewrite) {
if ($action !== null) {
$parameters = array_merge(array($this->_request_action_key => $action), $parameters);
}
$parameters = array_merge(array($this->_request_controller_key => $service), $parameters);
}
if (!is_array($parameters)) {
$parameters = array();
}
$session_name = Project::getSession()->getSessionName();
/*if (($this -> _username != $user) && ($user !== null) && ((int)Project::getUser() -> getDbUser() -> id > 0)){
$sid = Project::getSession() -> getSID();
//var_dump($sid);die;
$parameters[$session_name] = $sid;
} else {
if (isset($parameters[$session_name])){
unset($parameters[$session_name]);
}
}*/
$query = '';
foreach ($parameters as $k => $v) {
if (strlen($query)) {
$query .= $this->_param_delimiter;
}
if (!is_numeric($k) && strlen($k)) {
$query .= $k . $this->_value_delimiter . $v;
} else {
$query .= $v;
}
}
//$query = http_build_query(is_array($parameters)?$parameters:array(), '', $this -> _param_delimiter);
$url = '';
if ($this->_rewrite) {
$url = $action_model->request_key;
}
if ($query) {
//$query = str_replace('=', $this -> _value_delimiter, $query);
//$query = str_replace($this -> _param_delimiter.$this -> _value_delimiter, $this -> _param_delimiter, $query);
$url .= ($this->_rewrite ? '/' : '?') . $query . ($this->_rewrite ? '/' : null);
}
if ($this->_rewrite) {
if ($user === null) {
if ($this->_username !== null) {
$user = $this->_username;
}
}
if ($user !== null) {
$host = ($this->IsSecure() ? "https://" : "http://") . $user . (strlen($user) ? '.' : '') . $this->_config->get('base_host') . '/';
} else {
$host = $this->getHost();
}
$url = $host . $url;
} else {
$url = $this->getAbsoluteUrl() . $url;
}
return $url;
}
示例7: _getData
/**
* Формирование всех основных данных для HTML-форм
*/
protected function _getData(&$data, $p_action, $p_categoryID = null, $p_n_page = null, $p_userID = null, $p_str_find = null, $p_sort_rating = null, $p_sort_type = null)
{
$v_categoryID = (int) $p_categoryID;
$v_n_page = (int) $p_n_page;
$v_userID = (int) $p_userID;
$v_model = new SocialModel();
$v_request = Project::getRequest();
$v_session = Project::getSession();
$request_keys = $v_request->getKeys();
$socials_per_page = $request_keys['spp'];
if ($socials_per_page) {
if (in_array($socials_per_page, array(10, 20, 30))) {
$v_session->add('spp', $socials_per_page);
$v_list_per_page = $socials_per_page;
} else {
$v_list_per_page = 10;
$v_session->add('spp', $v_list_per_page);
}
} else {
if ($v_session->getKey('spp')) {
$v_list_per_page = $v_session->getKey('spp');
} else {
$v_list_per_page = 10;
}
}
// $v_list_per_page = $this->getParam('social_pos_per_page', 4);
$v_DbPager = new DbPager($v_n_page, $v_list_per_page);
$v_model->setPager($v_DbPager);
$data['social_pos_list'] = $v_model->loadSocialPosList($v_categoryID, $v_userID, $p_str_find, $p_sort_rating, $p_sort_type);
$v_pager_view = new SitePagerView();
// Формируем объект-постраничный вывод
$data['social_pos_list_pager'] = $v_pager_view->show2($v_model->getPager(), 'Social', $p_action, array($v_categoryID));
// class SitePagerView -> function show2(IDbPager $pager, $controller = null, $action = null, $params = array(), $user = null)
}
示例8: _getData
protected function _getData(&$data, $p_action, $p_categoryID = null, $p_n_page = null, $p_userID = null, $p_tagID = null, $p_show_only_public = false)
{
if ($p_categoryID == 'imported') {
$v_categoryID = -1;
} else {
$v_categoryID = (int) $p_categoryID;
}
$v_n_page = (int) $p_n_page;
$v_userID = (int) $p_userID;
$v_tagID = (int) $p_tagID;
$v_model = new BookmarksModel();
$v_request = Project::getRequest();
$v_session = Project::getSession();
$request_keys = $v_request->getKeys();
$bookmarks_per_page = $request_keys['bpp'];
if ($bookmarks_per_page) {
if (in_array($bookmarks_per_page, array(10, 20, 30))) {
$v_session->add('bpp', $bookmarks_per_page);
$v_list_per_page = $bookmarks_per_page;
} else {
$v_list_per_page = 10;
$v_session->add('bpp', $v_list_per_page);
}
} else {
if ($v_session->getKey('bpp')) {
$v_list_per_page = $v_session->getKey('bpp');
} else {
$v_list_per_page = 10;
}
}
//$v_list_per_page = $this->getParam('bookmarks_per_page', 4);
$v_DbPager = new DbPager($v_n_page, $v_list_per_page);
$v_model->setPager($v_DbPager);
$data['bookmarks_list'] = $v_model->loadBookmarksList($v_categoryID, $v_userID, $v_tagID, (bool) $p_show_only_public);
$v_pager_view = new SitePagerView();
// Формируем объект-постраничный вывод
$data['bookmarks_list_pager'] = $v_pager_view->show2($v_model->getPager(), 'Bookmarks', $p_action, array($v_categoryID, $v_tagID));
// class SitePagerView -> function show2(IDbPager $pager, $controller = null, $action = null, $params = array(), $user = null)
if ($v_categoryID > 0) {
// -- формирование облака тегов для выбранной категории
$v_tags_model = new BookmarksTagModel();
$data['bookmarks_tags_list'] = $v_tags_model->loadTagsWhere($v_categoryID, $v_userID, null, (bool) $p_show_only_public);
}
/*
// Номер выводимой страницы, определяется адресом bookmarks_list/0/1/2/ ...bookmarks_list/0/0/2/
// где bookmarks_list/{id_категории}/{id_тега}/{номер страницы}/
$v_categoryID = $v_request->getKeyByNumber(0);
$v_tagID = $v_request->getKeyByNumber(1);
$v_n_page = $v_request->getKeyByNumber(2);
$this->_getData($data, 'BookmarksList', $v_categoryID, $v_n_page, 0, $v_tagID, true);
*/
}
示例9: isValidCaptcha
static function isValidCaptcha($entry)
{
return trim($entry) == Project::getSession()->getKey('captcha_keystring');
}
示例10: SearchByInterestAction
/**
* Action: Поиск по интересам
*/
public function SearchByInterestAction()
{
$v_request = Project::getRequest();
$v_session = Project::getSession();
$data = array();
$this->_BaseSiteData($data);
$data['action'] = 'SearchByInterest';
$v_id_interest = (int) $v_request->getKeyByNumber(0);
$v_n_page = (int) $v_request->getKeyByNumber(1);
$v_model = new InterestsModel();
$data['interests_list'] = $v_model->loadAll();
if ($v_id_interest > 0) {
$this->_getData($data, 'SearchByInterest', $v_n_page, $v_id_interest);
}
$this->_view->assign('tab_list', TabController::getSearchUserTabs(false, true));
// Show tabs
$this->_view->assign('counter_users', $this->counter_users);
$this->_view->Search_ByInterest($data);
$this->_view->parse();
}
示例11: GTDAddSecureUserAction
public function GTDAddSecureUserAction()
{
$model = new GTDModel();
$user_id = Project::getUser()->getDbUser()->id;
$v_request = Project::getRequest();
$v_session = Project::getSession();
$request_keys = $v_request->getKeys();
$model->addSecureUser($request_keys['id'], $request_keys['section'], $request_keys['addusr']);
switch ($request_keys['section']) {
case 1:
$this->GTDAction();
break;
case 2:
$this->GTDViewFoldersAction();
break;
case 3:
$this->GTDViewFilesAction();
break;
}
}
示例12: _list
protected function _list(&$data, $action, $catId = null, $tagId = null, $userId = null, $order = null, $sort_type = null, $sort = null)
{
$param = Project::getRequest()->getKeys();
array_shift($param);
$question_model = new QuestionModel();
$question_cat_model = new QuestionCatModel();
if ($catId > 0) {
$tag_model = new QuestionTagModel();
$data['question_tag_list'] = $tag_model->loadTags($catId);
}
$v_request = Project::getRequest();
$v_session = Project::getSession();
$request_keys = $v_request->getKeys();
$questions_per_page = $request_keys['qpp'];
if ($questions_per_page) {
if (in_array($questions_per_page, array(10, 20, 30))) {
$v_session->add('qpp', $questions_per_page);
$v_list_per_page = $questions_per_page;
} else {
$v_list_per_page = 10;
$v_session->add('qpp', $v_list_per_page);
}
} else {
if ($v_session->getKey('qpp')) {
$v_list_per_page = $v_session->getKey('qpp');
} else {
$v_list_per_page = 10;
}
}
//$pager = new DbPager($request->pn, 20); //TODO: pageSize
$pager = new DbPager($request->pn, $v_list_per_page);
$question_model->setPager($pager);
$data['question_list'] = $question_model->loadWhere($catId, $tagId, $userId, $order, $sort_type, $sort);
$data['question_cat_list'] = $question_cat_model->loadAll();
$pager_view = new SitePagerView();
$data['question_list_pager'] = $pager_view->show2($question_model->getPager(), 'QuestionAnswer', $action, $param);
}
示例13: DebateRefreshChat
function DebateRefreshChat()
{
$debateModel = new DebateModel();
$user = Project::getUser()->getDbUser();
$sessiovVars = Project::getSession();
$debateChatId = $sessiovVars->getKey('debateChatId');
$debateChatHelpersId = $sessiovVars->getKey('debateChatHelpersId');
$debateChatUsersId = $sessiovVars->getKey('debateChatUsersId');
$message = array();
$debateNow = $debateModel->getDebateNow();
$activeEtap = $debateModel->getActiveEtap();
$userNumber = $debateModel->getUserNumber($debateNow, $user->id);
$message['user_id'] = $user->id;
$aChatLines = $debateModel->getChatLines('debate_chat', $debateChatId);
$htmlChatText = $debateModel->getHtmlChatText($aChatLines, $debateNow);
$lastId = $debateModel->getLastIdFromArray($aChatLines);
if ($lastId) {
$sessiovVars->add('debateChatId', $lastId);
}
$debate_user_id = $debateModel->getUserByHelper($debateNow, $user->id);
if (!$debate_user_id && $userNumber) {
$debate_user_id = $user->id;
}
$aChatHelpersLines = $debateModel->getChatLines('debate_helpers_chat', $debateChatHelpersId, $debate_user_id);
$htmlChatHelpersText = $debateModel->getHtmlChatText($aChatHelpersLines, $debateNow);
$lastId = $debateModel->getLastIdFromArray($aChatHelpersLines);
if ($lastId) {
$sessiovVars->add('debateChatHelpersId', $lastId);
}
$aChatUsersLines = $debateModel->getChatLines('debate_users_chat', $debateChatUsersId);
$htmlChatUsersText = $debateModel->getHtmlChatText($aChatUsersLines, $debateNow);
$lastId = $debateModel->getLastIdFromArray($aChatUsersLines);
if ($lastId) {
$sessiovVars->add('debateChatUsersId', $debateModel->getLastIdFromArray($aChatUsersLines));
}
$message['htmlChatText'] = $htmlChatText;
$message['htmlChatHelpersText'] = $htmlChatHelpersText;
$message['htmlChatUsersText'] = $htmlChatUsersText;
// show or hide Changeable elements
$message['isPause'] = $activeEtap['is_pause'];
if ($debateNow['user_id_1'] == $user->id) {
$userNumber = 1;
} elseif ($debateNow['user_id_2'] == $user->id) {
$userNumber = 2;
} else {
$userNumber = 0;
}
$message['userNumber'] = $userNumber;
// hide/show message box for Debate Users
$isHelperCanSay = $debateModel->isHelperCanSay($user->id);
$message['isHelperCanSay'] = $isHelperCanSay;
if ($userNumber) {
// hide/show button "helper can say"
if ($debateModel->isHelperCanSay($debateNow['helper_id_' . $userNumber . '_1'])) {
$message['helperSay1'] = 'hide';
} else {
$message['helperSay1'] = 'show';
}
if ($debateModel->isHelperCanSay($debateNow['helper_id_' . $userNumber . '_2'])) {
$message['helperSay2'] = 'hide';
} else {
$message['helperSay2'] = 'show';
}
// hide button PAUSE , if already pressed
//if (!$debateNow['is_ready_'.$userNumber]) $message['hide_pause'] = $userNumber;
if (!$debateNow['is_ready_1']) {
$message['hide_pause1'] = 1;
} else {
$message['hide_pause1'] = 0;
}
if (!$debateNow['is_ready_2']) {
$message['hide_pause2'] = 1;
} else {
$message['hide_pause2'] = 0;
}
}
// hide/show button vote_for_user in debate
if ($debateModel->isUserDebateVoted($user->id)) {
$message['isUserVoted'] = 1;
} else {
$message['isUserVoted'] = 0;
}
$this->_view->returnChat($message);
$this->_view->ajax();
}
示例14: addDesktopAction
public function addDesktopAction()
{
$v_request = Project::getRequest();
$v_session = Project::getSession();
if ($v_request->action == 'change') {
$userModel = new UserModel();
$desktops = unserialize($userModel->getDesktops());
$desktops[$v_request->d] = $v_request->vklad_name;
$desktops = serialize($desktops);
$userModel->addDesktop($desktops);
} elseif ($v_request->action == 'del') {
$userModel = new UserModel();
$desktops = unserialize($userModel->getDesktops());
unset($desktops[$v_request->d]);
$desktops = serialize($desktops);
$userModel->addDesktop($desktops);
} else {
$request_keys = $v_request->getKeys();
$userModel = new UserModel();
$desktops = unserialize($userModel->getDesktops());
//$desktops[] = $v_request['tab_name'];
$desktops[] = 'Новая вкладка';
$desktops = serialize($desktops);
$userModel->addDesktop($desktops);
}
if ($v_request->d) {
Project::getResponse()->redirect(Project::getRequest()->createUrl("Index", "Index", array('d' => $v_request->d)));
} else {
Project::getResponse()->redirect(Project::getRequest()->createUrl("Index", "Index"));
}
}