only load non assigned tags
fix custom onClick events
This commit is contained in:
@ -95,7 +95,10 @@ class Video extends RequestBase {
|
||||
*/
|
||||
private function loadVideos() {
|
||||
$this->addActionHandler("loadVideo", function () {
|
||||
$query = "SELECT movie_name,movie_id,movie_url,thumbnail,poster,likes,quality,length FROM videos WHERE movie_id='" . $_POST['movieid'] . "'";
|
||||
$video_id = $_POST['movieid'];
|
||||
|
||||
$query = " SELECT movie_name,movie_id,movie_url,thumbnail,poster,likes,quality,length
|
||||
FROM videos WHERE movie_id=$video_id";
|
||||
|
||||
$result = $this->conn->query($query);
|
||||
$row = $result->fetch_assoc();
|
||||
@ -112,7 +115,7 @@ class Video extends RequestBase {
|
||||
// todo drop video url from db -- maybe one with and one without extension
|
||||
// extension hardcoded here!!!
|
||||
$arr["movie_url"] = str_replace("?", "%3F", $this->videopath . $row["movie_name"] . ".mp4");
|
||||
$arr["likes"] = $row["likes"];
|
||||
$arr["likes"] = (int) $row["likes"];
|
||||
$arr["quality"] = $row["quality"];
|
||||
$arr["length"] = $row["length"];
|
||||
|
||||
@ -120,13 +123,27 @@ class Video extends RequestBase {
|
||||
$arr['tags'] = array();
|
||||
$query = "SELECT t.tag_name FROM video_tags
|
||||
INNER JOIN tags t on video_tags.tag_id = t.tag_id
|
||||
WHERE video_tags.video_id=" . $_POST['movieid'] . "
|
||||
WHERE video_tags.video_id=$video_id
|
||||
GROUP BY t.tag_name";
|
||||
$result = $this->conn->query($query);
|
||||
while ($r = mysqli_fetch_assoc($result)) {
|
||||
array_push($arr['tags'], $r);
|
||||
}
|
||||
|
||||
// get the random predict tags
|
||||
$arr['suggesttag'] = array();
|
||||
// select 5 random tags which are not selected for current video
|
||||
$query = "SELECT * FROM tags
|
||||
WHERE tag_id NOT IN (
|
||||
SELECT video_tags.tag_id FROM video_tags
|
||||
WHERE video_id=$video_id)
|
||||
ORDER BY rand()
|
||||
LIMIT 5";
|
||||
$result = $this->conn->query($query);
|
||||
while ($r = mysqli_fetch_assoc($result)) {
|
||||
array_push($arr['suggesttag'], $r);
|
||||
}
|
||||
|
||||
$this->commitMessage(json_encode($arr));
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user