/** * Get or load ZViewBlock instance * @param string $a_name * @return ZViewBlock */ public function &block($a_name) { if (!$this->hasBlock($a_name)) { try { $this->addBlock($a_name); } catch (Exception $e) { if ($this->getModule()->isMode(ZModule::MODE_DEBUG)) { throw new ZControllerException('Block "' . $a_name . '" is not found', ZControllerException::EXC_BLOCK); } return Zoombi::null(); } } return $this->getBlock($a_name); }
public function &__get($a_value) { if ($a_value == 'module') { if (count($this->parents) > 0) { return $this->parents[count($this->parents) - 1]; } } return Zoombi::null(); }
public final function &factory($a_name) { $n = 'Zoombi_' . ucfirst($a_name); $c = Zoombi::null(); try { $c = new $n(); } catch (Exception $e) { Zoombi::getApplication()->triggerError($e); } return $c; }
/** * Get plugin * @return ZPlugin */ public final function &getPlugin($a_plugin) { switch (gettype($a_plugin)) { case 'int': case 'string': if (isset($this->m_plugins[$a_plugin])) { return $this->m_plugins[$a_plugin]; } break; case 'object': if ($a_plugin instanceof ZPlugin) { foreach ($this->m_plugins as $k => $plg) { if ($plg === $a_plugin) { return $this->m_plugins[$k]; } } } break; } return Zoombi::null(); }
/** * Get Zoombi_Layout instance by name * @param string $a_name * @return Zoombi_Layout */ public function &getLayout($a_name) { if ($this->hasLayout($a_name)) { return $this->m_layouts[Zoombi_String::normalize($a_name)]; } return Zoombi::null(); }
/** * Get ZLayout instance by name * @param string $a_name * @return ZLayout */ public function &getLayout($a_name) { if ($this->hasLayout($a_name)) { return $this->m_layout[trim((string) $a_name)]; } return Zoombi::null(); }
/** * Get ZBlockView instance by name * @param string $a_name * @return ZBlockView */ public function &getBlock($a_name) { if ($this->hasBlock($a_name)) { return $this->m_block[trim((string) $a_name)]; } return Zoombi::null(); }