[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: wrapper.class.php 4544 2006-08-15 13:49:12Z predator $ 4 * @package Joomla 5 * @subpackage Menus 6 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 7 * @license http://www.gnu.org/copyleft/gpl.html 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 // no direct access 16 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 17 18 /** 19 * Wrapper class 20 * @package Joomla 21 * @subpackage Menus 22 */ 23 class wrapper_menu { 24 25 function edit( &$uid, $menutype, $option ) { 26 global $database, $my, $mainframe; 27 28 $menu = new mosMenu( $database ); 29 $menu->load( (int)$uid ); 30 31 // fail if checked out not by 'me' 32 if ($menu->checked_out && $menu->checked_out != $my->id) { 33 mosErrorAlert( "The module ".$menu->title." is currently being edited by another administrator" ); 34 } 35 36 if ( $uid ) { 37 $menu->checkout( $my->id ); 38 } else { 39 $menu->type = 'wrapper'; 40 $menu->menutype = $menutype; 41 $menu->ordering = 9999; 42 $menu->parent = intval( mosGetParam( $_POST, 'parent', 0 ) ); 43 $menu->published = 1; 44 $menu->link = 'index.php?option=com_wrapper'; 45 } 46 47 // build the html select list for ordering 48 $lists['ordering'] = mosAdminMenus::Ordering( $menu, $uid ); 49 // build the html select list for the group access 50 $lists['access'] = mosAdminMenus::Access( $menu ); 51 // build the html select list for paraent item 52 $lists['parent'] = mosAdminMenus::Parent( $menu ); 53 // build published button option 54 $lists['published'] = mosAdminMenus::Published( $menu ); 55 // build the url link output 56 $lists['link'] = mosAdminMenus::Link( $menu, $uid ); 57 58 // get params definitions 59 $params = new mosParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' ); 60 if ( $uid ) { 61 $menu->url = $params->def( 'url', '' ); 62 } 63 64 wrapper_menu_html::edit( $menu, $lists, $params, $option ); 65 } 66 67 68 function saveMenu( $option, $task ) { 69 global $database; 70 71 $params = mosGetParam( $_POST, 'params', '' ); 72 $params[url] = mosGetParam( $_POST, 'url', '' ); 73 74 if (is_array( $params )) { 75 $txt = array(); 76 foreach ($params as $k=>$v) { 77 $txt[] = "$k=$v"; 78 } 79 $_POST['params'] = mosParameters::textareaHandling( $txt ); 80 } 81 82 $row = new mosMenu( $database ); 83 84 if (!$row->bind( $_POST )) { 85 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 86 exit(); 87 } 88 89 if (!$row->check()) { 90 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 91 exit(); 92 } 93 if (!$row->store()) { 94 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 95 exit(); 96 } 97 $row->checkin(); 98 $row->updateOrder( 'menutype = ' . $database->Quote( $row->menutype ) . ' AND parent = ' . (int) $row->parent ); 99 100 101 $msg = 'Menu item Saved'; 102 switch ( $task ) { 103 case 'apply': 104 mosRedirect( 'index2.php?option='. $option .'&menutype='. $row->menutype .'&task=edit&id='. $row->id, $msg ); 105 break; 106 107 case 'save': 108 default: 109 mosRedirect( 'index2.php?option='. $option .'&menutype='. $row->menutype, $msg ); 110 break; 111 } 112 } 113 } 114 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |