Beispiel #1
0
 /**
  * Set <link> elements
  *
  * @return void
  */
 public function setHeadLinks()
 {
     foreach ($this->getOptions() as $headLink => $options) {
         $attributes = array_key_exists('attributes', $options) && isset($options['attributes']) ? $options['attributes'] : array();
         $placement = array_key_exists('placement', $options) && isset($options['placement']) ? $options['placement'] : 'APPEND';
         $this->_view->headLink($attributes, $placement);
     }
 }
Beispiel #2
0
 /**
  * Injects additional scripts and styles,
  * that was linked to headScript after it was outputed
  * This method allows to call scripts from Axis_Box
  *
  * @param string $pageOutput
  */
 public function filter($pageOutput)
 {
     $head = substr($pageOutput, 0, strpos($pageOutput, '</head>'));
     if (empty($head)) {
         return $pageOutput;
     }
     $pageOutput = str_replace(array('{{headStyle}}', '{{headLink}}', '{{headScript}}'), array($this->_view->headStyle()->toString(), $this->_view->headLink()->toString(), $this->_view->headScript()->toString()), $pageOutput);
     return $pageOutput;
 }
 function _initView()
 {
     $view = new Zend_View();
     $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset = utf-8');
     $view->headLink()->appendStylesheet(HOST_PROJECT . "/public/css/bootstrap.min.css");
     $view->headLink()->offsetSetStylesheet("2", HOST_PROJECT . "/public/css/bootstrap-theme.css");
     $view->headLink()->offsetSetStylesheet("3", HOST_PROJECT . "/public/css/style.css");
     $view->headScript()->appendFile(HOST_PROJECT . "/public/js/jquery-1.11.3.min.js");
     $view->headScript()->offsetSetFile("2", HOST_PROJECT . "/public/js/bootstrap.min.js");
     $view->headScript()->offsetSetFile("3", HOST_PROJECT . "/public/js/myscript.js");
 }
Beispiel #4
0
 protected function _initView()
 {
     $options = $this->getOption('resources');
     if (isset($options['view'])) {
         $view = new Zend_View($options['view']);
     } else {
         $view = new Zend_View();
     }
     if (isset($options['view']['doctype'])) {
         $view->doctype($options['view']['doctype']);
     }
     if (isset($options['view']['contentType'])) {
         $view->headMeta()->appendHttpEquiv('Content-Type', $options['view']['contentType']);
     }
     /**
      * Default Title
      */
     $view->headTitle('IPMCore')->setSeparator(' - ');
     $rev = $options['view']['version'];
     /**
      * JavaScript. Also see Layout.phtml in app/layouts
      */
     $view->headScript()->appendFile('/js/jslibs.js', 'text/javascript')->appendFile('/js/ipmc/ipmcore.scripts_' . $rev . '.js', 'text/javascript');
     /**
      * CSS. Also see Layout.phtml in app/layouts
      */
     $view->headLink()->appendStylesheet('/css/print_' . $rev . '.css', 'print')->appendStylesheet('/css/screen_' . $rev . '.css', 'screen, projection')->appendStylesheet('/css/ie_' . $rev . '.css', 'screen, projection', 'IE')->appendStylesheet('/css/ipmcore_' . $rev . '.css');
     if (APPLICATION_ENV != 'production') {
         Zend_Registry::set('version', $options['view']['version']);
     }
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     return $view;
 }
