| 97 |
$i++; |
$i++; |
| 98 |
} |
} |
| 99 |
|
|
| 100 |
$menuhandler = mosMenuHandler::getInstance(); |
// Query to get published menu item counts |
| 101 |
|
$query = "SELECT a.menutype, count( a.menutype ) as num" |
| 102 |
|
. "\n FROM #__menu AS a" |
| 103 |
|
. "\n WHERE a.published = 1" |
| 104 |
|
. "\n GROUP BY a.menutype" |
| 105 |
|
. "\n ORDER BY a.menutype" |
| 106 |
|
; |
| 107 |
|
$database->setQuery( $query ); |
| 108 |
|
$published = $database->loadObjectList(); |
| 109 |
|
|
| 110 |
|
// Query to get unpublished menu item counts |
| 111 |
|
$query = "SELECT a.menutype, count( a.menutype ) as num" |
| 112 |
|
. "\n FROM #__menu AS a" |
| 113 |
|
. "\n WHERE a.published = 0" |
| 114 |
|
. "\n GROUP BY a.menutype" |
| 115 |
|
. "\n ORDER BY a.menutype" |
| 116 |
|
; |
| 117 |
|
$database->setQuery( $query ); |
| 118 |
|
$unpublished = $database->loadObjectList(); |
| 119 |
|
if (!$unpublished) $unpublished = array(); |
| 120 |
|
|
| 121 |
|
// Query to get trash menu item counts |
| 122 |
|
$query = "SELECT a.menutype, count( a.menutype ) as num" |
| 123 |
|
. "\n FROM #__menu AS a" |
| 124 |
|
. "\n WHERE a.published = -2" |
| 125 |
|
. "\n GROUP BY a.menutype" |
| 126 |
|
. "\n ORDER BY a.menutype" |
| 127 |
|
; |
| 128 |
|
$database->setQuery( $query ); |
| 129 |
|
$trash = $database->loadObjectList(); |
| 130 |
|
if (!$trash) $trash = array(); |
| 131 |
|
|
| 132 |
for( $i = 0; $i < $total; $i++ ) { |
for( $i = 0; $i < $total; $i++ ) { |
| 133 |
$count = $menuhandler->getMenuCount($menus[$i]->type, 1); |
// adds published count |
| 134 |
$menus[$i]->published = $count ? $count : '-'; |
foreach ( $published as $count ) { |
| 135 |
$count = $menuhandler->getMenuCount($menus[$i]->type, 0); |
if ( $menus[$i]->type == $count->menutype ) { |
| 136 |
$menus[$i]->unpublished = $count ? $count : '-'; |
$menus[$i]->published = $count->num; |
| 137 |
$count = $menuhandler->getMenuCount($menus[$i]->type, -2); |
} |
| 138 |
$menus[$i]->trash = $count ? $count : '-'; |
} |
| 139 |
|
if ( @!$menus[$i]->published ) { |
| 140 |
|
$menus[$i]->published = '-'; |
| 141 |
|
} |
| 142 |
|
// adds unpublished count |
| 143 |
|
foreach ( $unpublished as $count ) { |
| 144 |
|
if ( $menus[$i]->type == $count->menutype ) { |
| 145 |
|
$menus[$i]->unpublished = $count->num; |
| 146 |
|
} |
| 147 |
|
} |
| 148 |
|
if ( @!$menus[$i]->unpublished ) { |
| 149 |
|
$menus[$i]->unpublished = '-'; |
| 150 |
|
} |
| 151 |
|
// adds trash count |
| 152 |
|
foreach ( $trash as $count ) { |
| 153 |
|
if ( $menus[$i]->type == $count->menutype ) { |
| 154 |
|
$menus[$i]->trash = $count->num; |
| 155 |
|
} |
| 156 |
|
} |
| 157 |
|
if ( @!$menus[$i]->trash ) { |
| 158 |
|
$menus[$i]->trash = '-'; |
| 159 |
|
} |
| 160 |
} |
} |
| 161 |
|
|
| 162 |
require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' ); |
require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' ); |
| 204 |
// block to stop renaming of 'mainmenu' menutype |
// block to stop renaming of 'mainmenu' menutype |
| 205 |
if ( $old_menutype == 'mainmenu' ) { |
if ( $old_menutype == 'mainmenu' ) { |
| 206 |
if ( $menutype <> 'mainmenu' ) { |
if ( $menutype <> 'mainmenu' ) { |
| 207 |
echo "<script> alert('You cannot rename the \'mainmenu\' Menu as this will disrupt the proper operation of Mambo'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot rename the "mainmenu" Menu as this will disrupt the proper operation of Mambo')."); window.history.go(-1); </script>\n"; |
| 208 |
exit; |
exit; |
| 209 |
} |
} |
| 210 |
} |
} |
| 217 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 218 |
$menus = $database->loadResultArray(); |
$menus = $database->loadResultArray(); |
| 219 |
foreach ( $menus as $menu ) { |
foreach ( $menus as $menu ) { |
| 220 |
$params = mosParseParams( $menu ); |
$pparser = new mosParameters($menu); |
| 221 |
|
$params = $pparser->getParams(); |
| 222 |
if ( $params->menutype == $menutype ) { |
if ( $params->menutype == $menutype ) { |
| 223 |
echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('A menu already exists with that name - you must enter a unique Menu Name')."); window.history.go(-1); </script>\n"; |
| 224 |
exit; |
exit; |
| 225 |
} |
} |
| 226 |
} |
} |
| 255 |
exit(); |
exit(); |
| 256 |
} |
} |
| 257 |
|
|
| 258 |
$msg = 'New Menu created [ '. $menutype .' ]'; |
$msg = sprintf(T_('New Menu created [ %s ]'), $menutype); |
| 259 |
break; |
break; |
| 260 |
|
|
| 261 |
default: |
default: |
| 273 |
$row->load( $module ); |
$row->load( $module ); |
| 274 |
|
|
| 275 |
$save = 0; |
$save = 0; |
| 276 |
$params = mosParseParams( $row->params ); |
$pparser = new mosParameters($row->params); |
| 277 |
|
$params = $pparser->getParams(); |
| 278 |
if ( $params->menutype == $old_menutype ) { |
if ( $params->menutype == $old_menutype ) { |
| 279 |
$params->menutype = $menutype; |
$params->menutype = $menutype; |
| 280 |
$save = 1; |
$save = 1; |
| 309 |
$database->query(); |
$database->query(); |
| 310 |
} |
} |
| 311 |
|
|
| 312 |
$msg = 'Menu Items & Modules updated'; |
$msg = T_('Menu Items & Modules updated'); |
| 313 |
break; |
break; |
| 314 |
} |
} |
| 315 |
|
|
| 323 |
global $database; |
global $database; |
| 324 |
|
|
| 325 |
if ( $type == 'mainmenu' ) { |
if ( $type == 'mainmenu' ) { |
| 326 |
echo "<script> alert('You cannot delete the \'mainmenu\' menu as it is core menu'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a core menu')."); window.history.go(-1); </script>\n"; |
| 327 |
exit(); |
exit(); |
| 328 |
} |
} |
| 329 |
|
|
| 330 |
// list of menu items to delete |
// list of menu items to delete |
| 331 |
$menuhandler = mosMenuHandler::getInstance(); |
$query = "SELECT a.name, a.id" |
| 332 |
$items =& $menuhandler->getMenusByType($type); |
. "\n FROM #__menu AS a" |
| 333 |
|
. "\n WHERE ( a.menutype IN ( '$type' ) )" |
| 334 |
|
. "\n ORDER BY a.name" |
| 335 |
|
; |
| 336 |
|
$database->setQuery( $query ); |
| 337 |
|
$items = $database->loadObjectList(); |
| 338 |
|
|
| 339 |
// list of modules to delete |
// list of modules to delete |
| 340 |
$query = "SELECT id" |
$query = "SELECT id" |
| 348 |
foreach ( $mods as $module ) { |
foreach ( $mods as $module ) { |
| 349 |
$row = new mosModule( $database ); |
$row = new mosModule( $database ); |
| 350 |
$row->load( $module ); |
$row->load( $module ); |
| 351 |
|
$pparser = new mosParameters($row->params); |
| 352 |
$params = mosParseParams( $row->params ); |
$params = $pparser->getParams(); |
| 353 |
if ( $params->menutype == $type ) { |
if ( $params->menutype == $type ) { |
| 354 |
$mid[] = $module; |
$mid[] = $module; |
| 355 |
} |
} |
| 373 |
global $database; |
global $database; |
| 374 |
|
|
| 375 |
if ( $type == 'mainmenu' ) { |
if ( $type == 'mainmenu' ) { |
| 376 |
echo "<script> alert('You cannot delete the \'mainmenu\' menu as it is core menu'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a core menu')."); window.history.go(-1); </script>\n"; |
| 377 |
exit(); |
exit(); |
| 378 |
} |
} |
| 379 |
|
|
| 432 |
global $database; |
global $database; |
| 433 |
|
|
| 434 |
// Content Items query |
// Content Items query |
| 435 |
$menuhandler = mosMenuHandler::getInstance(); |
$query = "SELECT a.name, a.id" |
| 436 |
$items =& $menuhandler->getMenusByType($type); |
. "\n FROM #__menu AS a" |
| 437 |
|
. "\n WHERE ( a.menutype IN ( '". $type ."' ) )" |
| 438 |
|
. "\n ORDER BY a.name" |
| 439 |
|
; |
| 440 |
|
$database->setQuery( $query ); |
| 441 |
|
$items = $database->loadObjectList(); |
| 442 |
|
|
| 443 |
HTML_menumanager::showCopy( $option, $type, $items ); |
HTML_menumanager::showCopy( $option, $type, $items ); |
| 444 |
} |
} |
| 461 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 462 |
$menus = $database->loadResultArray(); |
$menus = $database->loadResultArray(); |
| 463 |
foreach ( $menus as $menu ) { |
foreach ( $menus as $menu ) { |
| 464 |
$params = mosParseParams( $menu ); |
$pparser = new mosParameters($menu); |
| 465 |
|
$params = $pparser->getParams(); |
| 466 |
if ( $params->menutype == $menu_name ) { |
if ( $params->menutype == $menu_name ) { |
| 467 |
echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('A menu with that name already exists - you must enter a unique Menu Name')."); window.history.go(-1); </script>\n"; |
| 468 |
exit; |
exit; |
| 469 |
} |
} |
| 470 |
} |
} |
| 524 |
exit(); |
exit(); |
| 525 |
} |
} |
| 526 |
|
|
| 527 |
$msg = 'Copy of Menu `'. $type .'` created, consisting of '. $total .' items'; |
$msg = sprintf(Tn_('Copy of Menu `%s` created, consisting of %d item', 'Copy of Menu `%s` created, consisting of %d items', $total), $type, $total); |
| 528 |
mosRedirect( 'index2.php?option=' . $option, $msg ); |
mosRedirect( 'index2.php?option=' . $option, $msg ); |
| 529 |
} |
} |
| 530 |
|
|