[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/html/parameter/element/ -> modulelayouts.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 module from the module or default template overrides.
  16   *
  17   * @package     Joomla.Platform
  18   * @subpackage  Parameter
  19   * @note        Note that JFormFieldModuleLayout does not end in s.
  20   * @since       11.1
  21   * @deprecated  Use JFormFieldModuleLayout instead
  22   */
  23  class JElementModuleLayouts extends JElementList
  24  {
  25      /**
  26       * @var        string
  27       */
  28      protected $_name = 'ModuleLayouts';
  29  
  30      /**
  31       * Get the options for the list.
  32       *
  33       * @param   JXMLElement  &$node  JXMLElement node object containing the settings for the element
  34       *
  35       * @return  string
  36       *
  37       * @deprecated    12.1   Use JFormFieldModuleLayouts::getInput instead.
  38       * @since   11.1
  39       */
  40  	protected function _getOptions(&$node)
  41      {
  42          // Deprecation warning.
  43          JLog::add('JElementModuleLayouts::_getOptions() is deprecated.', JLog::WARNING, 'deprecated');
  44  
  45          $clientId = ($v = $node->attributes('client_id')) ? $v : 0;
  46  
  47          $options = array();
  48          $path1 = null;
  49          $path2 = null;
  50  
  51          // Load template entries for each menuid
  52          $db = JFactory::getDBO();
  53          $query = $db->getQuery(true);
  54          $query->select('template');
  55          $query->from('#__template_styles');
  56          $query->where('client_id = ' . (int) $clientId);
  57          $query->where('home = 1');
  58          $db->setQuery($query);
  59          $template = $db->loadResult();
  60  
  61          if ($module = $node->attributes('module'))
  62          {
  63              $base = ($clientId == 1) ? JPATH_ADMINISTRATOR : JPATH_SITE;
  64              $module = preg_replace('#\W#', '', $module);
  65              $path1 = $base . '/modules/' . $module . '/tmpl';
  66              $path2 = $base . '/templates/' . $template . '/html/' . $module;
  67              $options[] = JHTML::_('select.option', '', '');
  68          }
  69  
  70          if ($path1 && $path2)
  71          {
  72              jimport('joomla.filesystem.file');
  73              $path1 = JPath::clean($path1);
  74              $path2 = JPath::clean($path2);
  75  
  76              $files = JFolder::files($path1, '^[^_]*\.php$');
  77              foreach ($files as $file)
  78              {
  79                  $options[] = JHTML::_('select.option', JFile::stripExt($file));
  80              }
  81  
  82              if (is_dir($path2) && $files = JFolder::files($path2, '^[^_]*\.php$'))
  83              {
  84                  $options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT'));
  85                  foreach ($files as $file)
  86                  {
  87                      $options[] = JHTML::_('select.option', JFile::stripExt($file));
  88                  }
  89                  $options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT'));
  90              }
  91          }
  92  
  93          // Merge any additional options in the XML definition.
  94          $options = array_merge(parent::_getOptions($node), $options);
  95  
  96          return $options;
  97      }
  98  }


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