$data){ $query = "INSERT INTO " . CR_TABLE_2 . "(image_id, contest_id, rank, comment, author) VALUES( '" . $data['image_id'] ."', '" . $_POST['contest_id'] ."', '" . $data['rank'] ."', '" . $data['comment'] ."', '" . $data['author'] . "' );"; pwg_query($query); } redirect(CR_ADMIN . '&tab=results&contest_id=' . $_POST['contest_id']); } // +-----------------------------------------------------------------------+ // Suppression d'un résultat // +-----------------------------------------------------------------------+ if(isset($_GET['delete_result'])){ pwg_query('DELETE FROM ' . CR_TABLE_2 . ' WHERE contest_id = ' . $_GET['contest_id'] . ' AND image_id = ' . $_GET['delete_result'] . ';'); redirect(CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id']); } // +-----------------------------------------------------------------------+ // Affichage des résultats // +-----------------------------------------------------------------------+ $query = "SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";"; $contest = pwg_db_fetch_assoc(pwg_query($query)); $template->assign(array( 'NAME' => trigger_event('render_CR_content', $contest['name']), 'CONTEST_ID' => $_GET['contest_id'] )); $query = "SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id = " . $_GET['contest_id'] . " ORDER BY rank;"; $results = pwg_query($query); while($result = pwg_db_fetch_assoc($results)){ $template->append('results', array( 'RANK' => $result['rank'], 'ID' => $result['image_id'], 'AUTHOR' => $result['author'], 'COMMENT' => $result['comment'], 'U_DELETE' => CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id'] . '&delete_result=' . $result['image_id'], )); } // +-----------------------------------------------------------------------+ // Template // +-----------------------------------------------------------------------+ $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/results.tpl')); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>