Exemplo n.º 1
0
 /**
  * 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']);
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  */
 public function __construct(View $View, $settings = array())
 {
     $themeConfig = CroogoTheme::config($View->theme);
     $themeSettings = $themeConfig['settings'];
     $settings = Hash::merge($themeSettings, $settings);
     parent::__construct($View, $settings);
 }
Exemplo n.º 5
0
 /**
  * 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();
 }
Exemplo n.º 6
0
    /**
     * 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>';
    }
Exemplo n.º 7
0
 public function __construct(View $View, $settings = array())
 {
     $themeConfig = CroogoTheme::config($View->theme);
     $this->_themeSettings = $themeConfig['settings'];
     $this->_iconMap = $this->_themeSettings['icons'];
     $prefix = $View->request->param('prefix');
     if (isset($this->_themeSettings['prefixes'][$prefix]['helpers']['Html']['icons'])) {
         $this->_iconMap = Hash::merge($this->_iconMap, $this->_themeSettings['prefixes'][$prefix]['helpers']['Html']['icons']);
     }
     parent::__construct($View);
     $this->__setupDeprecatedViewVars();
 }
Exemplo n.º 8
0
 /**
  * Activate a theme
  *
  * @param string $theme Name of theme
  * @return boolean
  */
 protected function _activateTheme($theme = null)
 {
     if ($r = $this->_CroogoTheme->activate($theme)) {
         if (is_null($theme)) {
             $this->out(__('Theme deactivated successfully.'));
         } else {
             $this->out(__('Theme "%s" activated successfully.', $theme));
         }
     } else {
         $this->err(__('Theme "%s" activation failed.', $theme));
     }
     return true;
 }
Exemplo n.º 9
0
    /**
     * Constructor
     */
    public function __construct(View $View, $settings = array())
    {
        $themeConfig = CroogoTheme::config($View->theme);
        $themeSettings = $themeConfig['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>';
    }
Exemplo n.º 10
0
 /**
  * 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;
         }
     }
 }
Exemplo n.º 11
0
 /**
  * List themes
  */
 public function themes($theme = null)
 {
     $CroogoTheme = new CroogoTheme();
     $all = $this->params['all'];
     $current = Configure::read('Site.theme');
     $themes = $theme == null ? $CroogoTheme->getThemes() : array($theme);
     $this->out("Themes:", 2);
     $default = empty($current) || $current == 'default';
     $this->out(__d('croogo', '%-20s%-50s%s', __d('croogo', 'Theme'), __d('croogo', 'Author'), __d('croogo', 'Status')));
     $this->out(str_repeat('-', 80));
     foreach ($themes as $theme) {
         $active = $theme == $current || $default && $theme == 'default';
         $status = $active ? '<success>active</success>' : '<info>inactive</info>';
         if (!$active && !$all) {
             continue;
         }
         $data = $CroogoTheme->getThemeData($theme);
         $author = isset($data['author']) ? $data['author'] : '';
         $this->out(__d('croogo', '%-20s%-50s%s', $theme, $author, $status));
     }
 }
Exemplo n.º 12
0
 /**
  * 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];
 }
Exemplo n.º 13
0
 /**
  * testGetThemes
  */
 public function testGetThemes()
 {
     $themes = $this->CroogoTheme->getThemes();
     $this->assertTrue(array_key_exists('Mytheme', $themes));
 }