Support Joomla!

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.
Source code for file /joomla/database/table/section.php

Documentation is available at section.php

  1. <?php
  2. /**
  3. @version        $Id: section.php 10381 2008-06-01 03:35:53Z pasamio $
  4. @package        Joomla.Framework
  5. @subpackage    Table
  6. @copyright    Copyright (C) 2005 - 2008 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.  * Section table
  20.  *
  21.  * @package     Joomla.Framework
  22.  * @subpackage        Table
  23.  * @since    1.0
  24.  */
  25. class JTableSection extends JTable
  26. {
  27.     /** @var int Primary key */
  28.     var $id                    = null;
  29.     /** @var string The menu title for the section (a short name)*/
  30.     var $title                = null;
  31.     /** @var string The full name for the section*/
  32.     var $name                = null;
  33.     /** @var string The alias for the section*/
  34.     var $alias                = null;
  35.     /** @var string */
  36.     var $image                = null;
  37.     /** @var string */
  38.     var $scope                = null;
  39.     /** @var int */
  40.     var $image_position        = null;
  41.     /** @var string */
  42.     var $description        = null;
  43.     /** @var boolean */
  44.     var $published            = null;
  45.     /** @var boolean */
  46.     var $checked_out        = 0;
  47.     /** @var time */
  48.     var $checked_out_time    = 0;
  49.     /** @var int */
  50.     var $ordering            = null;
  51.     /** @var int */
  52.     var $access                = null;
  53.     /** @var string */
  54.     var $params                = null;
  55.  
  56.     /**
  57.     * @param database A database connector object
  58.     */
  59.     function __construct&$db {
  60.         parent::__construct'#__sections''id'$db );
  61.     }
  62.  
  63.     /** Overloaded check function
  64.      *
  65.      * @access public
  66.      * @return boolean 
  67.      * @see JTable::check
  68.      * @since 1.5
  69.      */
  70.     function check()
  71.     {
  72.         // check for valid name
  73.         if (trim$this->title == ''{
  74.             $this->setErrorJText::_'SECTION MUST HAVE A TITLE') );
  75.             return false;
  76.         }
  77.  
  78.         // check for existing name
  79.         /*$query = "SELECT id"
  80.         . ' FROM #__sections "
  81.         . ' WHERE title = '. $this->_db->Quote($this->title)
  82.         . ' AND scope = ' . $this->_db->Quote($this->scope)
  83.         ;
  84.         $this->_db->setQuery( $query );
  85.  
  86.         $xid = intval( $this->_db->loadResult() );
  87.         if ($xid && $xid != intval( $this->id )) {
  88.             $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Section') );
  89.             return false;
  90.         }*/
  91.  
  92.         if(empty($this->alias)) {
  93.             $this->alias = $this->title;
  94.         }
  95.         $this->alias = JFilterOutput::stringURLSafe($this->alias);
  96.         if(trim(str_replace('-','',$this->alias)) == ''{
  97.             $datenow =JFactory::getDate();
  98.             $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
  99.         }
  100.  
  101.         return true;
  102.     }
  103.  
  104.     /**
  105.     * Overloaded bind function
  106.     *
  107.     * @access public
  108.     * @param array $hash named array
  109.     * @return null|string   null is operation was satisfactory, otherwise returns an error
  110.     * @see JTable:bind
  111.     * @since 1.5
  112.     */
  113.     function bind($array$ignore '')
  114.     {
  115.         if (isset$array['params'&& is_array($array['params']))
  116.         {
  117.             $registry new JRegistry();
  118.             $registry->loadArray($array['params']);
  119.             $array['params'$registry->toString();
  120.         }
  121.  
  122.         return parent::bind($array$ignore);
  123.     }
  124. }

Documentation generated on Sat, 14 Nov 2009 11:18:36 +0000 by phpDocumentor 1.3.1