/** * 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'); }
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; }
/** * 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'); }
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); }
/** * 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); }
/** * 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); }
/** * Setup the Toolbar * * @since 1.6 */ protected function _setToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $canDo = TemplatesHelper::getActions(); JToolBarHelper::title($isNew ? JText::_('Templates_Manager_Add_Style') : JText::_('Templates_Manager_Edit_Style')); // If not checked out, can save the item. if ($canDo->get('core.edit')) { JToolBarHelper::apply('style.apply'); JToolBarHelper::save('style.save'); JToolBarHelper::addNew('style.save2new', 'JToolbar_Save_and_new'); } // 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'); } else { JToolBarHelper::cancel('style.cancel', 'JToolbar_Close'); } JToolBarHelper::divider(); JToolBarHelper::help('screen.style.edit'); }
/** * 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); }
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; }
/** * Setup the Toolbar */ protected function _setToolbar() { $user = JFactory::getUser(); $canDo = TemplatesHelper::getActions(); JToolBarHelper::title(JText::_('Templates_Manager_View_Template'), 'thememanager'); JToolBarHelper::cancel('template.cancel', 'JToolbar_Close'); JToolBarHelper::divider(); JToolBarHelper::help('screen.template.view'); }
/** * 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); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { Request::setVar('hidemainmenu', true); $canDo = TemplatesHelper::getActions(); Toolbar::title(Lang::txt('COM_TEMPLATES_MANAGER_VIEW_TEMPLATE'), 'thememanager'); Toolbar::cancel('template.cancel', 'JTOOLBAR_CLOSE'); Toolbar::divider(); Toolbar::help('template'); }
/** * 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; }
/** * 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'); }
/** * Add the page title and toolbar. * * @return void * @since 1.6 */ protected function addToolbar() { $state = $this->get('State'); $canDo = TemplatesHelper::getActions(); Toolbar::title(Lang::txt('COM_TEMPLATES_MANAGER_TEMPLATES'), 'thememanager'); if ($canDo->get('core.admin')) { Toolbar::preferences('com_templates'); Toolbar::divider(); } Toolbar::help('templates'); }
/** * Setup the Toolbar. */ protected function _setToolbar() { $state = $this->get('State'); $canDo = TemplatesHelper::getActions(); JToolBarHelper::title(JText::_('Templates_Manager_Templates'), 'thememanager'); if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_templates'); } JToolBarHelper::divider(); JToolBarHelper::help('screen.templates'); }
/** * Add the page title and toolbar. * * @return void * @since 1.6 */ protected function addToolbar() { $state = $this->get('State'); $canDo = TemplatesHelper::getActions(); JToolBarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES'), 'thememanager'); if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_templates'); JToolBarHelper::divider(); } JToolBarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES'); }
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); }
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); }
/** * 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 . '" />'; }
/** * 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(); }
protected function getInput() { $this->params = $this->element->attributes(); $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); $attr = ''; $attr .= $this->def('size') ? ' size="' . (int) $this->def('size') . '"' : ''; $attr .= $this->def('multiple') ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $canDo = TemplatesHelper::getActions(); JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_EDIT_FILE'), 'thememanager'); // Can save the item. if ($canDo->get('core.edit')) { JToolbarHelper::apply('source.apply'); JToolbarHelper::save('source.save'); } JToolbarHelper::cancel('source.cancel'); JToolbarHelper::divider(); JToolbarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES_EDIT_SOURCE'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { Request::setVar('hidemainmenu', true); $canDo = TemplatesHelper::getActions(); Toolbar::title(Lang::txt('COM_TEMPLATES_MANAGER_EDIT_FILE'), 'thememanager'); // Can save the item. if ($canDo->get('core.edit')) { Toolbar::apply('source.apply'); Toolbar::save('source.save'); } Toolbar::cancel('source.cancel'); Toolbar::divider(); Toolbar::help('source'); }
/** * Setup the Toolbar */ protected function _setToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $canDo = TemplatesHelper::getActions(); JToolBarHelper::title(JText::_('Templates_Manager_Edit_file')); // If not checked out, can save the item. if ($canDo->get('core.edit')) { JToolBarHelper::apply('source.apply'); JToolBarHelper::save('source.save'); } JToolBarHelper::cancel('source.cancel'); JToolBarHelper::divider(); JToolBarHelper::help('screen.source.edit'); }
/** * 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_EDIT_FILE'), 'thememanager'); // Can save the item. if ($canDo->get('core.edit')) { JToolBarHelper::apply('source.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('source.save', 'JTOOLBAR_SAVE'); } JToolBarHelper::cancel('source.cancel', 'JTOOLBAR_CANCEL'); JToolBarHelper::divider(); JToolBarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES_EDIT_SOURCE'); }
function parseXMLTemplateFiles($templateBaseDir) { // Read the template folder to find templates jimport('joomla.filesystem.folder'); $templateDirs = JFolder::folders($templateBaseDir); $rows = array(); // Check that the directory contains an xml file foreach ($templateDirs as $templateDir) { if (!($data = TemplatesHelper::parseXMLTemplateFile($templateBaseDir, $templateDir))) { continue; } else { $rows[] = $data; } } return $rows; }
/** * Method to display a view. * * @param boolean If true, the view output will be cached * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { // Load the submenu. TemplatesHelper::addSubmenu(JRequest::getCmd('view', 'styles')); $view = JRequest::getCmd('view', 'styles'); $layout = JRequest::getCmd('layout', 'default'); $id = JRequest::getInt('id'); // Check for edit form. if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_templates&view=styles', false)); return false; } parent::display(); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->preview = JComponentHelper::getParams('com_templates')->get('template_positions_display'); TemplatesHelper::addSubmenu('styles'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); return parent::display($tpl); }
/** * 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_STYLES'), 'eye 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'); JHtmlSidebar::setAction('index.php?option=com_templates&view=styles'); JHtmlSidebar::addFilter(JText::_('COM_TEMPLATES_FILTER_TEMPLATE'), 'filter_template', JHtml::_('select.options', TemplatesHelper::getTemplateOptions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.template'))); JHtmlSidebar::addFilter(JText::_('JGLOBAL_FILTER_CLIENT'), 'filter_client_id', JHtml::_('select.options', TemplatesHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id'))); }