本文整理汇总了PHP中JTableNested::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP JTableNested::delete方法的具体用法?PHP JTableNested::delete怎么用?PHP JTableNested::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTableNested
的用法示例。
在下文中一共展示了JTableNested::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete category record
*
* @author RickG
* @return boolean True on success
* @todo Add check for store and products assinged to category before allowing delete
*/
public function delete($pk = null, $children = true)
{
if (parent::delete($pk, $children)) {
return true;
} else {
return false;
}
}
示例2: delete
public function delete($pk = null, $children = true)
{
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__judirectory_template_styles');
$query->where('template_id =' . $pk);
$db->setQuery($query);
$styleIds = $db->loadColumn();
if ($styleIds) {
$styleTable = JTable::getInstance("Style", "JUDirectoryTable");
foreach ($styleIds as $styleId) {
if (!$styleTable->delete($styleId)) {
return false;
}
}
}
return parent::delete($pk);
}
示例3: delete
/**
* Method to delete a node and, optionally, its child nodes from the table.
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*/
public function delete($pk = null, $children = true)
{
$dispatcher = RFactory::getDispatcher();
// Import plugin types
if ($this->_eventBeforeDelete || $this->_eventAfterDelete) {
foreach ($this->_pluginTypesToImport as $type) {
JPluginHelper::importPlugin($type);
}
}
// Trigger before delete
if ($this->_eventBeforeDelete) {
$results = $dispatcher->trigger($this->_eventBeforeDelete, array($this, $pk, $children));
if (count($results) && in_array(false, $results, true)) {
return false;
}
}
// Delete
if (!parent::delete($pk, $children)) {
return false;
}
// Trigger after delete
if ($this->_eventAfterDelete) {
$results = $dispatcher->trigger($this->_eventAfterDelete, array($this, $pk, $children));
if (count($results) && in_array(false, $results, true)) {
return false;
}
}
return true;
}
示例4: delete
/**
* Method to delete a node and, optionally, its child nodes from the table.
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*
* @since 3.1
*/
public function delete($pk = null, $children = false)
{
$return = parent::delete($pk, $children);
if ($return) {
$helper = new JHelperTags();
$helper->tagDeleteInstances($pk);
}
return $return;
}
示例5: delete
/**
* Override parent delete method to process tags
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*
* @since 3.1
* @throws UnexpectedValueException
*/
public function delete($pk = null, $children = true)
{
$result = parent::delete($pk);
$this->tagsHelper->typeAlias = $this->extension . '.category';
return $result && $this->tagsHelper->deleteTagData($this, $pk);
}
示例6: delete
/**
* Method to delete a node and, optionally, its child nodes from the table.
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*
* @see http://docs.joomla.org/JTableNested/delete
*/
public function delete($pk = null, $children = false)
{
return parent::delete($pk, $children);
}
示例7: delete
/**
* Method to delete a node and, optionally, its child nodes from the table.
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*/
public function delete($pk = null, $children = true)
{
// Before delete
if (!$this->beforeDelete($pk, $children)) {
return false;
}
// Delete
if (!parent::delete($pk, $children)) {
return false;
}
// After delete
if (!$this->afterDelete($pk, $children)) {
return false;
}
return true;
}
示例8: delete
public function delete($pk = null)
{
$db = JFactory::getDbo();
$k = $this->_tbl_key;
$pk = is_null($pk) ? $this->{$k} : $pk;
$this->load($pk);
if ($this->home == 1 || $this->default == 1) {
$this->setError(JText::_('COM_JUDIRECTORY_CAN_NOT_DELETE_DEFAULT_TEMPLATE_STYLE'));
return false;
}
$defaultStyleObject = JUDirectoryFrontHelperTemplate::getDefaultTemplateStyle();
$query = $db->getQuery(true);
$query->update('#__judirectory_categories');
$query->set('style_id = -2');
if ($defaultStyleObject->template_id != $this->template_id) {
$query->set('template_params = ""');
}
$query->where('parent_id = 0');
$query->where('style_id = ' . $pk);
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__judirectory_categories');
$query->where('style_id = ' . $pk);
$db->setQuery($query);
$categoryArrayAssignedToStyle = $db->loadColumn();
$query = $db->getQuery(true);
$query->update('#__judirectory_categories');
$query->set('style_id = -1');
$query->where('parent_id != 0');
$query->where('style_id = ' . $pk);
$db->setQuery($query);
$db->execute();
foreach ($categoryArrayAssignedToStyle as $categoryIdAssignedToStyle) {
$styleObjectOfCategory = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($categoryIdAssignedToStyle);
if ($styleObjectOfCategory->template_id != $this->template_id) {
$query = $db->getQuery(true);
$query->update('#__judirectory_categories');
$query->set('template_params = ""');
$query->where('id = ' . $categoryIdAssignedToStyle);
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true);
$query->update('#__judirectory_listings AS listing');
$query->set('listing.template_params = ""');
$query->join('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id AND listingxref.main = 1');
$query->where('listing.style_id = -1');
$query->where('listingxref.cat_id = ' . $categoryIdAssignedToStyle);
$db->setQuery($query);
$db->execute();
JUDirectoryFrontHelperTemplate::removeTemplateParamsOfInheritedStyleCatListing($categoryIdAssignedToStyle);
}
}
$query = $db->getQuery(true);
$query->select('listing.id');
$query->select('listingxref.cat_id AS cat_id');
$query->from('#__judirectory_listings AS listing');
$query->join('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id AND listingxref.main = 1');
$query->where('listing.style_id = ' . $pk);
$db->setQuery($query);
$listingObjectListAssignedToStyle = $db->loadObjectList();
$catArrayResetTemplateParams = array();
foreach ($listingObjectListAssignedToStyle as $listingObject) {
$styleObjectOfCategory = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($listingObject->cat_id);
if ($styleObjectOfCategory->template_id != $this->template_id) {
$catArrayResetTemplateParams[] = $listingObject->cat_id;
}
}
$catArrayResetTemplateParams = array_unique($catArrayResetTemplateParams);
if (is_array($catArrayResetTemplateParams) && count($catArrayResetTemplateParams)) {
$query = $db->getQuery(true);
$query->update('#__judirectory_listings AS listing');
$query->join('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id AND listingxref.main = 1');
$query->set('listing.template_params = ""');
$query->set('listing.style_id = -1');
$query->where('listingxref.cat_id IN (' . implode(',', $catArrayResetTemplateParams) . ')');
$query->where('listing.style_id = ' . $pk);
$db->setQuery($query);
$db->execute();
}
return parent::delete($pk);
}