Esempio n. 1
0
 /**
  * Возвращает данные виджета, для передачи в шаблон
  *
  * @return array
  */
 public function getData()
 {
     // Инициализируем объект Zend_View (используем чистый Zend_View)
     $this->_view = new Zend_View();
     $this->_view->setBasePath(APPLICATION_PATH . '/templates/' . $this->_params['module']);
     // Создаем из дерева разделов объект меню
     $this->_categories = new Zend_Navigation($this->getCategoriesTree());
     // Вычленяем часть дерева, если опциями заданы начальные вершины + определяем активную ветку
     $this->_categories = $this->cropCategoriesTree()->setActiveBranch();
     $CategoriesMenu = $this->_categories;
     switch ($this->_options["type"]) {
         case "breadcrumbs":
             $menu = $this->getBreadcrumbs();
             break;
         case "childs":
             $menu = $this->getChilds();
             break;
         case "ajar":
             $menu = $this->getAjar();
             break;
         case "branch":
             $menu = $this->getBranch();
             break;
         case "brothers":
             $menu = $this->getBrothers();
             break;
         case "parent":
             $menu = $this->getParents();
             break;
         default:
             $menu = $this->getFull();
             break;
     }
     // Пытаемся отрендерить меню с итераторами
     $out = array();
     try {
         if (isset($this->_options['partial'])) {
             $menu->setPartial(array($this->_options['partial'] . '.partial.php', $this->_params['module']));
         }
         $out['menu'] = $menu->render();
     } catch (Exception $e) {
         $menu->setPartial(null);
         $out['menu'] = $menu->render();
     }
     // Получаем заголовки для меню
     if ($CategoriesMenu->key()) {
         $out['title'] = $CategoriesMenu->current()->getLabel();
         $out['name'] = $CategoriesMenu->current()->get('name');
     }
     return $out;
 }
Esempio n. 2
0
 /**
  * @param array $data
  */
 public function __construct(array $data = array())
 {
     $this->_view = new Zend_View();
     if (isset($data['name'])) {
         $this->_viewScriptName = $data['name'];
     } else {
         throw new InvalidArgumentException('Script name not setted!');
     }
     if (isset($data['basePath'])) {
         $this->_view->setBasePath($data['basePath']);
     }
     if (isset($data['scriptPath'])) {
         $this->_view->setScriptPath($data['scriptPath']);
     }
     parent::__construct($data);
 }
 public function postDispatch()
 {
     $response = $this->getResponse();
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/views');
     $response->append('footer', $view->render('footer.phtml'));
 }
Esempio n. 4
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;
 }
