Пример #1
0
 /**
  * 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);
     }
 }
Пример #2
0
 /**
  * Send email notification to moderators when a new comment is posted
  * 
  * @todo move logic to model / library class
  * 
  * @param HumanHelp_Model_Comment $comment
  * @param HumanHelp_Model_Page $page
  */
 public function _sendNewCommentEmail(HumanHelp_Model_Comment $comment, HumanHelp_Model_Page $page)
 {
     $config = Zend_Registry::get('config');
     $emailTemplate = new Zend_View();
     $emailTemplate->setScriptPath(APPLICATION_PATH . '/views/emails');
     $emailTemplate->addHelperPath(APPLICATION_PATH . '/views/helpers', 'HumanHelp_View_Helper_');
     $emailTemplate->setEncoding('UTF-8');
     $emailTemplate->comment = $comment;
     $emailTemplate->page = $page;
     $emailTemplate->baseUrl = 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl;
     $bodyHtml = $emailTemplate->render('newComment.phtml');
     $bodyText = $emailTemplate->render('newComment.ptxt');
     $mail = new Zend_Mail();
     $mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE)->setBodyHtml($bodyHtml, 'UTF-8')->setBodyText($bodyText, 'UTF-8')->setSubject("New comment on '{$page->getTitle()}' in '{$page->getBook()->getTitle()}'")->setFrom($config->fromAddress, $config->fromName);
     if (is_object($config->notifyComments)) {
         foreach ($config->notifyComments->toArray() as $rcpt) {
             $mail->addTo($rcpt);
         }
     } else {
         $mail->addTo($config->notifyComments);
     }
     if ($config->smtpServer) {
         $transport = new Zend_Mail_Transport_Smtp($config->smtpServer, $config->smtpOptions->toArray());
     } else {
         $transport = new Zend_Mail_Transport_Sendmail();
     }
     $mail->send($transport);
 }
Пример #3
0
 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'));
 }
Пример #4
0
 /**
  * Send email
  *
  * @param Zend_Mail $mail
  * @return Zend_Mail
  */
 public function send(Zend_Mail $mail = null)
 {
     if ($mail) {
         $mail = clone $mail;
     } else {
         $mail = new Zend_Mail();
     }
     $this->bodyHtml = $this->_view->render($this->_viewScriptName);
     $mail = $this->populate($mail);
     return $mail->send();
 }
Пример #5
0
 /**
  * load the template and send the message
  *
  * @param string $recipient
  * @param array $from
  * @param string $subject
  * @param string $template
  * @param array $data
  * @param string $cc
  * @return bool
  */
 public function send($recipient, $from = array(), $subject, $message, $cc = false)
 {
     $config = Zend_Registry::get('config');
     $this->_view->addScriptPath($config->filepath->emailTemplates);
     $this->_view->emailBody = $message;
     $this->_mail->setBodyHtml($this->_view->render('template.phtml'));
     $this->_mail->setFrom($from[0], $from[1]);
     $this->_mail->addTo($recipient);
     if ($cc) {
         $this->_mail->addCc($cc);
     }
     $this->_mail->setSubject($subject);
     return $this->_mail->send($this->_transport);
 }
Пример #6
0
 public function dispatch($p_params = null, $p_cols = null, $p_options = null)
 {
     $req = $this->getRequest();
     if (!$this->_hasDataMap) {
         $this->setDataMap();
     }
     $this->_isDispatched = true;
     if ($req->getParam('format') == 'json') {
         $this->dispatchData($p_params, $p_cols);
         return false;
     }
     $this->dispatchMedatata($p_params, $p_options);
     return $this->_outputObject->render($this->viewPath);
 }
