Пример #1
0
 /**
  * Remove tag from an item
  *
  * @return  void
  */
 public function removeTask()
 {
     $this->requiresAuthentication();
     $name = Request::getWord('tag', '');
     $id = Request::getInt('id', 0);
     $id = $id ? $id : $name;
     $tag = new Tag($id);
     if (!$tag->exists()) {
         throw new Exception(Lang::txt('Specified tag does not exist.'), 404);
     }
     $scope = Request::getWord('scope', '');
     $scope_id = Request::getInt('scope_id', 0);
     $tagger = Request::getInt('tagger', 0);
     if (!$scope || !$scope_id) {
         throw new Exception(Lang::txt('Invalid scope and/or scope_id.'), 500);
     }
     if (!$tag->removeFrom($scope, $scope_id, $tagger)) {
         throw new Exception(Lang::txt('Failed to remove tag from object.'), 500);
     }
     $this->send(null, 202);
 }