Beispiel #5
0
 /**
  * postDispatch
  *
  * @param  Zend_Controller_Request_Abstract $oRequest
  * @return void
  */
 public function postDispatch(Zend_Controller_Request_Abstract $oRequest)
 {
     // Vars
     $module = $oRequest->getModuleName();
     $controller = $oRequest->getControllerName();
     $action = $oRequest->getActionName();
     // Auto include action css/js
     // @todo Include css/js from alternative directories if public folder for the theme
     //       is founded in other folder
     $jsFind = false;
     $publicPath = ROOT_PATH . $this->_frontOptions['publicDir'];
     foreach ($this->_themes as $theme) {
         $themePath = '/themes/' . $theme;
         if ($module == "default") {
             $cssUri = $themePath . "/controllers/{$controller}/{$action}.css";
             $jsUri = $themePath . "/controllers/{$controller}/{$action}.js";
         } else {
             $cssUri = $themePath . "/modules/{$module}/{$controller}/{$action}.css";
             $jsUri = $themePath . "/modules/{$module}/{$controller}/{$action}.js";
         }
         if (is_file($publicPath . "/" . $cssUri)) {
             $this->_view->headLink()->appendStylesheet($this->_view->baseUrl($cssUri));
         }
         if (is_file($publicPath . "/" . $jsUri) and !$jsFind) {
             $this->_view->headScript()->appendFile($this->_view->baseUrl($jsUri));
             $jsFind = true;
         }
     }
 }
 public function indexAction()
 {
     $view = new Zend_View();
     $view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
     $view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
     $view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
     $txtSearch = $this->_getParam('txtSearch', '');
     $where = '';
     if ($txtSearch) {
         $where = ' name like "%' . $txtSearch . '%"';
     }
     $rowPerPage = $this->_getParam('rowperpage', 20);
     $currentPage = 1;
     $page = $this->_getParam('page', 1);
     if (!empty($page)) {
         $currentPage = $page;
     }
     $clients = new Default_Model_ClientsMapper();
     $listClients = $clients->getListClient($where);
     $paginator = Zend_Paginator::factory($listClients);
     $paginator->setItemCountPerPage($rowPerPage);
     $paginator->setCurrentPageNumber($currentPage);
     $this->view->paginator = $paginator;
     $this->view->txtSearch = $txtSearch;
 }
 public function preDispatch()
 {
     $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
     $config = $bootstrap->getOptions();
     $module = $this->getRequest()->getModuleName();
     if (isset($config[$module]['resources']['layout']['layout'])) {
         $layoutScript = $config[$module]['resources']['layout']['layout'];
         $this->getActionController()->getHelper('layout')->setLayout($layoutScript);
     }
     if (isset($config[$module]['site'])) {
         $headtitle = $config[$module]['site']['headtitle'];
         $keywords = $config[$module]['site']['keywords'];
         $description = $config[$module]['site']['description'];
         $layout = $module . '.css';
         $favicon = $module . '/favicon.ico';
     } else {
         $headtitle = $config['site']['headtitle'];
         $keywords = $config['site']['keywords'];
         $description = $config['site']['description'];
         $layout = 'default.css';
         $favicon = 'favicon.ico';
     }
     $view = new Zend_View();
     $view->doctype('XHTML1_STRICT');
     $view->headTitle($headtitle);
     $view->headTitle()->setSeparator(' | ');
     $view->headLink()->prependStylesheet('/css/' . $layout)->headLink(array('rel' => 'favicon', 'href' => '/images/' . $favicon), 'PREPEND')->prependStylesheet('/css/reset.css')->appendStylesheet('/css/menu.css');
     $view->env = APPLICATION_ENV;
     $view->headMeta()->appendName('keyword', $keywords)->appendName('description', $description)->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')->appendHttpEquiv('Content-Language', 'en-US');
 }
 public function indexAction()
 {
     $view = new Zend_View();
     $view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
     $view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
     $view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
     $company = new Default_Model_CompanyMapper();
     $rowPerPage = $this->_getParam('rowperpage', 20);
     $currentPage = 1;
     $page = $this->_getParam('page', 1);
     if (!empty($page)) {
         $currentPage = $page;
     }
     $txtSearch = $this->_getParam('txtSearch', '');
     $opt = $this->_getParam('opt', 'company_name');
     $sort = $this->_getParam('sort', 'created_date');
     $order = $this->_getParam('order', 'DESC');
     $where = '';
     if ($txtSearch) {
         $where = $opt . ' like "%' . $txtSearch . '%"';
     }
     $order1 = ' ORDER BY ' . $sort . ' ' . $order;
     $rows = $company->getListCompany($where, $order1);
     $paginator = Zend_Paginator::factory($rows);
     $paginator->setItemCountPerPage($rowPerPage);
     $paginator->setCurrentPageNumber($currentPage);
     $this->view->paginator = $paginator;
     $this->view->txtSearch = $txtSearch;
     $this->view->opt = $opt;
     $this->view->sort = $sort;
     $this->view->order = $order;
 }
Beispiel #9
0
 /**
  * _responseHtml
  *
  * @return void
  */
 private function _responseHtml()
 {
     $body = $this->_viewRenderer->getResponse()->getBody();
     $respHeader = "{$this->_view->doctype()}\n        <html>\n        <head>\n        {$this->_view->headMeta()}\n        {$this->_view->headTitle()}\n        {$this->_view->headStyle()}\n        {$this->_view->headLink()}\n        {$this->_view->headScript()}\n        {$this->_view->dojo()}\n        </head>";
     $respBody = "<body>{$body}</body>";
     $respFooter = "</html>";
     $this->_viewRenderer->getResponse()->setBody($respHeader . $respBody . $respFooter);
 }
 public function init()
 {
     $view = new Zend_View();
     //$view->headScript()->appendFile ( '/js/jquery-1.7.1.js' );
     $view->headLink()->appendStylesheet('/js/themes/base/jquery.ui.all.css');
     $view->headScript()->appendFile('/js/jquery.ui.datepicker.js');
     $view->headScript()->appendFile('/js/jquery.ui.core.js');
     $view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
     $view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
     $view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
     date_default_timezone_set('Asia/Ho_Chi_Minh');
     $aNamespace = new Zend_Session_Namespace('zs_User');
     if (!isset($aNamespace->islogin)) {
         $this->_redirect('/user');
     }
     $this->view->username = $aNamespace->username;
     $this->view->fullname = $aNamespace->fullname;
     $this->view->isAdmin = $aNamespace->isAdmin;
 }
Beispiel #11
0
 protected function _initView()
 {
     $view = new Zend_View();
     $view->doctype('XHTML1_STRICT');
     $view->headTitle('Truffes');
     $view->headLink()->appendStylesheet('/css/main.css');
     $view->addHelperPath(APPLICATION_PATH . '/helpers', 'View_Helper');
     $view->addHelperPath(APPLICATION_PATH . '/modules/frontend/views/helpers', 'View_Helper');
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     return $view;
 }
