Exemple #1
0
 /**
  * Get table with rating summary
  *
  * @param array of params
  */
 function get_rating_summary($params = array())
 {
     // Make sure we are not missing any param:
     $params = array_merge(array('rating_summary_star_totals' => 'count'), $params);
     $item_Blog =& $this->get_Blog();
     if (!$item_Blog->get_setting('display_rating_summary')) {
         // Don't display a rating summary
         return;
     }
     // get ratings and active ratings ( active ratings are younger then comment_expiry_delay )
     list($ratings, $active_ratings) = $this->get_ratings();
     $ratings_count = $ratings['all_ratings'];
     $active_ratings_count = $active_ratings['all_ratings'];
     if ($ratings_count == 0) {
         // No Comments
         return;
     }
     $average_real = number_format($ratings["summary"] / $ratings_count, 1, ".", "");
     $active_average_real = $active_ratings_count == 0 ? 0 : number_format($active_ratings["summary"] / $active_ratings_count, 1, ".", "");
     $result = '';
     $expiry_delay = $this->get_setting('comment_expiry_delay');
     if (empty($expiry_delay)) {
         $all_ratings_title = T_('User ratings');
     } else {
         $all_ratings_title = T_('Overall user ratings');
         $result .= '<div class="ratings_table">';
         $result .= '<div><strong>' . get_duration_title($expiry_delay) . '</strong></div>';
         $result .= $this->get_rating_table($active_ratings, $params);
         $result .= '</div>';
     }
     $result .= '<div class="ratings_table">';
     $result .= '<div><strong>' . $all_ratings_title . '</strong></div>';
     $result .= $this->get_rating_table($ratings, $params);
     $result .= '</div>';
     return $result;
 }
			</div>
			<?php 
        $expiry_delay = $Item->get_setting('post_expiry_delay');
        if (!empty($expiry_delay)) {
            // A filter to display even the expired comments
            ?>
			<div class="tile">
				&nbsp; | &nbsp;
				<input type="radio" name="show_comments_expiry" value="expiry" id="show_expiry_delay" class="radio" <?php 
            if ($show_comments_expiry == 'active') {
                echo 'checked="checked" ';
            }
            ?>
 />
				<label for="show_expiry_delay"><?php 
            echo get_duration_title($expiry_delay);
            ?>
</label>
			</div>
			<div class="tile">
				<input type="radio" name="show_comments_expiry" value="all" id="show_expiry_all" class="radio" <?php 
            if ($show_comments_expiry == 'all') {
                echo 'checked="checked" ';
            }
            ?>
 />
				<label for="show_expiry_all"><?php 
            echo T_('All comments');
            ?>
</label>
			</div>
Exemple #3
0
 /**
  * Get table with rating summary
  *
  * @param array of params
  */
 function get_rating_summary($params = array())
 {
     // Make sure we are not missing any param:
     $params = array_merge(array('rating_summary_star_totals' => 'count'), $params);
     // get ratings and active ratings ( active ratings are younger then post_expiry_delay )
     list($ratings, $active_ratings) = $this->get_ratings();
     $ratings_count = $ratings['all_ratings'];
     $active_ratings_count = $active_ratings['all_ratings'];
     if ($ratings_count == 0) {
         // No Comments
         return NULL;
     }
     $average_real = number_format($ratings["summary"] / $ratings_count, 1, ".", "");
     $active_average_real = $active_ratings_count == 0 ? 0 : number_format($active_ratings["summary"] / $active_ratings_count, 1, ".", "");
     $result = '<table class="ratings_table" cellspacing="2">';
     $result .= '<tr>';
     $expiry_delay = $this->get_setting('post_expiry_delay');
     if (empty($expiry_delay)) {
         $all_ratings_title = T_('User ratings');
     } else {
         $all_ratings_title = T_('Overall user ratings');
         $result .= '<td><div><strong>' . get_duration_title($expiry_delay) . '</strong></div>';
         $result .= $this->get_rating_table($active_ratings, $params);
         $result .= '</td>';
         $result .= '<td width="2px"></td>';
     }
     $result .= '<td><div><strong>' . $all_ratings_title . '</strong></div>';
     $result .= $this->get_rating_table($ratings, $params);
     $result .= '</td>';
     $result .= '</tr></table>';
     return $result;
 }