Пример #7
0
 /**
  * Set the e-mail's body from a template
  * 
  * @param  string $tempalte
  * @param  array  $params
  * @return Geves_Mail
  */
 public function fromTemplate($template, array $params)
 {
     $view = new Zend_View();
     $view->setScriptPath($this->_templateDir);
     $view->assign($params);
     if ($this->_layout) {
         $this->_layout->content = $view->render($template . '.phtml');
         $html = $this->_layout->render();
     } else {
         $html = $view->render($template . '.phtml');
     }
     $this->setBodyHtml($html);
     $this->setBodyText(strip_tags($html));
     return $this;
 }
 /**
  * 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 indexAction()
 {
     $form = new Application_Form_FaleConoscoForm();
     $this->view->form = $form;
     $params = $this->_request->getParams();
     if ($this->_request->isPost() && $form->isValid($params)) {
         try {
             $vista = Services::get('vista_rest');
             $vista->getAuthEmail();
             $smtpData = $vista->getResult();
             $config = array('auth' => 'login', 'username' => $smtpData['user'], 'password' => $smtpData['pass'], 'port' => $smtpData['port']);
             $transport = new Zend_Mail_Transport_Smtp($smtpData['smtp'], $config);
             Zend_Mail::setDefaultTransport($transport);
             $html = new Zend_View();
             $html->setScriptPath(APPLICATION_PATH . '/views/scripts/fale-conosco/');
             $html->data = $params;
             $emailBody = $html->render('email-body.phtml');
             $mail = new Zend_Mail();
             $mail->setBodyHtml($emailBody);
             $mail->setFrom('*****@*****.**', $params['nome']);
             $mail->addTo('*****@*****.**', 'Esselence');
             $mail->setSubject("Contato pelo Site {$params['nome']}");
             $mail->send();
             $this->view->success = true;
         } catch (Exception $e) {
             print_r($e->getMessage());
             exit;
         }
     }
 }
Пример #10
0
Файл: Email.php Проект: ud223/yj
 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;
 }
Пример #11
0
 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 postDispatch()
 {
     $response = $this->getResponse();
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/views');
     $response->append('footer', $view->render('footer.phtml'));
 }
Пример #13
0
 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;
 }
 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();
     }
 }
Пример #15
0
 /**
  *  dispatchLoop shutdown plugin
  *  get action view and wrap it with site template view
  * 	@author	Xinghao Yu <*****@*****.**>
  */
 public function dispatchLoopShutdown()
 {
     //logfire('postdispatch','happened');
     //chech whether using site template
     if ($this->_renderLayout > 0) {
         //logfire('isbackend', $this->_renderLayout);
         //get frontcontroller, request and response objects
         $frontController = Zend_Controller_Front::getInstance();
         $request = $frontController->getRequest();
         // If it is error page, we do not want wrap it with extra header and footer.
         if (!strcasecmp($request->getControllerName(), 'Error')) {
             return;
         }
         $response = $frontController->getResponse();
         //get action view and stored it in actionTempate var
         $body = $response->getBody();
         //logfire('body',$body);
         $this->_view->actionTemplate = $body;
         //get template script
         $layoutScript = $this->getTemplateScript();
         //logfire('script ', $layoutScript);
         //$this->_view->actionTemplate = '/'.$request->getControllerName().'/'.$request->getActionName().'.phtml';
         $content = $this->_view->render($layoutScript);
         $response->setBody($content);
     }
 }
Пример #16
0
 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');
 }
Пример #17
0
 /**
  * Send an email
  * @param String $emailTo
  * @param String $emailFrom
  * @param String $emailSubject
  * @param String $emailData
  * @param String $tpl
  * @return Zend_Session_Namespace
  * @author Reda Menhouch, reda@fornetmaroc.com
  */
 public function sendMail($toMail, $toName, $mailSubject, $emailData, $tpl, $fromMail = false, $fromName = false, $sujetMail = "", $h1Mail = "")
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
     $mailConfig = array('auth' => $config->mail->transport->auth, 'username' => $config->mail->transport->username, 'password' => $config->mail->transport->password, 'ssl' => $config->mail->transport->ssl, 'port' => $config->mail->transport->port);
     //var_dump($mailConfig); die;
     $transport = new Zend_Mail_Transport_Smtp($config->mail->transport->host, $mailConfig);
     $html = new Zend_View();
     $html->setScriptPath(APPLICATION_PATH . '/modules/frontend/views/emails/');
     foreach ($emailData as $key => $value) {
         $html->assign($key, $value);
     }
     $html->assign('sujetMail', $sujetMail);
     $html->assign('h1Mail', $h1Mail);
     $mailSubjectTail = "";
     //$mailSubjectTail=" - [" . $toMail . "]";
     $html->assign('site', $config->site->url);
     $bodyText = $html->render($tpl . '.phtml');
     $fromMail = $fromMail === false ? $config->mail->defaultFrom->email : $fromMail;
     $fromName = $fromName === false ? $config->mail->defaultFrom->name : $fromName;
     $mail = new Zend_Mail('utf-8');
     $mail->setBodyHtml($bodyText, 'utf-8');
     $mail->setFrom($fromMail, $fromName);
     $mail->addTo($toMail, $toName);
     $mail->setSubject($config->mail->defaultSubject->prefix . $mailSubject . $mailSubjectTail);
     $mail->send($transport);
 }
