Ignore:
Timestamp:
Aug 20, 2010, 12:33:47 PM (14 years ago)
Author:
mistic100
Message:

Fixs some errors. Add results previews. Code revision.

File:
1 edited

Legend:

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

    r6768 r6782  
    2525
    2626// +-----------------------------------------------------------------------+
    27 //                      Suppression d'un résultat
    28 // +-----------------------------------------------------------------------+
    29 if(isset($_GET['delete_result'])){
    30         pwg_query('DELETE FROM ' . CR_TABLE_2 . ' WHERE contest_id = ' . $_GET['contest_id'] . ' AND image_id = ' . $_GET['delete_result'] . ';');
    31         redirect(CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id']);
    32 }
    33 
    34 // +-----------------------------------------------------------------------+
    3527//                      Affichage des résultats
    3628// +-----------------------------------------------------------------------+
     
    4638
    4739while($result = pwg_db_fetch_assoc($results)){
    48         $template->append('results', array(
     40        $data = array(
    4941                'RANK' => $result['rank'],
    50                 'ID' => $result['image_id'],
     42                'IMAGE_ID' => $result['image_id'],
    5143                'AUTHOR' => $result['author'],
    5244                'COMMENT' => $result['comment'],
    5345                'U_DELETE' => CR_ADMIN . '&tab=results&contest_id=' . $_GET['contest_id'] . '&delete_result=' . $result['image_id'],
    54         ));
     46        );
     47       
     48        // Infos de l'image
     49        $query = "SELECT id, name, file, path, tn_ext
     50                FROM " . IMAGES_TABLE . "
     51                WHERE id = " . $result['image_id'] . ";";
     52        $image = pwg_query($query);
     53       
     54        if(!pwg_db_num_rows($image)){
     55                $themeconf = $template->get_template_vars('themeconf');
     56                $data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
     57                $data['IMAGE_NAME'] = 'N/A';
     58                $page['errors'][] = l10n_dec('CR_id_unknown %d', 'CR_id_unknown %d', $result['image_id']);
     59        }else{
     60                $image = pwg_db_fetch_assoc($image);
     61                $data['TN_SRC'] = get_thumbnail_url($image);
     62                $data['IMAGE_NAME'] = (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'];
     63        }
     64       
     65        $template->append('results', $data);
    5566}
    5667
Note: See TracChangeset for help on using the changeset viewer.