本文整理汇总了PHP中Zend_Session_Namespace::__isset方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session_Namespace::__isset方法的具体用法?PHP Zend_Session_Namespace::__isset怎么用?PHP Zend_Session_Namespace::__isset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session_Namespace
的用法示例。
在下文中一共展示了Zend_Session_Namespace::__isset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRole
public static function getRole()
{
$sessionAgent = new Zend_Session_Namespace("LeadsChat_Auth");
$sessionOwner = new Zend_Session_Namespace("LeadsChat_Owner_Auth");
if ($sessionAgent->__isset("agent")) {
$agent = $sessionAgent->agent;
$agent["level"] = $agent["type"];
return strtolower($agent["level"]);
}
if ($sessionOwner->__isset("owner")) {
$owner = $sessionOwner->owner;
$owner["level"] = "Owner";
return strtolower($owner["level"]);
}
return "guest";
}
示例2: loginAction
public function loginAction()
{
$ns = new Zend_Session_Namespace('admin');
$ns->set = 4;
if ($ns->__isset('set')) {
$r = (string) $ns->set;
echo strlen($r);
}
//echo $ns->set;exit;
if ($this->_request->isPost()) {
$user = $this->_getParam('user');
$pass = $this->_getParam('password');
if ($user == $this->_user && $pass == $this->_password) {
$ns->islogin = true;
$ns->setExpirationSeconds(36000000);
return $this->_redirect('/admin/index');
} else {
$this->view->error = 'Не вірний користувач чи пароль';
$this->view->username = $user;
}
}
}
示例3: hasPersistentMessage
/**
* 是否有持久化的异常信息
*
* @static
* @return boolean
*/
public static function hasPersistentMessage()
{
$session = new Zend_Session_Namespace(self::SESSION_NAMESPACE);
return $session->__isset('message');
}
示例4: getCurrentUser
/**
* Get the currently loggin in user
*
* @return \Gems_User_User
*/
public final function getCurrentUser()
{
if (!self::$currentUser) {
if ($this->session->__isset('__user_definition')) {
$defName = $this->session->__get('__user_definition');
// Check for during upgrade. Remove for version 1.6
if (substr($defName, -10, 10) != 'Definition') {
$defName .= 'Definition';
}
self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName)));
} else {
if (\MUtil_Console::isConsole()) {
if (!$this->project->isConsoleAllowed()) {
echo "Accessing " . GEMS_PROJECT_NAME . " from the command line is not allowed.\n";
exit;
}
$request = \Zend_Controller_Front::getInstance()->getRequest();
if ($request instanceof \MUtil_Controller_Request_Cli && $request->hasUserLogin()) {
$user = $this->getUser($request->getUserName(), $request->getUserOrganization());
$authResult = $user->authenticate($request->getUserPassword());
if (!$authResult->isValid()) {
echo "Invalid user login data.\n";
echo implode("\n", $authResult->getMessages());
exit;
}
self::$currentUser = $user;
} elseif ($this->project->getConsoleRole()) {
// \MUtil_Echo::track($this->request->getUserName(), $this->request->getUserOrganization());
self::$currentUser = $this->loadUser(self::USER_CONSOLE, 0, '(system)');
}
}
if (!self::$currentUser) {
self::$currentUser = $this->getUser(null, self::SYSTEM_NO_ORG);
}
self::$currentUser->setAsCurrentUser();
}
}
return self::$currentUser;
}
示例5: _initLanguage
/**
* initalize languages
*/
protected function _initLanguage()
{
$options = $this->getOptions();
$language = new Zend_Session_Namespace('language');
if ($language->__isset('session')) {
$lang = $language->lang;
} else {
$lang = $options['language']['locale'];
}
$translate = new Zend_Translate('csv', $options['language']['file'][$lang]['master']);
$translate->addTranslation(array('content' => $options['language']['file'][$lang]['master'], 'locale' => $lang));
$translate->addTranslation(array('content' => $options['language']['file'][$lang]['app'], 'locale' => $lang));
Zend_Registry::set('t', $translate);
Zend_Locale::setDefault($lang);
}
示例6: __isset
/**
* __isset() - determine if a variable in this object's namespace is set
*
* @param string $name - programmatic name of a key, in a <key,value> pair in the current namespace
* @return bool
*/
public function __isset($name)
{
if ($this->_persistObject) {
$data = parent::_namespaceGet($this->_namespace);
if (is_object($data)) {
return isset($data->{$name});
}
return FALSE;
}
return parent::__isset($name);
}
示例7: acceptRequestAction
public function acceptRequestAction()
{
$db = $this->db;
$sessionAgent = new Zend_Session_Namespace("LeadsChat_Auth");
if ($sessionAgent->agent_id && $this->_request->isXmlHttpRequest()) {
$agentId = $sessionAgent->agent_id;
$requestId = $this->_request->getPost("requestId");
$chatSessions = $this->chatSessionModel->getChatSessionCount($sessionAgent->agent_id);
if ($requestId) {
if ($this->chatRequestModel->isAccepted($requestId)) {
$this->view->result = array("message" => "Already accepted", "result" => false);
} else {
if ($chatSessions >= 4) {
$this->view->result = array("message" => "Accept exceed", "result" => false, "count" => $chatSessions);
} else {
//get the request from database
$sql = $db->select()->from("chat_requests")->joinInner("visitors", "visitors.visitor_id = chat_requests.visitor_id", array("owner_id"))->where("chat_request_id = ?", $requestId);
$request = $db->fetchRow($sql);
$date = date("Y-m-d h:i:s");
if ($request) {
//create actual lead
$lead = array("visitor_id" => $request["visitor_id"], "owner_id" => $request["owner_id"], "created" => $date, "chat_start" => $date);
$lead_id = $this->leadModel->partialCreate($lead);
//create a chat session
$chat_session = array("visitor_id" => $request["visitor_id"], "agent_id" => $sessionAgent->agent_id, "lead_id" => $lead_id, "created" => $date, "chat_request_id" => $requestId);
$db->insert("chat_sessions", $chat_session);
$chat_session_id = $db->lastInsertId("chat_sessions");
//create chat activity for both
$chat_activity = array("chatter_id" => $sessionAgent->agent_id, "chatter_type" => "A", "chat_session_id" => $chat_session_id, "created" => $date);
$db->insert("chat_activities", $chat_activity);
$chat_activity = array("chatter_id" => $request["visitor_id"], "chatter_type" => "V", "chat_session_id" => $chat_session_id, "created" => $date);
$db->insert("chat_activities", $chat_activity);
//create initial welcome message
$agent = $db->fetchRow($db->select()->from("agents", array("first_name"))->where("agent_id = ?", $agentId));
$message = "Hi. I am {$agent["first_name"]}. How may I serve you?";
$chat = array("from_id" => $agentId, "from_type" => "A", "message" => $message, "created" => $date, "chat_session_id" => $chat_session_id);
$db->insert("chats", $chat);
$accepted = array("accepted" => "Y");
$db->update("chat_requests", $accepted, "chat_request_id = " . $request["chat_request_id"]);
$available_agent = $db->fetchRow($db->select()->from("available_agents", array("currently_served"))->where("available_agents.agent_id = ?", $sessionAgent->agent_id));
$chatRequests = $this->chatRequestModel->getRequestCountForAgent($sessionAgent->agent_id);
if ($chatRequests["count"] >= 4) {
$accepted = array("available" => "N", "currently_served" => $chatRequests["count"]);
} else {
$accepted = array("available" => "Y", "currently_served" => $available_agent["currently_served"] + 1);
}
$db->update("available_agents", $accepted, "agent_id = " . $sessionAgent->agent_id);
//sessionize accepted chat sessions
if (!$sessionAgent->__isset("chat_sessions")) {
$sessionAgent->chat_sessions = array();
}
$sessionAgent->chat_sessions[] = $chat_session_id;
$this->view->result = array("chat_session_id" => $chat_session_id, "result" => true);
} else {
$this->view->result = array("message" => "Invalid Request", "result" => false);
}
}
}
}
}
$this->_helper->layout->setLayout("plain");
$this->_helper->viewRenderer("json");
}