[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

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

   1  <?php
   2  /**
   3  * @version        $Id: component.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   * Component table
  20   *
  21   * @package     Joomla.Framework
  22   * @subpackage        Table
  23   * @since    1.0
  24   */
  25  class JTableComponent extends JTable
  26  {
  27      /** @var int Primary key */
  28      var $id                    = null;
  29      /** @var string */
  30      var $name                = null;
  31      /** @var string */
  32      var $link                = null;
  33      /** @var int */
  34      var $menuid                = null;
  35      /** @var int */
  36      var $parent                = null;
  37      /** @var string */
  38      var $admin_menu_link    = null;
  39      /** @var string */
  40      var $admin_menu_alt        = null;
  41      /** @var string */
  42      var $option                = null;
  43      /** @var string */
  44      var $ordering            = null;
  45      /** @var string */
  46      var $admin_menu_img        = null;
  47      /** @var int */
  48      var $iscore                = null;
  49      /** @var string */
  50      var $params                = null;
  51      /** @var int */
  52      var $enabled            = null;
  53  
  54      /**
  55      * @param database A database connector object
  56      */
  57  	function __construct( &$db ) {
  58          parent::__construct( '#__components', 'id', $db );
  59      }
  60  
  61      /**
  62       * Loads a data row by option
  63       *
  64       * @param string The component option value
  65       * @return boolean
  66       */
  67  	function loadByOption( $option )
  68      {
  69          $db = &$this->getDBO();
  70          $query = 'SELECT id' .
  71                  ' FROM #__components' .
  72                  ' WHERE ' . $db->nameQuote( 'option' ) . '=' . $db->Quote( $option ) .
  73                  ' AND parent = 0';
  74          $db->setQuery( $query, 0, 1 );
  75          $id = $db->loadResult();
  76  
  77          if ($id === null) {
  78              return false;
  79          } else {
  80              return $this->load( $id );
  81          }
  82      }
  83  
  84      /**
  85       * Validate and filter fields
  86       */
  87  	function check()
  88      {
  89          $this->parent = intval( $this->parent );
  90          $this->ordering = intval( $this->ordering );
  91          return true;
  92      }
  93  
  94      /**
  95      * Overloaded bind function
  96      *
  97      * @access public
  98      * @param array $hash named array
  99      * @return null|string    null is operation was satisfactory, otherwise returns an error
 100      * @see JTable:bind
 101      * @since 1.5
 102      */
 103  	function bind($array, $ignore = '')
 104      {
 105          if (is_array( $array['params'] ))
 106          {
 107              $registry = new JRegistry();
 108              $registry->loadArray($array['params']);
 109              $array['params'] = $registry->toString();
 110          }
 111  
 112          return parent::bind($array, $ignore);
 113      }
 114  }


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