[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_menus/weblink_category_table/ -> weblink_category_table.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  class weblink_category_table_menu {
  21  
  22      /**
  23      * @param database A database connector object
  24      * @param integer The unique id of the category to edit (0 if new)
  25      */
  26  	function editCategory( $uid, $menutype, $option ) {
  27          global $database, $my, $mainframe;
  28          global $mosConfig_absolute_path;
  29  
  30          $menu = new mosMenu( $database );
  31          $menu->load( $uid );
  32  
  33          // fail if checked out not by 'me'
  34          if ($menu->checked_out && $menu->checked_out <> $my->id) {
  35              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";
  36              exit(0);
  37          }
  38  
  39          if ( $uid ) {
  40              $menu->checkout( $my->id );
  41          } else {
  42              $menu->type = 'weblink_category_table';
  43              $menu->menutype = $menutype;
  44              $menu->ordering = 9999;
  45              $menu->parent = intval( mosGetParam( $_POST, 'parent', 0 ) );
  46              $menu->published = 1;
  47          }
  48  
  49          // build list of categories
  50          $lists['componentid']    = mosAdminMenus::ComponentCategory( 'componentid', 'com_weblinks', intval( $menu->componentid ), NULL, 'ordering', 5, 0 ); 
  51          if ( $uid ) {
  52              // @RawSQLUse, trivial_implementation, SELECT, CONCEPT
  53              $query = "SELECT name"
  54              . "\n FROM #__categories"
  55              . "\n WHERE section = 'com_weblinks'"
  56              . "\n AND published = '1'"
  57              . "\n AND id = ". $menu->componentid
  58              ;
  59              $database->setQuery( $query );
  60              $category = $database->loadResult();
  61              $lists['componentid'] = '<input type="hidden" name="componentid" value="'. $menu->componentid .'" />'. $category;
  62          }
  63  
  64          // build the html select list for ordering
  65          $lists['ordering']         = mosAdminMenus::Ordering( $menu, $uid );
  66          // build the html select list for the group access
  67          $lists['access']         = mosAdminMenus::Access( $menu );
  68          // build the html select list for paraent item
  69          $lists['parent']         = mosAdminMenus::Parent( $menu );
  70          // build published button option
  71          $lists['published']     = mosAdminMenus::Published( $menu );
  72          // build the url link output
  73          $lists['link']         = mosAdminMenus::Link( $menu, $uid );
  74          
  75          // get params definitions
  76          $params =& new mosAdminParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' );
  77  
  78          weblink_category_table_menu_html::editCategory( $menu, $lists, $params, $option );
  79      }
  80  }
  81  ?>