Changeset 9200 for extensions/ContestResults/include/cr_comment_picture.php
- Timestamp:
- Feb 13, 2011, 11:12:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/include/cr_comment_picture.php
r6782 r9200 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 // +-----------------------------------------------------------------------+5 4 // Requète simple pour savoir si l'image a participé à des concours 6 // +-----------------------------------------------------------------------+ 7 $query = "SELECT image_id FROM " . CR_TABLE_2 . " WHERE image_id = " . $page['image_id'] . ";"; 8 $results = pwg_query($query); 5 $participation = pwg_query("SELECT image_id FROM " . CR_TABLE_2 . " WHERE image_id = " . $page['image_id'] . ";"); 9 6 10 if(pwg_db_num_rows($ results)){11 $ query ="SELECT7 if(pwg_db_num_rows($participation)){ 8 $results = pwg_query("SELECT 12 9 i.rank, 13 10 i.comment, … … 18 15 ON i.contest_id = c.id 19 16 WHERE i.image_id = " . $page['image_id'] . " 20 ORDER BY c.date_begin DESC;"; 21 $results = pwg_query($query); 17 ORDER BY c.date_begin DESC;"); 22 18 23 19 // Gère plusieurs participations 24 20 $comment = null; 25 while( $result = pwg_db_fetch_assoc($results)){21 while( $result = pwg_db_fetch_assoc($results)) { 26 22 // Rang amélioré 27 if($result['rank'] <= 3) $result['rank'] = l10n('CR_order_'.$result['rank']); 28 else $result['rank'] .= l10n('CR_order_sup'); 23 $result['rank'] = ($result['rank'] <= 3) ? l10n('CR_order_'.$result['rank']) : $result['rank'] . l10n('CR_order_sup'); 29 24 30 25 // Lien vers le concours … … 33 28 34 29 // Ajoute le commentaire après la description 35 $comment .= '<div style="border:1px solid #404040;padding:10px;margin:10px 25%"> 36 <b><a href="' . $result['contest_link'] .'">' . $result['contest_name'] . '</a></b> 37 :: <u>' . $result['rank'] . '</u> 30 $comment .= '<div class="CR_comment"> 31 <b><a href="' . $result['contest_link'] .'">' . $result['contest_name'] . '</a></b> :: <u>' . $result['rank'] . ' ' . l10n('CR_place') . '</u> 38 32 <p>' . trigger_event('render_CR_content', $result['comment']) . '</p> 39 33 </div>'; … … 42 36 $template->append('related_categories', '<a href="' . CR_PUBLIC . '">' . l10n('Contests') . '</a>' . $conf['level_separator'] . '<a href="' . $result['contest_link'] . '">' . $result['contest_name'] . '</a>'); 43 37 } 38 39 // style utilisé pour les blocs des concours 40 $css = '<style type="text/css"> 41 .CR_comment { 42 border:1px solid #404040; 43 padding:10px; 44 margin:10px 20%; 45 } 46 </style>'; 44 47 45 48 $template->assign('COMMENT_IMG', $template->get_template_vars('COMMENT_IMG') . $comment); 49 $template->assign('PLUGIN_PICTURE_BEFORE', $template->get_template_vars('PLUGIN_PICTURE_BEFORE') . $css); 46 50 } 47 48 51 ?>
Note: See TracChangeset
for help on using the changeset viewer.