Beispiel #12
0
 /** Construct the form
  * @access public
  */
 public function __construct()
 {
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element', 'element');
     $this->addElementPrefixPath('Pas_Filter', 'Pas/Filter/', 'filter');
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->setAttrib('class', 'form-horizontal');
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->clearDecorators();
     $this->_view = Zend_Layout::getMvcInstance()->getView();
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/select2.min.js', $type = 'text/javascript');
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/selectPrettify.js', $type = 'text/javascript');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/select2.css', $type = 'screen');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/bootstrap-multiselect.css', $type = 'screen');
     $person = new Pas_User_Details();
     $details = $person->getPerson();
     if ($details) {
         $this->_role = $details->role;
     } else {
         $this->_role = 'public';
     }
     parent::__construct();
 }
Beispiel #13
0
 /**
  * set view
  */
 protected function _setView()
 {
     if (null === self::$_view) {
         self::$_view = new Zend_View();
         $title = "Shrimp Project";
         self::$_view->setScriptPath(SP_APP_PATH . '/modules/default/views')->setEncoding('UTF-8')->strictVars(false)->addHelperPath('SP/View/Helper', 'SP_View_Helper_');
         self::$_view->doctype('XHTML1_STRICT');
         self::$_view->headTitle($title);
         self::$_view->headLink()->appendStylesheet('/theme/default/main.css');
         self::$_view->headScript()->appendFile('/js/jquery-1.4.2.min.js');
         self::$_view->headScript()->appendFile('/js/jquery.cookie.js');
         self::$_view->headScript()->appendFile('/js/sorttable.js');
         //self::$_view->htmlTable();
     }
 }
 public function indexAction()
 {
     $view = new Zend_View();
     $view->headLink()->appendStylesheet('/css/stylesheet.css');
     $this->_helper->layout->disableLayout();
     $aNamespace = new Zend_Session_Namespace('zs_User');
     if (isset($aNamespace->islogin)) {
         $this->_redirect('/resume');
     }
     $request = $this->getRequest();
     $msg = addslashes($request->getParam('msg'));
     $message = '';
     if ($msg) {
         $message = 'Username or Password incorrect!';
     }
     $this->view->message = $message;
 }
 /**
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action::init()
  */
 public function init()
 {
     $aNamespace = new Zend_Session_Namespace('zs_User');
     if (!isset($aNamespace->islogin)) {
         $this->_redirect('/user');
     }
     /* Initialize action controller here */
     $view = new Zend_View();
     //$view->headLink()->appendStylesheet ( '/css/stylesheet.css' );
     //$view->headScript()->appendFile ( '/js/jquery-1.8.0.min.js' );
     $view->headLink()->appendStylesheet('/js/themes/base/jquery.ui.all.css');
     $view->headScript()->appendFile('/js/jquery.ui.datepicker.js');
     $view->headScript()->appendFile('/js/jquery.ui.core.js');
     $this->view->username = $aNamespace->username;
     $this->view->fullname = $aNamespace->fullname;
     $this->view->isAdmin = $aNamespace->isAdmin;
     date_default_timezone_set('Asia/Ho_Chi_Minh');
 }
Beispiel #16
0
 protected function _initView()
 {
     // initialize view
     $view = new Zend_View();
     // doctype
     $view->doctype('XHTML1_STRICT');
     // encoding
     $view->setEncoding('UTF-8');
     // title
     $view->headTitle('Ofelia')->setSeparator(' | ')->setIndent(8);
     // meta tags
     $view->headMeta()->setHttpEquiv('Content-Type', 'text/html; charset=UTF-8')->appendHttpEquiv('Content-Language', 'en-US')->setName('keywords', 'Ofelia, Open-ended Front-end')->appendName('description', "PHPCabal's Open-ended Front-end")->appendName('google-site-verification', '')->setIndent(8);
     // stylesheets & feeds (headLinks)
     $view->headLink()->setStylesheet('/css/default.css', 'all')->appendStylesheet('/css/menu.css', 'all')->headLink(array('rel' => 'favicon', 'href' => '/images/favicon.ico'), 'PREPEND')->headLink(array('rel' => 'shortcut icon', 'href' => '/images/favicon.ico'), 'PREPEND')->appendAlternate('/feed/', 'application/rss+xml', 'Noticias Generales')->setIndent(8);
     // javascript
     $view->headScript()->appendFile('/js/default.js', 'text/javascript', array('charset' => 'utf-8'))->setIndent(8);
     // add it to the ViewRenderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     // return it, so that it can be stored by the bootstrap
     return $view;
 }
 protected function _initView()
 {
     // Initialize view
     $view = new Zend_View();
     $view->doctype('HTML5');
     $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
     //$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
     $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
     //jQuery
     $view->jQuery()->setLocalPath('/jtables/scripts/jquery-1.9.1.js')->setUiLocalPath('/jtables/scripts/jquery-ui-1.10.1.custom.js')->addStyleSheet('/jtables/css/jquery-ui-1.10.1.custom.css');
     $view->headLink()->appendStylesheet('/jtables/scripts/jtable/themes/lightcolor/blue/jtable.css')->appendStylesheet('/jtables/css/bootstrap.css')->appendStylesheet('/jtables/css/bootstrap-theme.css');
     //Script
     $view->headScript()->appendFile('/jtables/scripts/jquery-1.6.4.min.js')->appendFile('/jtables/scripts/jquery-ui-1.8.16.custom.min.js')->appendFile('/jtables/scripts/jtable/jquery.jtable.min.js')->appendFile('/jtables/scripts/jtable/localization/jquery.jtable.fr.js');
     //->appendFile('/jtables/scripts/bootstrap.js');
     //Zend_Dojo::enableView($view);
     Zend_Paginator::setDefaultScrollingStyle('Elastic');
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/pagination.phtml');
     // Add it to the ViewRenderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     //seulement si on utilise d'autres frameworks ajax
     ZendX_JQuery_View_Helper_JQuery::enableNoConflictMode();
     return $view;
 }
