[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/database/table/ -> category.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: category.php 14401 2010-01-26 14:10:00Z louis $
   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   * Category table
  20   *
  21   * @package     Joomla.Framework
  22   * @subpackage        Table
  23   * @since    1.0
  24   */
  25  class JTableCategory extends JTable
  26  {
  27      /** @var int Primary key */
  28      var $id                    = null;
  29      /** @var int */
  30      var $parent_id            = null;
  31      /** @var string The menu title for the category (a short name)*/
  32      var $title                = null;
  33      /** @var string The full name for the category*/
  34      var $name                = null;
  35      /** @var string The the alias for the category*/
  36      var $alias                = null;
  37      /** @var string */
  38      var $image                = null;
  39      /** @var string */
  40      var $section                = null;
  41      /** @var int */
  42      var $image_position        = null;
  43      /** @var string */
  44      var $description            = null;
  45      /** @var boolean */
  46      var $published            = null;
  47      /** @var boolean */
  48      var $checked_out            = 0;
  49      /** @var time */
  50      var $checked_out_time        = 0;
  51      /** @var int */
  52      var $ordering            = null;
  53      /** @var int */
  54      var $access                = null;
  55      /** @var string */
  56      var $params                = null;
  57  
  58      /**
  59      * @param database A database connector object
  60      */
  61  	function __construct( &$db )
  62      {
  63          parent::__construct( '#__categories', 'id', $db );
  64      }
  65  
  66      /**
  67       * Overloaded check function
  68       *
  69       * @access public
  70       * @return boolean
  71       * @see JTable::check
  72       * @since 1.5
  73       */
  74  	function check()
  75      {
  76          // check for valid name
  77          if (trim( $this->title ) == '') {
  78              $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Category') ));
  79              return false;
  80          }
  81  
  82          // check for existing name
  83          /*$query = 'SELECT id'
  84          . ' FROM #__categories '
  85          . ' WHERE title = '.$this->_db->Quote($this->title)
  86          . ' AND section = '.$this->_db->Quote($this->section)
  87          ;
  88          $this->_db->setQuery( $query );
  89  
  90          $xid = intval( $this->_db->loadResult() );
  91          if ($xid && $xid != intval( $this->id )) {
  92              $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Category') );
  93              return false;
  94          }*/
  95  
  96          if(empty($this->alias)) {
  97              $this->alias = $this->title;
  98          }
  99          $this->alias = JFilterOutput::stringURLSafe($this->alias);
 100          if(trim(str_replace('-','',$this->alias)) == '') {
 101              $datenow =& JFactory::getDate();
 102              $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
 103          }
 104  
 105          return true;
 106      }
 107  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1