Esempio n. 5
0
 protected function _initView()
 {
     $theme = 'default';
     $templatePath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates';
     Zend_Registry::set('user_date_format', 'm-d-Y');
     Zend_Registry::set('calendar_date_format', 'mm-dd-yy');
     Zend_Registry::set('db_date_format', 'Y-m-d');
     Zend_Registry::set('perpage', 10);
     Zend_Registry::set('menu', 'home');
     Zend_Registry::set('eventid', '');
     $dir_name = $_SERVER['DOCUMENT_ROOT'] . rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/');
     Zend_Registry::set('acess_file_path', $dir_name . SEPARATOR . "application" . SEPARATOR . "modules" . SEPARATOR . "default" . SEPARATOR . "plugins" . SEPARATOR . "AccessControl.php");
     Zend_Registry::set('siteconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "site_constants.php");
     Zend_Registry::set('emailconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "email_constants.php");
     Zend_Registry::set('emptab_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "emptabconfigure.php");
     Zend_Registry::set('emailconfig_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "mail_settings_constants.php");
     Zend_Registry::set('application_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "application_constants.php");
     $date = new Zend_Date();
     Zend_Registry::set('currentdate', $date->get('yyyy-MM-dd HH:mm:ss'));
     Zend_Registry::set('currenttime', $date->get('HH:mm:ss'));
     Zend_Registry::set('logo_url', '/public/images/landing_header.jpg');
     $view = new Zend_View();
     $view->setEscape('stripslashes');
     $view->setBasePath($templatePath);
     $view->setScriptPath(APPLICATION_PATH);
     $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
     $viewRenderer->setView($view);
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     return $this;
 }
Esempio n. 6
0
 /**
  * Get the view
  *
  * @return Zend_View
  */
 public function getView()
 {
     if (null === $this->_view) {
         $this->_view = new Zend_View(array('strictVars' => true));
         $this->_view->setBasePath($this->_getViewBasePath(), $this->_getViewBasePrefix());
         $this->_view->renderer = $this;
     }
     return $this->_view;
 }
Esempio n. 7
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'));
     }
 }
 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");
 }
 /**
  *
  * send email with a template
  *
  * @param string $type
  * @param array $params
  * @param string $toName
  * @param array $toEmails
  */
 public function sendWithTemplate($type, $params, $toName, $toEmails)
 {
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/modules/public/views/');
     foreach ($params as $key => $value) {
         $view->{$key} = $value;
     }
     if ($type == 'FORGOT_ADD_EXERCISE') {
         $htmlMessage = $view->render('emails/forgotAddExercise.phtml');
     }
     $emailOptions = array('type' => 'html', 'email' => $htmlMessage);
     $this->send($params['subject'], $toName, $toEmails, $emailOptions);
 }
 /**
  * Constructor requiring Zend_Form instance to be rendered
  * @param Zend_Form $form
  */
 public function __construct(Zend_Form $form, $form_id = null)
 {
     // create view and specify doctype to have self-closing tags.
     $view = new Zend_View();
     $view->setBasePath(dirname(__FILE__));
     $view->doctype('XHTML1_TRANSITIONAL');
     $this->form = $form;
     $this->form->setView(new Zend_View());
     $this->form->setAttrib('class', 'form_dynamic');
     if (!is_null($form_id)) {
         $this->form->setAttrib('id', $form_id);
     }
 }
 /**
  * 
  */
 public function Topbox($bezeichner)
 {
     $_Model = new Application_Model_Empfehlungen();
     $box = $_Model->getByBezeichner($bezeichner);
     if ($box) {
         $view = new Zend_View();
         $view->setBasePath(APPLICATION_PATH . '/views/');
         $view->assign('box', $box);
         $output = $view->render('_partials/topbox.phtml');
         return $output;
     } else {
         return '';
     }
 }
Esempio n. 12
0
 public function __invoke($message)
 {
     $layout = new Zend_Layout();
     // Установка пути к скриптам макета:
     $layout->setLayoutPath(APPLICATION_PATH . '/views/scripts/layouts');
     $layout->setLayout('inner');
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/views/');
     $view->error_message = $message;
     // установка переменных:
     $layout->content = $view->render('/exeption/user.phtml');
     echo $layout->render();
     //echo $message;
     die;
 }
Esempio n. 13
0
 protected function _initViewResource()
 {
     $config = $this->getOption('site');
     // utf-8 support
     if (function_exists('iconv')) {
         iconv_set_encoding('internal_encoding', 'UTF-8');
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('output_encoding', 'UTF-8');
     }
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding('UTF-8');
     }
     // init view
     $view = new Zend_View(array('encoding' => 'UTF-8'));
     $view->setBasePath($config['path'] . '/views')->addHelperPath(APPLICATION_PATH . '/views/helpers', 'View_Helper');
     // helpers
     $view->doctype('XHTML1_STRICT');
     $view->headTitle('kp parser')->setSeparator(' >> ');
     // init view renderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     Zend_Registry::set('Portal_View', $view);
     return $view;
 }
Esempio n. 14
0
File: init.php Progetto: jo91/kimai
 * Kimai - Open Source Time Tracking // http://www.kimai.org
 * (c) 2006-2009 Kimai-Development-Team
 *
 * Kimai is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; Version 3, 29 June 2007
 *
 * Kimai is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimai; If not, see <http://www.gnu.org/licenses/>.
 */
// Include Basics
include '../../includes/basics.php';
$dir_templates = "templates/";
$datasrc = "config.ini";
$settings = parse_ini_file($datasrc);
$dir_ext = $settings['EXTENSION_DIR'];
$user = checkUser();
// =========================================
// = Get the currently displayed timeframe =
// =========================================
$timeframe = get_timeframe();
$in = $timeframe[0];
$out = $timeframe[1];
$view = new Zend_View();
$view->setBasePath(WEBROOT . 'extensions/' . $dir_ext . '/' . $dir_templates);
echo $view->render('index.php');
Esempio n. 15
0
 /**
  * @override
  */
 public function setBasePath($path, $prefix = 'Zend_View')
 {
     $this->_zendView->setBasePath($path, $prefix);
     return parent::setBasePath($path);
 }
Esempio n. 16
0
 public function testSetBasePathWithClassPrefix()
 {
     $view = new Zend_View();
     $base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'View';
     $view->setBasePath($base, 'My_Foo');
     $this->_testBasePath($view, $base, 'My_Foo');
 }
Esempio n. 17
0
    $_REQUEST['a'] = '';
}
if (!isset($_REQUEST['name']) || is_array($_REQUEST['name'])) {
    $name = '';
} else {
    $name = $_REQUEST['name'];
}
if (!isset($_REQUEST['key']) || is_array($_REQUEST['key'])) {
    $key = 'nokey';
    // will never match since hash values are either NULL or 32 characters
} else {
    $key = $_REQUEST['key'];
}
require 'includes/basics.php';
$view = new Zend_View();
$view->setBasePath(WEBROOT . '/templates');
$authPlugin = Kimai_Registry::getAuthenticator();
$view->assign('kga', $kga);
// current database setup correct?
checkDBversion(".");
// processing login and displaying either login screen or errors
$name = htmlspecialchars(trim($name));
$is_customer = $database->is_customer_name($name);
if ($is_customer) {
    $id = $database->customer_nameToID($name);
    $customer = $database->customer_get_data($id);
    $keyCorrect = $key === $customer['passwordResetHash'];
} else {
    $id = $database->user_name2id($name);
    $user = $database->user_get_data($id);
    $keyCorrect = $key === $user['passwordResetHash'];
Esempio n. 18
0
 public function render($template, $data = array())
 {
     $root = Zend_Registry::get('root');
     // Prepare the view
     $view = new Zend_View();
     $view->setEncoding('UTF-8');
     $view->addHelperPath("{$root}/library/Stuffpress/View/Helper", 'Stuffpress_View_Helper');
     $view->setBasePath("{$root}/application/plugins/{$this->_prefix}/views");
     // Add the data
     foreach ($data as $k => $v) {
         $view->{$k} = $v;
     }
     return $view->render("{$template}.phtml");
 }
Esempio n. 19
0
 /**
  * Exports in rtf format. Wrtites the result to the stream.
  *
  * @param long $streamHandle
  */
 protected function _exportRtf($streamHandle)
 {
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/editor/views/');
     $template = 'export/rtf.phtml';
     // Writes the header of the rtf.
     $view->assign('renderHeader', true)->assign('renderBody', false)->assign('renderFooter', false);
     fwrite($streamHandle, $view->render($template));
     // Writes the concepts data. The body of the rtf.
     // Gets fields which will be exported.
     $fieldsToExport = $this->get('fieldsToExport');
     if (empty($fieldsToExport)) {
         $fieldsToExport = self::getExportableConceptFields();
     }
     $step = self::CONCEPTS_EXPORT_STEP;
     $start = 0;
     $hasMore = false;
     do {
         $concepts = $this->_getConcepts($start, $step, $hasMore);
         if (!empty($concepts)) {
             $conceptsData = array();
             foreach ($concepts as $concept) {
                 $conceptsData[] = $this->_prepareConceptDataForRtf($concept, $fieldsToExport);
             }
             $view->data = $conceptsData;
             $view->assign('renderHeader', false)->assign('renderBody', true)->assign('renderFooter', false);
             fwrite($streamHandle, $view->render($template));
         }
         $start += $step;
     } while ($hasMore);
     // Writes the footer of the rtf.
     $view->assign('renderHeader', false)->assign('renderBody', false)->assign('renderFooter', true);
     fwrite($streamHandle, $view->render($template));
 }
Esempio n. 20
0
 public function testSetBasePath()
 {
     $view = new Zend_View();
     $base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'View';
     $view->setBasePath($base);
     $this->_testBasePath($view, $base);
 }
Esempio n. 21
0
 private static function setupView()
 {
     $view = new Zend_View();
     $view->setEncoding('ISO-8859-1');
     $view->setEscape('htmlentities');
     $view->setBasePath('./application/views/');
     /** Define o diretório onde estarão as visões */
     $view->addHelperPath('./application/views/helpers', 'View_Helper');
     Zend_Registry::set('view', $view);
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     Zend_Layout::startMvc(array('layoutPath' => './application/layouts'));
 }