Exemplo n.º 1
0
 protected function _initObject($object)
 {
     // init vars
     $params = new YParameter();
     $params->loadString($object->params);
     $group = $object->application_group;
     $class = $group . 'Application';
     // load application class
     if (!class_exists($class)) {
         $path = ZOO_APPLICATION_PATH . "/{$group}/application.php";
         if (is_file($path)) {
             require_once $path;
         }
     }
     if (class_exists($class)) {
         $data = get_object_vars($object);
         // create application instance
         $object = new $class();
         // set data
         if (is_array($data)) {
             foreach ($data as $name => $value) {
                 $object->{$name} = $value;
             }
         }
     }
     return $object;
 }
Exemplo n.º 2
0
 public function render($params = array())
 {
     // get modules
     $modules = self::_load();
     $value = $this->_data->get('value');
     if ($value && isset($modules[$value])) {
         if ($modules[$value]->published) {
             $rendered = JModuleHelper::renderModule($modules[$value]);
             if (isset($modules[$value]->params)) {
                 $module_params = new YParameter();
                 $module_params->loadString($modules[$value]->params);
                 if ($moduleclass_sfx = $module_params->get('moduleclass_sfx')) {
                     $html[] = '<div class="' . $moduleclass_sfx . '">';
                     $html[] = $rendered;
                     $html[] = '</div>';
                     return implode("\n", $html);
                 }
             }
             return $rendered;
         }
     }
     return null;
 }
Exemplo n.º 3
0
 protected function _setMenuItems()
 {
     if (self::$_menu_items == null) {
         $component = JComponentHelper::getComponent('com_zoo');
         $menus = JSite::getMenu();
         $menu_items = $menus->getItems('componentid', $component->id);
         $menu_items = $menu_items ? $menu_items : array();
         self::$_menu_items = array('frontpage' => array(), 'category' => array(), 'item' => array());
         $params = new YParameter();
         foreach ($menu_items as $menu_item) {
             switch (@$menu_item->query['view']) {
                 case 'frontpage':
                     self::$_menu_items['frontpage'][$params->loadString($menu_item->params)->get('application')] = $menu_item;
                     break;
                 case 'category':
                     self::$_menu_items['category'][$params->loadString($menu_item->params)->get('category')] = $menu_item;
                     break;
                 case 'item':
                     self::$_menu_items['item'][$params->loadString($menu_item->params)->get('item_id')] = $menu_item;
                     break;
             }
         }
     }
     return self::$_menu_items;
 }