- <?PHP
- CLASS ModelsGlobal_Controller EXTENDS ILLI_Controller_Controller_Abstract
- {
- // route in routing xml
- const rt
- = 'page:sections';
- // args
- const rt_table
- = 'routetable';
- const rt_section
- = 'rootroutenode';
- const rt_sub
- = 'subroutenode';
- const rt_lang
- = 'iso';
- // database-field-names
- const db_route
- = 'routenode';
- const db_rtable
- = 'routetable';
- const db_lang
- = 'iso';
- const db_ruri
- = 'uri';
- const db_id
- = 'id';
- const db_oid
- = 'oid';
- const db_pid
- = 'pid';
- // db-tablenames
- const dbt_rootmenu
- = 'rootmenu';
- const dbt_submenu
- = 'submenu';
- // subs
- const lang
- = 'models/db/language';
- const tree
- = 'models/db/treemenu';
- const db
- = 'db/bridge';
- const nav
- = 'menu/Main-Nav-Deeplinked';
- // st
- private $route_pages
- = NULL;
- private $current_sub_pages
- = NULL;
- private $alternate_subaction
- = NULL;
- private $alternate_sectionaction
- = NULL;
- private $page_entry
- = NULL;
- public function set_LangIso($iso)
- {
- return $this->get_SubController(self::lang)
- ->set_Iso($iso);
- }
- public function get_LangIso()
- {
- return $this->get_SubController(self::lang)
- ->get_Iso();
- }
- public function get_RoutePages($route)
- {
- if(NULL === $this->route_pages)
- $this->route_pages =
- $this->get_SubController(self::db)
- ->simple_multi_search
- (
- self::dbt_submenu,
- array
- (
- self::db_route
- => $route,
- self::db_lang
- => $this->get_LangIso()
- ),
- array
- (
- 'limit'
- => NULL
- )
- );
- return $this->route_pages;
- }
- public function set_SubMenuItem(ILLI_Container $config)
- {
- $this->get_SubMenu()
- ->add_RouteLink
- (
- $config->_ident,
- array
- (
- ILLI_View_Navigation::active
- => $config->_active,
- 'a'
- => $config->_title
- ),
- self::rt,
- array
- (
- self::rt_table
- => $this->get_RouteParams()->{'_'.self::rt_table},
- self::rt_lang
- => $this->get_LangIso(),
- self::rt_section
- => $config->_routenode,
- self::rt_sub
- => $config->_uri
- )
- );
- return $this;
- }
- public function get_SubMenu()
- {
- return $this->get_SubController(self::nav)
- ->get_instance('sub');
- }
- public function render_SubMenu()
- {
- $SUBMENU = NULL;
- if(isset($this->get_RouteParams()->{'_'.self::rt_section}))
- $SUBMENU = $this->get_SubController(self::tree)
- ->from_route
- (
- $this->get_RoutePages
- (
- $this->get_RouteParams()->{'_'.self::rt_section}
- )
- );
- return
- (
- (NULL !== $SUBMENU)
- ? $SUBMENU->menu()
- : ''
- );
- }
- public function get_SubEntry()
- {
- if(NULL === $this->current_sub_pages)
- $this->current_sub_pages =
- $this->get_SubController(self::tree)
- ->get_current();
- return $this->current_sub_pages;
- }
- public function get_RootEntry()
- {
- if(NULL === $this->current_sub_pages)
- $this->current_sub_pages =
- $this->get_SubController(self::db)
- ->simple_multi_search
- (
- self::dbt_rootmenu,
- array
- (
- self::db_rtable
- => $this->get_RouteParams()
- ->{'_'.self::rt_table},
- self::db_route
- => $this->get_RouteParams()
- ->{'_'.self::rt_section},
- self::db_lang
- => $this->get_LangIso(),
- ),
- array
- (
- 'limit' => 1
- )
- );
- return $this->current_sub_pages;
- }
- public function get_CurrentEntry()
- {
- if(isset($this->get_RouteParams()->{'_'.self::rt_sub})
- && isset($this->get_RouteParams()->{'_'.self::rt_section}))
- {
- $subaction =
- ILLI_Constructeur::get_Instance(self::c_FLTRRT_.'App_Action')
- ->filter
- (
- $this->get_RouteParams()
- ->{'_'.self::rt_section}
- .'/'
- .$this->get_RouteParams()
- ->{'_'.self::rt_sub}
- );
- $this->alternate_subaction =
- $subaction['action'];
- $this->page_entry =
- $this->get_SubEntry();
- }
- else
- if(isset($this->get_RouteParams()->{'_'.self::rt_section})
- && !isset($this->get_RouteParams()->{'_'.self::rt_sub}))
- {
- $sectionaction =
- ILLI_Constructeur::get_Instance(self::c_FLTRRT_.'App_Action')
- ->filter
- (
- $this->get_RouteParams()->{'_'.self::rt_section}
- );
- $this->alternate_sectionaction =
- $sectionaction['action'];
- $this->page_entry =
- $this->get_RootEntry();
- }
- return $this->page_entry;
- }
- public function get_SectionAction($prfx = 'Default')
- {
- if(NULL === $this->alternate_sectionaction)
- return NULL;
- return $prfx.'_'.$this->alternate_sectionaction;
- }
- public function get_SubAction($prfx = 'Default')
- {
- if(NULL === $this->alternate_subaction)
- return NULL;
- return $prfx.'_'.$this->alternate_subaction;
- }
- }
Undefined
By: broadcast-model | Date: May 18 2010 16:28 | Format: None | Expires: never | Size: 6.45 KB | Hits: 953
Latest pastes
17 hours ago
20 hours ago
1 days ago
2 days ago
2 days ago