本文整理汇总了PHP中TemplatesHelper类的典型用法代码示例。如果您正苦于以下问题:PHP TemplatesHelper类的具体用法?PHP TemplatesHelper怎么用?PHP TemplatesHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemplatesHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setToolbar
/**
* Setup the Toolbar.
*/
protected function _setToolbar()
{
$state = $this->get('State');
$canDo = TemplatesHelper::getActions();
$isSite = $state->get('filter.client_id') == 0;
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('style.edit');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::custom('styles.sethome', 'default.png', 'default_f2.png', 'Templates_Toolbar_Set_Home', true);
}
JToolBarHelper::title(JText::_('Templates_Manager_Styles'), 'thememanager');
if ($canDo->get('core.create') && $isSite) {
JToolBarHelper::addNew('styles.duplicate', 'Templates_Toolbar_Save_Copy');
}
if ($canDo->get('core.delete') && $isSite) {
JToolBarHelper::deleteList('', 'styles.delete');
}
if ($canDo->get('core.admin')) {
JToolBarHelper::divider();
JToolBarHelper::preferences('com_templates');
}
JToolBarHelper::divider();
JToolBarHelper::help('screen.templates');
}
示例2: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$size = $node->attributes('size');
$multiple = $node->attributes('multiple');
$subtemplates = $this->def($node->attributes('subtemplates'), 1);
$control = $control_name . '[' . $name . ']';
$attribs = 'class="inputbox"';
if ($multiple) {
if (!is_array($value)) {
$value = explode(',', $value);
}
$attribs .= ' multiple="multiple"';
$control .= '[]';
}
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_templates' . DS . 'helpers' . DS . 'template.php';
$rows = TemplatesHelper::parseXMLTemplateFiles(JPATH_ROOT . DS . 'templates');
$options = $this->createList($rows, JPATH_ROOT . DS . 'templates', $subtemplates);
if ($size) {
$attribs .= ' size="' . $size . '"';
} else {
$attribs .= ' size="' . (count($options) > 10 ? 10 : count($options)) . '"';
}
$list = JHTML::_('select.genericlist', $options, $control, $attribs, 'value', 'text', $value, $control_name . $name);
return $list;
}
示例3: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = TemplatesHelper::getActions();
$isSite = $state->get('filter.client_id') == 0;
JToolBarHelper::title(JText::_('COM_TEMPLATES_MANAGER_STYLES'), 'thememanager');
if ($canDo->get('core.edit.state')) {
JToolBarHelper::makeDefault('styles.setDefault', 'COM_TEMPLATES_TOOLBAR_SET_HOME');
JToolBarHelper::divider();
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('style.edit');
}
if ($canDo->get('core.create')) {
JToolBarHelper::custom('styles.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
JToolBarHelper::divider();
}
if ($canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'styles.delete');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_templates');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_STYLES');
}
示例4: display
public function display($tpl = null)
{
JToolBarHelper::title(JText::_('Template Manager'), 'thememanager');
JToolBarHelper::custom('edit', 'back.png', 'back_f2.png', 'Back', false, false);
require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'templates.php';
// Initialise some variables
$option = JRequest::getCmd('option');
$id = JRequest::getVar('id', '', 'method', 'int');
$template = TemplatesHelper::getTemplateName($id);
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
$tp = true;
$url = $client->id ? JURI::base() : JURI::root();
if (!$template) {
return JError::raiseWarning(500, JText::_('Template not specified'));
}
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
$this->assignRef('option', $option);
$this->assignRef('client', $client);
$this->assignRef('id', $id);
$this->assignRef('template', $template);
$this->assignRef('tp', $tp);
$this->assignRef('url', $url);
parent::display($tpl);
}
示例5: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = TemplatesHelper::getActions();
JToolBarHelper::title($isNew ? JText::_('COM_TEMPLATES_MANAGER_ADD_STYLE') : JText::_('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('style.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('style.save', 'JTOOLBAR_SAVE');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('style.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('style.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('style.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
// Get the help information for the template item.
$lang = JFactory::getLanguage();
$help = $this->get('Help');
if ($lang->hasKey($help->url)) {
$debug = $lang->setDebug(false);
$url = JText::_($help->url);
$lang->setDebug($debug);
} else {
$url = null;
}
JToolBarHelper::help($help->key, false, $url);
}
示例6: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
Request::setVar('hidemainmenu', true);
$isNew = $this->item->id == 0;
$canDo = TemplatesHelper::getActions();
Toolbar::title($isNew ? Lang::txt('COM_TEMPLATES_MANAGER_ADD_STYLE') : Lang::txt('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
Toolbar::apply('style.apply');
Toolbar::save('style.save');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
Toolbar::save2copy('style.save2copy');
}
if (empty($this->item->id)) {
Toolbar::cancel('style.cancel');
} else {
Toolbar::cancel('style.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
// Get the help information for the template item.
$lang = Lang::getRoot();
$help = $this->get('Help');
if ($lang->hasKey($help->url)) {
$debug = $lang->setDebug(false);
$url = Lang::txt($help->url);
$lang->setDebug($debug);
} else {
$url = null;
}
Toolbar::help('style');
//$help->key, false, $url);
}
示例7: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 1.6
*/
public function getOptions()
{
$app = JFactory::getApplication();
$clientId = $app->getUserStateFromRequest('com_templates.styles.filter.client_id', 'filter_client_id', null);
$options = TemplatesHelper::getTemplateOptions($clientId);
return array_merge(parent::getOptions(), $options);
}
示例8: getItem
function getItem()
{
global $mainframe;
jimport('joomla.filesystem.path');
if (!$this->template) {
return JError::raiseWarning(500, 'Template not specified');
}
$tBaseDir = JPath::clean(JPATH_RSGALLERY2_SITE . '/templates');
if (!is_dir($tBaseDir . '/' . $this->template)) {
return JError::raiseWarning(500, 'Template not found');
}
$lang =& JFactory::getLanguage();
$lang->load('tpl_' . $this->template, JPATH_RSGALLERY2_SITE);
$ini = JPATH_RSGALLERY2_SITE . '/templates/' . $this->template . '/params.ini';
$xml = JPATH_RSGALLERY2_SITE . '/templates/' . $this->template . '/templateDetails.xml';
$row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $this->template);
jimport('joomla.filesystem.file');
// Read the ini file
if (JFile::exists($ini)) {
$content = JFile::read($ini);
} else {
$content = null;
}
$params = new JParameter($content, $xml, 'template');
// Set FTP credentials, if given
jimport('joomla.client.helper');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$item = new stdClass();
$item->params = $params;
$item->row = $row;
$item->type = $this->_type;
$item->template = $this->template;
return $item;
}
示例9: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 1.6
*/
public function getOptions()
{
// Get the client_id filter from the user state.
$clientId = JFactory::getApplication()->getUserStateFromRequest('com_templates.styles.client_id', 'client_id', '0', 'string');
// Get the templates for the selected client_id.
$options = TemplatesHelper::getTemplateOptions($clientId);
// Merge into the parent options.
return array_merge(parent::getOptions(), $options);
}
示例10: getItems
/**
* Override parent getItems to add extra XML metadata.
*
* @return array
*
* @since 1.6
*/
public function getItems()
{
$items = parent::getItems();
foreach ($items as &$item) {
$client = JApplicationHelper::getClientInfo($item->client_id);
$item->xmldata = TemplatesHelper::parseXMLTemplateFile($client->path, $item->element);
}
return $items;
}
示例11: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$canDo = TemplatesHelper::getActions();
JToolBarHelper::title(JText::_('COM_TEMPLATES_MANAGER_VIEW_TEMPLATE'), 'thememanager');
JToolBarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES_EDIT');
}
示例12: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
include_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/template.php';
$template_path = JPATH_ADMINISTRATOR . '/templates';
$templates = TemplatesHelper::parseXMLTemplateFiles($template_path);
$options = array();
$options[] = JHTML::_('select.option', '', JText::_('DEFAULT'));
foreach ($templates as $t) {
$options[] = JHTML::_('select.option', $t->directory, $t->name);
}
return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . '][]', 'class="inputbox"', 'value', 'text', $value);
}
示例13: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
$subtemplates = $this->def('subtemplates', 1);
$show_system = $this->def('show_system', 1);
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
$rows = TemplatesHelper::getTemplateOptions('0');
$options = $this->createList($rows, JPATH_ROOT . '/templates', $subtemplates, $show_system);
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
示例14: getInput
/**
* Method to get the output of this element
*
* @param null
* @return string
*/
protected function getInput()
{
$name = $this->name;
$fieldName = $this->fieldname;
$value = $this->value;
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
$options = TemplatesHelper::getTemplateOptions(0);
if (!empty($options) && is_array($options)) {
array_unshift($options, array('value' => '', 'text' => ''));
return JHTML::_('select.genericlist', $options, $fieldName, null, 'value', 'text', MagebridgeModelConfig::load($fieldName));
}
return '<input type="text" name="' . $name . '" value="' . $value . '" />';
}
示例15: addToolbar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_templates');
JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES'), 'eye thememanager');
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_templates');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES');
JHtmlSidebar::setAction('index.php?option=com_templates&view=templates');
JHtmlSidebar::addFilter(JText::_('JGLOBAL_FILTER_CLIENT'), 'filter_client_id', JHtml::_('select.options', TemplatesHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')));
$this->sidebar = JHtmlSidebar::render();
}