/** * testGetDataMixedManifest */ public function testGetDataMixedManifest() { $data = $this->CroogoTheme->getData('MixedManifest'); $keys = array_keys($data); sort($keys); $expected = array('name', 'regions', 'screenshot', 'settings', 'type', 'vendor'); $this->assertEquals($expected, $keys); $this->assertEquals('MixedManifest', $data['name']); $this->assertEquals('croogo/mixed-manifest-theme', $data['vendor']); }
/** * beforeFilter * * @return void * @access public */ public function beforeFilter() { parent::beforeFilter(); $this->layout = 'install'; $croogoTheme = new CroogoTheme(); $data = $croogoTheme->getData($this->theme); $settings = $data['settings']; $this->set('themeSettings', $settings); $this->_generateAssets(); }
/** * Constructor */ public function __construct(View $View, $settings = array()) { if (isset($View->viewVars['themeSettings'])) { $themeSettings = $View->viewVars['themeSettings']; $settings = Hash::merge(array('iconDefaults' => $themeSettings['iconDefaults'], 'icons' => $themeSettings['icons']), $settings); } else { $croogoTheme = new CroogoTheme(); $themeData = $croogoTheme->getData(); $themeSettings = $themeData['settings']; $settings = Hash::merge($themeSettings, $settings); } parent::__construct($View, $settings); }
/** * setUp */ public function setUp() { parent::setUp(); $this->ComponentCollection = new ComponentCollection(); $request = new CakeRequest('nodes/index'); $request->params = array('controller' => 'nodes', 'action' => 'index', 'named' => array()); $view = new View(new TheCroogoTestController($request, new CakeResponse())); $croogoTheme = new CroogoTheme(); $data = $croogoTheme->getData(); $settings = $data['settings']; $view->set('themeSettings', $settings); $this->Croogo = new CroogoHelper($view); $aclHelper = Configure::read('Site.acl_plugin') . 'Helper'; $this->Croogo->Acl = $this->getMock($aclHelper, array('linkIsAllowedByRoleId'), array($view)); $this->Croogo->Acl->expects($this->any())->method('linkIsAllowedByRoleId')->will($this->returnValue(true)); $this->menus = CroogoNav::items(); CroogoNav::clear(); }
/** * Constructor */ public function __construct(View $View, $settings = array()) { if (isset($View->viewVars['themeSettings'])) { $themeSettings = $View->viewVars['themeSettings']; $settings = Hash::merge(array('iconDefaults' => $themeSettings['iconDefaults'], 'icons' => $themeSettings['icons']), $settings); } else { $croogoTheme = new CroogoTheme(); $themeData = $croogoTheme->getData(); $themeSettings = $themeData['settings']; $settings = Hash::merge($themeSettings, $settings); } parent::__construct($View, $settings); $themeCss = $themeSettings['css']; $boxIconClass = trim($settings['iconDefaults']['classDefault'] . ' ' . $settings['iconDefaults']['classPrefix'] . 'list'); $this->_tags['beginbox'] = "<div class='{$themeCss['row']}'>\n\t\t\t\t<div class='{$themeCss['columnFull']}'>\n\t\t\t\t\t<div class='box'>\n\t\t\t\t\t\t<div class='box-title'>\n\t\t\t\t\t\t\t<i class='{$boxIconClass}'></i>\n\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='box-content %s'>"; $this->_tags['endbox'] = '</div> </div> </div> </div>'; $this->_tags['icon'] = '<i class="%s"%s></i>'; }
/** * Setup themes * * @return void */ protected function _setupTheme() { $prefix = isset($this->request->params['prefix']) ? $this->request->params['prefix'] : ''; if ($prefix === 'admin') { $theme = Configure::read('Site.admin_theme'); if ($theme) { App::build(array('View/Helper' => array(App::themePath($theme) . 'Helper' . DS))); } $this->layout = 'admin'; } else { $theme = Configure::read('Site.theme'); } $this->theme = $theme; $croogoTheme = new CroogoTheme(); $data = $croogoTheme->getData($theme); $settings = $data['settings']; if (empty($settings['prefixes']['admin']['helpers']['Croogo.Croogo'])) { $this->helpers[] = 'Croogo.Croogo'; } if (isset($settings['prefixes'][$prefix])) { foreach ($settings['prefixes'][$prefix]['helpers'] as $helper => $settings) { $this->helpers[$helper] = $settings; } } }
/** * Helper method to retrieve given $theme settings * * @param string $theme Theme name * @return array Theme configuration data */ public static function config($theme = null) { static $croogoTheme = null; static $themeData = array(); if ($croogoTheme === null) { $croogoTheme = new CroogoTheme(); } if (empty($themeData[$theme])) { $data = $croogoTheme->getData($theme); $request = Router::getRequest(); if ($request) { $prefix = $request->param('prefix'); if (isset($data['settings']['prefixes'][$prefix]['css'])) { $data['settings']['css'] = Hash::merge($data['settings']['prefixes'][$prefix]['css'], $data['settings']['css']); } } $themeData[$theme] = $data; } return $themeData[$theme]; }