当前位置: 首页>>代码示例>>PHP>>正文


PHP JTableNested::_getAssetParentId方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:joebushi,项目名称:joomla,代码行数:40,代码来源:category.php

示例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);
     }
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:38,代码来源:category.php

示例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);
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:29,代码来源:category.php


注:本文中的JTableNested::_getAssetParentId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。