Changeset 867
- Timestamp:
- 08/31/08 14:31:19 (3 months ago)
- Location:
- plugins/rateit/trunk
- Files:
-
- 1 added
- 1 modified
-
dash_highest_rated_entries.php (added)
-
rateit.plugin.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/rateit/trunk/rateit.plugin.php
r806 r867 33 33 'license' => 'Apache License 2.0', 34 34 'description' => 'adding Star Rating to your posts.', 35 'guid' => '5ffe55ac-2773-11dd-b5d6-001b210f913f' 35 36 ); 36 37 } … … 62 63 } 63 64 64 Options::set( 'rateit__post_pos', 'bottom' ); 65 Options::set('rateit__post_pos', 'bottom'); 66 Modules::add(_t('Highest Rated Entries', 'rateit')); 65 67 } 66 68 … … 86 88 public function action_update_check() 87 89 { 88 Update::add( 'Rate It!', '5ffe55ac-2773-11dd-b5d6-001b210f913f', $this->info->version);90 Update::add('Rate It!', $this->info->guid, $this->info->version); 89 91 } 90 92 … … 134 136 } 135 137 return $actions; 138 } 139 140 /** 141 * filter: dash_modules 142 * 143 * @access public 144 * @param array $modules 145 * @return array 146 */ 147 public function filter_dash_modules($modules) 148 { 149 $modules[] = _t('Highest Rated Entries', 'rateit'); 150 $this->add_template('dash_highest_rated_entries', dirname(__FILE__) . '/dash_highest_rated_entries.php'); 151 return $modules; 152 } 153 154 /** 155 * filter: dash_module_highest_rated_entries 156 * 157 * @access public 158 * @param array $module 159 * @param string $module_id 160 * @param object $theme 161 * @return array 162 */ 163 public function filter_dash_module_highest_rated_entries($module, $module_id, $theme) 164 { 165 $module['title'] = _t('Highest Rated Entries', 'rateit'); 166 167 $theme->highest_rated_posts = DB::get_results('SELECT * FROM {posts} LEFT JOIN {postinfo} ON {posts}.id = {postinfo}.post_id WHERE {postinfo}.name = \'rateit_rating\' ORDER BY {postinfo}.value DESC LIMIT 0,5;', array(), 'Post'); 168 169 $module['content'] = $theme->fetch('dash_highest_rated_entries'); 170 return $module; 136 171 } 137 172 … … 288 323 if ( !$log->insert() ) return false; 289 324 290 $post->info->rateit_total+= $rating; 291 $post->info->rateit_count+= 1; 325 $post->info->rateit_total += $rating; 326 $post->info->rateit_count += 1; 327 $post->info->rateit_rating = $post->info->rateit_total / $post->info->rateit_count; 292 328 $post->info->commit(); 293 329 … … 305 341 } 306 342 343 /** 344 * create table 345 * 346 * @access private 347 * @return boolean 348 */ 307 349 private function install_db() 308 350 {
