| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: menutypes.php 18162 2010-07-16 07:00:47Z ian $ 4 * @package Joomla.Framework 5 * @subpackage Table 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license 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 // Check to ensure this file is within the rest of the framework 16 defined('JPATH_BASE') or die(); 17 18 /** 19 * Menu Types table 20 * 21 * @package Joomla.Framework 22 * @subpackage Table 23 * @since 1.5 24 */ 25 class JTableMenuTypes extends JTable 26 { 27 /** @var int Primary key */ 28 var $id = null; 29 /** @var string */ 30 var $menutype = null; 31 /** @var string */ 32 var $title = null; 33 /** @var string */ 34 var $description = null; 35 36 /** 37 * Constructor 38 * 39 * @access protected 40 * @param database A database connector object 41 */ 42 function __construct( &$db ) 43 { 44 parent::__construct( '#__menu_types', 'id', $db ); 45 } 46 47 /** 48 * @return boolean 49 */ 50 function check() 51 { 52 $this->menutype = JFilterInput::clean($this->menutype, 'menutype'); 53 if (empty($this->menutype)) { 54 $this->setError( "Cannot save: Empty menu type" ); 55 return false; 56 } 57 58 // correct spurious data 59 if (trim( $this->title) == '') { 60 $this->title = $this->menutype; 61 } 62 63 $db =& JFactory::getDBO(); 64 65 // check for unique menutype for new menu copy 66 $query = 'SELECT menutype' . 67 ' FROM #__menu_types'; 68 if ($this->id) { 69 $query .= ' WHERE id != '.(int) $this->id; 70 } 71 72 $db->setQuery( $query ); 73 $menus = $db->loadResultArray(); 74 75 foreach ($menus as $menutype) 76 { 77 if ($menutype == $this->menutype) 78 { 79 $this->setError( "Cannot save: Duplicate menu type '{$this->menutype}'" ); 80 return false; 81 } 82 } 83 84 return true; 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |