Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 public function &__get($a_value)
 {
     if ($a_value == 'module') {
         if (count($this->parents) > 0) {
             return $this->parents[count($this->parents) - 1];
         }
     }
     return Zoombi::null();
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * 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();
 }
Exemplo n.º 5
0
 /**
  * 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();
 }
Exemplo n.º 6
0
 /**
  * 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();
 }
Exemplo n.º 7
0
 /**
  * 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();
 }