Beispiel #18
0
 protected function _initView()
 {
     // initialize view
     $view = new Zend_View();
     // get it's configuration file
     $site = new Zend_Config_Ini(APPLICATION_PATH . '/configs/site.ini', APPLICATION_ENV);
     // doctype
     $view->doctype($site->doctype);
     // encoding
     $view->setEncoding($site->encoding);
     // title
     $view->headTitle($site->name)->setSeparator(' | ')->setIndent(8);
     // meta tags
     $view->headMeta()->setName('keywords', $site->keywords)->appendName('description', $site->description)->appendName('google-site-verification', $site->googleVerification)->setIndent(8);
     // stylesheets & feeds (headLinks)
     $view->headLink()->setStylesheet('/css/layout.css', 'all')->appendStylesheet('/css/default.css', 'all')->appendStylesheet('/css/menu.css', 'all')->headLink(array('rel' => 'favicon', 'href' => '/images/favicon.ico'), 'PREPEND')->headLink(array('rel' => 'shortcut icon', 'href' => '/images/favicon.ico'), 'PREPEND')->appendAlternate('/feed/', 'application/rss+xml', 'News')->setIndent(8);
     // javascript
     $view->headScript()->appendFile('/js/default.js', 'text/javascript', array('charset' => $site->encoding))->setIndent(8);
     // add it to the ViewRenderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     // return it, so that it can be stored by the bootstrap
     return $view;
 }
Beispiel #19
0
 /**
  * Metodo que adicona os arquivos CSS/JS básicos para a requisição.
  *
  * @param Zend_View $view        	
  */
 public function addBasicFilesOfRequestToView(&$view, $inibeCache = false)
 {
     // Paths básicos para os arquivos de JS e CSS
     $pathStylesheet = SITE_PATH . '/css';
     $pathScript = SITE_PATH . '/js';
     // Incrementa cada path com a expressao
     // <path>/<module>/<controller>/<action>.(css,js)
     $pathStylesheet .= '/' . $this->getRequest()->getModuleName() . '/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . '.css';
     $pathScript .= '/' . $this->getRequest()->getModuleName() . '/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . '.js';
     // Verifica se o path indicado é realmente um arquivo de estilos válido
     if (is_file($pathStylesheet) && is_readable($pathStylesheet)) {
         // Recupera o caminho relativo do arquivo
         $relativeStylesheet = str_replace(SITE_PATH, $view->baseUrl(), $pathStylesheet);
         // Adiciona o arquivo a lista de styles do site
         $view->headLink()->appendStylesheet($relativeStylesheet . ($inibeCache ? '?' . mt_rand(0, 99999) : ''));
     }
     // Verifica se o path indicado é realmente um arquivo de scripts válido
     if (is_file($pathScript) && is_readable($pathScript)) {
         // Recupera o caminho relativo do arquivo
         $relativeScript = str_replace(SITE_PATH, $view->baseUrl(), $pathScript);
         // Adiciona o arquivo a lista de styles do site
         $view->headScript()->appendFile($relativeScript . ($inibeCache ? '?' . mt_rand(0, 99999) : ''));
     }
 }
 /**
  * @description append css
  * @param array $cssArray
  * @param Zend_View $view
  * @return void
  * @author Se#
  * @version 0.0.1
  */
 public function css(array $cssArray, $view)
 {
     foreach ($cssArray as $css) {
         $view->headLink()->appendStylesheet($css);
     }
 }
Beispiel #21
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));
     //        }
 }
