Changeset 2227 for trunk/include/picture_rate.inc.php
- Timestamp:
- Feb 29, 2008, 2:25:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/picture_rate.inc.php
r2201 r2227 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 // | branch : BSF (Best So Far) 8 // | file : $RCSfile$ 7 // | file : $Id$ 9 8 // | last update : $Date$ 10 9 // | last modifier : $Author$ … … 36 35 SELECT COUNT(rate) AS count 37 36 , ROUND(AVG(rate),2) AS average 38 , ROUND(STD(rate),2) AS STD37 , ROUND(STD(rate),2) AS std 39 38 FROM '.RATE_TABLE.' 40 39 WHERE element_id = '.$picture['current']['id'].' 41 40 ;'; 42 41 $row = mysql_fetch_array(pwg_query($query)); 43 if ($row['count'] == 0) 44 { 45 $value = l10n('no_rate'); 46 } 47 else 48 { 49 $value = sprintf( 50 l10n('%.2f (rated %d times, standard deviation = %.2f)'), 51 $row['average'], 52 $row['count'], 53 $row['STD'] 54 ); 55 } 42 $template->assign('rate_summary', $row); 56 43 57 44 $user_rate = null; … … 84 71 } 85 72 86 $template->assign_block_vars( 87 'rate', 88 array( 89 'SENTENCE' =>isset($user_rate) ? l10n('update_rate') : l10n('new_rate'), 90 'F_ACTION' => add_url_params( 73 $template->assign( 74 'rating', 75 array( 76 'F_ACTION' => add_url_params( 91 77 $url_self, 92 78 array('action'=>'rate') 93 ) 79 ), 80 'USER_RATE'=> $user_rate, 81 'marks' => $conf['rate_items'] 94 82 ) 95 83 ); 96 97 $template->assign_block_vars('info_rate', array('CONTENT' => $value));98 99 foreach ($conf['rate_items'] as $num => $mark)100 {101 $template->assign_block_vars(102 'rate.rate_option',103 array(104 'OPTION' => $mark,105 'SEPARATOR' => ($num > 0 ? '|' : ''),106 )107 );108 if (isset($user_rate) and $user_rate==$mark)109 {110 $template->assign_block_vars('rate.rate_option.my_rate', array() );111 }112 else113 {114 $template->assign_block_vars('rate.rate_option.not_my_rate', array() );115 }116 }117 84 } 118 85 }
Note: See TracChangeset
for help on using the changeset viewer.