[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_banners/tables/ -> banner.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: banner.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Banners
   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  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  /**
  19   * @package        Joomla
  20   * @subpackage    Banners
  21   */
  22  class TableBanner extends JTable
  23  {
  24      /** @var int */
  25      var $bid                = null;
  26      /** @var int */
  27      var $cid                = null;
  28      /** @var string */
  29      var $type                = '';
  30      /** @var string */
  31      var $name                = '';
  32      /** @var string */
  33      var $alias                = '';
  34      /** @var int */
  35      var $imptotal            = 0;
  36      /** @var int */
  37      var $impmade            = 0;
  38      /** @var int */
  39      var $clicks                = 0;
  40      /** @var string */
  41      var $imageurl            = '';
  42      /** @var string */
  43      var $clickurl            = '';
  44      /** @var date */
  45      var $date                = null;
  46      /** @var int */
  47      var $showBanner            = 0;
  48      /** @var int */
  49      var $checked_out        = 0;
  50      /** @var date */
  51      var $checked_out_time    = 0;
  52      /** @var string */
  53      var $editor                = '';
  54      /** @var string */
  55      var $custombannercode    = '';
  56      /** @var int */
  57      var $catid                = null;
  58      /** @var string */
  59      var $description        = null;
  60      /** @var int */
  61      var $sticky                = null;
  62      /** @var int */
  63      var $ordering            = null;
  64      /** @var date */
  65      var $publish_up            = null;
  66      /** @var date */
  67      var $publish_down        = null;
  68      /** @var string */
  69      var $tags                = null;
  70      /** @var string */
  71      var $params                = null;
  72  
  73  	function __construct( &$_db )
  74      {
  75          parent::__construct( '#__banner', 'bid', $_db );
  76  
  77  
  78          $now =& JFactory::getDate();
  79          $this->set( 'date', $now->toMySQL() );
  80      }
  81  
  82  	function clicks()
  83      {
  84          $query = 'UPDATE #__banner'
  85          . ' SET clicks = ( clicks + 1 )'
  86          . ' WHERE bid = ' . (int) $this->bid
  87          ;
  88          $this->_db->setQuery( $query );
  89          $this->_db->query();
  90      }
  91  
  92      /**
  93       * Overloaded check function
  94       *
  95       * @access public
  96       * @return boolean
  97       * @see JTable::check
  98       * @since 1.5
  99       */
 100  	function check()
 101      {
 102          // check for valid client id
 103          if (is_null($this->cid) || $this->cid == 0) {
 104              $this->setError(JText::_( 'BNR_CLIENT' ));
 105              return false;
 106          }
 107  
 108          // check for valid name
 109          if(trim($this->name) == '') {
 110              $this->setError(JText::_( 'BNR_NAME' ));
 111              return false;
 112          }
 113  
 114          if(empty($this->alias)) {
 115              $this->alias = $this->name;
 116          }
 117          $this->alias = JFilterOutput::stringURLSafe($this->alias);
 118  
 119          /*if(trim($this->imageurl) == '') {
 120              $this->setError(JText::_( 'BNR_IMAGE' ));
 121              return false;
 122          }
 123          if(trim($this->clickurl) == '' && trim($this->custombannercode) == '') {
 124              $this->setError(JText::_( 'BNR_URL' ));
 125              return false;
 126          }*/
 127  
 128          return true;
 129      }
 130  }
 131  ?>


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