Beispiel #22
0
 /**
  * Initializes the application with global standards for the view
  *
  * @access public
  * @return void
  */
 public function init()
 {
     //$seconds = 60 * 60 * 24 * 1; // 1 day
     //Zend_Session::RememberMe($seconds);
     $appName = Zend_Registry::get('appName');
     $moduleName = $this->getRequest()->getModuleName();
     $controllerName = $this->getRequest()->getControllerName();
     $actionName = $this->getRequest()->getActionName();
     $controller = $this->getActionController();
     $view = new Zend_View();
     $auth = App_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         Zend_Layout::getMvcInstance()->assign('user_name', $auth->getUserName());
     }
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         Zend_Layout::getMvcInstance()->assign('user_role', $auth->getRoleId());
     }
     /* if ($auth->hasIdentity()) {
               $identity = $auth->getIdentity();
               if ($identity->role_id == 2 && $controllerName != 'accounts' && $controllerName != 'error' && $controllerName != 'index') {
               $accounts = new Application_Model_Accounts();
               $select = $accounts->select()->where("user_id=" . $identity->id);
               $result = $accounts->fetchRow($select);
     
               if (count($result) == 0) {
               $this->getResponse()->setRedirect('/accounts/create');
               }
               }
               } */
     /* if ($_SERVER['REQUEST_URI'] == '/index/login' || $_SERVER['REQUEST_URI'] == '/index/login/') {
        $this->getResponse()->setRedirect('/login');
        } */
     $baseUrl = Zend_Registry::get('baseurl');
     //echo $_SERVER['REQUEST_URI'];
     if ($controllerName != 'index' && $moduleName != 'api' && $controllerName != 'error' && !$auth->hasIdentity()) {
         $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
     }
     if ($moduleName == 'cadmin' && !$auth->hasIdentity()) {
         $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
     }
     if ($moduleName == 'iadmin' && !$auth->hasIdentity()) {
         $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
     }
     if ($moduleName == 'campaign' && !$auth->hasIdentity()) {
         $this->getResponse()->setRedirect($baseUrl . '/campaign/manage-campaigns?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI'])));
     }
     //$view->headScript()->appendFile($baseUrl . '/js/braintree.js');
     //$view->headLink()->appendStylesheet($baseUrl . '/css/main.css');
     Zend_Registry::set('controller', $controllerName);
     Zend_Registry::set('action', $actionName);
     //Get the scripts and css directories
     $scripts = empty($moduleName) ? new App_Directory('js/' . $controllerName) : new App_Directory('js/' . $moduleName . '/' . $controllerName);
     $css = empty($moduleName) ? new App_Directory('css/' . $controllerName) : new App_Directory('css/' . $moduleName . '/' . $controllerName);
     //Append the scripts (if any) that pertain to this action and controller
     if ($scripts->exists()) {
         $scripts = $scripts->getFiles();
         foreach ($scripts as $script) {
             if ($script === $actionName . ".js") {
                 if (empty($moduleName)) {
                     $view->inlineScript()->appendFile($baseUrl . '/js/' . $controllerName . '/' . $script);
                 } else {
                     $view->inlineScript()->appendFile($baseUrl . '/js/' . $moduleName . '/' . $controllerName . '/' . $script);
                 }
             }
         }
     }
     //Append the stylesheets (if any) that pertain to this action and controller
     if ($css->exists()) {
         $css = $css->getFiles();
         foreach ($css as $stylesheet) {
             if ($stylesheet === $actionName . ".css") {
                 if (empty($moduleName)) {
                     $view->headLink()->appendStylesheet($baseUrl . '/css/' . $controllerName . '/' . $stylesheet);
                 } else {
                     $view->headLink()->appendStylesheet($baseUrl . '/css/' . $moduleName . '/' . $controllerName . '/' . $stylesheet);
                 }
             }
         }
     }
     $appName = Zend_Registry::get('appName');
     $view->inlineScript()->prependScript('var appName = "' . $appName . '"');
     $view->prefix = $this->getRequest()->isXmlHttpRequest() || $this->getRequest()->getParam('ajax') == 'true' ? 'ajax' : 'page';
     $view->action = $actionName;
     $view->controller = $controllerName;
     if ($moduleName == 'default') {
         Zend_Registry::set('resource', $controllerName . "/" . $actionName);
     } else {
         Zend_Registry::set('resource', $moduleName . "/" . $controllerName . "/" . $actionName);
     }
     $arr_data = App_Controller_Functions::getPageTitleAndMeta(Zend_Registry::get('resource'));
     Zend_Registry::set('pageTitle', $arr_data['pageTitle']);
     Zend_Registry::set('metaTitle', $arr_data['metaTitle']);
     Zend_Registry::set('metaDescription', $arr_data['metaDescription']);
 }
 public function expectationAction()
 {
     $view = new Zend_View();
     $view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
     $view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
     $view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
     $resumeId = $this->getRequest()->getParam('id');
     $resume = new Default_Model_ResumeMapper();
     $listProvince = $resume->getProvince();
     $expectationRowSet = new Default_Model_Expectation();
     $expectationMapper = new Default_Model_ExpectationMapper();
     $expectationMapper->find($resumeId, $expectationRowSet);
     $provinceArr = array();
     if ($expectationRowSet->getResExpectationId()) {
         $resumeProvince = $expectationMapper->getExpectationProvince($expectationRowSet->getResExpectationId());
         foreach ($resumeProvince as $province) {
             $provinceArr[] = $province['province_id'];
         }
     }
     $this->view->listProvince = $listProvince;
     $this->view->resumeId = $resumeId;
     $this->view->expectationRowSet = $expectationRowSet;
     $this->view->resumeProvince = $provinceArr;
 }
