示例#1
0
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     if (isset($this->cat_id) && $this->cat_id) {
         $cat_id = $this->cat_id;
     } elseif ($this->id) {
         $cat_id = JUDirectoryHelper::getListingById($this->id)->cat_id;
     }
     if ($cat_id) {
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('asset_id'));
         $query->from($this->_db->quoteName('#__judirectory_categories'));
         $query->where($this->_db->quoteName('id') . ' = ' . $cat_id);
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     if ($assetId === null) {
         $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_judirectory'));
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
示例#2
0
 /**
  * Get the parent asset id for the record
  *
  * @return	int
  * @since	1.6
  */
 protected function _getAssetParentId($table = null, $id = null)
 {
     // Initialise variables.
     $assetId = null;
     $db = $this->getDbo();
     // This is a article under a category.
     if ($this->catid) {
         // Build the query to get the asset id for the parent category.
         $query = $db->getQuery(true);
         $query->select('asset_id');
         $query->from('#__categories');
         $query->where('id = ' . (int) $this->catid);
         // 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
0
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     if ($this->group_id > 0) {
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('asset_id'));
         $query->from($this->_db->quoteName('#__judirectory_fields_groups'));
         $query->where($this->_db->quoteName('id') . ' = ' . $this->group_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_judirectory'));
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
示例#4
0
 /**
  * Get the parent asset id for the record
  *
  * @return	int
  * @since	1.6
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     // search parent document asset ID
     $this->_db->setQuery('SELECT `asset_id` FROM `#__joomdoc` WHERE `path` = ' . $this->_db->Quote($this->parent_path) . ' ORDER BY `version` DESC');
     if ($parentAssetId = (int) $this->_db->loadResult()) {
         return $parentAssetId;
     }
     // search component asset ID
     $this->_db->setQuery('SELECT `id` FROM `#__assets` WHERE `name` = ' . $this->_db->Quote(JOOMDOC_OPTION));
     if ($parentAssetId = (int) $this->_db->loadResult()) {
         return $parentAssetId;
     }
     // return default parent asset ID
     return parent::_getAssetParentId($table, $id);
 }
示例#5
0
 /**
  * Method to get the parent asset id for the record
  *
  * @param   JTable  $table A JTable object for the asset parent
  * @param   integer $id
  *
  * @return  integer
  */
 protected function getAssetParentId(JTable $table = null, $id = null)
 {
     // Initialise variables.
     $assetId = null;
     $db = $this->getDbo();
     $query = $db->getQuery(true)->select('id')->from('#__assets')->where('name = ' . $db->quote('com_modules'));
     // Get the asset id from the database.
     $db->setQuery($query);
     if ($result = $db->loadResult()) {
         $assetId = (int) $result;
     }
     // Return the asset id.
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
 protected function _getAssetParentId($table = null, $id = null)
 {
     $assetId = null;
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__assets');
     $query->where('name = ' . $db->quote('com_igallery'));
     $db->setQuery($query);
     if ($result = $db->loadResult()) {
         $assetId = (int) $result;
     }
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
示例#7
0
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__assets');
     $query->where('name = "com_judirectory"');
     $db->setQuery($query);
     if ($result = $db->loadResult()) {
         $assetId = (int) $result;
     }
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
示例#8
0
 /**
  * Method to get the parent asset id for the record
  *
  * @param   JTable   $table  A JTable object (optional) for the asset parent
  * @param   integer  $id     The id (optional) of the content.
  *
  * @return  integer
  *
  * @since   11.1
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     // This is a module that needs to parent with the extension.
     if ($assetId === null) {
         // Build the query to get the asset id of the parent component.
         $query = $this->_db->getQuery(true)->select($this->_db->quoteName('id'))->from($this->_db->quoteName('#__assets'))->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote('com_modules'));
         // 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);
     }
 }
示例#9
0
 /**
  * Method to get the parent asset id for the record
  *
  * @param   JTable   $table  A JTable object (optional) for the asset parent
  * @param   integer  $id     The id (optional) of the content.
  *
  * @return  integer
  *
  * @since   11.1
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     // This is a point under a category.
     if ($this->townid) {
         // 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('#__places_point'))->where($this->_db->quoteName('id') . ' = ' . (int) $this->townid);
         // 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);
     }
 }
示例#10
0
 /**
  * Get the parent asset id for the record
  *
  * @return	int
  */
 protected function _getAssetParentId()
 {
     // Initialise variables.
     $assetId = null;
     $db = $this->getDbo();
     // Build the query to get the asset id for the parent category.
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__assets');
     $query->where('name = ' . $db->quote('com_jinc'));
     // Get the asset id from the database.
     $db->setQuery($query);
     if ($result = $db->loadResult()) {
         $assetId = (int) $result;
     }
     // Return the asset id.
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId();
     }
 }
示例#11
0
 /**
  * Method to get the parent asset id for the record
  *
  * @param   JTable   $table  A JTable object (optional) for the asset parent
  * @param   integer  $id     The id (optional) of the content.
  *
  * @return  integer
  *
  * @since   11.1
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     // Initialise variables.
     $assetId = null;
     // Build the query to get the asset id for the component.
     $query = $this->_db->getQuery(true);
     $query->select($this->_db->quoteName('id'));
     $query->from($this->_db->quoteName('#__assets'));
     $query->where($this->_db->quoteName('name') . " LIKE 'com_bwpostman'");
     // 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);
     }
 }
示例#12
0
 /**
  * Get the parent asset id for the record
  *
  * @return	int
  * @since	1.6
  */
 protected function _getAssetParentId($table = null, $id = null)
 {
     // 	Initialise variables.
     $assetId = null;
     $db = $this->getDbo();
     $extension = 'com_solidres';
     // 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 = $db->getQuery(true);
         $query->select('asset_id')->from('#__sr_categories')->where('id = ' . (int) $this->parent_id);
         // Get the asset id from the database.
         $db->setQuery($query);
         if ($result = $db->loadResult()) {
             $assetId = (int) $result;
         }
     } elseif ($assetId === null) {
         // Build the query to get the asset id for the parent category.
         $query = $db->getQuery(true);
         $query->select('id')->from('#__assets')->where('name = ' . $db->quote($extension));
         // Get the asset id from the database.
         $db->setQuery($query);
         if ($result = $db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     // Return the asset id.
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
示例#13
0
文件: type.php 项目: adjaika/J3Base
 /**
  * Method to get the parent asset under which to register this one.
  * By default, all assets are registered to the ROOT node with ID,
  * which will default to 1 if none exists.
  * The extended class can define a table and id to lookup.  If the
  * asset does not exist it will be created.
  *
  * @param   JTable   $table  A JTable object for the asset parent.
  * @param   integer  $id     Id to look up
  *
  * @return  integer
  *
  * @since   3.6
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     $asset = JTable::getInstance('asset');
     if ($asset->loadByName('com_menus')) {
         $assetId = $asset->id;
     }
     return is_null($assetId) ? parent::_getAssetParentId($table, $id) : $assetId;
 }
示例#14
0
 /**         
  * Method to get the asset-parent-id of the item         
  *         
  * @return      int         
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     // We will retrieve the parent-asset from the visforms table
     $assetId = null;
     $fid = $this->fid;
     if ($fid > 0) {
         // Build the query to get the asset id for the parent category.
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('asset_id'));
         $query->from($this->_db->quoteName('#__visforms'));
         $query->where($this->_db->quoteName('id') . ' = ' . (int) $fid);
         // Get the asset id from the database.
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     } else {
         //use component as default
         $assetParent = JTable::getInstance('Asset');
         // Default: if no asset-parent can be found we take the global asset
         $assetId = $assetParent->getRootId();
         // The item has the component as asset-parent
         $assetParent->loadByName('com_visforms');
         // Return the found asset-parent-id
         if ($assetParent->id) {
             $assetId = $assetParent->id;
         }
     }
     // Return the asset id.
     if ($assetId) {
         return $assetId;
     }
     return parent::_getAssetParentId($table, $id);
 }
示例#15
0
 /**
  * Get the parent asset id for the record
  *
  * @return      int
  * @since       1.6
  */
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     // Initialise variables.
     $assetId = null;
     // This is a project under a department.
     if ($this->parent_id_key) {
         // Build the query to get the asset id for the parent category.
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('asset_id'));
         $query->from($this->_db->quoteName('#__parent_item_table'));
         $query->where($this->_db->quoteName('id') . ' = ' . (int) $this->parent_id_key);
         // 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;
     }
     return parent::_getAssetParentId($table, $id);
 }
示例#16
0
 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $parts = DPFieldsHelper::extract($this->context);
     $component = $parts ? $parts[0] : null;
     if ($component) {
         // 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($component));
         // Get the asset id from the database.
         $this->_db->setQuery($query);
         $assetId = null;
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
             if ($assetId) {
                 return $assetId;
             }
         }
     }
     return parent::_getAssetParentId($table, $id);
 }