Ignore:
Timestamp:
Feb 13, 2011, 11:12:58 AM (13 years ago)
Author:
mistic100
Message:

ContestResults :

  • Code revision
  • Add Letton (lv_LV) language, thanks to Aivars Baldone
  • Delete display options
  • Fix languages bugs
  • Improve public appearence
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContestResults/admin/results.php

    r6782 r9200  
    33
    44// +-----------------------------------------------------------------------+
    5 //                      Modification des résultats
     5//                              Modification des résultats
    66// +-----------------------------------------------------------------------+
    7 if(isset($_POST['results_modify'])){
    8         $query = "DELETE FROM " . CR_TABLE_2 . " WHERE `contest_id` = " . $_POST['contest_id'] .";";
    9         pwg_query($query);
     7if (isset($_POST['results_modify'])) {
     8        pwg_query("DELETE FROM " . CR_TABLE_2 . " WHERE `contest_id` = " . $_GET['contest_id'] .";");
    109       
    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                        )
    1319                        VALUES(
    1420                                '" . $data['image_id'] ."',
    15                                 '" . $_POST['contest_id'] ."',
     21                                '" . $_GET['contest_id'] ."',
    1622                                '" . $data['rank'] ."',
    1723                                '" . $data['comment'] ."',
    1824                                '" . $data['author'] . "'
    19                         );";
    20                 pwg_query($query);
     25                        );");
    2126        }
    2227       
    23         redirect(CR_ADMIN . '&tab=results&contest_id=' . $_POST['contest_id']);
     28        redirect(CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id']);
    2429}
    2530
    2631// +-----------------------------------------------------------------------+
    27 //                      Affichage des résultats
     32//                              Affichage des résultats
    2833// +-----------------------------------------------------------------------+
     34// Nom du concours
    2935$query = "SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";";
    3036$contest = pwg_db_fetch_assoc(pwg_query($query));
     37
    3138$template->assign(array(
    3239        'NAME' => trigger_event('render_CR_content', $contest['name']),
     
    3441));
    3542
    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;");
    3845
    39 while($result = pwg_db_fetch_assoc($results)){
     46while ($result = pwg_db_fetch_assoc($results)) {
    4047        $data = array(
    4148                'RANK' => $result['rank'],
     
    4350                'AUTHOR' => $result['author'],
    4451                'COMMENT' => $result['comment'],
    45                 'U_DELETE' => CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id'] . '&delete_result=' . $result['image_id'],
    4652        );
    4753       
    4854        // Infos de l'image
    49         $query = "SELECT id, name, file, path, tn_ext
     55        $image = pwg_query("SELECT id, name, file, path, tn_ext
    5056                FROM " . IMAGES_TABLE . "
    51                 WHERE id = " . $result['image_id'] . ";";
    52         $image = pwg_query($query);
     57                WHERE id = " . $result['image_id'] . ";");
    5358       
    54         if(!pwg_db_num_rows($image)){
     59        if (!pwg_db_num_rows($image)) {
    5560                $themeconf = $template->get_template_vars('themeconf');
    5661                $data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
    5762                $data['IMAGE_NAME'] = 'N/A';
    5863                $page['errors'][] = l10n_dec('CR_id_unknown %d', 'CR_id_unknown %d', $result['image_id']);
    59         }else{
     64               
     65        } else {
    6066                $image = pwg_db_fetch_assoc($image);
    6167                $data['TN_SRC'] = get_thumbnail_url($image);
Note: See TracChangeset for help on using the changeset viewer.