コード例 #1
0
ファイル: Session.php プロジェクト: kidaa30/yes
 /**
  * Adds a userContext to the stack.
  *
  * @param string $userContext
  *   The url to return to when done.
  * @param bool $check
  *   Should we do a dupe checking with the top element.
  *
  * @return void
  */
 public function pushUserContext($userContext, $check = TRUE)
 {
     if (empty($userContext)) {
         return;
     }
     $this->createScope(self::USER_CONTEXT);
     // hack, reset if too big
     if (count($this->_session[$this->_key][self::USER_CONTEXT]) > 10) {
         $this->resetScope(self::USER_CONTEXT);
         $this->createScope(self::USER_CONTEXT);
     }
     $topUC = array_pop($this->_session[$this->_key][self::USER_CONTEXT]);
     // see if there is a match between the new UC and the top one. the match needs to be
     // fuzzy since we use the referer at times
     // if close enough, lets just replace the top with the new one
     if ($check && $topUC && CRM_Utils_String::match($topUC, $userContext)) {
         array_push($this->_session[$this->_key][self::USER_CONTEXT], $userContext);
     } else {
         if ($topUC) {
             array_push($this->_session[$this->_key][self::USER_CONTEXT], $topUC);
         }
         array_push($this->_session[$this->_key][self::USER_CONTEXT], $userContext);
     }
 }
コード例 #2
0
 /**
  * adds a userContext to the stack
  *
  * @param string  $userContext the url to return to when done
  * @param boolean $check       should we do a dupe checking with the top element
  * @return void
  *
  * @access public
  * 
  */
 function pushUserContext($userContext, $check = true)
 {
     if (empty($userContext)) {
         return;
     }
     $this->createScope(CRM_CORE_SESSION_USER_CONTEXT);
     // hack, reset if too big
     if (count($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT]) > 10) {
         $this->resetScope(CRM_CORE_SESSION_USER_CONTEXT);
         $this->createScope(CRM_CORE_SESSION_USER_CONTEXT);
     }
     $topUC = array_pop($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT]);
     // see if there is a match between the new UC and the top one. the match needs to be
     // fuzzy since we use the referer at times
     if ($check && $topUC && CRM_Utils_String::match($topUC, $userContext)) {
         array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $topUC);
     } else {
         if ($topUC) {
             array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $topUC);
         }
         array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $userContext);
     }
     // CRM_Core_Error::debug( 'UC', $this->_session[$this->_key][self::USER_CONTEXT] );
 }