add Tag option to delete tag

fix code style warnings
This commit is contained in:
2021-01-31 17:14:02 +01:00
parent d59980460f
commit b5220634a2
6 changed files with 93 additions and 28 deletions

View File

@@ -9,6 +9,7 @@ class Tags extends RequestBase {
function initHandlers() {
$this->addToDB();
$this->getFromDB();
$this->delete();
}
private function addToDB() {
@@ -65,4 +66,19 @@ class Tags extends RequestBase {
$this->commitMessage(json_encode($rows));
});
}
private function delete() {
/**
* delete a Tag from a video
*/
$this->addActionHandler("deleteVideoTag", function () {
$movieid = $_POST['video_id'];
$tagid = $_POST['tag_id'];
// skip tag add if already assigned
$query = "DELETE FROM video_tags WHERE tag_id=$tagid AND video_id=$movieid";
$this->commitMessage($this->conn->query($query) ? '{"result":"success"}' : '{"result":"' . $this->conn->error . '"}');
});
}
}