/** * Remove tag from tag group * * @param int $tag_id * @param int $group_id */ public function remove_tag_from_group($tag_id, $group_id) { if (!vivvo_hooks_manager::call('tag_removeTagFromGroup', array(&$tag_id, &$group_id))) { return vivvo_hooks_manager::get_status(); } $user = vivvo_lite_site::get_instance()->user; if ($user && $user->can('MANAGE_TAGS')) { $tag_group_rel = new TagsToTagsGroups_list(); $tag_group_rel->get_rel($tag_id, $group_id); if ($tag_group_rel->sql_delete_list($this->_post_master)) { return true; } $this->set_error_code(2416); return false; } $this->set_error_code(2410); return false; }
function on_delete($post_master) { require_once dirname(__FILE__) . '/TagsToTagsGroups.class.php'; $list = new TagsToTagsGroups_list(); $list->get_rel_by_group_id($this->id); $list->sql_delete_list($post_master); vivvo_lite_site::get_instance()->get_url_manager()->unregister_url(urlencode($this->url)); // THE REST OF DELETES IS DONE WITHIN on_delete HANDLERS IN RELEVANT CLASSES }
function on_delete($post_master) { // if tag is not related to any other group, delete it $list = new TagsToTagsGroups_list(); //check if tag is related to any other group, if not remove it if (!$list->search(array('search_tag_id' => $this->tag_id, 'search_not_id' => $this->id))) { //delete directly to avoid calling on_delete actions recursively $post_master->sql_delete_list('articles_tags', "tag_id={$this->tag_id}"); $post_master->sql_delete_list('tags', "id={$this->tag_id}"); } }