[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/html/parameter/element/ -> componentlayouts.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Platform
   4   * @subpackage  HTML
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  defined('JPATH_PLATFORM') or die;
  11  
  12  require_once dirname(__FILE__) . '/list.php';
  13  
  14  /**
  15   * Parameter to display a list of the layouts for a component view from the extension or default template overrides.
  16   *
  17   * @package     Joomla.Platform
  18   * @subpackage  Parameter
  19   * @see         JFormFieldComponentLayout
  20   * @note        When replacing take note that JFormFieldComponentLayout does not end in s.
  21   * @since       11.1
  22   * @deprecated  Use JFormFieldComponentLayouts instead
  23   */
  24  class JElementComponentLayouts extends JElementList
  25  {
  26      /**
  27       * @var    string
  28       */
  29      protected $_name = 'ComponentLayouts';
  30  
  31      /**
  32       * Get the options for the list.
  33       *
  34       * @param   JXMLElement  &$node  JXMLElement node object containing the settings for the element
  35       *
  36       * @return  array
  37       *
  38       * @since   11.1
  39       *
  40       * @deprecated  12.1
  41       * @see         JFormFieldComponentLayout
  42       */
  43  	protected function _getOptions(&$node)
  44      {
  45          // Deprecation warning.
  46          JLog::add('JElementComponentLayouts::_getOptions() is deprecated.', JLog::WARNING, 'deprecated');
  47  
  48          $options = array();
  49          $path1 = null;
  50          $path2 = null;
  51  
  52          // Load template entries for each menuid
  53          $db = JFactory::getDBO();
  54          $query = 'SELECT template' . ' FROM #__template_styles' . ' WHERE client_id = 0 AND home = 1';
  55          $db->setQuery($query);
  56          $template = $db->loadResult();
  57  
  58          if ($view = $node->attributes('view') && $extn = $node->attributes('extension'))
  59          {
  60              $view = preg_replace('#\W#', '', $view);
  61              $extn = preg_replace('#\W#', '', $extn);
  62              $path1 = JPATH_SITE . '/components/' . $extn . '/views/' . $view . '/tmpl';
  63              $path2 = JPATH_SITE . '/templates/' . $template . '/html/' . $extn . '/' . $view;
  64              $options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_MENU_REQUEST_SETTING'));
  65          }
  66  
  67          if ($path1 && $path2)
  68          {
  69              jimport('joomla.filesystem.file');
  70              $path1 = JPath::clean($path1);
  71              $path2 = JPath::clean($path2);
  72  
  73              $files = JFolder::files($path1, '^[^_]*\.php$');
  74              foreach ($files as $file)
  75              {
  76                  $options[] = JHtml::_('select.option', JFile::stripExt($file));
  77              }
  78  
  79              if (is_dir($path2) && $files = JFolder::files($path2, '^[^_]*\.php$'))
  80              {
  81                  $options[] = JHtml::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT_TEMPLATE'));
  82                  foreach ($files as $file)
  83                  {
  84                      $options[] = JHtml::_('select.option', JFile::stripExt($file));
  85                  }
  86                  $options[] = JHtml::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT_TEMPLATE'));
  87              }
  88          }
  89  
  90          // Merge any additional options in the XML definition.
  91          $options = array_merge(parent::_getOptions($node), $options);
  92  
  93          return $options;
  94      }
  95  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1