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 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; }
/** * 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; }
/** * Set <script> elements * * @return void */ public function setHeadScripts() { foreach ($this->getOptions() as $headScript => $options) { $mode = array_key_exists('mode', $options) && isset($options['mode']) ? $options['mode'] : 'FILE'; $spec = array_key_exists('spec', $options) && isset($options['spec']) ? $options['spec'] : null; $placement = array_key_exists('placement', $options) && isset($options['placement']) ? $options['placement'] : 'APPEND'; $this->_view->headScript($mode, $spec, $placement); } }
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"); }
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; }
/** * 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 postDispatch(Zend_Controller_Request_Abstract $p_request) { // stick the baseUrl to the basePath because we have a dispatched request now // and format those god damn slashes!! $baseUrl = trim(Zend_Controller_Front::getInstance()->getBaseUrl(), '/'); $currentUrn = ($baseUrl != "" ? '/' . $baseUrl : "") . '/' . trim($this->_baseUrn, '/') . '/'; $filesToAppend = array("{$this->_basePath}{$this->_sharedFileName}.{$this->_fileSuffix}" => "{$currentUrn}{$this->_sharedFileName}.{$this->_fileSuffix}", 'script' => $this->view->jQueryReady()->toString(), "{$this->_basePath}{$p_request->getControllerName()}.{$this->_fileSuffix}" => "{$currentUrn}{$p_request->getControllerName()}.{$this->_fileSuffix}", "{$this->_basePath}{$p_request->getControllerName()}" . DIR_SEP . "{$p_request->getActionName()}.{$this->_fileSuffix}" => "{$currentUrn}{$p_request->getControllerName()}" . '/' . "{$p_request->getActionName()}.{$this->_fileSuffix}"); foreach ($filesToAppend as $path => $urn) { if ($path == 'script') { $this->view->headScript()->appendScript($urn); } if ($this->_basePath && file_exists($path)) { $this->view->headScript()->appendFile($urn); } } }
/** * _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); }
/** * (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'); }
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; }
protected function _initView() { $view = new Zend_View(); $view->doctype('XHTML1_TRANSITIONAL'); $view->headMeta()->appendHttpEquiv('Content-type', 'text/html;charset=utf-8'); $view->headTitle('· Intermodels · Un deseo...hecho realidad · Modelos · Gogós · Azafatas · Agencia · Barcelona ·')->setSeparator(' - '); $view->headScript()->prependFile('http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'); $view->addHelperPath('Neo/View/Helper', 'Neo_View_Helper'); $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); return $view; }
/** * 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(); } }
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(); // 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; }
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; }
/** * 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) : '')); } }
/** * (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}/"); } } } }
public function avandceSearchAction() { $view = new Zend_View(); $view->headScript()->appendFile('/js/resume.js'); $cond = array(); $post = $this->getRequest()->getPost(); //print_r($post);exit; if (@$post['full_name']) { $cond[] = 'full_name like "%' . $post['full_name'] . '%" '; } if (@$post['email']) { $cond[] = '(email_1 like "%' . $post['email'] . '%" OR email_2 like "%' . $post['email'] . '%")'; } if (@$post['phone']) { $cond[] = '(mobile_1 like "%' . $post['phone'] . '%" OR mobile_2 like "%' . $post['phone'] . '%") '; } if (@$post['gender']) { $cond[] = 'gender = "' . $post['gender'] . '"'; } if (@$post['marital_status']) { $cond[] = 'marital_status = "' . $post['marital_status'] . '"'; } $choice = array(); if (@$post['job_title']) { $choice[] = 'job_title'; $cond[] = 'job_title like "%' . $post['job_title'] . '%"'; } if (@$post['company_name']) { $choice[] = 'company_name'; $cond[] = 'company_name like "%' . $post['company_name'] . '%"'; } if (@$post['salary']) { $choice[] = 'salary'; $symbol = $post['symbol']; if ($symbol == 1) { $symbol = '='; } else { if ($symbol == 2) { $symbol = '>'; } else { $symbol = '<'; } } $cond[] = 'current_salary ' . $symbol . ' "' . $post['salary'] . '"'; } if (@$post['experother']) { $choice[] = 'experother'; $cond[] = 'experience_other like "%' . $post['experother'] . '%"'; } if (@$post['functions']) { $choice[] = 'functions'; $cond[] = 'function_id in (' . $post['functions'] . ')'; } if (@$post['provinces']) { $choice[] = 'provinces'; $cond[] = 'province_id in (' . $post['provinces'] . ')'; } if (@$post['school_name']) { $choice[] = 'education'; $cond[] = 'school_name like "%' . $post['school_name'] . '%"'; } if (@$post['program_name']) { $choice[] = 'education'; $cond[] = 'program_name like "%' . $post['program_name'] . '%"'; } if (@$post['keyword']) { $keyword = $post['keyword']; $choice[] = 'keyword'; $where = '(job_title like "%' . $keyword . '%"'; $where .= ' OR company_name like "%' . $keyword . '%"'; $where .= ' OR duties like "%' . $keyword . '%"'; $where .= ' OR experience_other like "%' . $keyword . '%")'; $cond[] = $where; } //print_r($cond);exit; $resume = new Default_Model_ResumeMapper(); $rows = $resume->getListResume($cond, $choice); $paginator = Zend_Paginator::factory($rows); $paginator->setItemCountPerPage(20); $paginator->setCurrentPageNumber(1); $this->view->paginator = $paginator; //$this->view->rows = $rows; $this->view->search = 1; $this->_helper->layout->disableLayout(); $this->render('list-resume'); }
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)); // } }
public static function interp(Zend_View $view, $pID, $pRows, $query_string, $pStore_id, $height, $width, $pParams) { if (is_object($pRows)) { $pRows = $pRows->toArray(); } ob_start(); ?> <div id="<?php echo $pID; ?> _node" style="height: <?php echo $height; ?> px; width: <?php echo $width; ?> px"></div> <?php $view->headScript()->captureStart(); ?> function areweloading() { console.debug('yes we are'); } function make_dojogrid_<?php echo $pID; ?> () { var layout = [ <?php ob_start(); foreach ($pRows as $row) { ?> [ <?php $fields = array(); foreach ($row as $col) { ?> <?php $fields[] = self::_format_formatter(Zend_Json::encode($col)); } echo join(',', $fields); ?> ],<?php } echo rtrim(ob_get_clean(), ", \n\r"); ?> ]; console.debug('made layout'); console.debug(layout); var grid = new dojox.grid.DataGrid( { query: <?php echo $query_string; ?> , structure: layout, store: <?php echo $pStore_id; ?> }); console.debug('grid made'); dojo.byId('<?php echo $pID; ?> _node').appendChild(grid.domNode); grid.startup(); } dojo.addOnLoad(areweloading); dojo.addOnLoad(make_dojogrid_<?php echo $pID; ?> ); <?php $view->headScript()->captureEnd(); return ob_get_clean(); }
/** * * @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; }
/** * Setup js scripts in headStyle stack * @return null */ protected function _setupJs() { $this->_view->headScript()->appendFile('/js/jquery-1.4.2.min.js', $type = 'text/javascript'); }
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; }
/** * Add a JS file in the webpage * @param Zend_View $view * @param array $js */ private static function addJs(Zend_View $view, $js) { // Custom XML file inclusion of the js files if (!empty($js)) { foreach ($js as $item) { $view->headScript()->appendFile($item); } } }
/** * @description append JS * @param array $jsArray * @param Zend_View $view * @return void * @author Se# * @version 0.0.1 */ public function js(array $jsArray, $view) { foreach ($jsArray as $js) { $view->headScript()->appendFile($js); } }