/** * Constructor */ public function __construct() { $this->clear(); Template::bindGlobal('scripts', $this->scripts); Template::bindGlobal('styles', $this->styles); hook('head', array($this, 'output')); }
/** * Init */ public function init() { parent::init(); Template::bindGlobal('meta', $this->info); title(t(config('site.name', SITE_URL))); hook('head', array($this, 'head'), 0); hook('menu.setActive', array($this, 'menuTitleHook')); hook('Pages.showPage.before', array($this, 'showObjectTitle')); hook('admin.gear.request', array($this, 'showObjectTitle')); }
/** * Activate */ public function activate() { $cogear = getInstance(); Template::bindGlobal('theme', $this); hook('done', array($this, 'render')); }
/** * Load gears */ public function loadGears() { if ($this->gears_are_loaded) { return; } hook('exit', array($this, 'save')); if (DEVELOPMENT or !($this->all_gears = $this->system_cache->read('gears/all', TRUE))) { $this->all_gears = array(); if ($gears_paths = array_merge(find('*' . DS . self::GEAR . EXT), find('*' . DS . '*' . DS . self::GEAR . EXT))) { foreach ($gears_paths as $path) { $gear = self::pathToGear($path); $class = $gear . '_' . self::GEAR; if ($gear == 'Core' or !class_exists($class)) { continue; } $reflection = new ReflectionClass($class); if (!$reflection->isAbstract() && $reflection->isSubclassOf(self::GEAR)) { $gear = strtolower($gear); $this->all_gears[$gear] = $class; } } } $this->system_cache->write('gears/all', $this->all_gears); } $this->installed_gears = $this->system_cache->read('gears/installed', TRUE); $this->active_gears = $this->system_cache->read('gears/active', TRUE); foreach ($this->all_gears as $gear => $class) { if (isset($this->active_gears[$gear])) { $this->gears->{$gear} instanceof Gear or class_exists($class) && ($this->gears->{$gear} = new $class()); } elseif (DEVELOPMENT && class_exists($class)) { $object = new $class(); if ($object->info('type') == Gear::CORE) { $this->gears->{$gear} instanceof Gear or $this->gears->{$gear} = $object; $this->active_gears[$gear] = $class; $this->write_gears = TRUE; } } } $this->sortGears(); foreach ($this->gears as $name => $gear) { $gear->init(); } Template::bindGlobal('cogear', $this); event('gears.loaded', $this); $this->gears_are_loaded = TRUE; }
/** * */ public function render(){ $menu = Template::getGlobal('top_menu'); $output = $menu->render('Admin_Menu.top_menu'); Template::bindGlobal('top_menu',$output); }