Exemplo n.º 1
0
 function image($url, $folder = 'images')
 {
     $fc = Zend_Controller_Front::getInstance();
     return $fc->getBaseUrl() . DS . 'public' . DS . 'view' . DS . $fc->getRequest()->getModuleName() . DS . 'layouts' . DS . My_Layout_Assist::getLayout() . DS . $folder . DS . $url;
 }
Exemplo n.º 2
0
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $this->controller = $request->getControllerName();
     $this->action = $request->getActionName();
     $this->module = $request->getModuleName();
     /* Adiciono os js padrão */
     $view = new Zend_View();
     $cfg = Zend_Registry::get('config');
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $layout = Zend_Layout::getMvcInstance()->getLayout();
     //        $jss = array(
     //            'config'
     //        );
     //
     //
     //
     //        foreach ($jss as $js)
     //            $view->headScript()->appendFile($view->baseUrl($js), 'text/javascript');
     /*         * ******************************JS e CSS Adicionais***************************** */
     $jss_adicionais = $cfg->{$module} ? $cfg->{$module}->headScript ? $cfg->{$module}->headScript->toArray() : false : false;
     $css_adicionais = $cfg->{$module} ? $cfg->{$module}->headLink ? $cfg->{$module}->headLink->toArray() : false : false;
     $jss_adicionaisAmbos = $cfg->ambos->headScript ? $cfg->ambos->headScript->toArray() : false;
     $css_adicionaisAmbos = $cfg->ambos->headLink ? $cfg->ambos->headLink->toArray() : false;
     $adicionais = array();
     if ($jss_adicionais) {
         $adicionais = array_merge($adicionais, $jss_adicionais);
     }
     if ($css_adicionais) {
         $adicionais = array_merge($adicionais, $css_adicionais);
     }
     if ($jss_adicionaisAmbos) {
         $adicionais = array_merge($adicionais, $jss_adicionaisAmbos);
     }
     if ($css_adicionaisAmbos) {
         $adicionais = array_merge($adicionais, $css_adicionaisAmbos);
     }
     //Adicionando essenciais na página Auth
     if ($controller == 'auth') {
         $jquery = 'public/js/jquery.min.js';
         $view->headScript()->appendFile($view->baseUrl($jquery), 'text/javascript');
         $jsmaruti = 'public/js/maruti.login.js';
         $view->headScript()->appendFile($view->baseUrl($jsmaruti), 'text/javascript');
         $bootstrapcss = 'public/css/bootstrap.min.css';
         $view->headLink()->appendStylesheet($view->baseUrl($bootstrapcss));
         $bootstrapresponsive = 'public/css/bootstrap-responsive.min.css';
         $view->headLink()->appendStylesheet($view->baseUrl($bootstrapresponsive));
         $maruti = 'public/css/maruti-login.css';
         $view->headLink()->appendStylesheet($view->baseUrl($maruti));
     }
     //Acrescento o basedir nas urls e adiciono na página
     if (count($adicionais) && $controller != 'auth') {
         foreach ($adicionais as $adicional) {
             $fileAdicional = 'public' . $adicional;
             $ext = array_pop(explode('.', $fileAdicional));
             if ($ext == 'js') {
                 $view->headScript()->appendFile($view->baseUrl($fileAdicional), 'text/javascript');
             } else {
                 $view->headLink()->appendStylesheet($view->baseUrl($fileAdicional));
             }
         }
     }
     //                $view->headLink(array('rel' => 'shortcut icon',
     //
     //                                  'href' => $view->baseUrl('/data/favicon.ico')));
     /*         * ************************************************************************* */
     if ($controller != 'impressos') {
         My_Layout_Assist::out();
     }
     $viewLayout = Zend_Layout::getMvcInstance()->getView();
     $viewLayout->controller = $controller;
     $viewLayout->action = $action;
     ######################################################################
     $mod = $request->getModuleName();
     $controller = $this->controller = $request->getControllerName();
     $action = $request->getActionName();
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . DS . 'modules' . DS . $mod . DS . 'views' . DS . 'layouts');
     $view = new Zend_View();
     $auth = Zend_Auth::getInstance();
     //        if ($auth->hasIdentity()) {
     //
     //            $table = new User();
     //
     //            $user = $auth->getIdentity();
     //
     //            $viewLayout->user = $table->fetchRow(array('id = ?' => $user->id));
     //        }
 }
Exemplo n.º 3
0
 public static function setLayout($layout)
 {
     self::$_layout = $layout;
 }