PHP Zend_View_Interface Code Examples

This page contains top rated real world PHP examples of Zend_View_Interface extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: Pagination.php Project: humansky/qframe
0
 /**
  * Generates a list of pagination links
  *
  * @param  QFrame_Paginator paginator object
  * @param  string         (optional) action to use for page link
  * @param  string         (optional) variable to use for page number
  * @param  Array          (optional) list of additional parameters to add to each link
  * @return string
  */
 public function pagination($pager, $action = 'page', $pageNum = 'id', $params = array())
 {
     if (count($pager->pageNumbers()) <= 1) {
         return '';
     }
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $b = new Tag_Builder();
     $content = '';
     // set up an array of arguments that are common to all links
     $linkArgs = array_merge($params, array('controller' => $controller, 'action' => $action));
     // print out links to each page number (unless it is the current page number
     // in which case print out just the number, no link)
     foreach ($pager->pageNumbers() as $page) {
         if ($page == $pager->currentNumber()) {
             $pageContent = "{$page} ";
         } else {
             $linkArgs[$pageNum] = $page;
             $pageContent = $this->_view->linkTo($linkArgs, "{$page}") . ' ';
         }
         $content .= $b->li($pageContent);
     }
     // prepend a previous page link if there is/are previous page(s), otherwise
     // just the equivalent text
     if ($pager->currentNumber() > 1) {
         $linkArgs[$pageNum] = $pager->currentNumber() - 1;
         $content = $b->li($this->_view->linkTo($linkArgs, '< prev'), ' ', $content);
     }
     // append a next page link if there is/are next page(s), otherwise just
     // the equivalent text
     if ($pager->currentNumber() < $pager->lastPageNumber()) {
         $linkArgs[$pageNum] = $pager->currentNumber() + 1;
         $content .= $b->li($this->_view->linkTo($linkArgs, 'next >'), ' ');
     }
     return $b->ol(array('class' => 'pagination'), $content);
 }
Example #2
Show file File: UserValidator.php Project: EricHogue/Koryukan
0
 /**
  * Make sure the user is valid
  *
  * @return void
  */
 public function isValid($value)
 {
     $valid = true;
     $this->_user = $value;
     $namePartsValidator = new Zend_Validate();
     $namePartsValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alpha(array('allowWhiteSpace' => true)))->addValidator(new Zend_Validate_StringLength(array('min' => 2)));
     if (!$namePartsValidator->isValid($this->_user->getFirstName())) {
         $valid = false;
         $this->_error($this->_view->translate('The first name must have at least 2 characters and consist only of letters'));
     }
     if (!$namePartsValidator->isValid($this->_user->getLastName())) {
         $valid = false;
         $this->_error($this->_view->translate('The last name must have at least 2 characters and consist only of letters'));
     }
     $emailValidator = new Zend_Validate_EmailAddress();
     if (!$emailValidator->isValid($this->_user->getEmail())) {
         $valid = false;
         $this->_error($this->_view->translate('You must entre a valid email'));
     }
     if ($this->_user->isNew()) {
         $usernameValidator = new Zend_Validate();
         $usernameValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => false)))->addValidator(new Zend_Validate_StringLength(array('min' => 5)));
         if (!$usernameValidator->isValid($this->_user->getUsername())) {
             $this->_error($this->_view->translate('The username must have at least 5 characters and contains no white spaces'));
         }
     }
     return $valid;
 }
Example #3
Show file File: CheckSkinStyles.php Project: ngukho/ducbui-cms
0
 /**
  *
  */
 public function checkSkinStyles($name, $values)
 {
     $config = Zend_Registry::get('config');
     $basePath = $config->design->pathToSkins;
     $xhtml = array();
     $this->view->name = $name;
     $this->view->selectedStyles = $values;
     //load the skin folders
     if (is_dir('./' . $basePath)) {
         $folders = Digitalus_Filesystem_Dir::getDirectories('./' . $basePath);
         if (count($folders) > 0) {
             foreach ($folders as $folder) {
                 $this->view->skin = $folder;
                 $styles = Digitalus_Filesystem_File::getFilesByType('./' . $basePath . '/' . $folder . '/styles', 'css');
                 if (is_array($styles)) {
                     foreach ($styles as $style) {
                         //add each style sheet to the hash
                         // key = path / value = filename
                         $hashStyles[$style] = $style;
                     }
                     $this->view->styles = $hashStyles;
                     $xhtml[] = $this->view->render($this->partialFile);
                     unset($hashStyles);
                 }
             }
         }
     } else {
         throw new Zend_Acl_Exception('Unable to locate skin folder');
     }
     return implode(null, $xhtml);
 }
Example #4
Show file File: JQuery.php Project: GemsTracker/MUtil
0
 /**
  * jQuery-enable a view instance
  *
  * @param  \Zend_View_Interface $view
  * @return void
  */
 public static function enableView(\Zend_View_Interface $view)
 {
     if (false === $view->getPluginLoader('helper')->getPaths('MUtil_JQuery_View_Helper')) {
         $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
         $view->addHelperPath('MUtil/JQuery/View/Helper', 'MUtil_JQuery_View_Helper');
     }
 }
Example #5
Show file File: ExpireHeader.php Project: vilmarsitio/registrodeprecos
0
 /**
  * Constructor do Helper. Utilizado para setar o quando deve-se adicionar ao timestamp da data atual.
  * @param $dias
  * @param $meses
  * @param $anos
  */
 public function expireHeader($dias = 10, $meses = 0, $anos = 0)
 {
     $this->timestamp = mktime(date('H'), date('i'), date('s'), date('m') + $meses, date('d') + $dias, date('Y') + $anos);
     $this->view->headMeta()->appendName('expires', date('r', $this->timestamp));
     $this->view->headMeta()->appendHttpEquiv('Expires', date('r', $this->timestamp));
     return null;
 }
Example #6
Show file File: IndexController.php Project: jorgenils/zend-framework
0
 public function indexAction()
 {
     // STAGE 3: Choose, create, and optionally update models using business logic.
     $cities = parse_ini_file('cities.ini');
     // $cities contains our simple data model
     // STAGE 4: Apply business logic to create a presentation model for the view.
     ksort($_SERVER);
     $this->_view->SERVER = $_SERVER;
     $this->_view->date = date('Y-m-d H:i:s');
     $this->_view->cities = array();
     $this->_view->distances = array();
     if (isset($_REQUEST['distance'])) {
         $maxDistance = intval($_REQUEST['distance']);
     } else {
         $this->_redirect('/?distance=10000');
     }
     $this->_view->maxDistance = $maxDistance;
     foreach ($cities as $city => $distance) {
         // business logic specifies to filter the data model satisfying distance criteria
         if ($distance < $maxDistance) {
             $this->_view->cities[] = $city;
             $this->_view->distances[] = $distance;
             #echo "Distance from London, UK to $city is $distance km.<br>\n";
         }
     }
     // STAGE 5: Choose view and submit presentation model to view.
     $this->_response->appendBody($this->_view->render('indexIndex.phtml'));
 }
Example #7
Show file File: PartialViewPlugin.php Project: DBezemer/server
0
 /**
  * Assign the plugin to the view
  * 
  * @param Zend_View_Interface $view
  */
 public function plug(Zend_View_Interface $view)
 {
     $view->addBasePath($this->getTemplatePath());
     if (!isset($view->plugins)) {
         $view->plugins = array();
     }
     $view->plugins[$this->getPHTML()] = $this->getDataArray();
 }
Example #8
Show file File: FormErrorsGoTo.php Project: knatorski/SMS
0
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
     }
     return '<div class="pointer" onClick = goToErrorLabel(\'' . $element->getId() . '\')>' . $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd() . '</div>';
 }
Example #9
Show file File: JqEmail.php Project: shevron/zend-simplecal
0
 public function getParamArr()
 {
     foreach ((array) $this->_emailContent->getViewAssignments() as $assign) {
         $this->_view->assign($assign[0], $assign[1]);
     }
     $arr = array('password' => self::VALIDATION_PASSWORD, 'to' => $this->_emailContent->getTo(), 'subject' => $this->_emailContent->getSubject(), 'body' => $this->renderBody($this->_emailContent->getViewScript()));
     return $arr;
 }
