[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/plugins/system/legacy/ -> adminmenus.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: adminmenus.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla.Legacy
   5  * @subpackage    1.5
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * Utility class for drawing admin menu HTML elements
  20   *
  21   * @static
  22   * @package     Joomla.Legacy
  23   * @subpackage    1.5
  24   * @since    1.0
  25   * @deprecated    As of version 1.5
  26   */
  27  class mosAdminMenus
  28  {
  29      /**
  30        * Legacy function, use {@link JHTML::_('menu.ordering')} instead
  31        *
  32        * @deprecated    As of version 1.5
  33       */
  34  	function Ordering( &$row, $id )
  35      {
  36          return JHTML::_('menu.ordering', $row, $id);
  37      }
  38  
  39      /**
  40        * Legacy function, use {@link JHTML::_('list.accesslevel', )} instead
  41        *
  42        * @deprecated    As of version 1.5
  43       */
  44  	function Access( &$row )
  45      {
  46          return JHTML::_('list.accesslevel', $row);
  47      }
  48  
  49      /**
  50        * Legacy function, deprecated
  51        *
  52        * @deprecated    As of version 1.5
  53       */
  54  	function Published( &$row )
  55      {
  56          $published = JHTML::_('select.booleanlist',  'published', 'class="inputbox"', $row->published );
  57          return $published;
  58      }
  59  
  60      /**
  61        * Legacy function, use {@link JAdminMenus::MenuLinks()} instead
  62        *
  63        * @deprecated    As of version 1.5
  64       */
  65  	function MenuLinks( &$lookup, $all=NULL, $none=NULL, $unassigned=1 )
  66      {
  67          $options = JHTML::_('menu.linkoptions', $lookup, $all, $none|$unassigned);
  68          if (empty( $lookup )) {
  69              $lookup = array( JHTML::_('select.option',  -1 ) );
  70          }
  71          $pages = JHTML::_('select.genericlist',   $options, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' );
  72          return $pages;
  73      }
  74  
  75      /**
  76        * Legacy function, deprecated
  77        *
  78        * @deprecated    As of version 1.5
  79       */
  80  	function Category( &$menu, $id, $javascript='' )
  81      {
  82          $db =& JFactory::getDBO();
  83  
  84          $query = 'SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( " / ", s.title, c.title) AS `text`'
  85          . ' FROM #__sections AS s'
  86          . ' INNER JOIN #__categories AS c ON c.section = s.id'
  87          . ' WHERE s.scope = "content"'
  88          . ' ORDER BY s.name, c.name'
  89          ;
  90          $db->setQuery( $query );
  91          $rows = $db->loadObjectList();
  92          $category = '';
  93  
  94          $category .= JHTML::_('select.genericlist',   $rows, 'componentid', 'class="inputbox" size="10"'. $javascript, 'value', 'text', $menu->componentid );
  95          $category .= '<input type="hidden" name="link" value="" />';
  96  
  97          return $category;
  98      }
  99  
 100      /**
 101        * Legacy function, deprecated
 102        *
 103        * @deprecated    As of version 1.5
 104       */
 105  	function Section( &$menu, $id, $all=0 )
 106      {
 107          $db =& JFactory::getDBO();
 108  
 109          $query = 'SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`'
 110          . ' FROM #__sections AS s'
 111          . ' WHERE s.scope = "content"'
 112          . ' ORDER BY s.name'
 113          ;
 114          $db->setQuery( $query );
 115          if ( $all ) {
 116              $rows[] = JHTML::_('select.option',  0, '- '. JText::_( 'All Sections' ) .' -' );
 117              $rows = array_merge( $rows, $db->loadObjectList() );
 118          } else {
 119              $rows = $db->loadObjectList();
 120          }
 121  
 122          $section = JHTML::_('select.genericlist',   $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid );
 123          $section .= '<input type="hidden" name="link" value="" />';
 124  
 125          return $section;
 126      }
 127  
 128      /**
 129        * Legacy function, deprecated
 130        *
 131        * @deprecated    As of version 1.5
 132       */
 133  	function Component( &$menu, $id )
 134      {
 135          $db =& JFactory::getDBO();
 136  
 137          $query = 'SELECT c.id AS value, c.name AS text, c.link'
 138          . ' FROM #__components AS c'
 139          . ' WHERE c.link <> ""'
 140          . ' ORDER BY c.name'
 141          ;
 142          $db->setQuery( $query );
 143          $rows = $db->loadObjectList( );
 144  
 145          $component = JHTML::_('select.genericlist',   $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid, '', 1 );
 146  
 147          return $component;
 148      }
 149  
 150  
 151      /**
 152        * Legacy function, deprecated
 153        *
 154        * @deprecated    As of version 1.5
 155       */
 156  	function ComponentName( &$menu, $id )
 157      {
 158          $db =& JFactory::getDBO();
 159  
 160          $query = 'SELECT c.id AS value, c.name AS text, c.link'
 161          . ' FROM #__components AS c'
 162          . ' WHERE c.link <> ""'
 163          . ' ORDER BY c.name'
 164          ;
 165          $db->setQuery( $query );
 166          $rows = $db->loadObjectList( );
 167  
 168          $component = 'Component';
 169          foreach ( $rows as $row ) {
 170              if ( $row->value == $menu->componentid ) {
 171                  $component = JText::_( $row->text );
 172              }
 173          }
 174  
 175          return $component;
 176      }
 177  
 178  
 179      /**
 180        * Legacy function, use {@link JHTML::_('list.images', )} instead
 181        *
 182        * @deprecated    As of version 1.5
 183       */
 184  	function Images( $name, &$active, $javascript=NULL, $directory=NULL )
 185      {
 186          return JHTML::_('list.images', $name, $active, $javascript, $directory);
 187      }
 188  
 189      /**
 190        * Legacy function, use {@link JHTML::_('list.specificordering', )} instead
 191        *
 192        * @deprecated    As of version 1.5
 193       */
 194  	function SpecificOrdering( &$row, $id, $query, $neworder=0 )
 195      {
 196          return JHTML::_('list.specificordering', $row, $id, $query, $neworder);
 197      }
 198  
 199      /**
 200        * Legacy function, use {@link JHTML::_('list.users', )} instead
 201        *
 202        * @deprecated    As of version 1.5
 203       */
 204  	function UserSelect( $name, $active, $nouser=0, $javascript=NULL, $order='name', $reg=1 )
 205      {
 206          return JHTML::_('list.users', $name, $active, $nouser, $javascript, $order, $reg);
 207      }
 208  
 209      /**
 210        * Legacy function, use {@link JHTML::_('list.positions', )} instead
 211        *
 212        * @deprecated    As of version 1.5
 213       */
 214  	function Positions( $name, $active=NULL, $javascript=NULL, $none=1, $center=1, $left=1, $right=1, $id=false )
 215      {
 216          return JHTML::_('list.positions', $name, $active, $javascript, $none, $center, $left, $right, $id);
 217      }
 218  
 219      /**
 220        * Legacy function, use {@link JHTML::_('list.category', )} instead
 221        *
 222        * @deprecated    As of version 1.5
 223       */
 224  	function ComponentCategory( $name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1 )
 225      {
 226          return JHTML::_('list.category', $name, $section, $active, $javascript, $order, $size, $sel_cat);
 227      }
 228  
 229      /**
 230        * Legacy function, use {@link JHTML::_('list.section', )} instead
 231        *
 232        * @deprecated    As of version 1.5
 233       */
 234  	function SelectSection( $name, $active=NULL, $javascript=NULL, $order='ordering' )
 235      {
 236          return JHTML::_('list.section', $name, $active, $javascript, $order);
 237      }
 238  
 239      /**
 240        * Legacy function, deprecated
 241        *
 242        * @deprecated    As of version 1.5
 243       */
 244  	function Links2Menu( $type, $and )
 245      {
 246          $db =& JFactory::getDBO();
 247  
 248          $query = 'SELECT * '
 249          . ' FROM #__menu '
 250          . ' WHERE type = '.$db->Quote($type)
 251          . ' AND published = 1'
 252          . $and
 253          ;
 254          $db->setQuery( $query );
 255          $menus = $db->loadObjectList();
 256  
 257          return $menus;
 258      }
 259  
 260      /**
 261        * Legacy function, deprecated
 262        *
 263        * @deprecated    As of version 1.5
 264       */
 265  	function MenuSelect( $name='menuselect', $javascript=NULL )
 266      {
 267          $db =& JFactory::getDBO();
 268  
 269          $query = 'SELECT params'
 270          . ' FROM #__modules'
 271          . ' WHERE module = "mod_mainmenu"'
 272          ;
 273          $db->setQuery( $query );
 274          $menus = $db->loadObjectList();
 275          $total = count( $menus );
 276          $menuselect = array();
 277          for( $i = 0; $i < $total; $i++ )
 278          {
 279              $registry = new JRegistry();
 280              $registry->loadINI($menus[$i]->params);
 281              $params = $registry->toObject( );
 282  
 283              $menuselect[$i]->value     = $params->menutype;
 284              $menuselect[$i]->text     = $params->menutype;
 285          }
 286          // sort array of objects
 287          JArrayHelper::sortObjects( $menuselect, 'text', 1 );
 288  
 289          $menus = JHTML::_('select.genericlist',   $menuselect, $name, 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
 290  
 291          return $menus;
 292      }
 293  
 294      /**
 295        * Legacy function, deprecated
 296        *
 297        * @deprecated    As of version 1.5
 298       */
 299  	function ReadImages( $imagePath, $folderPath, &$folders, &$images )
 300      {
 301          jimport( 'joomla.filesystem.folder' );
 302          $imgFiles = JFolder::files( $imagePath );
 303  
 304          foreach ($imgFiles as $file)
 305          {
 306              $ff_     = $folderPath.DS.$file;
 307              $ff     = $folderPath.DS.$file;
 308              $i_f     = $imagePath .'/'. $file;
 309  
 310              if ( is_dir( $i_f ) && $file <> 'CVS' && $file <> '.svn') {
 311                  $folders[] = JHTML::_('select.option',  $ff_ );
 312                  mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images );
 313              } else if ( preg_match( "#bmp|gif|jpg|png#i", $file ) && is_file( $i_f ) ) {
 314                  // leading / we don't need
 315                  $imageFile = substr( $ff, 1 );
 316                  $images[$folderPath][] = JHTML::_('select.option',  $imageFile, $file );
 317              }
 318          }
 319      }
 320  
 321      /**
 322        * Legacy function, deprecated
 323        *
 324        * @deprecated    As of version 1.5
 325       */
 326  	function GetImageFolders( &$folders, $path )
 327      {
 328          $javascript     = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\"";
 329          $getfolders     = JHTML::_('select.genericlist',   $folders, 'folders', 'class="inputbox" size="1" '. $javascript, 'value', 'text', '/' );
 330          return $getfolders;
 331      }
 332  
 333      /**
 334       * Legacy function, deprecated
 335       *
 336       * @deprecated    As of version 1.5
 337       */
 338  	function GetImages( &$images, $path )
 339      {
 340          if ( !isset($images['/'] ) ) {
 341              $images['/'][] = JHTML::_('select.option',  '' );
 342          }
 343  
 344          //$javascript    = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
 345          $javascript    = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
 346          $getimages    = JHTML::_('select.genericlist',   $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" '. $javascript , 'value', 'text', null );
 347  
 348          return $getimages;
 349      }
 350  
 351      /**
 352        * Legacy function, deprecated
 353        *
 354        * @deprecated    As of version 1.5
 355       */
 356  	function GetSavedImages( &$row, $path )
 357      {
 358          $images2 = array();
 359          foreach( $row->images as $file ) {
 360              $temp = explode( '|', $file );
 361              if( strrchr($temp[0], '/') ) {
 362                  $filename = substr( strrchr($temp[0], '/' ), 1 );
 363              } else {
 364                  $filename = $temp[0];
 365              }
 366              $images2[] = JHTML::_('select.option',  $file, $filename );
 367          }
 368          //$javascript    = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
 369          $javascript    = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
 370          $imagelist     = JHTML::_('select.genericlist',   $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
 371  
 372          return $imagelist;
 373      }
 374  
 375      /**
 376        * Legacy function, use {@link JHTML::_('image.site')} instead
 377        *
 378        * @deprecated    As of version 1.5
 379       */
 380  	function ImageCheck( $file, $directory='/images/M_images/', $param=NULL, $param_directory='/images/M_images/', $alt=NULL, $name='image', $type=1, $align='top' )
 381      {
 382          $attribs = array('align' => $align);
 383          return JHTML::_('image.site', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
 384      }
 385  
 386      /**
 387        * Legacy function, use {@link JHTML::_('image.administrator')} instead
 388        *
 389        * @deprecated    As of version 1.5
 390       */
 391  	function ImageCheckAdmin( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt=NULL, $name=NULL, $type=1, $align='middle' )
 392      {
 393          $attribs = array('align' => $align);
 394          return JHTML::_('image.administrator', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
 395      }
 396  
 397      /**
 398        * Legacy function, use {@link MenusHelper::getMenuTypes()} instead
 399        *
 400        * @deprecated    As of version 1.5
 401       */
 402  	function menutypes()
 403      {
 404          JError::raiseNotice( 0, 'mosAdminMenus::menutypes method deprecated' );
 405      }
 406  
 407      /**
 408        * Legacy function, use {@link MenusHelper::menuItem()} instead
 409        *
 410        * @deprecated    As of version 1.5
 411       */
 412  	function menuItem( $item )
 413      {
 414          JError::raiseNotice( 0, 'mosAdminMenus::menuItem method deprecated' );
 415      }
 416  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1