2012-05-05 14:41:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* widget callback function to display user box..
|
|
|
|
*/
|
|
|
|
|
|
|
|
function displayUserBox($widget)
|
|
|
|
{
|
|
|
|
return Fetch('widgets/user-box.html');
|
|
|
|
}
|
|
|
|
|
2012-05-22 11:34:45 +00:00
|
|
|
/**
|
|
|
|
* Fetch user0box for admin area
|
|
|
|
* @param type $widget
|
|
|
|
* @return type
|
|
|
|
*/
|
2012-05-05 14:41:49 +00:00
|
|
|
function displayUserBoxAdmin($widget)
|
|
|
|
{
|
|
|
|
return Fetch('/layout/widgets/user-box-admin.html',FRONT_TEMPLATEDIR);
|
|
|
|
}
|
2012-05-18 13:47:20 +00:00
|
|
|
|
2012-05-22 11:34:45 +00:00
|
|
|
/**
|
|
|
|
* outputs related videos widget....
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function displayRelatedVideos($widget)
|
|
|
|
{
|
|
|
|
return Fetch('widgets/related-videos.html');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get CBv3 Rating
|
|
|
|
* @param type $video
|
|
|
|
* @param type $type
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-05-19 13:42:45 +00:00
|
|
|
function cbv3_rating($video,$type='perc')
|
|
|
|
{
|
|
|
|
if($type=='perc')
|
|
|
|
{
|
|
|
|
$rating = $video['rating'];
|
|
|
|
|
|
|
|
if($rating>5)
|
|
|
|
{
|
|
|
|
$rating_output = '<span class="rating-text rating-green">';
|
|
|
|
}elseif($rating<5 && $rating)
|
|
|
|
{
|
|
|
|
$rating_output = '<span class="rating-text rating-red">';
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
$rating_output = '<span class="rating-text">';
|
|
|
|
}
|
|
|
|
|
|
|
|
$rating_output .= round($rating*10+0.49,0);
|
|
|
|
$rating_output .= '%</span>';
|
|
|
|
|
|
|
|
return $rating_output;
|
|
|
|
}
|
2012-05-22 11:34:45 +00:00
|
|
|
|
|
|
|
if($type=='video-bar')
|
|
|
|
{
|
|
|
|
assign('video',$video);
|
|
|
|
|
|
|
|
if($video['rated_by']>0)
|
|
|
|
{
|
|
|
|
$rated_by = $video['rated_by'];
|
|
|
|
$rating = $video['rating'];
|
|
|
|
$rating_full = $rating*10;
|
|
|
|
$likes = $rating_full*$rated_by/100;
|
|
|
|
$likes = round($likes+0.49,0);
|
|
|
|
|
|
|
|
$dislikes = $rated_by-$likes;
|
|
|
|
|
|
|
|
assign('rating',array('rating'=>$rating,
|
|
|
|
'dislikes'=>$dislikes,
|
|
|
|
'likes'=>$likes,
|
|
|
|
'rated_by'=>$rated_by,
|
|
|
|
'rating_perc'=>$rating_full
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Fetch('blocks/rating.html');
|
|
|
|
}
|
2012-05-19 13:42:45 +00:00
|
|
|
}
|
2012-05-22 11:34:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show-rating function for cbv3 template
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function cbv3_show_rating($rating)
|
|
|
|
{
|
|
|
|
|
|
|
|
$array = array();
|
|
|
|
if(error())
|
|
|
|
{
|
|
|
|
$array['err'] = error();
|
|
|
|
}
|
|
|
|
|
|
|
|
$array['rating'] = $rating;
|
|
|
|
|
|
|
|
$rated_by = $rating['ratings'];
|
|
|
|
$rating = $rating['rating'];
|
|
|
|
$rating_full = $rating*10;
|
|
|
|
$likes = $rating_full*$rated_by/100;
|
|
|
|
$likes = round($likes+0.49,0);
|
|
|
|
|
|
|
|
$dislikes = $rated_by-$likes;
|
|
|
|
|
|
|
|
assign('rating',array('rating'=>$rating,
|
|
|
|
'dislikes'=>$dislikes,
|
|
|
|
'likes'=>$likes,
|
|
|
|
'rated_by'=>$rated_by,
|
|
|
|
'rating_perc'=>$rating_full
|
|
|
|
));
|
|
|
|
|
|
|
|
$template = Fetch('blocks/rating.html');
|
|
|
|
|
|
|
|
$array['template'] = $template;
|
|
|
|
|
|
|
|
echo json_encode($array);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-05-05 14:41:49 +00:00
|
|
|
?>
|