Example #10
Show file File: ZendViewEngine.php Project: richardfullmer/WhitewashingZFMvcCompatBundle
0
 /**
  * @param TemplateLocatorInterface $locator
  * @param ContainerInterface $container
  * @param TemplateNameParserInterface $parser
  * @param Zend_View_Interface $zendView
  */
 public function __construct(FileLocatorInterface $locator, ContainerInterface $container, TemplateNameParserInterface $parser, $zendView)
 {
     $this->locator = $locator;
     $this->container = $container;
     $this->parser = $parser;
     $this->view = $zendView;
     // Zend View is not able to handle absolute paths except with this little trick
     $this->view->setScriptPath('');
 }
Example #11
Show file File: TinyMceYN.php Project: hoalangoc/ftf
0
 public function setView(Zend_View_Interface $view = null)
 {
     if (null !== $view) {
         if (false === $view->getPluginLoader('helper')->getPaths('Ynresponsiveevent_Widget_EventFooterAbout_View_Helper')) {
             $view->addHelperPath(APPLICATION_PATH . '/application/modules/Ynresponsiveevent/widgets/event-footer-about/View/Helper', 'Ynresponsiveevent_Widget_EventFooterAbout_View_Helper');
         }
     }
     return parent::setView($view);
 }
Example #12
Show file File: CacheTagLifetime.php Project: rommmka/axiscommerce
0
 /**
  *
  * @static
  * @param string $value
  * @param Zend_View_Interface $view
  * @return string
  */
 public static function getHtml($value, Zend_View_Interface $view = null)
 {
     $value = Zend_Json_Decoder::decode($value);
     $html = '';
     foreach (self::_getOptions() as $options) {
         $html .= $options['name'] . ' ' . $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
     }
     return $html;
 }
Example #13
Show file File: ErrorHelpers.php Project: humansky/qframe
0
 /**
  * Returns a readable version of a call in a stack trace (returned by Exception->getTrace())
  *
  * @param  Array single call in the call stack
  * @return string
  */
 public function stringifyCall($call)
 {
     $string = "{$this->relativizePath($call['file'])}({$call['line']}): ";
     if (isset($call['class'])) {
         $string .= "{$call['class']}{$call['type']}";
     }
     $string .= "{$call['function']}({$this->stringifyParameters($call)})";
     return $this->view->h($string);
 }
Example #14
Show file File: DisplayGroup.php Project: VUW-SIM-FIS/emiemi
0
 /**
  * Set the view object
  *
  * Ensures that the view object has the dojo view helper path set.
  * 
  * @param  Zend_View_Interface $view 
  * @return Zend_Dojo_Form_Element_Dijit
  */
 public function setView(Zend_View_Interface $view = null)
 {
     if (null !== $view) {
         if (false === $view->getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
             $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
         }
     }
     return parent::setView($view);
 }
Example #15
Show file File: EscapeCheckEmpty.php Project: abdulhadikaryana/kebudayaan
0
 /**
  * Fungsi escapeCheckEmpty
  *
  * @param string $date tanggal yang mau diformat
  * @param integer $format jenis format yang mau dilakukan
  *
  * @return string tanggal yang sudah diformat
  */
 public function escapeCheckEmpty($input)
 {
     $output = '';
     if (empty($input)) {
         $output = '-';
     } else {
         $output = $this->view->escape($input);
     }
     return $output;
 }
Example #16
Show file File: SelectLanguage.php Project: ngukho/ducbui-cms
0
 /**
  *
  */
 public function selectLanguage($name, $value, $attribs = null)
 {
     //select version
     $config = Zend_Registry::get('config');
     $siteVersions = $config->language->translations;
     foreach ($siteVersions as $locale => $label) {
         $data[$locale] = $this->view->getTranslation($label);
     }
     return $this->view->formSelect($name, $value, $attribs, $data);
 }
Example #17
Show file File: ProfileLink.php Project: modulexcite/zfopenid
0
 public function profileLink()
 {
     $baseUrl = $this->view->baseUrl();
     $auth = Zend_Auth::getInstance();
     $html = '<a href="' . $baseUrl . '/user/login"> Login </a>';
     if ($auth->hasIdentity()) {
         $html = '<a href="' . $baseUrl . '/user/logout"> Logout </a>';
     }
     return $html;
 }
