<?php
/**
* @package Joomla.Platform
* @subpackage Database
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
jimport('joomla.database.tablenested');
/**
* Table class supporting modified pre-order tree traversal behavior.
*
* @package Joomla.Platform
* @subpackage Database
* @link http://docs.joomla.org/JTableAsset
* @since 11.1
*/
class JTableAsset extends JTableNested
{
/**
* The primary key of the asset.
*
* @var integer
* @since 11.1
*/
public $id = null;
/**
* The unique name of the asset.
*
* @var string
* @since 11.1
*/
public $name = null;
/**
* The human readable title of the asset.
*
* @var string
* @since 11.1
*/
public $title = null;
/**
* The rules for the asset stored in a JSON string
*
* @var string
* @since 11.1
*/
public $rules = null;
/**
* Constructor
*
* @param JDatabase &$db A database connector object
*
* @since 11.1
*/
public function __construct(&$db)
{
parent::__construct('#__assets', 'id', $db);
}
/**
* Method to load an asset by it's name.
*
* @param string $name The name of the asset.
*
* @return integer
*
* @since 11.1
*/
public function loadByName($name)
{
// Get the JDatabaseQuery object
$query = $this->_db->getQuery(true);
// Get the asset id for the asset.
$query->select($this->_db->quoteName('id'));
$query->from($this->_db->quoteName('#__assets'));
$query->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($name));
$this->_db->setQuery($query);
$assetId = (int) $this->_db->loadResult();
if (empty($assetId))
{
return false;
}
// Check for a database error.
if ($error = $this->_db->getErrorMsg())
{
$this->setError($error);
return false;
}
return $this->load($assetId);
}
/**
* Asset that the nested set data is valid.
*
* @return boolean True if the instance is sane and able to be stored in the database.
*
* @link http://docs.joomla.org/JTable/check
* @since 11.1
*/
public function check()
{
$this->parent_id = (int) $this->parent_id;
// JTableNested does not allow parent_id = 0, override this.
if ($this->parent_id > 0)
{
// Get the JDatabaseQuery object
$query = $this->_db->getQuery(true);
$query->select('COUNT(id)');
$query->from($this->_db->quoteName($this->_tbl));
$query->where($this->_db->quoteName('id') . ' = ' . $this->parent_id);
$this->_db->setQuery($query);
if ($this->_db->loadResult())
{
return true;
}
else
{
if ($error = $this->_db->getErrorMsg())
{
$this->setError($error);
}
else
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_INVALID_PARENT_ID'));
}
return false;
}
}
return true;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| asset.php | 2013-03-01 19:55 | 2.88 KB | 76129f60960:kunden | -xw-x----- | |
| category.php | 2013-03-01 19:55 | 5.34 KB | 76129f60960:kunden | -xw-x----- | |
| content.php | 2013-03-01 19:55 | 9.94 KB | 76129f60960:kunden | -xw-x----- | |
| extension.php | 2013-03-01 19:55 | 4.85 KB | 76129f60960:kunden | -xw-x----- | |
| index.html | 2013-03-01 19:55 | 31 B | 76129f60960:kunden | -xw-x----- | |
| language.php | 2013-03-01 19:55 | 2.05 KB | 76129f60960:kunden | -xw-x----- | |
| menu.php | 2013-03-01 19:55 | 5.7 KB | 76129f60960:kunden | -xw-x----- | |
| menutype.php | 2013-03-01 19:55 | 7.54 KB | 76129f60960:kunden | -xw-x----- | |
| module.php | 2013-03-01 19:55 | 1.95 KB | 76129f60960:kunden | -xw-x----- | |
| session.php | 2013-03-01 19:55 | 4.52 KB | 76129f60960:kunden | -xw-x----- | |
| update.php | 2013-03-01 19:55 | 2.42 KB | 76129f60960:kunden | -xw-x----- | |
| user.php | 2013-03-01 19:55 | 12.51 KB | 76129f60960:kunden | -xw-x----- | |
| usergroup.php | 2013-03-01 19:55 | 6.6 KB | 76129f60960:kunden | -xw-x----- | |
| viewlevel.php | 2013-03-01 19:55 | 1.46 KB | 76129f60960:kunden | -xw-x----- | |