Source for file mod_fullmenu.php

Documentation is available at mod_fullmenu.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @author Mambo Foundation Inc see README.php
  5. @copyright Mambo Foundation Inc.
  6. *  See COPYRIGHT.php for copyright notices and details.
  7. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  8. *  LICENSE.php
  9. *  Mambo is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU General Public License
  11. *  as published by the Free Software Foundation; version 2 of the
  12. *  License.
  13. */ 
  14.  
  15. /** ensure this file is being included by a parent file */
  16. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  17.  
  18. /**
  19. * Full DHTML Admnistrator Menus
  20. */
  21.     /**
  22.     * Show the menu
  23.     * @param string The current user type
  24.     */
  25.     function show$usertype='' {
  26.         global $acl$database;
  27.         global $mosConfig_live_site$mosConfig_enable_stats$mosConfig_caching;
  28.  
  29.         // cache some acl checks
  30.         $canConfig             $acl->acl_check'administration''config''users'$usertype );
  31.  
  32.         $manageTemplates     $acl->acl_check'administration''manage''users'$usertype'components''com_templates' );
  33.         $manageTrash         $acl->acl_check'administration''manage''users'$usertype'components''com_trash' );
  34.         $manageMenuMan         $acl->acl_check'administration''manage''users'$usertype'components''com_menumanager' );
  35.         $manageLanguages     $acl->acl_check'administration''manage''users'$usertype'components''com_languages' );
  36.         $installModules     $acl->acl_check'administration''install''users'$usertype'modules''all' );
  37.         $editAllModules     $acl->acl_check'administration''edit''users'$usertype'modules''all' );
  38.         $installMambots     $acl->acl_check'administration''install''users'$usertype'mambots''all' );
  39.         $editAllMambots     $acl->acl_check'administration''edit''users'$usertype'mambots''all' );
  40.         $installComponents     $acl->acl_check'administration''install''users'$usertype'components''all' );
  41.         $editAllComponents     $acl->acl_check'administration''edit''users'$usertype'components''all' );
  42.         $canMassMail         $acl->acl_check'administration''manage''users'$usertype'components''com_massmail' );
  43.         $canManageUsers     $acl->acl_check'administration''manage''users'$usertype'components''com_users' );
  44.  
  45.         $query "SELECT a.id, a.title, a.name,"
  46.         . "\nCOUNT(DISTINCT c.id) AS numcat, COUNT(DISTINCT b.id) AS numarc"
  47.         . "\n FROM #__sections AS a"
  48.         . "\n LEFT JOIN #__categories AS c ON c.section=a.id"
  49.         . "\n LEFT JOIN #__content AS b ON b.sectionid=a.id AND b.state=-1"
  50.         . "\n WHERE a.scope='content'"
  51.         . "\n GROUP BY a.id"
  52.         . "\n ORDER BY a.ordering"
  53.         ;
  54.         $database->setQuery$query );
  55.         $sections $database->loadObjectList();
  56.         $nonemptySections 0;
  57.         if ($sectionsforeach ($sections as $section)
  58.         if ($section->numcat 0)
  59.         $nonemptySections++;
  60.         $menuTypes mosAdminMenus::menutypes();
  61. ?>
  62.         <div id="myMenuID"></div>
  63.         <script language="JavaScript" type="text/javascript">
  64.         var myMenu =
  65.         [
  66.         <?php
  67.         // Home Sub-Menu
  68.         ?>            [null,'<?php echo T_('Home'?>','index2.php',null,'<?php echo T_('Control Panel'?>'],
  69.         _cmSplit,
  70.         <?php
  71.         // Site Sub-Menu
  72.         ?>            [null,'<?php echo T_('Site'?>',null,null,'<?php echo T_('Site Management'?>',
  73.         <?php
  74.         if ($canConfig{
  75.             ?>                ['<img src="../includes/js/ThemeOffice/config.png" />','<?php echo T_('Global Configuration'?>','index2.php?option=com_config&hidemainmenu=1',null,'<?php echo T_('Configuration'?>'],
  76.             <?php
  77.         }
  78.         if ($manageLanguages{
  79.             ?>                ['<img src="../includes/js/ThemeOffice/language.png" />','<?php echo T_('Language Manager'?>','index2.php?option=com_languages',null,'<?php echo T_('Manage languages'?>'],
  80.             <?php
  81.         }
  82.         ?>                ['<img src="../includes/js/ThemeOffice/media.png" />','<?php echo T_('Media Manager'?>','index2.php?option=com_media',null,'<?php echo T_('Manage Media Files'?>'],
  83.         ['<img src="../includes/js/ThemeOffice/preview.png" />', '<?php echo T_('Preview'?>', null, null, '<?php echo T_('Preview'?>',
  84.         ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('In New Window'?>','<?php echo $mosConfig_live_site?>/index.php','_blank','<?php echo $mosConfig_live_site?>'],
  85.         ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('Inline'?>','index2.php?option=com_admin&task=preview',null,'<?php echo $mosConfig_live_site?>'],
  86.         ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('Inline with Positions'?>','index2.php?option=com_admin&task=preview2',null,'<?php echo $mosConfig_live_site?>'],
  87.         ],
  88.         ['<img src="../includes/js/ThemeOffice/globe1.png" />', '<?php echo T_('Statistics'?>', null, null, '<?php echo T_('Site Statistics'?>',
  89.         <?php
  90.         if ($mosConfig_enable_stats == 1{
  91.             ?>                    ['<img src="../includes/js/ThemeOffice/globe4.png" />', '<?php echo T_('Browser, OS, Domain'?>', 'index2.php?option=com_statistics', null, '<?php echo T_('Browser, OS, Domain'?>'],
  92.             ['<img src="../includes/js/ThemeOffice/globe3.png" />', '<?php echo T_('Page Impressions'?>', 'index2.php?option=com_statistics&task=pageimp', null, '<?php echo T_('Page Impressions'?>'],
  93.             <?php
  94.         }
  95.         ?>                    ['<img src="../includes/js/ThemeOffice/search_text.png" />', '<?php echo T_('Search Text'?>', 'index2.php?option=com_statistics&task=searches', null, '<?php echo T_('Search Text'?>']
  96.         ],
  97.         <?php
  98.         if ($manageTemplates{
  99.             ?>                ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Template Manager'?>',null,null,'<?php echo T_('Change site template'?>',
  100.             ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Site Templates'?>','index2.php?option=com_templates',null,'<?php echo T_('Change site template'?>'],
  101.             ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Administrator Templates'?>','index2.php?option=com_templates&client=admin',null,'<?php echo T_('Change admin template'?>'],
  102.             ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Module Positions'?>','index2.php?option=com_templates&task=positions',null,'<?php echo T_('Template positions'?>']
  103.             ],
  104.             <?php
  105.         }
  106.         if ($manageTrash{
  107.             ?>                ['<img src="../includes/js/ThemeOffice/trash.png" />','<?php echo T_('Trash Manager'?>','index2.php?option=com_trash',null,'<?php echo T_('Manage Trash'?>'],
  108.             <?php
  109.         }
  110.         if ($canManageUsers || $canMassMail{
  111.             ?>                ['<img src="../includes/js/ThemeOffice/users.png" />','<?php echo T_('User Manager'?>','index2.php?option=com_users&task=view',null,'<?php echo T_('Manage users'?>'],
  112.             <?php
  113.         }
  114.         ?>            ],
  115.         <?php
  116.         // Menu Sub-Menu
  117.         ?>            _cmSplit,
  118.         [null,'<?php echo T_('Menu'?>',null,null,'<?php echo T_('Menu Management'?>',
  119.         <?php
  120.         if ($manageMenuMan{
  121.             ?>                ['<img src="../includes/js/ThemeOffice/menus.png" />','<?php echo T_('Menu Manager'?>','index2.php?option=com_menumanager',null,'<?php echo T_('Menu Manager'?>'],
  122.             _cmSplit,
  123.             <?php
  124.         }
  125.         foreach $menuTypes as $menuType {
  126.             ?>                ['<img src="../includes/js/ThemeOffice/menus.png" />','<?php echo $menuType;?>','index2.php?option=com_menus&menutype=<?php echo $menuType;?>',null,''],
  127.             <?php
  128.         }
  129.         ?>            ],
  130.         _cmSplit,
  131.         <?php
  132.         // Content Sub-Menu
  133.         ?>            [null,'<?php echo T_('Content'?>',null,null,'<?php echo T_('Content Management'?>',
  134.         <?php
  135.         if (count($sections0{
  136.             ?>                ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Content by Section'?>',null,null,'<?php echo T_('Content Managers'?>',
  137.             <?php
  138.             foreach ($sections as $section{
  139.                 $txt addslashes$section->title $section->title $section->name );
  140.                 ?>                    ['<img src="../includes/js/ThemeOffice/document.png" />','<?php echo $txt;?>', null, null,'<?php echo $txt;?>',
  141.                 <?php
  142.                 if ($section->numcat{
  143.                     ?>                        ['<img src="../includes/js/ThemeOffice/edit.png" />', '<?php echo $txt;?> <?php echo T_('Items'?>', 'index2.php?option=com_content&sectionid=<?php echo $section->id;?>',null,null],
  144.                     <?php
  145.                 }
  146.                 ?>                        ['<img src="../includes/js/ThemeOffice/add_section.png" />', '<?php echo T_('Add/Edit'?> <?php echo $txt;?> <?php echo T_('Categories'?>', 'index2.php?option=com_categories&section=<?php echo $section->id;?>',null, null],
  147.                 <?php
  148.                 if ($section->numarc{
  149.                     ?>                        ['<img src="../includes/js/ThemeOffice/backup.png" />', '<?php echo $txt;?> <?php echo T_('Archive'?>', 'index2.php?option=com_content&task=showarchive&sectionid=<?php echo $section->id;?>',null,null],
  150.                     <?php
  151.                 }
  152.                 ?>                    ],
  153.                 <?php
  154.             // foreach
  155.             ?>                ],
  156.             _cmSplit,
  157.             <?php
  158.         }
  159.         ?>
  160.         ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('All Content Items'?>','index2.php?option=com_content&sectionid=0',null,'<?php echo T_('Manage Content Items'?>'],
  161.         ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Static Content Manager'?>','index2.php?option=com_typedcontent',null,'<?php echo T_('Manage Typed Content Items'?>'],
  162.         _cmSplit,
  163.         ['<img src="../includes/js/ThemeOffice/add_section.png" />','<?php echo T_('Section Manager'?>','index2.php?option=com_sections&scope=content',null,'<?php echo T_('Manage Content Sections'?>'],
  164.         <?php
  165.         if (count($sections0{
  166.             ?>                ['<img src="../includes/js/ThemeOffice/add_section.png" />','<?php echo T_('Category Manager'?>','index2.php?option=com_categories&section=content',null,'<?php echo T_('Manage Content Categories'?>'],
  167.             <?php
  168.         }
  169.         ?>                _cmSplit,
  170.         ['<img src="../includes/js/ThemeOffice/home.png" />','<?php echo T_('Frontpage Manager'?>','index2.php?option=com_frontpage',null,'<?php echo T_('Manage Frontpage Items'?>'],
  171.         ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Archive Manager'?>','index2.php?option=com_content&task=showarchive&sectionid=0',null,'<?php echo T_('Manage Archive Items'?>'],
  172.         ],
  173.         <?php
  174.         // Components Sub-Menu
  175.         if ($installComponents{
  176.             ?>            _cmSplit,
  177.             [null,'<?php echo T_('Components'?>',null,null,'<?php echo T_('Component Management'?>',
  178.             ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Review/Uninstall'?>','index2.php?option=com_installer&element=component',null,'<?php echo T_('Install/Uninstall components'?>'],
  179.             _cmSplit,
  180.             <?php
  181.             $query "SELECT * FROM #__components WHERE name <> 'frontpage' and name <> 'media manager' ORDER BY ordering,name"
  182.             ;
  183.             $database->setQuery$query );
  184.             $comps $database->loadObjectList();   // component list
  185.             $subs array();    // sub menus
  186.             // first pass to collect sub-menu items
  187.             foreach ($comps as $row{
  188.                 if ($row->parent{
  189.                     if (!array_key_exists$row->parent$subs )) {
  190.                         $subs[$row->parentarray();
  191.                     }
  192.                     $subs[$row->parent][$row;
  193.                 }
  194.             }
  195.             $topLevelLimit 19//You can get 19 top levels on a 800x600 Resolution
  196.             $topLevelCount 0;
  197.             foreach ($comps as $row{
  198.                 if ($editAllComponents $acl->acl_check'administration''edit''users'$usertype'components'$row->option )) {
  199.                     if ($row->parent == && (trim$row->admin_menu_link || array_key_exists$row->id$subs ))) {
  200.                         $topLevelCount++;
  201.                         if ($topLevelCount $topLevelLimit{
  202.                             continue;
  203.                         }
  204.                         $name addslashes$row->name );
  205.                         $alt addslashes$row->admin_menu_alt );
  206.                         $link $row->admin_menu_link "'index2.php?$row->admin_menu_link'"null";
  207.                         echo "\t\t\t\t['<img src=\"../includes/$row->admin_menu_img\" />','$name',$link,null,'$alt'";
  208.                         if (array_key_exists$row->id$subs )) {
  209.                             foreach ($subs[$row->idas $sub{
  210.                                 echo ",\n";
  211.                                 $name addslashes$sub->name );
  212.                                 $alt addslashes$sub->admin_menu_alt );
  213.                                 $link $sub->admin_menu_link "'index2.php?$sub->admin_menu_link'"null";
  214.                                 echo "\t\t\t\t\t['<img src=\"../includes/$sub->admin_menu_img\" />','$name',$link,null,'$alt']";
  215.                             }
  216.                         }
  217.                         echo "\n\t\t\t\t],\n";
  218.                     }
  219.                 }
  220.             }
  221.             if ($topLevelLimit $topLevelCount{
  222.                 echo "\t\t\t\t['<img src=\"../includes/js/ThemeOffice/sections.png\" />','".T_('More Components...')."','index2.php?option=com_admin&task=listcomponents',null,'".T_('More Components')."'],\n";
  223.             }
  224.             ?>
  225.             ],
  226.             <?php
  227.             // Modules Sub-Menu
  228.             if ($installModules $editAllModules{
  229.                 ?>            _cmSplit,
  230.                 [null,'<?php echo T_('Modules'?>',null,null,'<?php echo T_('Module Management'?>',
  231.                 <?php
  232.                 if ($installModules{
  233.                     ?>                ['<img src="../includes/js/ThemeOffice/install.png" />', '<?php echo T_('Review/Uninstall'?>', 'index2.php?option=com_installer&element=module', null, '<?php echo T_('Install custom modules'?>'],
  234.                     _cmSplit,
  235.                     <?php
  236.                 }
  237.                 if ($editAllModules{
  238.                     ?>                ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Site Modules'?>', "index2.php?option=com_modules", null, '<?php echo T_('Manage Site modules'?>'],
  239.                     ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Administrator Modules'?>', "index2.php?option=com_modules&client=admin", null, '<?php echo T_('Manage Administrator modules'?>'],
  240.                     <?php
  241.                 }
  242.                 ?>            ],
  243.                 <?php
  244.             // if ($installModules | $editAllModules)
  245.         // if $installComponents
  246.         // Mambots Sub-Menu
  247.         if ($installMambots $editAllMambots{
  248.             ?>            _cmSplit,
  249.             [null,'<?php echo T_('Mambots'?>',null,null,'<?php echo T_('Mambot Management'?>',
  250.             <?php
  251.             if ($installMambots{
  252.                 ?>                ['<img src="../includes/js/ThemeOffice/install.png" />', '<?php echo T_('Review/Uninstall'?>', 'index2.php?option=com_installer&element=mambot', null, '<?php echo T_('Install custom mambot'?>'],
  253.                 _cmSplit,
  254.                 <?php
  255.             }
  256.             if ($editAllMambots{
  257.                 ?>                ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Site Mambots'?>', "index2.php?option=com_mambots", null, '<?php echo T_('Manage Site Mambots'?>'],
  258.                 <?php
  259.             }
  260.             ?>            ],
  261.             <?php
  262.         }
  263.         ?>
  264.         <?php
  265.         // Installer Sub-Menu
  266.         if ($installModules{
  267.             ?>            _cmSplit,
  268.             [null,'<?php echo T_('Installers'?>',null,null,'<?php echo T_('Installer List'?>',
  269.             ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Universal'?>','index2.php?option=com_installer&element=universal&client=admin',null,'<?php echo T_('Install Any Plugin'?>'],
  270.             <?php //this features uses simplexml which in not support pre php 5
  271.             if (phpversion(>=5?>
  272.             ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Add-on Packages'?>','index2.php?option=com_installer&task=addon&element=universal&client=admin',null,'<?php echo T_('Mambo Add-on Pakcages'?>'],
  273.             <?php ?>
  274.             //Commenting out The Source option for now since it is not working...
  275.             /*
  276.             <?php if (ini_get('allow_url_fopen')) ?>
  277.             ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('The Source'?>','index2.php?option=com_installer&task=thesource&element=universal&client=admin',null,'<?php echo T_('Install from The Source'?>'],
  278.             <?php ?>
  279.             */
  280.             ],
  281.             <?php
  282.         // if ($installModules)
  283.         // Messages Sub-Menu
  284.         if ($canConfig{
  285.             ?>            _cmSplit,
  286.             [null,'<?php echo T_('Messages'?>',null,null,'<?php echo T_('Messaging Management'?>',
  287.             ['<img src="../includes/js/ThemeOffice/messaging_inbox.png" />','<?php echo T_('Inbox'?>','index2.php?option=com_messages',null,'<?php echo T_('Private Messages'?>'],
  288.             ['<img src="../includes/js/ThemeOffice/messaging_config.png" />','<?php echo T_('Configuration'?>','index2.php?option=com_messages&task=config&hidemainmenu=1',null,'<?php echo T_('Configuration'?>']
  289.             ],
  290.             <?php
  291.             // System Sub-Menu
  292.             ?>            _cmSplit,
  293.             [null,'<?php echo T_('System'?>',null,null,'<?php echo T_('System Management'?>',
  294.             <?php
  295.             if ($canConfig{
  296.                 ?>                ['<img src="../includes/js/ThemeOffice/checkin.png" />', '<?php echo T_('Global Checkin'?>', 'index2.php?option=com_checkin', null,'<?php echo T_('Check-in all checked-out items'?>'],
  297.                 ['<img src="../includes/js/ThemeOffice/sysinfo.png" />', '<?php echo T_('System Information'?>', 'index2.php?option=com_admin&task=sysinfo', null, '<?php echo T_('View System Information'?>'],
  298.                 <?php //this features uses simplexml which in not support pre php 5
  299.                 if (phpversion(>=5?>
  300.                 ['<img src="../includes/js/ThemeOffice/globe2.png" />', '<?php echo T_('Check for Updates'?>', 'index2.php?option=com_admin&task=versioninfo', null, '<?php echo T_('Check for Updates'?>'],
  301.                 <?php ?>
  302.                 <?php
  303.                 if ($mosConfig_caching{
  304.                     ?>
  305.                     ['<img src="../includes/js/ThemeOffice/config.png" />','<?php echo T_('Clean Cache'?>','index2.php?option=com_content&task=clean_cache',null,'<?php echo T_('Clean the content items cache'?>'],
  306.                     <?php
  307.                 }
  308.             }
  309.         }
  310.         ?>            ],
  311.         <?php
  312.         // Support Sub-Menu
  313.         ?>            _cmSplit,
  314.         [null,'پشتیبانی',null,null,'گروه پشتیبانی مامبولرن',
  315.             ['<img src="../includes/js/ThemeOffice/home.png" />', 'مامبولرن', 'http://www.mambolearn.com', null,'وب سایت رسمی گروه مامبولرن'],
  316.             ['<img src="../includes/js/ThemeOffice/users.png" />', 'انجمن', 'http://www.mambolearn.com/forum/', null,'تالار پشتیبانی مامبولرن'],
  317.             ['<img src="../includes/js/ThemeOffice/content.png" />', 'آموزش', 'http://www.mambolearn.com/fa/training.html', null,'آموزش های نوشته شده توسط تیم مامبولرن'],
  318.             ['<img src="../includes/js/ThemeOffice/globe1.png" />', 'دریافت فایل', 'http://www.mambolearn.com/fa/download.html', null,'دریافت آخرین هسته، کامپوننت، مارژول، قالب، مامبوت فارسی'],
  319.         ],
  320.         _cmSplit,
  321.         <?php
  322.         // Help Sub-Menu
  323.         if(file_exists(mamboCore::get('rootPath').'/help/mambo.whatsnew.html')){?>[null,'<?php echo T_('Help'?>','index2.php?option=com_admin&task=help',null,null]<?php ?>
  324.         ];
  325.         cmDraw ('myMenuID', myMenu, 'hbl', cmThemeOffice, 'ThemeOffice');
  326.         </script>
  327. <?php
  328.     }
  329. }
  330. $cache =mosCache::getCache'mos_fullmenu' );
  331.  
  332. mosFullAdminMenu::show$my->usertype );
  333. //$cache->call( 'mosFullAdminMenu::show', $my->usertype );
  334. ?>

Documentation generated on Mon, 05 May 2008 16:21:15 +0400 by phpDocumentor 1.4.0