Example #18
Show file File: View.php Project: jpbender/mage_virtual
0
 /**
  * Retrieve view object
  *
  * @return Zend_View
  */
 public function getView()
 {
     if (null === $this->_view) {
         $options = $this->getOptions();
         $this->_view = new Zend_View($options);
         if (isset($options['doctype'])) {
             $this->_view->doctype()->setDoctype(strtoupper($options['doctype']));
         }
     }
     return $this->_view;
 }
Example #19
Show file File: Menu.php Project: Konstnantin/zf-app
0
 /**
  * @return string
  */
 public function menu()
 {
     $model = new Site_Model_Menu();
     $items = $model->fetchAll(null, 'orderid');
     $activeItem = $model->fetchRow(array('"' . addcslashes($this->view->url(), "'") . '" LIKE CONCAT("%",url,"%")'), 'LENGTH(url) desc');
     $this->view->items = $items;
     if ($activeItem) {
         $this->view->activeId = $activeItem->id;
     }
     return $this->view->render('menu.phtml');
 }
Example #20
Show file File: IsXhtml.php Project: ngukho/ducbui-cms
0
 /**
  *
  */
 public function isXhtml($doctype = null)
 {
     if (empty($doctype)) {
         $doctype = $this->view->doctype();
     }
     if (strpos($doctype, 'XHTML')) {
         return ' xmlns="http://www.w3.org/1999/xhtml"';
     } else {
         return null;
     }
 }
Example #21
Show file File: NewsMeta.php Project: abdulhadikaryana/kebudayaan
0
 /**
  * Fungsi metaNews
  *
  * @param string $publishDate tanggal news dibuat
  *
  * @return string html untuk meta
  */
 public function newsMeta($publishDate, $customMsg = 'Posted on ')
 {
     $langId = Zend_Registry::get('languageId');
     if ($langId == 1) {
         $customMsg = 'Ditulis ';
     } else {
         $customMsg = 'Posted on ';
     }
     $html = $customMsg . $this->view->dateConverter($publishDate, 'tanggal-waktu');
     return $html;
 }
Example #22
Show file File: HistoryproxyHelper.php Project: amsl-project/historyproxy.ontowiki
0
 public function init()
 {
     // init view
     if (null === $this->view) {
         $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
         if (null === $viewRenderer->view) {
             $viewRenderer->initView();
         }
         $this->view = clone $viewRenderer->view;
         $this->view->clearVars();
     }
 }
Example #23
Show file File: GetIconByFiletype.php Project: ngukho/ducbui-cms
0
 /**
  *
  */
 public function getIconByFileType($file, $asImage = true)
 {
     $config = Zend_Registry::get('config');
     $this->icons = $config->filetypes;
     $icon = $this->getIcon($file);
     if ($asImage) {
         $base = $this->view->getBaseUrl() . '/' . $config->filepath->icons;
         return "<img src='{$base}/{$icon}' />";
     } else {
         return $icon;
     }
 }
Example #24
Show file File: QuestionnairedataHelpers.php Project: humansky/qframe
0
 /**
  * Generates a drop down box listing all crypto profiles
  *
  * @param  integer current crypto profile (or null if no current profile)
  * @param string element name
  * @return string
  */
 public function cryptoSelect($cryptoID, $name = 'cryptoID')
 {
     $options[0] = 'none';
     $cryptos = CryptoModel::getAllProfiles();
     foreach ($cryptos as $crypto) {
         $profileName = $this->view->h($crypto->name);
         if (!isset($options[$crypto->cryptoID])) {
             $options[$crypto->cryptoID] = $profileName;
         }
     }
     return $this->view->formSelect($name, $cryptoID, null, $options);
 }
Example #25
Show file File: ColumnSort.php Project: abdulhadikaryana/kebudayaan
0
 /**
  * Fungsi utama untuk sorting
  *
  * @param array $sorter komponen sorting
  * @param array $options settingan sorting
  *
  * @return string 
  */
 function columnSort($sorter, $options)
 {
     $html = '';
     // Menampilkan nama kolom
     $html .= '<a href="' . $this->view->url($sorter) . '#firstsection' . '">';
     $html .= $options['title'];
     $html .= '</a>';
     // Menampilkan gambar sorting
     if ($sorter['sortby'] == $options['param']) {
         $html .= '<span class="img-sort">' . $this->view->statusSort($sorter['sortorder']) . '</span>';
     }
     return $html;
 }
