[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_menus/component_item_link/ -> component_item_link.class.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Menus
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  /**
  21  * Component item link class
  22  */
  23  class component_item_link_menu {
  24  
  25  	function edit( &$uid, $menutype, $option ) {
  26          global $database, $my, $mainframe;
  27      
  28          $menu = new mosMenu( $database );
  29          $menu->load( $uid );
  30      
  31          // fail if checked out not by 'me'
  32          if ($menu->checked_out && $menu->checked_out <> $my->id) {
  33              echo "<script>alert('".sprintf(T_('The module %s is currently being edited by another administrator'),$menu->title )."'); document.location.href='index2.php?option=$option'</script>\n";
  34              exit(0);
  35          }
  36      
  37          if ( $uid ) {
  38              $menu->checkout( $my->id );
  39          } else {
  40              // load values for new entry
  41              $menu->type = 'component_item_link';
  42              $menu->menutype = $menutype;
  43              $menu->browserNav = 0;
  44              $menu->ordering = 9999;
  45              $menu->parent = intval( mosGetParam( $_POST, 'parent', 0 ) );
  46              $menu->published = 1;
  47          }
  48      
  49          if ( $uid ) {
  50              $temp = explode( '&Itemid=', $menu->link );
  51              // @RawSQLUse, trivial_implementation, SELECT
  52               $query = "SELECT a.name"
  53              . "\n FROM #__menu AS a"
  54              . "\n WHERE a.link = '". $temp[0] ."'"
  55              ;
  56              $database->setQuery( $query );
  57              $components = $database->loadResult();
  58              $lists['components'] =  $components;
  59              $lists['components'] .= '<input type="hidden" name="link" value="'. $menu->link .'" />';
  60          } else {
  61              $query = "SELECT CONCAT( a.link, '&amp;Itemid=', a.id ) AS value, a.name AS text"
  62              . "\n FROM #__menu AS a"
  63              . "\n WHERE a.published = '1'"
  64              . "\n AND a.type = 'components'"
  65              . "\n ORDER BY a.menutype, a.name"
  66              ;
  67              $database->setQuery( $query );
  68              $components = $database->loadObjectList( );
  69      
  70              //    Create a list of links
  71              $lists['components'] = mosHTML::selectList( $components, 'link', 'class="inputbox" size="10"', 'value', 'text', '' );
  72          }
  73      
  74          // build html select list for target window
  75          $lists['target']         = mosAdminMenus::Target( $menu );
  76      
  77          // build the html select list for ordering
  78          $lists['ordering']         = mosAdminMenus::Ordering( $menu, $uid );
  79          // build the html select list for the group access
  80          $lists['access']         = mosAdminMenus::Access( $menu );
  81          // build the html select list for paraent item
  82          $lists['parent']         = mosAdminMenus::Parent( $menu );
  83          // build published button option
  84          $lists['published']     = mosAdminMenus::Published( $menu );
  85          // build the url link output
  86          $lists['link']         = mosAdminMenus::Link( $menu, $uid, 1 );
  87          
  88          // get params definitions
  89          $params =& new mosAdminParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' );
  90      
  91          component_item_link_menu_html::edit( $menu, $lists, $params, $option );
  92      }
  93  }
  94  ?>