/** * Init view */ protected function _initView() { $theme = 'default-ui'; if (isset($_COOKIE["theme"])) { $theme = $_COOKIE["theme"]; } elseif (isset($this->config->app->theme)) { $theme = $this->config->app->theme; } define('THEME', $theme); // Initialize view $_options = $this->getOptions(); $view = new Zend_View(); $view->doctype('HTML5'); $view->headMeta() ->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ->appendHttpEquiv('X-UA-Compatible', 'IE=Edge'); $view->headTitle($_options['app']['name'])->setSeparator(' - '); // 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; }
public function postAction() { $email = $this->_request->getParam('email'); $response = $this->_helper->response(); if (Kebab_Validation_Email::isValid($email)) { // Create user object $user = Doctrine_Core::getTable('Model_Entity_User')->findOneBy('email', $email); $password = Kebab_Security::createPassword(); if ($user !== false) { $user->password = md5($password); $user->save(); $configParam = Zend_Registry::get('config')->kebab->mail; $smtpServer = $configParam->smtpServer; $config = $configParam->config->toArray(); // Mail phtml $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/views/mails/'); $view->assign('password', $password); $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config); $mail = new Zend_Mail('UTF-8'); $mail->setFrom($configParam->from, 'Kebab Project'); $mail->addTo($user->email, $user->fullName); $mail->setSubject('Reset Password'); $mail->setBodyHtml($view->render('forgot-password.phtml')); $mail->send($transport); $response->setSuccess(true)->getResponse(); } else { $response->addNotification(Kebab_Notification::ERR, 'There isn\'t user with this email')->getResponse(); } } else { $response->addError('email', 'Invalid email format')->getResponse(); } }
protected function _initView() { // Start initail view $this->bootstrap('layout'); $config = $this->getOption('views'); $resources = $this->getOption('resources'); $view = new Zend_View(); if (isset($resources['layout']['layoutPath'])) { $view->assign('layoutRootPath', $resources['layout']['layoutPath']); } $this->bootstrap('db'); Zend_Loader::loadClass('Ht_Utils_SystemSetting'); $sysSetting = Ht_Utils_SystemSetting::getSettings(); $view->assign('sysSetting', $sysSetting); $view->assign('profile', Zend_Auth::getInstance()->getIdentity()); Zend_Loader::loadClass("Ht_Model_SystemSetting"); $this->setSystemLogConfiguration($sysSetting); // use the viewrenderer to keep the code DRY // instantiate and add the helper in one go $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); $viewRenderer->setViewSuffix('phtml'); // add it to the action helper broker Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); /** * Set inflector for Zend_Layout */ $inflector = new Zend_Filter_Inflector(':script.:suffix'); $inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml')); // Initialise Zend_Layout's MVC helpers $this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector); return $this->getResource('layout')->getView(); }
/** * @covers Robo47_View_Helper_Gravatar::Gravatar * @dataProvider gravatarProvider */ public function testGravatar($email, $size, $rating, $default, $ssl, $separator, $params) { $view = new Zend_View(); $view->setEncoding('utf-8'); $view->Doctype(Zend_View_Helper_Doctype::XHTML1_STRICT); $service = new Robo47_Service_Gravatar(); $helper = new Robo47_View_Helper_Gravatar($service); $helper->setView($view); $gravatarImageTag = $helper->Gravatar($email, $size, $rating, $default, $ssl, $separator, $params); $src = $service->getUri($email, $size, $rating, $default, $ssl, $separator); $alt = 'Gravatar ' . $service->getGravatarHash($email); libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML('<html><head><title></title></head><body>' . $gravatarImageTag . '</body></html>'); libxml_use_internal_errors(false); $nodes = $dom->getElementsByTagName('img'); $this->assertEquals(1, $nodes->length); $image = $nodes->item(0); $this->assertTrue($image->hasAttribute('src'), 'Image has no attribute "href"'); $this->assertTrue($image->hasAttribute('alt'), 'Image has no alt'); foreach ($params as $param => $value) { $this->assertTrue($image->hasAttribute($param), 'Image has no attribute "' . $param . '"'); $this->assertEquals($value, $image->getAttribute($param), 'Image attribute "' . $param . '" has wrong value'); } $srcAttribute = $image->getAttribute('src'); $this->assertEquals($src, $srcAttribute, 'Image attribute "src" has wrong value'); if (isset($params['alt'])) { $altAttribute = $image->getAttribute('alt'); $this->assertEquals($params['alt'], $altAttribute, 'Image attribute "alt" has wrong value'); } else { $altAttribute = $image->getAttribute('alt'); $this->assertEquals($alt, $altAttribute, 'Image attribute "alt" has wrong value'); } }
/** * Creates a pre-configured view object. * * @return Zend_View */ protected function createView() { $view = new Zend_View(); $urlHelper = new Mol_Test_View_Helper_Url(); $view->registerHelper($urlHelper, 'url'); return $view; }
public function news() { $view = new Zend_View(); $base = $view->baseurl(); try { $query = "SELECT * FROM page where menu like '12' ORDER BY id DESC limit 0,4"; $stml = $this->db->prepare($query); $stml->execute(); while ($result = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $result['id']; $title = $result['title']; $url = khongdau($title); $date = $result['date']; $menu = $result['menu']; $images = $result['images']; $link = "{$base}/trang/{$url}-{$id}-{$menu}.html"; echo "<div class='clear_10'></div>"; echo "<a href=\"{$url}/pages/tin-tuc-12.html\" title=\"{$ten}\"> <img src=\"{$base}/Upload/{$images}\"> </a>"; echo "<a href=\"{$link}\"> <h5> {$title} </h5></a>"; echo "<span>{$date} <span>"; echo "<div class='clear'></div>"; echo "<div class='clear_border'></div>"; } } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
protected function renderMenu() { $container = new Zend_Navigation(VAR_menu); $this->view->assign('menu', $container); $this->view->assign('module', $this->_getParam('module')); Zend_Layout::getMvcInstance()->assign('navbar', $this->view->render('navbar.phtml')); }
/** * Set doctype * * @return void */ public function setDoctype() { $options = $this->getOptions(); if (array_key_exists('doctype', $options)) { $this->_view->doctype($options['doctype']); } }
protected function _initView() { $view = new Zend_View(); $view->headTitle('test test'); $view->docType('XHTML1_STRICT'); Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/layouts')); }
/** * Adds elements from the model to the bridge that creates the form. * * @param \MUtil_Model_Bridge_FormBridgeInterface $bridge * @param \MUtil_Model_ModelAbstract $model */ protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model) { $this->mailElements->setForm($bridge->getForm()); $this->initItems(); $this->addItems($bridge, 'gct_name'); $this->addItems($bridge, 'gct_id_template', 'gct_target'); $this->addItems($bridge, 'gct_code'); $bridge->getForm()->getElement('gct_target')->setAttrib('onchange', 'this.form.submit()'); $defaultTab = $this->project->getLocaleDefault(); $this->mailElements->addFormTabs($bridge, 'gctt', 'active', $defaultTab, 'tabcolumn', 'gctt_lang', 'selectedTabElement', 'send_language'); $config = array('extraPlugins' => 'bbcode,availablefields', 'toolbar' => array(array('Source', '-', 'Undo', 'Redo'), array('Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'), array('Link', 'Unlink', 'Image', 'SpecialChar'), '/', array('Bold', 'Italic', 'Underline'), array('NumberedList', 'BulletedList', '-', 'Blockquote'), array('Maximize'), array('availablefields'))); $mailfields = $this->mailer->getMailFields(); foreach ($mailfields as $field => $value) { $mailfields[$field] = utf8_encode($value); } $config['availablefields'] = $mailfields; $config['availablefieldsLabel'] = $this->_('Fields'); $this->view->inlineScript()->prependScript("\n CKEditorConfig = " . \Zend_Json::encode($config) . ";\n "); $bridge->addFakeSubmit('preview', array('label' => $this->_('Preview'))); $bridge->addElement($this->mailElements->createEmailElement('to', $this->_('To (test)'), false)); $bridge->addElement($this->mailElements->createEmailElement('from', $this->_('From'), false)); //$bridge->addRadio('send_language', array('label' => $this->_('Test language'), 'multiOptions' => )) $bridge->addHidden('send_language'); $bridge->addFakeSubmit('sendtest', array('label' => $this->_('Send (test)'))); $bridge->addElement($this->getSaveButton($bridge->getForm())); $bridge->addElement($this->mailElements->createPreviewHtmlElement('Preview HTML')); $bridge->addElement($this->mailElements->createPreviewTextElement('Preview Text')); $bridge->addHtml('available_fields', array('label' => $this->_('Available fields'))); }
/** * Método Responsável pelo Envio * @return boolean * @throws Zend_Mail_Exception */ public function envia() { try { //$oConteudoEmail = $this->oViewEmail->setScriptPath ($this->sTemplate); //if (isset($this->oDadosView->oArquivoAnexo)) { // // $this->oEmail->createAttachment ($this->getArquivoAnexo()); //} $sConteudoEmail = $this->oViewEmail->render(APPLICATION_PATH . '/../public/templates/' . $this->getTemplate()); if ($this->getConfiguracaoEmail()->formato == 'html') { $this->oEmail->setBodyHtml($sConteudoEmail); } else { $this->oEmail->setBodyText($sConteudoEmail); } $this->oEmail->setFrom($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem); $this->oEmail->setReplyTo($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem); $this->oEmail->addTo($this->oViewEmail->sEmailDestino, $this->oViewEmail->sNomeDestino); $this->oEmail->setSubject($this->oViewEmail->sAssunto); $this->oEmail->send($this->getMetodoTransporte()); $oRetorno->mensage = self::SUCESSO_ENVIO; $oRetorno->status = true; return $oRetorno; } catch (Zend_Mail_Exception $oErro) { throw new Zend_Mail_Exception($oErro); } }
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; }
public function registerAction() { $request = $this->getRequest(); $form = new Form_User_Registration(); if ($request->isPost()) { if ($form->isValid($request->getPost())) { $model = new Model_User($form->getValues()); $user_id = $model->save(); $model->setId($user_id); $globalSession = Zend_Registry::get('dlo.session'); $globalSession->user = $model; //Zend_Loader::loadClass('Zend_View'); $view = new Zend_View(); $view->activationLink = "http://DrivingLessonOnline.com/user/verify-email/id/" . $model->getId() . "/guid/" . hash('sha1', $model->getSalt() . $model->getId() . $model->getPassword()) . "/"; $view->setBasePath(APPLICATION_PATH . "/views/"); $mailBodyHtml = $view->render('Templates/Account-Activation-Email.phtml'); //send email verification email before user can start using their account. $mail = new Zend_Mail(); $mail->setBodyHtml($mailBodyHtml); $mail->setFrom('*****@*****.**', 'Registration'); $mail->addTo($model->getEmail(), $model->getDisplayName()); $mail->setSubject($model->getDisplayName() . ' activiate your account for Driving Lesson Online.com'); $mail->send(); //thank user and inform to check their email to enable their account. $this->_redirect('/user/registered'); } } $this->view->form = $form; }
protected function _initView() { //INICIAR PLUGIN PARA CADA MODULE TER SEU LAYOUT $view = new Zend_View(); $view->setEncoding('UTF-8'); Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/modules/default/layouts/scripts', 'layout' => 'default', 'pluginClass' => 'App_Plugins_SetLayout')); }
public function postDispatch() { $response = $this->getResponse(); $view = new Zend_View(); $view->setBasePath(APPLICATION_PATH . '/views'); $response->append('footer', $view->render('footer.phtml')); }
/** * Sets and compiles E-mail templates for both plain and html */ public function setTemplate($template) { $tempPath = $this->_config->email->templatesPath; $this->_template = $template; $myView = new Zend_View(); $myView->setScriptPath($tempPath); $hasContent = false; // compile html template if available $fileName = 'html.' . $template; $filePath = $tempPath . '/' . $fileName; if (is_file($filePath)) { $this->_logger->info('Custom_Email::setTemplate(): Rendering HTML "' . $template . '" template.'); $viewHtml = clone $myView; $this->_body_html = $this->applyTokens($viewHtml, $fileName); $hasContent = true; } // compile plain text template if available $fileName = 'plain.' . $template; $filePath = $tempPath . '/' . $fileName; if (is_file($filePath)) { $this->_logger->info('Custom_Email::setTemplate(): Rendering plain text "' . $template . '" template.'); $viewPlain = clone $myView; $this->_body_plain = $this->applyTokens($viewPlain, $fileName); $hasContent = true; } if (!$hasContent) { $this->_logger->err('Custom_Email::setTemplate(' . $template . '): Unable to find e-mail template.'); } }
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; }
protected function _initView() { $this->bootstrap(array('request')); // Initialize view $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->doctype('XHTML1_STRICT'); $view->headTitle()->setSeparator(' » '); // Save the base URL $view->baseUrl = $this->getResource('request')->getBaseUrl(); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); // Add some stylesheet $view->headLink()->appendStylesheet($view->baseUrl . '/css/default.css'); // Set user info /* $session = $this->getResource('session'); $view->userLoggedIn = $session->logged_in; $view->userInfo = $session->user; */ $view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'SimpleCal_View_Helper_'); Zend_Dojo::enableView($view); // Return it, so that it can be stored by the bootstrap return $view; }
public function render($datas) { $this->_scriptName = $datas->scriptName; # html mail // needed: email, passwd, scriptname $file = APPLICATION_PATH . '/configs/langs/' . $datas->lang . '/emails.ini'; $texts = new Zend_Config_Ini($file, $this->_scriptName); $view = new Zend_View(); $view->setScriptPath($this->_config->mail->scriptsPath); $view->setHelperPath($this->_config->mail->helpersPath); // switch sur la lang pour header switch ($datas->lang) { case 'befl': case 'befr': case 'nl': $view->top = 'top_challenge.jpg'; break; default: $view->top = 'top.jpg'; break; } $view->texts = $texts; $view->assign((array) $datas->view); $view->webhost = $this->_config->site->webhost; $view->tplname = $this->_scriptName; // on gere le setFrom ici car localisé $this->setFrom($this->_config->mail->addressFrom, $texts->labelFrom); $this->_document = $view->render($this->_scriptName . '.phtml'); $this->setSubject(utf8_decode($texts->subject)); $this->setBodyHtml($this->_document, 'utf-8'); $this->addTo($datas->view->email); $this->send(); }
public function sendEmail($template, $to, $subject, $params = array()) { try { $config = array('auth' => 'Login', 'port' => $this->_bootstrap_options['mail']['port'], 'ssl' => 'ssl', 'username' => $this->_bootstrap_options['mail']['username'], 'password' => $this->_bootstrap_options['mail']['password']); $tr = new Zend_Mail_Transport_Smtp($this->_bootstrap_options['mail']['server'], $config); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail('UTF-8'); $layout = new Zend_Layout(); $layout->setLayoutPath($this->_bootstrap_options['mail']['layout']); $layout->setLayout('email'); $view = $layout->getView(); $view->domain_url = $this->_bootstrap_options['site']['domainurl']; $view = new Zend_View(); $view->params = $params; $view->setScriptPath($this->_bootstrap_options['mail']['view_script']); $layout->content = $view->render($template . '.phtml'); $content = $layout->render(); $mail->setBodyText(preg_replace('/<[^>]+>/', '', $content)); $mail->setBodyHtml($content); $mail->setFrom($this->_bootstrap_options['mail']['from'], $this->_bootstrap_options['mail']['from_name']); $mail->addTo($to); $mail->setSubject($subject); $mail->send(); } catch (Exception $e) { // 这里要完善 } return true; }
/** * Test Function for exceptionAction * * @return void */ public function exceptionAction() { echo "In exception action\n"; $view = new Zend_View(); $view->addBasePath(dirname(dirname(__FILE__)) . '/views'); $view->render('ob.phtml'); }
public function format($event) { foreach ($this->_filterValues as $configName) { $configValue = $this->_getConfigValue($this->_applicationConfiguration, $configName); if (is_null($configValue)) { continue; } if (is_array($configValue)) { foreach ($configValue as $configValueElement) { $event['message'] = str_replace($configValueElement, self::REPLACE_WITH, $event['message']); if (array_key_exists('details', $event)) { $event['details'] = str_replace($configValueElement, self::REPLACE_WITH, $event['details']); } } } else { $event['message'] = str_replace($configValue, self::REPLACE_WITH, $event['message']); if (array_key_exists('details', $event)) { $event['details'] = str_replace($configValue, self::REPLACE_WITH, $event['details']); } } } $view = new Zend_View(); foreach ($event as $key => $val) { $view->__set($key, $val); } return $view; }
public function getView() { $view = new Zend_View(); $view->addHelperPath(dirname(__FILE__) . '/../../../../library/Zend/View/Helper'); $view->addScriptPath(dirname(__FILE__) . '/../_files/views/'); return $view; }
public function getView() { require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath('ZendX/MooTools/View/Helper/', 'ZendX_MooTools_View_Helper'); return $view; }
public function getView() { require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(dirname(__FILE__) . '/../../../../library/Zend/View/Helper'); return $view; }
/** * Bootstrapping view * * @return Zend_View */ protected function _initView() { // initialize view $view = new Zend_View(); $view->doctype("XHTML1_STRICT"); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); // translate $view->translate = $translate = Zend_Registry::get("translate"); $viewRenderer->setView($view); // college default info parameters $config = $this->getOption('app'); $config['environment'] = APPLICATION_ENV; $view->app = $config; $view->headTitle($config['header']); // Helpers $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper"); $view->jQuery()->enable(); $view->addHelperPath(APPLICATION_PATH . "/views/helpers/", "My_View_Helper"); // Navigation $navigation = Zend_Registry::get('navigation'); $view->navigation($navigation)->setTranslator($translate); // Return it, so that it can be stored by the bootstrap return $view; }
public function getView() { $view = new Zend_View(); $libPath = dirname(__FILE__) . '/../../../library'; $view->addHelperPath($libPath . '/Zend/View/Helper'); return $view; }
private function dequy_menu_doc($id) { $vie = new Zend_View(); $base = $vie->baseurl(); $cnDB1 = Zend_Registry::get('connectDB'); $tv = "select * from add_page where cat_page_id='{$id}' and active=1 order by position ASC"; $stml1 = $cnDB1->prepare($tv); $stml1->execute(); while ($result1 = $stml1->fetch(PDO::FETCH_ASSOC)) { $id = $result1['id']; $ten = $result1['title']; $url = khongdau($ten); $link_menu = "{$base}/pages/{$url}-{$id}.html"; echo "<li>"; echo "<a href=\"{$link_menu}\">"; echo $result1['title']; echo "</a>"; $xacdinh_menu_con_doc = $this->xacdinh_menu_con_doc($id); if ($xacdinh_menu_con_doc == "co") { echo "<ul>"; $this->dequy_menu_doc($id); echo "</ul>"; } else { } echo "</li>"; } }
public function getView() { require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); return $view; }
public function Show($parameters) { $output = ""; $ns = new Zend_Session_Namespace(); $languageID = Languages::get_language_id($ns->lang); $mainviewhelper = new Zend_View(); $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/'); $view = new Zend_View(); $view->addScriptPath('../library/Shineisp/Custom/views'); $translator = Shineisp_Registry::getInstance()->Zend_Translate; if (!empty($parameters['code'])) { $code = $parameters['code']; } else { return ""; } // Get the products $data = Products::GetProductsByGroupCode($code, $languageID); // Check the existence of the mandatories attributes if (!empty($data['attributes'][0])) { $view->attributes = $data['attributes']; } // Check if there are values set for the group of the product selected if (!empty($data['attributes_values'][0])) { $view->values = $data['attributes_values']; } // Get the products if (!empty($data['products'][0])) { $view->products = $data['products']; } $view->mainviewhelper = $mainviewhelper; // Path of the template return $view->render('productsattributes.phtml'); }