Updated:Video likes counter function added
This commit is contained in:
parent
c44dda2c63
commit
0861628524
1 changed files with 18 additions and 0 deletions
|
@ -1477,6 +1477,24 @@ class CBvideo extends CBCategory
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate rating and likes
|
||||||
|
*
|
||||||
|
* @param Arrray $video
|
||||||
|
* @return Array $rating
|
||||||
|
*/
|
||||||
|
function get_video_likes($video)
|
||||||
|
{
|
||||||
|
$ratings = $video['rated_by'];
|
||||||
|
$rating = $video['rating'];
|
||||||
|
|
||||||
|
$perc = $rating * 10;
|
||||||
|
|
||||||
|
$likes = round(($perc * $ratings / 100) );
|
||||||
|
|
||||||
|
return array('likes' => $likes, 'dislikes' => $ratings - $likes);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function used to rate video
|
* Function used to rate video
|
||||||
|
|
Loading…
Add table
Reference in a new issue