| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 4 * @license GNU General Public License version 2 or later; see LICENSE.txt 5 */ 6 7 // No direct access. 8 defined('_JEXEC') or die; 9 10 /** 11 * Templates component helper. 12 * 13 * @package Joomla.Administrator 14 * @subpackage com_templates 15 * @since 1.6 16 */ 17 class TemplatesHelper 18 { 19 /** 20 * Configure the Linkbar. 21 * 22 * @param string The name of the active view. 23 */ 24 public static function addSubmenu($vName) 25 { 26 JSubMenuHelper::addEntry( 27 JText::_('COM_TEMPLATES_SUBMENU_STYLES'), 28 'index.php?option=com_templates&view=styles', 29 $vName == 'styles' 30 ); 31 JSubMenuHelper::addEntry( 32 JText::_('COM_TEMPLATES_SUBMENU_TEMPLATES'), 33 'index.php?option=com_templates&view=templates', 34 $vName == 'templates' 35 ); 36 } 37 38 /** 39 * Gets a list of the actions that can be performed. 40 * 41 * @return JObject 42 */ 43 public static function getActions() 44 { 45 $user = JFactory::getUser(); 46 $result = new JObject; 47 48 $actions = array( 49 'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete' 50 ); 51 52 foreach ($actions as $action) { 53 $result->set($action, $user->authorise($action, 'com_templates')); 54 } 55 56 return $result; 57 } 58 59 /** 60 * Get a list of filter options for the application clients. 61 * 62 * @return array An array of JHtmlOption elements. 63 */ 64 public static function getClientOptions() 65 { 66 // Build the filter options. 67 $options = array(); 68 $options[] = JHtml::_('select.option', '0', JText::_('JSITE')); 69 $options[] = JHtml::_('select.option', '1', JText::_('JADMINISTRATOR')); 70 71 return $options; 72 } 73 74 /** 75 * Get a list of filter options for the templates with styles. 76 * 77 * @return array An array of JHtmlOption elements. 78 */ 79 public static function getTemplateOptions($clientId = '*') 80 { 81 // Build the filter options. 82 $db = JFactory::getDbo(); 83 $query = $db->getQuery(true); 84 85 if ($clientId != '*') { 86 $query->where('client_id='.(int) $clientId); 87 } 88 89 $query->select('element as value, name as text, extension_id as e_id'); 90 $query->from('#__extensions'); 91 $query->where('type='.$db->quote('template')); 92 $query->where('enabled=1'); 93 $query->order('client_id'); 94 $query->order('name'); 95 $db->setQuery($query); 96 $options = $db->loadObjectList(); 97 return $options; 98 } 99 100 public static function parseXMLTemplateFile($templateBaseDir, $templateDir) 101 { 102 $data = new JObject; 103 104 // Check of the xml file exists 105 $filePath = JPath::clean($templateBaseDir.'/templates/'.$templateDir.'/templateDetails.xml'); 106 if (is_file($filePath)) 107 { 108 $xml = JApplicationHelper::parseXMLInstallFile($filePath); 109 110 if ($xml['type'] != 'template') { 111 return false; 112 } 113 114 foreach ($xml as $key => $value) { 115 $data->set($key, $value); 116 } 117 } 118 119 return $data; 120 } 121 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |