本文整理汇总了PHP中JTableNested::_getAssetParentId方法的典型用法代码示例。如果您正苦于以下问题:PHP JTableNested::_getAssetParentId方法的具体用法?PHP JTableNested::_getAssetParentId怎么用?PHP JTableNested::_getAssetParentId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTableNested
的用法示例。
在下文中一共展示了JTableNested::_getAssetParentId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getAssetParentId
/**
* Get the parent asset id for the record
*
* @return int
*/
protected function _getAssetParentId()
{
// Initialise variables.
$assetId = null;
// This is a category under a category.
if ($this->parent_id > 1) {
// Build the query to get the asset id for the parent category.
$query = new JQuery();
$query->select('asset_id');
$query->from('#__categories');
$query->where('id = ' . (int) $this->parent_id);
// Get the asset id from the database.
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
} elseif ($assetId === null) {
// Build the query to get the asset id for the parent category.
$query = new JQuery();
$query->select('id');
$query->from('#__assets');
$query->where('name = ' . $this->_db->quote($this->extension));
// Get the asset id from the database.
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
}
// Return the asset id.
if ($assetId) {
return $assetId;
} else {
return parent::_getAssetParentId();
}
}
示例2: _getAssetParentId
/**
* Get the parent asset id for the record
*
* @param JTable $table A JTable object for the asset parent.
* @param integer $id The id for the asset
*
* @return integer The id of the asset's parent
*
* @since 11.1
*/
protected function _getAssetParentId(JTable $table = null, $id = null)
{
$assetId = null;
// This is a category under a category.
if ($this->parent_id > 1) {
// Build the query to get the asset id for the parent category.
$query = $this->_db->getQuery(true)->select($this->_db->quoteName('asset_id'))->from($this->_db->quoteName('#__categories'))->where($this->_db->quoteName('id') . ' = ' . $this->parent_id);
// Get the asset id from the database.
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
} elseif ($assetId === null) {
// Build the query to get the asset id for the parent category.
$query = $this->_db->getQuery(true)->select($this->_db->quoteName('id'))->from($this->_db->quoteName('#__assets'))->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($this->extension));
// Get the asset id from the database.
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
}
// Return the asset id.
if ($assetId) {
return $assetId;
} else {
return parent::_getAssetParentId($table, $id);
}
}
示例3: _getAssetParentId
protected function _getAssetParentId(JTable $table = null, $id = null)
{
$assetId = null;
if ($this->parent_id > 0) {
$query = $this->_db->getQuery(true);
$query->select($this->_db->quoteName('asset_id'));
$query->from($this->_db->quoteName('#__judownload_categories'));
$query->where($this->_db->quoteName('id') . ' = ' . $this->parent_id);
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
}
if (!$assetId) {
$query = $this->_db->getQuery(true);
$query->select($this->_db->quoteName('id'));
$query->from($this->_db->quoteName('#__assets'));
$query->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote('com_judownload'));
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult()) {
$assetId = (int) $result;
}
}
if ($assetId) {
return $assetId;
} else {
return parent::_getAssetParentId($table, $id);
}
}