Source for file wrapper.class.php

Documentation is available at wrapper.class.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Menus
  5. @copyright  Refer to copyright.php
  6. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  7. @author Mambo Foundation Inc see README.php
  8. */ 
  9.  
  10. /** ensure this file is being included by a parent file */
  11. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  12.  
  13. /**
  14. * Wrapper class
  15. */
  16. class wrapper_menu {
  17.  
  18.     function edit&$uid$menutype$option {
  19.         global $database$my$mainframe;
  20.         global $mosConfig_absolute_path;
  21.  
  22.         $menu new mosMenu$database );
  23.         $menu->load$uid );
  24.  
  25.         // fail if checked out not by 'me'
  26.         if ($menu->checked_out && $menu->checked_out <> $my->id{
  27.             echo "<script>alert('".sprintf(T_('The module % is currently being edited by another administrator')$menu->title)."'); document.location.href='index2.php?option=$option'</script>\n";
  28.             exit(0);
  29.         }
  30.  
  31.         if $uid {
  32.             $menu->checkout$my->id );
  33.         else {
  34.             $menu->type 'wrapper';
  35.             $menu->menutype $menutype;
  36.             $menu->ordering 9999;
  37.             $menu->parent intvalmosGetParam$_POST'parent') );
  38.             $menu->published 1;
  39.             $menu->link 'index.php?option=com_wrapper';
  40.         }
  41.  
  42.         // build the html select list for ordering
  43.         $lists['ordering']         mosAdminMenus::Ordering$menu$uid );
  44.         // build the html select list for the group access
  45.         $lists['access']         mosAdminMenus::Access$menu );
  46.         // build the html select list for paraent item
  47.         $lists['parent']         mosAdminMenus::Parent$menu );
  48.         // build published button option
  49.         $lists['published']     mosAdminMenus::Published$menu );
  50.         // build the url link output
  51.         $lists['link']         mosAdminMenus::Link$menu$uid );
  52.         
  53.         // get params definitions
  54.         $params =new mosAdminParameters$menu->params$mainframe->getPath'menu_xml'$menu->type )'menu' );
  55.         if $uid {
  56.             $menu->url $params->def'url''' );
  57.         }
  58.  
  59.         wrapper_menu_html::edit$menu$lists$params$option );
  60.     }
  61.  
  62.  
  63.     function saveMenu$option$task {
  64.         global $database;
  65.     
  66.         $params mosGetParam$_POST'params''' );
  67.         $params[urlmosGetParam$_POST'url''' );
  68.         
  69.         if (is_array$params )) {
  70.             $txt array();
  71.             foreach ($params as $k=>$v{
  72.                $txt["$k=$v";
  73.             }
  74.              $_POST['params'mosParameters::textareaHandling$txt );
  75.         }            
  76.  
  77.         $row new mosMenu$database );
  78.     
  79.         if (!$row->bind$_POST )) {
  80.             echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  81.             exit();
  82.         }
  83.     
  84.         if (!$row->check()) {
  85.             echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  86.             exit();
  87.         }
  88.         if (!$row->store()) {
  89.             echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  90.             exit();
  91.         }
  92.         $row->checkin();
  93.         $row->updateOrder"menutype='$row->menutype' AND parent='$row->parent');
  94.         
  95.         
  96.         $msg 'Menu item Saved';
  97.         switch $task {
  98.             case 'apply':
  99.                 mosRedirect'index2.php?option='$option .'&menutype='$row->menutype .'&task=edit&id='$row->id$msg );
  100.                 break;
  101.         
  102.             case 'save':
  103.             default:
  104.                 mosRedirect'index2.php?option='$option .'&menutype='$row->menutype$msg );
  105.             break;
  106.         }
  107.     }
  108. }
  109.  
  110.  
  111. ?>

Documentation generated on Mon, 05 May 2008 16:24:31 +0400 by phpDocumentor 1.4.0