Пример #18
0
 /**
  * Generate the PDF file using the given template
  *
  * All required style files, includes, etc are either provided in the
  * template as absolute paths or as relative paths to the template file.
  *
  * @param string $pTemplate
  * @param $pViewVariables default null
  * @param &$pPdfFileName this will contain the full path to the PDF 
  * @throws OSS_Pdf_PdfLatex_Exception
  * @return string a binary string, the content of the PDF file
  */
 public function generatePdf($pTemplate, $pViewVariables = null, &$pPdfFileName)
 {
     $this->_changeDelimiters();
     foreach ($pViewVariables as $var => $val) {
         $this->_view->{$var} = $val;
     }
     // try and create a temporary file for the generated LaTeX
     // tempnam() doesn't like '..' in the filename
     $filename = "{$this->_options['executables']['pdflatex']['output_directory']}/auto-gen-" . mt_rand();
     $pPdfFileName = "{$filename}.pdf";
     if (@touch($filename) === false) {
         throw new OSS_Pdf_PdfLatex_Exception('Could not create temporary file for the PDF document. Check permissions.');
     }
     @file_put_contents($filename, $this->_view->render("../../data/pdflatex/templates/{$pTemplate}.tpl"));
     // generate the PDF
     $cmd = 'cd ' . escapeshellarg($this->_options['executables']['pdflatex']['output_directory']) . ' && ' . escapeshellcmd($this->_options['executables']['pdflatex']['cmd']) . ' -output-directory ' . escapeshellarg($this->_options['executables']['pdflatex']['output_directory']) . ' ' . escapeshellarg($filename);
     $lastline = exec($cmd, $output, $retval);
     $lastline = exec($cmd, $output, $retval);
     if ($retval != 0) {
         throw new OSS_Pdf_PdfLatex_Exception('Could not compile LaTeX file ' . $filename);
     }
     $pdf = @file_get_contents($filename . '.pdf');
     @unlink($filename);
     @unlink($filename . '.aux');
     @unlink($filename . '.log');
     //@unlink( $filename . '.pdf' ); // the file might be needed later
     $this->_resetDelimiters();
     return $pdf;
 }
