public function ratingHtml($rating, $size = 10, $show_when_zero = false)
 {
     return photosPhoto::getRatingHtml($rating, $size, $show_when_zero);
 }
 public function backendPhoto($photo_id)
 {
     $photo_model = new photosPhotoModel();
     $photo = $photo_model->getById($photo_id);
     if ($photo) {
         $votes_count_text = '';
         if ($photo['votes_count'] > 0) {
             $votes_count_text = _wp('%d vote', '%d votes', $photo['votes_count']);
         }
         $vote_model = new photosPublicgalleryVoteModel();
         $vote_item = $vote_model->getByField(array('photo_id' => $photo['id'], 'contact_id' => wa()->getUser()->getId()));
         $your_rate = 0;
         if ($vote_item) {
             $your_rate = $vote_item['rate'];
         }
         $html = '<a class="hint" href="javascript:void(0);" id="photo-rate-votes-count" data-you-voted="' . (int) ($your_rate > 0) . '"><u>' . $votes_count_text . '</u></a>' . '<span id="p-your-rate-wrapper">' . _wp('My vote: ') . '<a href="javascript:void(0);" id="your-rate" class="p-rate-photo" data-rate="' . $your_rate . '">' . photosPhoto::getRatingHtml($your_rate, 10, true) . '</a></span>' . '<a class="inline-link p-rate-clear small" href="javascript:void(0);" style="display:none;" id="clear-photo-rate"><b><i>' . _wp('cancel my vote') . '</b></i></a>';
         $html .= '<script>$.photos.publicgalleryInitYourRate();</script>';
         return array('after_rate' => $html);
     }
 }