[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/administrator/modules/ -> mod_fullmenu.php (source)

   1  <?php
   2  /**
   3  * @version $Id: mod_fullmenu.php 6072 2006-12-20 02:09:09Z robs $
   4  * @package Joomla
   5  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  16  
  17  if (!defined( '_JOS_FULLMENU_MODULE' )) {
  18      /** ensure that functions are declared only once */
  19      define( '_JOS_FULLMENU_MODULE', 1 );
  20  
  21      /**
  22      * Full DHTML Admnistrator Menus
  23      * @package Joomla
  24      */
  25      class mosFullAdminMenu {
  26          /**
  27          * Show the menu
  28          * @param string The current user type
  29          */
  30  		function show( $usertype='' ) {
  31              global $acl, $database;
  32              global $mosConfig_live_site, $mosConfig_enable_stats, $mosConfig_caching;
  33  
  34              // cache some acl checks
  35              $canConfig             = $acl->acl_check( 'administration', 'config', 'users', $usertype );
  36  
  37              $manageTemplates     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_templates' );
  38              $manageTrash         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_trash' );
  39              $manageMenuMan         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_menumanager' );
  40              $manageLanguages     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_languages' );
  41              $installModules     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'modules', 'all' );
  42              $editAllModules     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'modules', 'all' );
  43              $installMambots     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'mambots', 'all' );
  44              $editAllMambots     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'mambots', 'all' );
  45              $installComponents     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'components', 'all' );
  46              $editAllComponents     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'components', 'all' );
  47              $canMassMail         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_massmail' );
  48              $canManageUsers     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_users' );
  49  
  50              $query = "SELECT a.id, a.title, a.name"
  51              . "\n FROM #__sections AS a"
  52              . "\n WHERE a.scope = 'content'"
  53              . "\n GROUP BY a.id"
  54              . "\n ORDER BY a.ordering"
  55              ;
  56              $database->setQuery( $query );
  57              $sections = $database->loadObjectList();
  58  
  59              $menuTypes = mosAdminMenus::menutypes();
  60              ?>
  61              <div id="myMenuID"></div>
  62              <script language="JavaScript" type="text/javascript">
  63              var myMenu =
  64              [
  65              <?php
  66          // Home Sub-Menu
  67      ?>            [null,'Home','index2.php',null,'Control Panel'],
  68                  _cmSplit,
  69                  <?php
  70          // Site Sub-Menu
  71      ?>            [null,'Site',null,null,'Site Management',
  72      <?php
  73                  if ($canConfig) {
  74      ?>                ['<img src="../includes/js/ThemeOffice/config.png" />','Global Configuration','index2.php?option=com_config&hidemainmenu=1',null,'Configuration'],
  75      <?php
  76                  }
  77                  if ($manageLanguages) {
  78      ?>                ['<img src="../includes/js/ThemeOffice/language.png" />','Language Manager',null,null,'Manage languages',
  79                            ['<img src="../includes/js/ThemeOffice/language.png" />','Site Languages','index2.php?option=com_languages',null,'Manage Languages'],
  80                         ],
  81      <?php
  82                  }
  83      ?>                ['<img src="../includes/js/ThemeOffice/media.png" />','Media Manager','index2.php?option=com_media',null,'Manage Media Files'],
  84                          ['<img src="../includes/js/ThemeOffice/preview.png" />', 'Preview', null, null, 'Preview',
  85                          ['<img src="../includes/js/ThemeOffice/preview.png" />','In New Window','<?php echo $mosConfig_live_site; ?>/index.php','_blank','<?php echo $mosConfig_live_site; ?>'],
  86                          ['<img src="../includes/js/ThemeOffice/preview.png" />','Inline','index2.php?option=com_admin&task=preview',null,'<?php echo $mosConfig_live_site; ?>'],
  87                          ['<img src="../includes/js/ThemeOffice/preview.png" />','Inline with Positions','index2.php?option=com_admin&task=preview2',null,'<?php echo $mosConfig_live_site; ?>'],
  88                      ],
  89                      ['<img src="../includes/js/ThemeOffice/globe1.png" />', 'Statistics', null, null, 'Site Statistics',
  90      <?php
  91                  if ($mosConfig_enable_stats == 1) {
  92      ?>                    ['<img src="../includes/js/ThemeOffice/globe4.png" />', 'Browser, OS, Domain', 'index2.php?option=com_statistics', null, 'Browser, OS, Domain'],
  93      <?php
  94                  }
  95      ?>                    ['<img src="../includes/js/ThemeOffice/search_text.png" />', 'Search Text', 'index2.php?option=com_statistics&task=searches', null, 'Search Text']
  96                      ],
  97      <?php
  98                  if ($manageTemplates) {
  99      ?>                ['<img src="../includes/js/ThemeOffice/template.png" />','Template Manager',null,null,'Change site template',
 100                            ['<img src="../includes/js/ThemeOffice/template.png" />','Site Templates','index2.php?option=com_templates',null,'Change site template'],
 101                            _cmSplit,
 102                            ['<img src="../includes/js/ThemeOffice/template.png" />','Administrator Templates','index2.php?option=com_templates&client=admin',null,'Change admin template'],
 103                            _cmSplit,
 104                            ['<img src="../includes/js/ThemeOffice/template.png" />','Module Positions','index2.php?option=com_templates&task=positions',null,'Template positions']
 105                        ],
 106      <?php
 107                  }
 108                  if ($manageTrash) {
 109      ?>                ['<img src="../includes/js/ThemeOffice/trash.png" />','Trash Manager','index2.php?option=com_trash',null,'Manage Trash'],
 110      <?php
 111                  }
 112                  if ($canManageUsers || $canMassMail) {
 113      ?>                ['<img src="../includes/js/ThemeOffice/users.png" />','User Manager','index2.php?option=com_users&task=view',null,'Manage users'],
 114      <?php
 115                      }
 116      ?>            ],
 117      <?php
 118          // Menu Sub-Menu
 119      ?>            _cmSplit,
 120                  [null,'Menu',null,null,'Menu Management',
 121      <?php
 122                  if ($manageMenuMan) {
 123      ?>                ['<img src="../includes/js/ThemeOffice/menus.png" />','Menu Manager','index2.php?option=com_menumanager',null,'Menu Manager'],
 124                      _cmSplit,
 125      <?php
 126                  }
 127                  foreach ( $menuTypes as $menuType ) {
 128      ?>                ['<img src="../includes/js/ThemeOffice/menus.png" />','<?php echo $menuType;?>','index2.php?option=com_menus&menutype=<?php echo $menuType;?>',null,''],
 129      <?php
 130                  }
 131      ?>            ],
 132                  _cmSplit,
 133      <?php
 134          // Content Sub-Menu
 135      ?>            [null,'Content',null,null,'Content Management',
 136      <?php
 137                  if (count($sections) > 0) {
 138      ?>                ['<img src="../includes/js/ThemeOffice/edit.png" />','Content by Section',null,null,'Content Managers',
 139      <?php
 140                      foreach ($sections as $section) {
 141                          $txt = addslashes( $section->title ? $section->title : $section->name );
 142      ?>                    ['<img src="../includes/js/ThemeOffice/document.png" />','<?php echo $txt;?>', null, null,'<?php echo $txt;?>',
 143                              ['<img src="../includes/js/ThemeOffice/edit.png" />', '<?php echo $txt;?> Items', 'index2.php?option=com_content&sectionid=<?php echo $section->id;?>',null,null],
 144                              ['<img src="../includes/js/ThemeOffice/backup.png" />', '<?php echo $txt;?> Archives','index2.php?option=com_content&task=showarchive&sectionid=<?php echo $section->id;?>',null,null],
 145                              ['<img src="../includes/js/ThemeOffice/add_section.png" />', '<?php echo $txt;?> Categories', 'index2.php?option=com_categories&section=<?php echo $section->id;?>',null, null],
 146                          ],
 147      <?php
 148                      } // foreach
 149      ?>                ],
 150                      _cmSplit,
 151      <?php
 152                  }
 153      ?>
 154                      ['<img src="../includes/js/ThemeOffice/edit.png" />','All Content Items','index2.php?option=com_content&sectionid=0',null,'Manage Content Items'],
 155                        ['<img src="../includes/js/ThemeOffice/edit.png" />','Static Content Manager','index2.php?option=com_typedcontent',null,'Manage Typed Content Items'],
 156                        _cmSplit,
 157                        ['<img src="../includes/js/ThemeOffice/add_section.png" />','Section Manager','index2.php?option=com_sections&scope=content',null,'Manage Content Sections'],
 158                      ['<img src="../includes/js/ThemeOffice/add_section.png" />','Category Manager','index2.php?option=com_categories&section=content',null,'Manage Content Categories'],
 159                      _cmSplit,
 160                        ['<img src="../includes/js/ThemeOffice/home.png" />','Front Page Manager','index2.php?option=com_frontpage',null,'Manage Front Page Items'],
 161                        ['<img src="../includes/js/ThemeOffice/edit.png" />','Archive Manager','index2.php?option=com_content&task=showarchive&sectionid=0',null,'Manage Archive Items'],
 162                        ['<img src="../includes/js/ThemeOffice/globe3.png" />', 'Page Impressions', 'index2.php?option=com_statistics&task=pageimp', null, 'Page Impressions'],
 163                  ],
 164      <?php
 165          // Components Sub-Menu
 166          if ($installComponents) {
 167      ?>            _cmSplit,
 168                  [null,'Components',null,null,'Component Management',
 169      <?php
 170              $query = "SELECT *"
 171              . "\n FROM #__components"
 172              . "\n WHERE name != 'frontpage'"
 173              . "\n AND name != 'media manager'"
 174              . "\n ORDER BY ordering, name"
 175              ;
 176              $database->setQuery( $query );
 177              $comps = $database->loadObjectList();    // component list
 178              $subs = array();    // sub menus
 179              // first pass to collect sub-menu items
 180              foreach ($comps as $row) {
 181                  if ($row->parent) {
 182                      if (!array_key_exists( $row->parent, $subs )) {
 183                          $subs[$row->parent] = array();
 184                      }
 185                      $subs[$row->parent][] = $row;
 186                  }
 187              }
 188              $topLevelLimit = 19; //You can get 19 top levels on a 800x600 Resolution
 189              $topLevelCount = 0;
 190              foreach ($comps as $row) {
 191                  if ($editAllComponents | $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'components', $row->option )) {
 192                      if ($row->parent == 0 && (trim( $row->admin_menu_link ) || array_key_exists( $row->id, $subs ))) {
 193                          $topLevelCount++;
 194                          if ($topLevelCount > $topLevelLimit) {
 195                              continue;
 196                          }
 197                          $name = addslashes( $row->name );
 198                          $alt = addslashes( $row->admin_menu_alt );
 199                          $link = $row->admin_menu_link ? "'index2.php?$row->admin_menu_link'" : "null";
 200                          echo "\t\t\t\t['<img src=\"../includes/$row->admin_menu_img\" />','$name',$link,null,'$alt'";
 201                          if (array_key_exists( $row->id, $subs )) {
 202                              foreach ($subs[$row->id] as $sub) {
 203                                  echo ",\n";
 204                                  $name = addslashes( $sub->name );
 205                                  $alt = addslashes( $sub->admin_menu_alt );
 206                                  $link = $sub->admin_menu_link ? "'index2.php?$sub->admin_menu_link'" : "null";
 207                                  echo "\t\t\t\t\t['<img src=\"../includes/$sub->admin_menu_img\" />','$name',$link,null,'$alt']";
 208                              }
 209                          }
 210                          echo "\n\t\t\t\t],\n";
 211                      }
 212                  }
 213              }
 214              if ($topLevelLimit < $topLevelCount) {
 215                  echo "\t\t\t\t['<img src=\"../includes/js/ThemeOffice/sections.png\" />','More Components...','index2.php?option=com_admin&task=listcomponents',null,'More Components'],\n";
 216              }
 217      ?>
 218                  ],
 219      <?php
 220          // Modules Sub-Menu
 221              if ($installModules | $editAllModules) {
 222      ?>            _cmSplit,
 223                  [null,'Modules',null,null,'Module Management',
 224      <?php
 225                  if ($editAllModules) {
 226      ?>                ['<img src="../includes/js/ThemeOffice/module.png" />', 'Site Modules', "index2.php?option=com_modules", null, 'Manage Site modules'],
 227                      ['<img src="../includes/js/ThemeOffice/module.png" />', 'Administrator Modules', "index2.php?option=com_modules&client=admin", null, 'Manage Administrator modules'],
 228      <?php
 229                  }
 230      ?>            ],
 231      <?php
 232              } // if ($installModules | $editAllModules)
 233          } // if $installComponents
 234          // Mambots Sub-Menu
 235          if ($installMambots | $editAllMambots) {
 236      ?>            _cmSplit,
 237                  [null,'Mambots',null,null,'Mambot Management',
 238      <?php
 239              if ($editAllMambots) {
 240      ?>                ['<img src="../includes/js/ThemeOffice/module.png" />', 'Site Mambots', "index2.php?option=com_mambots", null, 'Manage Site Mambots'],
 241      <?php
 242              }
 243      ?>            ],
 244      <?php
 245          }
 246      ?>
 247      <?php
 248          // Installer Sub-Menu
 249          if ($installModules) {
 250      ?>            _cmSplit,
 251                  [null,'Installers',null,null,'Installer List',
 252      <?php
 253              if ($manageTemplates) {
 254      ?>                ['<img src="../includes/js/ThemeOffice/install.png" />','Templates - Site','index2.php?option=com_installer&element=template&client=',null,'Install Site Templates'],
 255                      ['<img src="../includes/js/ThemeOffice/install.png" />','Templates - Admin','index2.php?option=com_installer&element=template&client=admin',null,'Install Administrator Templates'],
 256      <?php
 257              }
 258              if ($manageLanguages) {
 259      ?>                ['<img src="../includes/js/ThemeOffice/install.png" />','Languages','index2.php?option=com_installer&element=language',null,'Install Languages'],
 260                      _cmSplit,
 261      <?php
 262              }
 263      ?>                ['<img src="../includes/js/ThemeOffice/install.png" />', 'Components','index2.php?option=com_installer&element=component',null,'Install/Uninstall Components'],
 264                      ['<img src="../includes/js/ThemeOffice/install.png" />', 'Modules', 'index2.php?option=com_installer&element=module', null, 'Install/Uninstall Modules'],
 265                      ['<img src="../includes/js/ThemeOffice/install.png" />', 'Mambots', 'index2.php?option=com_installer&element=mambot', null, 'Install/Uninstall Mambots'],
 266                  ],
 267      <?php
 268          } // if ($installModules)
 269          // Messages Sub-Menu
 270          if ($canConfig) {
 271      ?>            _cmSplit,
 272                    [null,'Messages',null,null,'Messaging Management',
 273                        ['<img src="../includes/js/ThemeOffice/messaging_inbox.png" />','Inbox','index2.php?option=com_messages',null,'Private Messages'],
 274                        ['<img src="../includes/js/ThemeOffice/messaging_config.png" />','Configuration','index2.php?option=com_messages&task=config&hidemainmenu=1',null,'Configuration']
 275                    ],
 276      <?php
 277          // System Sub-Menu
 278          /*
 279      ?>            _cmSplit,
 280                    [null,'System',null,null,'System Management',
 281                        ['<img src="../includes/js/ThemeOffice/joomla_16x16.png" />', 'Version Check', 'index2.php?option=com_admin&task=versioncheck', null,'Version Check'],
 282                        ['<img src="../includes/js/ThemeOffice/sysinfo.png" />', 'System Info', 'index2.php?option=com_admin&task=sysinfo', null,'System Information'],
 283      <?php
 284          */
 285      ?>            _cmSplit,
 286                    [null,'System',null,null,'System Management',
 287                        ['<img src="../includes/js/ThemeOffice/joomla_16x16.png" />', 'Version Check', 'http://www.joomla.org/latest10', '_blank','Version Check'],
 288                        ['<img src="../includes/js/ThemeOffice/sysinfo.png" />', 'System Info', 'index2.php?option=com_admin&task=sysinfo', null,'System Information'],
 289      <?php
 290                if ($canConfig) {
 291      ?>
 292                      ['<img src="../includes/js/ThemeOffice/checkin.png" />', 'Global Checkin', 'index2.php?option=com_checkin', null,'Check-in all checked-out items'],
 293      <?php
 294                  if ($mosConfig_caching) {
 295      ?>                ['<img src="../includes/js/ThemeOffice/config.png" />','Clean Content Cache','index2.php?option=com_admin&task=clean_cache',null,'Clean the content items cache'],
 296                      ['<img src="../includes/js/ThemeOffice/config.png" />','Clean All Caches','index2.php?option=com_admin&task=clean_all_cache',null,'Clean all caches'],
 297      <?php
 298                  }
 299              }
 300      ?>            ],
 301      <?php
 302                  }
 303      ?>            _cmSplit,
 304      <?php
 305          // Help Sub-Menu
 306      ?>            [null,'Help','index2.php?option=com_admin&task=help',null,null]
 307              ];
 308              cmDraw ('myMenuID', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
 309              </script>
 310      <?php
 311          }
 312  
 313  
 314          /**
 315          * Show an disbaled version of the menu, used in edit pages
 316          * @param string The current user type
 317          */
 318  		function showDisabled( $usertype='' ) {
 319              global $acl;
 320  
 321              $canConfig             = $acl->acl_check( 'administration', 'config', 'users', $usertype );
 322              $installModules     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'modules', 'all' );
 323              $editAllModules     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'modules', 'all' );
 324              $installMambots     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'mambots', 'all' );
 325              $editAllMambots     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'mambots', 'all' );
 326              $installComponents     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'components', 'all' );
 327              $editAllComponents     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'components', 'all' );
 328              $canMassMail         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_massmail' );
 329              $canManageUsers     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_users' );
 330  
 331              $text = 'Menu inactive for this Page';
 332              ?>
 333              <div id="myMenuID" class="inactive"></div>
 334              <script language="JavaScript" type="text/javascript">
 335              var myMenu =
 336              [
 337              <?php
 338          /* Home Sub-Menu */
 339              ?>
 340                  [null,'<?php echo 'Home'; ?>',null,null,'<?php echo $text; ?>'],
 341                  _cmSplit,
 342              <?php
 343          /* Site Sub-Menu */
 344              ?>
 345                  [null,'<?php echo 'Site'; ?>',null,null,'<?php echo $text; ?>'
 346                  ],
 347              <?php
 348          /* Menu Sub-Menu */
 349              ?>
 350                  _cmSplit,
 351                  [null,'<?php echo 'Menu'; ?>',null,null,'<?php echo $text; ?>'
 352                  ],
 353                  _cmSplit,
 354              <?php
 355          /* Content Sub-Menu */
 356              ?>
 357                   [null,'<?php echo 'Content'; ?>',null,null,'<?php echo $text; ?>'
 358                  ],
 359              <?php
 360          /* Components Sub-Menu */
 361                  if ( $installComponents) {
 362                      ?>
 363                      _cmSplit,
 364                      [null,'<?php echo 'Components'; ?>',null,null,'<?php echo $text; ?>'
 365                      ],
 366                      <?php
 367                  } // if $installComponents
 368                  ?>
 369              <?php
 370          /* Modules Sub-Menu */
 371                  if ( $installModules | $editAllModules) {
 372                      ?>
 373                      _cmSplit,
 374                      [null,'<?php echo 'Modules'; ?>',null,null,'<?php echo $text; ?>'
 375                      ],
 376                      <?php
 377                  } // if ( $installModules | $editAllModules)
 378                  ?>
 379              <?php
 380          /* Mambots Sub-Menu */
 381                  if ( $installMambots | $editAllMambots) {
 382                      ?>
 383                      _cmSplit,
 384                      [null,'<?php echo 'Mambots'; ?>',null,null,'<?php echo $text; ?>'
 385                      ],
 386                      <?php
 387                  } // if ( $installMambots | $editAllMambots)
 388                  ?>
 389  
 390  
 391                  <?php
 392          /* Installer Sub-Menu */
 393                  if ( $installModules) {
 394                      ?>
 395                      _cmSplit,
 396                      [null,'<?php echo 'Installers'; ?>',null,null,'<?php echo $text; ?>'
 397                          <?php
 398                          ?>
 399                      ],
 400                      <?php
 401                  } // if ( $installModules)
 402                  ?>
 403                  <?php
 404          /* Messages Sub-Menu */
 405                  if ( $canConfig) {
 406                      ?>
 407                      _cmSplit,
 408                        [null,'<?php echo 'Messages'; ?>',null,null,'<?php echo $text; ?>'
 409                        ],
 410                      <?php
 411                  }
 412                  ?>
 413  
 414                  <?php
 415          /* System Sub-Menu */
 416                  if ( $canConfig) {
 417                      ?>
 418                      _cmSplit,
 419                        [null,'<?php echo 'System'; ?>',null,null,'<?php echo $text; ?>'
 420                      ],
 421                      <?php
 422                  }
 423                  ?>
 424                  _cmSplit,
 425                  <?php
 426          /* Help Sub-Menu */
 427                  ?>
 428                  [null,'<?php echo 'Help'; ?>',null,null,'<?php echo $text; ?>']
 429              ];
 430              cmDraw ('myMenuID', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
 431              </script>
 432              <?php
 433          }
 434      }
 435  }
 436  $cache =& mosCache::getCache( 'mos_fullmenu' );
 437  
 438  $hide = intval( mosGetParam( $_REQUEST, 'hidemainmenu', 0 ) );
 439  
 440  if ( $hide ) {
 441      mosFullAdminMenu::showDisabled( $my->usertype );
 442  } else {
 443      mosFullAdminMenu::show( $my->usertype );
 444  }
 445  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics