/** * The event which runs after deleting a record * * @param DataModel &$model The model which calls this event * @param integer $oid The PK value of the record which was deleted * * @return void * * @throws \Exception Error message if failed to detele tags */ public function onAfterDelete(&$model, $oid) { $this->tagsHelper->typeAlias = $model->getContentType(); if (!$this->tagsHelper->deleteTagData($model, $oid)) { throw new \Exception('Error deleting Tags'); } }
/** * The event which runs after deleting a record * * @param DataModel &$model The model which calls this event * @param integer $oid The PK value of the record which was deleted * * @return boolean True to allow the deletion without errors */ public function onAfterDelete(&$model, $oid) { // If this resource has tags, delete the tags first if ($model->hasTags()) { $tagsHelper = new \JHelperTags(); $tagsHelper->typeAlias = $model->getContentType(); if (!$tagsHelper->deleteTagData($model, $oid)) { throw new \Exception('Error deleting Tags'); } } }
/** * The event which runs after deleting a record * * @param FOFTable &$table The table which calls this event * @param integer $oid The PK value of the record which was deleted * * @return boolean True to allow the deletion without errors */ public function onAfterDelete(&$table, $oid) { // If this resource has tags, delete the tags first if ($table->hasTags()) { $tagsHelper = new JHelperTags(); $tagsHelper->typeAlias = $table->getAssetKey(); if (!$tagsHelper->deleteTagData($table, $oid)) { $table->setError('Error deleting Tags'); return false; } } }
/** * 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); }
/** * Pre-processor for $table->delete($pk) * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * @param string $tableKey The normal key of the table * * @return void * * @throws UnexpectedValueException */ public function onBeforeDelete($pk, $tableKey) { $this->parseTypeAlias(); $this->tagsHelper->deleteTagData($this->table, $pk); }
function deleteListItems($ids) { $this->onExecuteBefore('deleteListItems', array(&$ids)); $tags = new JHelperTags(); $table = $this->getTable('products'); $tags->typeAlias = 'com_ksenmart.product'; foreach ($ids as $id) { $table->load($id); $tags->deleteTagData($table, $id); $query = $this->_db->getQuery(true); $query->delete('#__ksenmart_product_properties_values')->where('product_id=' . $id); $this->_db->setQuery($query); $this->_db->query(); $query = $this->_db->getQuery(true); $query->delete('#__ksenmart_products_categories')->where('product_id=' . $id); $this->_db->setQuery($query); $this->_db->query(); $query = $this->_db->getQuery(true); $query->delete('#__ksenmart_products_child_groups')->where('product_id=' . $id); $this->_db->setQuery($query); $this->_db->query(); $query = $this->_db->getQuery(true); $query->delete('#__ksenmart_products_relations')->where('product_id=' . $id); $this->_db->setQuery($query); $this->_db->query(); $query = $this->_db->getQuery(true); $query->delete('#__ksenmart_products')->where('id=' . $id); $this->_db->setQuery($query); $this->_db->query(); KSMedia::deleteItemMedia($id, 'product'); $query = $this->_db->getQuery(true); $query->select('id')->from('#__ksenmart_products')->where('parent_id=' . $id); $this->_db->setQuery($query); $childs = $this->_db->loadColumn(); if (count($childs) > 0) { $this->deleteListItems($childs); } } $this->onExecuteAfter('deleteListItems', array(&$ids)); return true; }
/** * Override parent delete method to delete tags information. * * @param integer $pk Primary key to delete. * * @return boolean True on success. * * @since 3.1 * @throws UnexpectedValueException */ public function delete($pk = null) { $result = parent::delete($pk); return $result && $this->tagsHelper->deleteTagData($this, $pk); }
/** * Override parent delete method to delete tags information. * * @param integer $pk Primary key to delete. * * @return boolean True on success. * * @since 3.1 * @throws UnexpectedValueException */ public function delete($pk = null) { $result = parent::delete($pk); $this->tagsHelper->typeAlias = 'com_content.article'; return $result && $this->tagsHelper->deleteTagData($this, $pk); }
function deleteUCM($type, $elements) { if (!isset($this->structure[$type]) || !$this->_isCompatible) { return false; } $structure = $this->structure[$type]; $component = 'hikashop'; if (!empty($structure['component'])) { $component = $structure['component']; } $alias = 'com_' . $component . '.' . $structure['table']; $tagsHelper = new JHelperTags(); $tagsHelper->typeAlias = $alias; $id = $structure['id']; $tagsTable = new JHikaShopTagTable($structure, null); $ret = true; foreach ($elements as $element) { if (empty($element)) { continue; } $tagsTable->{$id} = $element; if (!$tagsHelper->deleteTagData($tagsTable, $element)) { $ret = false; } } return $ret; }
/** * Override parent delete method to delete tags information. * * @param integer $pk Primary key to delete. * * @return boolean True on success. * * @since 3.1 * @throws UnexpectedValueException */ public function delete($pk = null) { $result = parent::delete($pk); $this->tagsHelper->typeAlias = 'com_wcatalog.product'; return $result && $this->tagsHelper->deleteTagData($this, $pk); }
/** * Override parent delete method to delete tags information. * * @param integer $pk Primary key to delete. * * @return boolean True on success. * * @since 3.1 * @throws UnexpectedValueException */ public function delete($pk = null) { $result = parent::delete($pk); $this->tagsHelper->typeAlias = 'com_newsfeeds.newsfeed'; return $result && $this->tagsHelper->deleteTagData($this, $pk); }