Example #26
Show file File: LanguageForm.php Project: ngukho/ducbui-cms
0
 /**
  *  this helper renders a language selector
  *  it also processes the selected language
  *  it must be rendered above the content in order for the current
  *  content to reflect the language selection
  */
 public function languageForm()
 {
     //process form if this is a post back
     if (Digitalus_Filter_Post::has('setLang')) {
         Digitalus_Language::setLanguage($_POST['language']);
         // @todo: this needs to redirect so it loads the whole page in the new language
     }
     $currentLanguage = Digitalus_Language::getLanguage();
     $languageSelector = $this->view->selectLanguage('language', $currentLanguage);
     $xhtml = '<form action="' . $this->view->ModuleAction() . '" method="post">';
     $xhtml .= '<p>' . $languageSelector . '</p>';
     $xhtml .= '<p>' . $this->view->formSubmit('setLang', $this->view->getTranslation('Set Language')) . '</p>';
     $xhtml .= '</form>';
     return $xhtml;
 }
Example #27
Show file File: Standalone.php Project: Mendim/gtv-resources
0
 /**
  * Escape a string
  * 
  * @param  string $string 
  * @return string
  */
 protected function _escape($string)
 {
     if ($this->view instanceof Zend_View_Interface) {
         return $this->view->escape($string);
     }
     return htmlentities((string) $string, null, 'UTF-8');
 }
Example #28
Show file File: Container.php Project: bhaumik25/zend-framework
0
 /**
  * Render dojo module paths and requires
  * 
  * @return string
  */
 protected function _renderExtras()
 {
     $js = array();
     $modulePaths = $this->getModulePaths();
     if (!empty($modulePaths)) {
         foreach ($modulePaths as $path) {
             $js[] = 'dojo.registerModulePath("' . $this->view->escape($path) . '");';
         }
     }
     $modules = $this->getModules();
     if (!empty($modules)) {
         foreach ($modules as $module) {
             $js[] = 'dojo.require("' . $this->view->escape($module) . '");';
         }
     }
     $onLoadActions = array();
     foreach ($this->getOnLoadActions() as $callback) {
         $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
     }
     $content = '';
     if (!empty($js)) {
         $content .= implode("\n    ", $js) . "\n";
     }
     if (!empty($onLoadActions)) {
         $content .= implode("\n    ", $onLoadActions) . "\n";
     }
     if (preg_match('/^\\s*$/s', $content)) {
         return '';
     }
     $html = '<script type="text/javascript">' . PHP_EOL . ($this->_isXhtml ? '//<![CDATA[' : '//<!--') . PHP_EOL . $content . ($this->_isXhtml ? '//]]>' : '//-->') . PHP_EOL . PHP_EOL . '</script>';
     return $html;
 }
Example #29
Show file File: SelectBlog.php Project: laiello/digitalus-cms
0
 /**
  *
  */
 public function selectBlog($name, $value)
 {
     $mdlBlog = new Blog_Blog();
     $blogs = $mdlBlog->getBlogs();
     if ($blogs == null) {
         return $this->view->getTranslation('There are no blogs to view!');
     } else {
         $options[] = $this->view->getTranslation('Select One');
         foreach ($blogs as $blog) {
             $options[$blog->id] = $blog->name;
         }
         $form = new Digitalus_Form();
         $select = $form->createElement('select', $name, array('multiOptions' => $options, 'belongsTo' => 'module'));
         return $select;
     }
 }
Example #30
Show file File: FormElement.php Project: jorgenils/zend-framework
0
 /**
  * Creates a hidden element.
  *
  * We have this as a common method because other elements often
  * need hidden elements for their operation.
  *
  * @access protected
  *
  * @param $name The element name.
  *
  * @param $value The element value.
  *
  * @param $attribs Attributes for the element.
  *
  * @return string A hidden element.
  */
 protected function _hidden($name, $value = null, $attribs = null)
 {
     return '<input type="hidden"'
          . ' name="' . $this->view->escape($name) . '"'
          . ' value="' . $this->view->escape($value) . '"'
          . $this->_htmlAttribs($attribs) . ' />';
 }