Beispiel #24
0
 /**
  *
  * @param unknown_type $type
  * @param Zend_View $zview
  * @param unknown_type $useCompression
  * @param unknown_type $useConcatenation
  * @param unknown_type $ctrl
  */
 public static function concatScripts($type, Zend_View $zview, $useConcatenation = true)
 {
     $r = '';
     $path = Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/html';
     $path2 = Sydney_Tools_Paths::getJslibsPath();
     $arrayOrig['jsOrig'] = Zend_Registry::getInstance()->get('config')->admin->js->orig;
     $arrayOrig['cssOrig'] = Zend_Registry::getInstance()->get('config')->admin->css->orig;
     $arrayLibs['jsLibs'] = Zend_Registry::getInstance()->get('config')->admin->js->libs;
     $arrayLibs['cssLibs'] = Zend_Registry::getInstance()->get('config')->admin->css->libs;
     /**
      * CSS + JS
      */
     // adding the main files from the jslibs
     foreach ($arrayLibs[$type . 'Libs'] as $file) {
         if ($useConcatenation) {
             if (file_exists($path2 . $file)) {
                 $tcnt = file_get_contents($path2 . $file);
                 if ($type == 'css' && preg_match('#sydneyassets\\/jslibs\\/jquery#', $file)) {
                     $needleStr = "#url\\(\"images\\/([a-zA-Z0-9_-]+)\\.(png|gif|jpg)\"#";
                     $replaceStr = "url(" . Sydney_Tools_Paths::getRootUrlCdn() . "\\/sydneyassets\\/jslibs\\/jquery\\/css\\/smoothness\\/images\\/\$1.\$2";
                     $tcnt = preg_replace($needleStr, $replaceStr, $tcnt);
                 }
                 if ($type == 'css' && preg_match('/skins\\/sam/', $file)) {
                     $pht = preg_replace("/^\\/assets\\/yui\\/build\\/([A-z]{1,50})\\/assets\\/skins\\/sam\\/([A-z-_]{1,50}(\\.css))/", "/sydneyassets/yui/build/\\1/assets/skins/sam/", $file);
                     $tcnt = str_replace('../../../../assets/skins/sam/', Sydney_Tools::getRootUrlCdn() . '/sydneyassets/yui/build/assets/skins/sam/', $tcnt);
                     $tcnt = preg_replace("/url\\(([A-z0-9_-]{1,50})\\.(png)\\)/", "url(" . $pht . "\\1.\\2)", $tcnt);
                 }
                 $r .= "/* =========== File: " . $path2 . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n";
             }
         } else {
             if ($type == 'css') {
                 $zview->headLink()->appendStylesheet($file);
             } else {
                 // GDE - 19/08/2013 - On va chercher "jslibs" sur le cdn (com.antidot.sydney)
                 $zview->headScript()->appendFile(Zend_Registry::getInstance()->get('config')->general->cdn . $file, 'text/javascript');
             }
         }
     }
     // adding the main files
     foreach ($arrayOrig[$type . 'Orig'] as $file) {
         if ($useConcatenation) {
             $tcnt = file_get_contents($path . $file);
             $r .= "/* =========== File: " . $path . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n";
         } else {
             if ($type == 'css') {
                 $zview->headLink()->appendStylesheet($file);
             } else {
                 $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $file, 'text/javascript');
             }
         }
     }
     // END Foreach
     /**
      * JS
      */
     if ($type == 'js') {
         // adding the UI files
         $t = self::getDirList($path . '/sydneyassets/scripts/ui/');
         foreach ($t as $file) {
             if ($useConcatenation) {
                 $r .= "/* =========== File: " . $path . '/sydneyassets/scripts/ui/' . $file . " ================ */ \n\n\n" . file_get_contents($path . '/sydneyassets/scripts/ui/' . $file) . "\n\n\n\n";
             } else {
                 $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/scripts/ui/' . $file, 'text/javascript');
             }
         }
         // add the launcher
         $launchFile = '/sydneyassets/scripts/zLauncher.js';
         if ($useConcatenation) {
             $r .= "/* =========== File: " . $path . $launchFile . " ================ */ \n\n\n" . file_get_contents($path . $launchFile) . "\n\n\n\n";
         } else {
             $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $launchFile, 'text/javascript');
         }
     }
     return $r;
 }
Beispiel #25
0
	/**
	 * Setup css stylesheet in headStyle stack
	 * @return null
	 */
	protected function _setupCss()
	{
        $this->_view->headLink()->appendStylesheet( '/css/style.css' );
        $this->_view->headLink()->appendStylesheet( '/css/print.css' , 'print');
	}
