/** * Remove a resource from the user's account. * * @param object $resource The resource to remove. * * @return void * @access public * @todo delete any unused tags */ public function removeResource($resource) { // Remove the Saved Resource $join = new User_resource(); $join->user_id = $this->id; $join->resource_id = $resource->id; $join->delete(); // Remove the Tags from the resource $join = new Resource_tags(); $join->user_id = $this->id; $join->resource_id = $resource->id; $join->delete(); }
function removeTag($tagId, $user, $removeFromAllResources = false) { require_once ROOT_DIR . '/services/MyResearch/lib/Tags.php'; require_once ROOT_DIR . '/services/MyResearch/lib/Resource_tags.php'; $rTag = new Resource_tags(); if (!$removeFromAllResources) { $rTag->resource_id = $this->id; } $rTag->tag_id = $tagId; $rTag->user_id = $user->id; $rTag->find(); if ($rTag->N > 0) { while ($rTag->fetch()) { $rTag->delete(); } } else { //the tag was not found. return false; } //Check to see if the tag is still in use by any user for any resource. $rTag = new Resource_tags(); $rTag->tag_id = $tagId; $rTag->find(); if ($rTag->N == 0) { //Tag is still in use, delete it. $tags = new Tags(); $tags->id = $tagId; if ($tags->find(true)) { $tags->delete(); } } return true; }
/** * @todo: delete any unused tags */ function removeResource($resource) { // Remove the Saved Resource require_once ROOT_DIR . '/services/MyResearch/lib/User_list.php'; require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php'; $join = new User_resource(); $join->user_id = $this->user_id; $join->resource_id = $resource->id; $join->list_id = $this->id; $join->delete(); // Remove the Tags from the resource $join = new Resource_tags(); $join->user_id = $this->user_id; $join->resource_id = $resource->id; $join->list_id = $this->id; $join->delete(); }
/** * Remove the specified resource from the list. * * @param Resource $resource Resource object to remove * * @return void * @access public * @todo delete any unused tags */ public function removeResource($resource) { // Remove the Saved Resource $join = new User_resource(); $join->user_id = $this->user_id; $join->resource_id = $resource->id; $join->list_id = $this->id; $join->delete(); // Remove the Tags from the resource $join = new Resource_tags(); $join->user_id = $this->user_id; $join->resource_id = $resource->id; $join->list_id = $this->id; $join->delete(); // Update list modification date $this->updateModifiedDate(); }
/** * @todo: delete any unused tags */ function removeResource($resource) { require_once 'User_resource.php'; // Remove the Saved Resource $join = new User_resource(); $join->user_id = $this->id; $join->resource_id = $resource->id; $join->delete(); // Remove the Tags from the resource require_once 'Resource_tags.php'; $join = new Resource_tags(); $join->user_id = $this->id; $join->resource_id = $resource->id; $join->delete(); }