Changeset 9200 for extensions/ContestResults/admin/results.php
- Timestamp:
- Feb 13, 2011, 11:12:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/admin/results.php
r6782 r9200 3 3 4 4 // +-----------------------------------------------------------------------+ 5 // Modification des résultats5 // Modification des résultats 6 6 // +-----------------------------------------------------------------------+ 7 if(isset($_POST['results_modify'])){ 8 $query = "DELETE FROM " . CR_TABLE_2 . " WHERE `contest_id` = " . $_POST['contest_id'] .";"; 9 pwg_query($query); 7 if (isset($_POST['results_modify'])) { 8 pwg_query("DELETE FROM " . CR_TABLE_2 . " WHERE `contest_id` = " . $_GET['contest_id'] .";"); 10 9 11 foreach($_POST['results'] AS $i => $data){ 12 $query = "INSERT INTO " . CR_TABLE_2 . "(image_id, contest_id, rank, comment, author) 10 foreach ($_POST['results'] AS $i => $data) { 11 pwg_query("INSERT INTO " . CR_TABLE_2 . " 12 ( 13 image_id, 14 contest_id, 15 rank, 16 comment, 17 author 18 ) 13 19 VALUES( 14 20 '" . $data['image_id'] ."', 15 '" . $_ POST['contest_id'] ."',21 '" . $_GET['contest_id'] ."', 16 22 '" . $data['rank'] ."', 17 23 '" . $data['comment'] ."', 18 24 '" . $data['author'] . "' 19 );"; 20 pwg_query($query); 25 );"); 21 26 } 22 27 23 redirect(CR_ADMIN . '& tab=results&contest_id=' . $_POST['contest_id']);28 redirect(CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id']); 24 29 } 25 30 26 31 // +-----------------------------------------------------------------------+ 27 // 32 // Affichage des résultats 28 33 // +-----------------------------------------------------------------------+ 34 // Nom du concours 29 35 $query = "SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";"; 30 36 $contest = pwg_db_fetch_assoc(pwg_query($query)); 37 31 38 $template->assign(array( 32 39 'NAME' => trigger_event('render_CR_content', $contest['name']), … … 34 41 )); 35 42 36 $query = "SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id = " . $_GET['contest_id'] . " ORDER BY rank;"; 37 $results = pwg_query( $query);43 // Résultats 44 $results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id = " . $_GET['contest_id'] . " ORDER BY rank;"); 38 45 39 while ($result = pwg_db_fetch_assoc($results)){46 while ($result = pwg_db_fetch_assoc($results)) { 40 47 $data = array( 41 48 'RANK' => $result['rank'], … … 43 50 'AUTHOR' => $result['author'], 44 51 'COMMENT' => $result['comment'], 45 'U_DELETE' => CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id'] . '&delete_result=' . $result['image_id'],46 52 ); 47 53 48 54 // Infos de l'image 49 $ query ="SELECT id, name, file, path, tn_ext55 $image = pwg_query("SELECT id, name, file, path, tn_ext 50 56 FROM " . IMAGES_TABLE . " 51 WHERE id = " . $result['image_id'] . ";"; 52 $image = pwg_query($query); 57 WHERE id = " . $result['image_id'] . ";"); 53 58 54 if (!pwg_db_num_rows($image)){59 if (!pwg_db_num_rows($image)) { 55 60 $themeconf = $template->get_template_vars('themeconf'); 56 61 $data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png'; 57 62 $data['IMAGE_NAME'] = 'N/A'; 58 63 $page['errors'][] = l10n_dec('CR_id_unknown %d', 'CR_id_unknown %d', $result['image_id']); 59 }else{ 64 65 } else { 60 66 $image = pwg_db_fetch_assoc($image); 61 67 $data['TN_SRC'] = get_thumbnail_url($image);
Note: See TracChangeset
for help on using the changeset viewer.