Beispiel #26
0
 protected function _initView()
 {
     // Initialize view
     $view = new Zend_View();
     // Set encoding and doctype
     $view->setEncoding('utf-8');
     $view->doctype('HTML4_STRICT');
     //====================== Set the content type, language and title ====================//
     $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
     $view->headMeta()->appendHttpEquiv('Content-Language', 'en-US');
     $view->headMeta()->appendName('description', 'tour bus, booking, website');
     $view->headMeta()->appendName('keywords', 'Tour bus booking website is where we can book tickets for trip');
     $view->headTitle('Tour Bus Booking');
     //===================================================================================//
     //================== Include blueprint css framework =============//
     $view->headLink()->appendStylesheet('/css/blueprint/screen.css', 'screen, projection');
     $view->headLink()->appendStylesheet('/css/blueprint/print.css', 'print');
     $view->headLink()->appendStylesheet('/css/blueprint/ie.css', 'screen, projection', 'lt IE8');
     //===============================================================//
     //=============== Include jquery library ================//
     $view->headScript()->appendFile('/scripts/libraries/jquery-1.4.2.min.js', 'text/javascript');
     $view->headScript()->appendFile('/scripts/libraries/jquery.tablesorter.js', 'text/javascript');
     $view->headScript()->appendFile('/scripts/libraries/jquery.dataTables.js', 'text/javascript');
     //=============== add jquery library ================//
     // Why can't?????
     // add jquery UI library
     //$view->headScript()->appendFile('/scripts/libraries/jquery-ui-1.8.7.custom.min.js', 'text/javascript');
     //$view->headLink()->appendStylesheet('/css/ui-lightness/jquery-ui-1.8.7.custom.css');
     //========== Set skin for website ==========//
     $skin = 'blues';
     $view->skin = $skin;
     Zend_Registry::set('skin', $skin);
     //==========================================//
     //================== Add helper path ====================//
     // this helper path for LoadSkin
     $view->addHelperPath('TBB/View/Helper', 'TBB_View_Helper');
     // this helper path for ZendX datepicker
     $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
     //=======================================================//
     //================ Include jquery UI (this way by Stackoverflow, not me)==================//
     $view->jQuery()->addStylesheet('/css/ui-lightness/jquery-ui-1.8.7.custom.css')->setLocalPath('/scripts/libraries/jquery-1.4.2.min.js')->setUiLocalPath('/scripts/libraries/jquery-ui-1.8.7.custom.min.js');
     //====================================================================================//
     //================ Set view for view renderer ===============//
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     //===========================================================//
     // Return it, so that it can be stored by the bootstrap
     return $view;
 }
Beispiel #27
0
 /**
  * Add a CSS file in the webpage
  * @param Zend_View $view
  * @param array $css
  */
 private static function addCSS(Zend_View $view, $css)
 {
     // Custom XML file inclusion of the css files
     if (!empty($css)) {
         foreach ($css as $item) {
             $view->headLink()->appendStylesheet($item);
         }
     }
 }
