本文整理汇总了PHP中Zend_View_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Abstract类的具体用法?PHP Zend_View_Abstract怎么用?PHP Zend_View_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_View_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtmlOutput
/**
* Create the snippets content
*
* This is a stub function either override getHtmlOutput() or override render()
*
* @param \Zend_View_Abstract $view Just in case it is needed here
* @return \MUtil_Html_HtmlInterface Something that can be rendered
*/
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$url = $view->url(array('action' => 'export'));
$container = \MUtil_Html::div(array('id' => 'export-container'));
$button = $container->button(array($this->_('Export'), 'id' => 'modelExport'));
return $container;
}
示例2: _replace
/**
* Does the hard work for preg_replace_callback() in self::filter()
*
* @param string $matches
* @return string
*/
protected function _replace($matches)
{
if ($this->_view instanceof Zend_View_Abstract) {
$href = $this->_view->escape($matches[0]);
} else {
$href = htmlspecialchars($matches[0]);
}
return '<a' . ' href="' . $href . '"' . (null !== $this->_class ? ' class="' . $this->_class . '"' : '') . ' target="_blank" rel="nofollow"' . '>' . $matches[0] . '</a>';
}
示例3: __construct
/**
* Construct the record iterator.
*
* @uses Omeka_View_Helper_Singularize::singularize()
* @param array $records
* @param null|Zend_View_Abstract $view
* @param null|string $currentRecordVar
*/
public function __construct(array $records, $view = null, $currentRecordVar = null)
{
// Normalize the current record variable for the view.
if ($view instanceof Zend_View_Abstract) {
$currentRecordVar = $view->singularize($currentRecordVar);
}
$this->_records = $records;
$this->_currentRecordVar = $currentRecordVar;
$this->_view = $view;
}
示例4: getHtmlOutput
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$post = $this->request->getPost();
$export = $this->loader->getExport();
$exportTypes = $export->getExportClasses();
if (isset($post['type'])) {
$currentType = $post['type'];
} else {
reset($exportTypes);
$currentType = key($exportTypes);
}
if (\MUtil_Bootstrap::enabled()) {
$form = new \Gems_Form(array('id' => 'exportOptionsForm', 'class' => 'form-horizontal'));
} else {
$form = new \Gems_Form_TableForm();
}
$url = $view->url() . '/step/batch';
$form->setAction($url);
$elements = array();
$elements['type'] = $form->createElement('select', 'type', array('label' => $this->_('Export to'), 'multiOptions' => $exportTypes, 'class' => 'autosubmit'));
$form->addElements($elements);
$exportClass = $export->getExport($currentType);
$exportName = $exportClass->getName();
$exportFormElements['firstCheck'] = $form->createElement('hidden', $currentType);
$exportFormElements = $exportClass->getFormElements($form, $data);
if ($exportFormElements) {
$form->addElements($exportFormElements);
}
if (!isset($post[$currentType])) {
$post[$exportName] = $exportClass->getDefaultFormValues();
}
$element = $form->createElement('submit', 'export_submit', array('label' => $this->_('Export')));
$form->addElement($element);
if ($post) {
$form->populate($post);
}
$container = \MUtil_Html::div(array('id' => 'export-form'));
$container->append($form);
$form->setAttrib('id', 'autosubmit');
$form->setAutoSubmit(\MUtil_Html::attrib('href', array('action' => $this->request->getActionName(), 'RouteReset' => true)), 'export-form', true);
return $container;
}
示例5: array
function _compile_compiler_tag($tagCommand, $tagArgs, &$output)
{
//We first try to use Smarty's own functionality to parse the tag
$found = parent::_compile_compiler_tag($tagCommand, $tagArgs, $output);
if ($found === false) {
try {
//Check if helper exists and create output
$this->zendView->getHelper($tagCommand);
$helperArgs = array();
if ($tagArgs !== null) {
//Start parsing our custom syntax
$params = explode(' ', $tagArgs);
foreach ($params as $p) {
//Split each key=value pair to vars
list($key, $value) = explode('=', $p, 2);
$section = '';
//If there's a dot in the key, it means we
//need to use associative arrays
if (strpos('.', $key) != -1) {
list($key, $section) = explode('.', $key);
}
//Use Smarty's own functions to parse the value
//so that if there's a variable, it gets changed to
//properly point at a template variable etc.
$value = $this->_parse_var_props($value);
//Put the value into the arg array
if ($section == '') {
if (array_key_exists($key, $helperArgs)) {
if (is_array($helperArgs[$key])) {
$helperArgs[$key][] = $value;
} else {
$helperArgs[$key] = array($helperArgs[$key], $value);
}
} else {
$helperArgs[$key] = $value;
}
} else {
if (!is_array($helperArgs[$key])) {
$helperArgs[$key] = array();
}
$helperArgs[$key][$section] = $value;
}
}
}
//Save the code to put to the template in the output
$output = "<?php echo \$this->callViewHelper('{$tagCommand}',array(" . $this->_createParameterCode($helperArgs) . ")); ?>";
$found = true;
} catch (Exception $e) {
//Exception means the helper was not found
$found = false;
fwrite(fopen('php://stderr', 'a'), $e->getMessage());
}
}
return $found;
}
示例6: __construct
public function __construct($config = array())
{
parent::__construct($config);
if (isset($config['phptal'])) {
System_Options::setOptions($this->getEngine(), (array) $config['phptal']);
}
}
示例7: _script
/**
* Finds a view script from the available directories.
*
* @param $name string The base name of the script.
* @return void
*/
protected function _script($name)
{
if (strpos($name, ".") === false) {
$name .= ".phtml";
}
return parent::_script(strtolower($name));
}
示例8: __construct
/**
* Constructor
*
* Pass it a an array with the following configuration options:
*
* scriptPath: the directory where your templates reside
* compileDir: the directory where you want your compiled templates (must be
* writable by the webserver)
* configDir: the directory where your configuration files reside
*
* both scriptPath and compileDir are mandatory options, as Smarty needs
* them. You can't set a cacheDir, if you want caching use Zend_Cache
* instead, adding caching to the view explicitly would alter behaviour
* from Zend_View.
*
* @see Zend_View::__construct
* @param array $config
* @throws Exception
*/
public function __construct($config = array())
{
$this->_smarty = new Smarty();
//smarty object
//compile dir must be set
if (!array_key_exists('compileDir', $config)) {
throw new Exception('compileDir must be set in $config for ' . get_class($this));
} else {
$this->_smarty->compile_dir = $config['compileDir'];
}
//configuration files directory
if (array_key_exists('configDir', $config)) {
$this->_smarty->config_dir = $config['configDir'];
}
if (array_key_exists('leftDelimiter', $config)) {
$this->_smarty->left_delimiter = $config['leftDelimiter'];
}
if (array_key_exists('rightDelimiter', $config)) {
$this->_smarty->right_delimiter = $config['rightDelimiter'];
}
if (array_key_exists('templateDir', $config)) {
$this->_smarty->template_dir = array($config['templateDir']);
}
if (array_key_exists('pluginDir', $config)) {
$this->_smarty->plugins_dir = $config['pluginDir'];
}
//call parent constructor
parent::__construct($config);
}
示例9: __construct
public function __construct($data = array())
{
parent::__construct($data);
$dirs = Zend_Registry::get('dirs');
$template = Zend_Registry::get('theme');
$config = Zend_Registry::get('config');
$qool_module = Zend_Registry::get('Qool_Module');
// Class Constructor.
// These automatically get set with each new instance.
$loader = new Twig_Loader_Filesystem(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP);
$twig = new Twig_Environment($loader, array('cache' => APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'twig' . DIR_SEP));
$lexer = new Twig_Lexer($twig, array('tag_comment' => array('<#', '#>}'), 'tag_block' => array('<%', '%>'), 'tag_variable' => array('<<', '>>')));
$twig->setLexer($lexer);
include_once APPL_PATH . $dirs['structure']['lib'] . DIR_SEP . 'Qool' . DIR_SEP . 'Template' . DIR_SEP . 'template.php';
if (file_exists(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php')) {
include_once APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php';
}
$funcs = get_defined_functions();
foreach ($funcs['user'] as $k => $v) {
$twig->addFunction($v, new Twig_Function_Function($v));
}
$this->_twig = $twig;
$this->assign('config', $config);
Zend_Registry::set('tplExt', 'html');
}
示例10: array
function __construct(Am_Di $di = null)
{
parent::__construct();
if (null === $di) {
$this->di = Am_Di::getInstance();
} else {
$this->di = $di;
}
if ($this->di->hasService('theme')) {
$this->theme = $this->di->theme;
} else {
$this->theme = new Am_Theme($this->di, 'default', array());
}
$this->setHelperPath('Am/View/Helper', 'Am_View_Helper_');
$this->setEncoding('UTF-8');
foreach ($this->di->viewPath as $dir) {
$this->addScriptPath($dir);
}
if (!$this->getScriptPaths()) {
$this->addScriptPath(dirname(__FILE__) . '/../../application/default/views');
}
$this->headScript()->prependScript("window.rootUrl = " . Am_Controller::getJson(REL_ROOT_URL) . ";\n");
$this->headScript()->prependScript("window.CKEDITOR_BASEPATH = " . Am_Controller::getJson(REL_ROOT_URL . '/application/default/views/public/js/ckeditor/') . ";\n");
$this->headScript()->prependScript("window.amLangCount = " . Am_Controller::getJson(count(Am_Di::getInstance()->config->get('lang.enabled'))) . ";\n");
}
示例11: renderRegion
/**
* Render a panel region
* @param array $region
* @param array $blocks
* @return string
*/
function renderRegion($region, $blocks = array())
{
if ($blocks || $this->is_admin_page) {
$rendered_blocks = array();
if ($blocks) {
foreach ($blocks as $block) {
$block->options['region'] = $region;
if (!$this->is_admin_page) {
$rendered_blocks[$block->id] = $block->render();
} else {
$rendered_blocks[$block->id] = $this->renderAdminBlock($block);
}
}
}
$this->view->assign('region', $region);
$this->view->assign('blocks', $rendered_blocks);
if ($this->is_admin_page) {
$template = "region_admin";
} else {
$template = "region_" . (isset($region['template']) && $region['template'] != "" ? $region['template'] : "standard");
}
return $this->view->render($template);
}
return "";
}
示例12: __construct
public function __construct($data = array())
{
parent::__construct($data);
$dirs = Zend_Registry::get('dirs');
$template = Zend_Registry::get('theme');
$qool_module = Zend_Registry::get('Qool_Module');
//set Qool directories
$templates = APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP;
$templates_c = APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'smarty' . DIR_SEP . 'templates_c' . DIR_SEP;
$configs = APPL_PATH . 'config' . DIR_SEP . 'smarty' . DIR_SEP;
$cache = APPL_PATH . $dirs['structure']['cache'] . DIR_SEP . 'smarty' . DIR_SEP . 'cache' . DIR_SEP;
// Class Constructor.
// These automatically get set with each new instance.
$this->_smarty = new Smarty();
$this->_smarty->setTemplateDir($templates);
$this->_smarty->setCompileDir($templates_c);
$this->_smarty->setConfigDir($configs);
$this->_smarty->setCacheDir($cache);
$this->_smarty->caching = Smarty::CACHING_LIFETIME_CURRENT;
$this->_smarty->caching = false;
//get the template file and register all functions in it to smarty
include_once APPL_PATH . $dirs['structure']['lib'] . DIR_SEP . 'Qool' . DIR_SEP . 'Template' . DIR_SEP . 'template.php';
if (file_exists(APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php')) {
include_once APPL_PATH . $dirs['structure']['templates'] . DIR_SEP . $qool_module . DIR_SEP . $template . DIR_SEP . 'functions.php';
}
// $this_smarty->register_function('date_now', 'print_current_date');
Zend_Registry::set('tplExt', 'tpl');
}
示例13: __toString
public function __toString()
{
if (null === ($verb = $this->getParam('verb'))) {
$this->_view->errors = array('badArgument' => 'Required verb is missing');
return $this->_view->render('index/error.phtml');
} else {
try {
try {
$this->checkParams($verb);
} catch (OaiPmh_Exception $e) {
$this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
return $this->_view->render('index/error.phtml');
}
try {
return $this->{$verb}();
} catch (Exception $e) {
$this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
return $this->_view->render('index/error.phtml');
}
} catch (OaiPmh_Exception $e) {
$this->_view->errors = array($e->getCodeAsString() => $e->getMessage());
return $this->_view->render('index/error.phtml');
} catch (Exception $e) {
$this->_view->errors = array('badArgument' => $e->getMessage());
return $this->_view->render;
}
}
}
示例14: __construct
public function __construct($config = array())
{
if (APPLICATION_ENV == "testing") {
$this->_testing = true;
$this->_streamUrl = 'php://memory';
}
parent::__construct($config);
}
示例15: __construct
/**
* Constructor
*
* Register Zend_View_Stream stream wrapper if short tags are disabled.
*
* @param array $config
* @return void
*/
public function __construct($config = array())
{
if (array_key_exists('mail', $config)) {
$this->setMail($config['mail']);
}
parent::__construct($config);
$this->addHelperPath('App/Mail/View/Helper', 'App_Mail_View_Helper');
}