Пример #19
0
 public function recoveryPasswordCliente($email)
 {
     try {
         if ($this->_modelCliente->verificarEmail($email) == true) {
             try {
                 $where = $this->_modelCliente->getAdapter()->quoteInto('email = ?', $email);
                 $user = $this->_modelCliente->fetchAll($where);
                 $html = new Zend_View();
                 $html->setScriptPath(APPLICATION_PATH . '/assets/templates/');
                 // enviando variaveis para a view
                 $html->assign('nome', $user[0]['nome']);
                 $html->assign('email', $user[0]['email']);
                 $html->assign('senha', $user[0]['pass']);
                 // criando objeto email
                 $mail = new Zend_Mail('utf-8');
                 // render view
                 $bodyText = $html->render('esqueciasenha.phtml');
                 // configurar envio
                 $mail->addTo($user[0]['email']);
                 $mail->setSubject('Esqueci a senha ');
                 $mail->setFrom('*****@*****.**', 'Instag');
                 $mail->setBodyHtml($bodyText);
                 $mail->send();
                 return true;
             } catch (Exception $e) {
                 throw $e;
             }
         } else {
             return false;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #20
0
 public function contatoAction()
 {
     if ($this->_request->isPost()) {
         $html = new Zend_View();
         $html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
         $title = 'Contato | Instag';
         $to = '*****@*****.**';
         $cc = '*****@*****.**';
         $html->assign('title', $title);
         $html->assign('nome', $this->_request->getPost('nome'));
         $html->assign('email', $this->_request->getPost('email'));
         $html->assign('assunto', $this->_request->getPost('assunto'));
         $html->assign('mensagem', $this->_request->getPost('mensagem'));
         $mail = new Zend_Mail('utf-8');
         $bodyText = $html->render('contato.phtml');
         $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => '*****@*****.**', 'password' => 'Inndeia123');
         $transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
         $mail->addTo($to);
         $mail->addCc($cc);
         $mail->setSubject($title);
         $mail->setFrom($this->_request->getPost('email'), $this->_request->getPost('name'));
         $mail->setBodyHtml($bodyText);
         $send = $mail->send($transport);
         if ($send) {
             $this->_helper->flashMessenger->addMessage('Sua mensagem foi enviada com sucesso, em breve entraremos em contato.');
         } else {
             $this->_helper->flashMessenger->addMessage('Falha no envio, tente novamente!');
         }
         $this->_redirect('/index');
     }
 }
Пример #21
0
 public function render($name)
 {
     if (is_array($name)) {
         $name = $this->_selectScript($name);
     }
     // loss of performance : $this->_selectScript uses _script and render uses it too.
     return parent::render($name);
 }
Пример #22
0
 public static function getWidgetMakerContent()
 {
     $translator = Zend_Registry::get('Zend_Translate');
     $view = new Zend_View(array('scriptPath' => dirname(__FILE__) . '/views'));
     $websiteHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('website');
     $data = array('title' => $translator->translate('Rss feed'), 'content' => $view->render('wmcontent.phtml'), 'icons' => array($websiteHelper->getUrl() . 'system/images/widgets/rss.png'));
     unset($view);
     return $data;
 }
Пример #23
0
 /**
  * Format a recordset
  * @param Garp_Model $model
  * @param Array $rowset
  * @return String
  */
 public function format(Garp_Model $model, array $rowset)
 {
     $view = new Zend_View();
     $view->setScriptPath(GARP_APPLICATION_PATH . '/modules/g/views/scripts/content/export/');
     $view->data = $rowset;
     $view->name = $model->getName();
     $out = $view->render('html.phtml');
     return $out;
 }
Пример #24
0
 public function postDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($request->getControllerName() != "api") {
         $response = $this->getResponse();
         $view = new Zend_View();
         $view->setBasePath(Zend_Controller_Front::getInstance()->getParam('config')->BasePath . '/application/views');
         $response->append('footer', $view->render('footer.phtml'));
     }
 }
Пример #25
0
 protected function render($mailName)
 {
     $view = new Zend_View();
     if (!$this->scriptPath) {
         $this->scriptPath = ROOT_PATH . "/templates/mail";
     }
     $view->setBasePath($this->scriptPath);
     $view->assign($this->assigns);
     return $view->render($mailName . ".phtml");
 }
Пример #26
0
 private function _generateContent($oResult, $sLayout)
 {
     $oView = new Zend_View();
     $sLayout = $sLayout;
     $oView->oData = $oResult;
     $sFile = basename($sLayout);
     $sPath = dirname($sLayout);
     $oView->setScriptPath($sPath);
     return $oView->render($sFile);
 }
Пример #27
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     // Generate the xml file in the public path /documents
     Reviews::getXMLDataMap($languageID);
     return $view->render('reviewsmap.phtml');
 }
Пример #28
0
 /**
  * Metoda wołana przez mechanizmy Zend'a.
  * Od razu tworzy widok na podstawie podanego layoutu - pliku phtml i łączy z danymi.
  * @param Common_Db_Adapter_ListResult $oResult - dane wejściowe
  * @param string $sLayout - oprogramowany plik phtml
  */
 public function direct(Common_Db_Adapter_ListResult $oResult, $sLayout)
 {
     $oView = new Zend_View();
     $sLayout = $sLayout;
     $oView->oData = $oResult;
     $sFile = basename($sLayout);
     $sPath = dirname($sLayout);
     $oView->setScriptPath($sPath);
     echo $oView->render($sFile);
 }
Пример #29
0
 public static function getTemplate($name, $vars = array())
 {
     $html = new Zend_View();
     $html->setScriptPath(APPLICATION_PATH . '/views/emaillayouts/');
     if (!empty($vars)) {
         foreach ($vars as $key => $value) {
             $html->assign($key, $value);
         }
     }
     return $html->render($name);
 }
Пример #30
0
 public function render($content)
 {
     if ($this->_enableLayout) {
         $this->initViewResource();
         $this->_content = $content;
         if ($this->_moveJavascriptToBottom) {
             $pattern = '/<script[^\\~]*[\\~]?[\\r]?[ \\t\\r\\n]*<\\/script>/s';
             preg_match_all($pattern, $this->_content, $result);
             $result = $result[0];
             $this->_content = preg_replace($pattern, '', $this->_content);
             foreach ($result as $value) {
                 $this->_contentScript .= $value . PHP_EOL;
             }
         }
         $this->_view->layoutManager = $this;
         return $this->_view->render("_layouts/{$this->_layoutFileName}");
     } else {
         return $content;
     }
 }