Example #1
0
 /**
  * Produces the HTML header by adding the required JS and CSS script to the view. 
  * These are the files necessary for Daiquiri to work as defined in $_files and any
  * additional file given in $inputfiles. If minify is enabled in the configuration 
  * file, the JS and CSS files are minified.
  * @param  array  $customFiles   additional static files
  * @param  array  $overrideFiles files that override the default files
  */
 public function headStatic(array $customFiles, array $overrideFiles = array())
 {
     $hl = $this->view->headLink();
     $hs = $this->view->headScript();
     $js = array();
     $css = array();
     if (Daiquiri_Config::getInstance()->core->minify->enabled == true) {
         $js[] = 'min/js/daiquiri.js';
         $css[] = 'min/css/daiquiri.css';
     } else {
         foreach (Daiquiri_View_Helper_HeadStatic::$files as $key => $file) {
             if (array_key_exists($key, $overrideFiles)) {
                 $file = $overrideFiles[$key];
             }
             $ext = pathinfo($file, PATHINFO_EXTENSION);
             if ($ext === 'js') {
                 $js[] = $file;
             } else {
                 if ($ext === 'css') {
                     $css[] = $file;
                 }
             }
         }
     }
     foreach ($customFiles as $file) {
         $ext = pathinfo($file, PATHINFO_EXTENSION);
         if ($ext === 'js') {
             $js[] = $file;
         } else {
             if ($ext === 'css') {
                 $css[] = $file;
             }
         }
     }
     // prepend files in reverse order
     foreach (array_reverse($css) as $file) {
         $hl->prependStylesheet($this->view->baseUrl($file));
     }
     foreach (array_reverse($js) as $file) {
         $hs->prependFile($this->view->baseUrl($file));
     }
     // echo the view helpers
     echo PHP_EOL . PHP_EOL . $hl . PHP_EOL . PHP_EOL . $hs . PHP_EOL . PHP_EOL;
 }
Example #2
0
 /**
  *
  */
 public function loadDefaultDesign()
 {
     $mdlDesign = new Model_Design();
     $design = $mdlDesign->getDefaultDesign();
     $mdlDesign->setDesign($design->id);
     //todo: this is duplicated in the builder
     //the design model returns the stylesheets organized by skin
     $skins = $mdlDesign->getStylesheets();
     if (is_array($skins)) {
         foreach ($skins as $skin => $styles) {
             if (is_array($styles)) {
                 foreach ($styles as $style) {
                     $this->view->headLink()->appendStylesheet('/skins/' . $skin . '/styles/' . $style);
                 }
             }
         }
     }
     $this->view->layout = $mdlDesign->getLayout();
 }