Пример #1
0
 /**
  * Sets the Session instance to this controller, reads the current site and node from the session.
  * @return null
  */
 public function preAction()
 {
     $this->session = $this->getSession();
     $siteId = $this->session->get(self::SESSION_SITE);
     if ($siteId) {
         try {
             $this->site = $this->models[SiteModel::NAME]->getSite($siteId);
         } catch (ZiboException $e) {
             $this->site = null;
         }
     }
     $nodeId = $this->session->get(self::SESSION_NODE);
     if ($nodeId) {
         try {
             $this->node = $this->models[NodeModel::NAME]->getNode($nodeId);
         } catch (ZiboException $e) {
             $this->node = null;
         }
     }
 }
Пример #2
0
 /**
  * Gets a variable of this wizard
  * @param string $name Name of the variable
  * @param mixed $default Default value for the variable
  * @return mixed Value of the variable if it's set, the default value otherwise
  */
 public function getVariable($name, $default = null)
 {
     $variables = $this->session->get($this->name, array());
     if (array_key_exists($name, $variables)) {
         return $variables[$name];
     }
     return $default;
 }
 /**
  * Gets the stored username from the session
  * @return string Stored username if set, null otherwise
  */
 protected function getSwitchedUsername()
 {
     return $this->session->get(self::SESSION_SWITCHED_USERNAME);
 }