[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

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

   1  <?php
   2  /**
   3   * @package     Joomla.Platform
   4   * @subpackage  Database
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  defined('JPATH_PLATFORM') or die;
  11  
  12  jimport('joomla.database.table');
  13  
  14  /**
  15   * Update table
  16   * Stores updates temporarily
  17   *
  18   * @package     Joomla.Platform
  19   * @subpackage  Table
  20   * @since       11.1
  21   */
  22  class JTableUpdate extends JTable
  23  {
  24      /**
  25       * Constructor
  26       *
  27       * @param   JDatabase  &$db  A database connector object
  28       *
  29       * @since   11.1
  30       */
  31  	public function __construct(&$db)
  32      {
  33          parent::__construct('#__updates', 'update_id', $db);
  34      }
  35  
  36      /**
  37       * Overloaded check function
  38       *
  39       * @return  boolean  True if the object is ok
  40       *
  41       * @see     JTable::check
  42       * @since   11.1
  43       */
  44  	public function check()
  45      {
  46          // check for valid name
  47          if (trim($this->name) == '' || trim($this->element) == '')
  48          {
  49              $this->setError(JText::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_EXTENSION'));
  50              return false;
  51          }
  52          return true;
  53      }
  54  
  55      /**
  56       * Overloaded bind function
  57       *
  58       * @param   array  $array   Named array
  59       * @param   mixed  $ignore  An optional array or space separated list of properties
  60       * to ignore while binding.
  61       *
  62       * @return  mixed  Null if operation was satisfactory, otherwise returns an error
  63       *
  64       * @see     JTable::bind
  65       * @since   11.1
  66       */
  67  	public function bind($array, $ignore = '')
  68      {
  69          if (isset($array['params']) && is_array($array['params']))
  70          {
  71              $registry = new JRegistry;
  72              $registry->loadArray($array['params']);
  73              $array['params'] = (string) $registry;
  74          }
  75  
  76          if (isset($array['control']) && is_array($array['control']))
  77          {
  78              $registry = new JRegistry;
  79              $registry->loadArray($array['control']);
  80              $array['control'] = (string) $registry;
  81          }
  82  
  83          return parent::bind($array, $ignore);
  84      }
  85  
  86      /**
  87       * Method to create and execute a SELECT WHERE query.
  88       *
  89       * @param   array  $options  Array of options
  90       *
  91       * @return  JDatabase  Results of query
  92       *
  93       * @since   11.1
  94       */
  95  	public function find($options = array())
  96      {
  97          $where = array();
  98          foreach ($options as $col => $val)
  99          {
 100              $where[] = $col . ' = ' . $this->_db->Quote($val);
 101          }
 102          $query = $this->_db->getQuery(true);
 103          $query->select($this->_db->quoteName($this->_tbl_key));
 104          $query->from($this->_db->quoteName($this->_tbl));
 105          $query->where(implode(' AND ', $where));
 106          $this->_db->setQuery($query);
 107          return $this->_db->loadResult();
 108      }
 109  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1