Beispiel #28
0
 /**
  * (non-PHPdoc)
  * @see Zend_Controller_Action_Helper_Abstract::preDispatch()
  */
 public function preDispatch()
 {
     $module = $this->getRequest()->getModuleName();
     $controller = $this->getRequest()->getControllerName();
     $keywords = Settings::findbyParam('default_html_keywords');
     $description = Settings::findbyParam('default_html_description');
     $copyright = Settings::findbyParam('default_copyright');
     // Get the skin paramenter set in the Settings Table in the database
     if ($module == "default") {
         $customskin = Settings::findbyParam('skin');
         $skin = !empty($customskin) && file_exists(PUBLIC_PATH . "/skins/{$module}/{$customskin}") ? $customskin : "blank";
     } elseif ($module == "admin") {
         $customskin = Settings::findbyParam('adminskin');
         $skin = !empty($customskin) && file_exists(PUBLIC_PATH . "/skins/{$module}/{$customskin}") ? $customskin : "blank";
     } else {
         $customskin = "";
         $skin = "";
     }
     // Get all the resources set in the layout.xml file
     $css = Shineisp_Commons_Layout::getResources($module, $controller, "css", $skin);
     $js = Shineisp_Commons_Layout::getResources($module, $controller, "js", $skin);
     $template = Shineisp_Commons_Layout::getTemplate($module, $controller, $skin);
     // Setting up the HEAD Section
     $view = new Zend_View();
     $view->doctype('XHTML1_TRANSITIONAL');
     #$view->headMeta ()->appendHttpEquiv ( 'Content-Type', 'text/html;charset=utf-8' );
     $view->headTitle(Settings::findbyParam('default_html_title'));
     $view->headMeta()->setName('robots', "INDEX, FOLLOW");
     $view->headMeta()->setName('author', !empty($copyright) ? $copyright : "Shine Software Company");
     $view->headMeta()->setName('keywords', !empty($keywords) ? $keywords : "shine software, isp software");
     $view->headMeta()->setName('description', !empty($description) ? $description : "This is a Shine Software application");
     $view->headTitle()->setSeparator(' / ');
     // Custom XML file inclusion of the js files
     if (!empty($js)) {
         // Fast including of the js file using the module name
         if (file_exists(PUBLIC_PATH . "/skins/{$module}/{$skin}/js/{$module}.js")) {
             $js[] = array('resource' => "/skins/{$module}/{$skin}/js/{$module}.js", 'position' => 'admin_endbody');
         }
         // Fast including of the js file for the controller
         if (file_exists(PUBLIC_PATH . "/skins/{$module}/{$skin}/js/{$controller}.js")) {
             $js[] = array('resource' => "/skins/{$module}/{$skin}/js/{$controller}.js", "position" => 'admin_endbody');
         }
         // Check the caches administrator preferences
         if (Settings::findbyParam('jscompression')) {
             @mkdir(PUBLIC_PATH . "/cache/");
             // Create the JS Compressor object
             $compressor = new Shineisp_Commons_jsCompressor();
             foreach ($js as $item) {
                 $compressor->add(PUBLIC_PATH . $item['resource']);
             }
             // Compress and minify the javascript files
             $filecompressed = $compressor->simpleMode()->hideDebugInfo()->cacheDir(PUBLIC_PATH . "/cache/")->write();
             $deferringjs = "<script>(function() { var s = document.createElement(\"script\"); s.type = \"text/javascript\"; s.async = true; s.src = \"/cache/{$filecompressed}\"; var x = document.getElementsByTagName(\"script\")[0]; x.parentNode.insertBefore(s, x) })();</script>";
             // Add the compressed file in the deferring mode
             if ($module == "admin") {
                 $view->placeholder("admin_htmlhead")->append($deferringjs);
             } elseif ($module == "default") {
                 $view->placeholder("htmlhead")->append($deferringjs);
             }
         } else {
             foreach ($js as $item) {
                 // check if the css or the js is a conditional item
                 $conditional = !empty($item['conditional']) ? array('conditional' => $item['conditional']) : null;
                 // check the position of the item in the page
                 if (!empty($item['position'])) {
                     $view->InlineScript()->setFile($item['resource'], 'text/javascript', $conditional)->toString();
                     $view->placeholder($item['position'])->append($view->InlineScript()->toString());
                 } else {
                     $view->headScript()->setFile($item['resource'], 'text/javascript', $conditional);
                     $view->placeholder("admin_endbody")->append($view->InlineScript()->toString());
                 }
             }
         }
     }
     // Custom XML file inclusion of the css files
     if (!empty($css)) {
         // Fast including of the css file using the module name
         if (file_exists(PUBLIC_PATH . "/skins/{$module}/{$skin}/css/{$module}.css")) {
             $css[]['resource'] = "/skins/{$module}/{$skin}/css/{$module}.css";
         }
         // Fast including of the css file for the controller
         if (file_exists(PUBLIC_PATH . "/skins/{$module}/{$skin}/css/{$controller}.css")) {
             $css[]['resource'] = "/skins/{$module}/{$skin}/css/{$controller}.css";
         }
         // Check the caches administrator preferences
         if (Settings::findbyParam('csscompression')) {
             @mkdir(PUBLIC_PATH . "/cache/");
             // Create the JS Compressor object
             $compressor = new Shineisp_Commons_cssCompressor();
             foreach ($css as $item) {
                 $compressor->add(PUBLIC_PATH . $item['resource']);
             }
             // Compress and minify the stylesheet files
             $filecompressed = $compressor->cacheDir(PUBLIC_PATH . "/cache/")->write();
             $view->headLink()->appendStylesheet("/cache/{$filecompressed}");
         } else {
             foreach ($css as $item) {
                 $conditional = !empty($item['conditional']) ? $item['conditional'] : null;
                 $view->headLink()->appendStylesheet($item['resource'], 'screen', $conditional);
             }
         }
     }
     $customcss = Settings::findbyParam('css');
     if ($customcss) {
         $view->placeholder("htmlhead")->append("<style>" . trim(preg_replace('/\\s\\s+/', ' ', $customcss)) . "</style>");
     }
     // Enable and Add the RSS Shine Software reference
     $view->headLink()->appendAlternate('/rss/', 'application/rss+xml', 'RSS Feed');
     $view->headLink()->headLink(array('rel' => 'icon', 'type' => 'image/x-icon', 'href' => "/skins/{$module}/{$skin}/images/favicon.ico"));
     $view->placeholder("endbody")->append(Settings::findbyParam('default_html_code'));
     $view->placeholder("htmlhead")->append(Settings::findbyParam('default_html_head'));
     $view->placeholder("endbody")->append(Settings::findbyParam('google_analytics_code'));
     // Change the default path script
     if (file_exists(APPLICATION_PATH . "/modules/{$module}/views/{$skin}/")) {
         $this->getActionController()->view->addBasePath(APPLICATION_PATH . "/modules/{$module}/views/{$skin}/");
     } else {
         $this->getActionController()->view->addBasePath(APPLICATION_PATH . "/modules/{$module}/views/blank/");
     }
     // Set the additional path for the layout templates
     if ($this->getActionController()->getHelper('viewRenderer')->getNoRender() == false) {
         if (file_exists(PUBLIC_PATH . "/skins/{$module}/{$skin}/")) {
             $this->getActionController()->view->addBasePath(PUBLIC_PATH . "/skins/{$module}/{$skin}/");
             // Setting the Template to be used
             $this->getActionController()->getHelper('layout')->setLayout($template);
         } else {
             if ($module != "system") {
                 // System module doesn't need the template folder
                 throw new Exception("Template folder has not been found in: " . PUBLIC_PATH . "/skins/{$module}/{$skin}/");
             }
         }
     }
 }