2 /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Syj_Controller_Action_Helper_SyjMedias extends Zend_Controller_Action_Helper_Abstract
9 public function init() {
10 $this->_config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/medias.ini', APPLICATION_ENV);
13 public function addScripts($action) {
14 $view = $this->getActionController()->view;
15 if (APPLICATION_ENV == "production") {
16 $view->headScript()->appendFile('js/' . $action . '.js' . '?' . Syj_Version::VERSION);
19 $scripts = explode(',', $this->_config->get('scripts')->get($action));
20 foreach ($scripts as $name) {
21 $view->headScript()->appendFile('js/' . trim($name) . '.js');
25 public function addStyleSheets($action) {
26 $view = $this->getActionController()->view;
27 if (APPLICATION_ENV == "production") {
28 $suffix = '?' . Syj_Version::VERSION;
33 $sheets = explode(',', $this->_config->get('css')->get($action));
34 foreach ($sheets as $sheet) {
35 $arr = explode(':', $sheet);
36 $arr = array_map('trim', $arr);
37 $href = 'css/' . $arr[0] . '.css' . $suffix;
38 $medias = array_slice($arr, 1);
42 $view->headLink()->appendStylesheet($href, $medias);