1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | global $user, $conf; |
---|
5 | |
---|
6 | $contests = pwg_query("SELECT |
---|
7 | id, |
---|
8 | name, |
---|
9 | visible, |
---|
10 | date_begin, |
---|
11 | date_end, |
---|
12 | logo, |
---|
13 | summary |
---|
14 | FROM " . CR_TABLE_1 . " |
---|
15 | WHERE id IN(" . $datas['contest_id'] . ");"); |
---|
16 | |
---|
17 | |
---|
18 | while ($contest = pwg_db_fetch_assoc($contests)) { |
---|
19 | $contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end'])); |
---|
20 | |
---|
21 | if ($contest['visible'] OR is_admin()) { |
---|
22 | // infos sur le concours |
---|
23 | $block['contests'][$contest['id']] = array( |
---|
24 | 'ID' => $contest['id'], |
---|
25 | 'NAME' => trigger_event('render_category_name', $contest['name']), |
---|
26 | 'VISIBLE' => $contest['visible'], |
---|
27 | 'STATUS' => $contest['status'], |
---|
28 | 'DATE_END' => format_date($contest['date_end']), |
---|
29 | 'DATE_BEGIN' => format_date($contest['date_begin']), |
---|
30 | 'LOGO' => $contest['logo'], |
---|
31 | 'SUMMARY' => CR_cut_string(trigger_event('render_category_name', $contest['summary']), $conf['ContestResults']['truncate_summary']), |
---|
32 | 'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_category_name', $contest['name'])), |
---|
33 | 'DAYS' => $contest['days'], |
---|
34 | ); |
---|
35 | |
---|
36 | // podium si terminé |
---|
37 | if ($contest['status'] == 'finished') { |
---|
38 | $results = pwg_query("SELECT |
---|
39 | i.id, |
---|
40 | i.name, |
---|
41 | i.file, |
---|
42 | i.path, |
---|
43 | i.tn_ext, |
---|
44 | c.rank, |
---|
45 | c.author |
---|
46 | FROM " . IMAGES_TABLE . " AS i |
---|
47 | INNER JOIN " . CR_TABLE_2 . " AS c |
---|
48 | ON c.image_id = i.id |
---|
49 | WHERE c.contest_id = " . $contest['id'] . " |
---|
50 | ORDER BY c.rank ASC |
---|
51 | LIMIT 3 OFFSET 0;"); |
---|
52 | |
---|
53 | while ($result = pwg_db_fetch_assoc($results)) { |
---|
54 | $block['contests'][$contest['id']]['RESULTS'][$result['rank']] = array( |
---|
55 | 'RANK' => $result['rank'], |
---|
56 | 'AUTHOR' => $result['author'], |
---|
57 | 'TN_SRC' => get_thumbnail_url($result) |
---|
58 | ); |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | switch ($datas['nb_per_line']) { |
---|
66 | case '1' : |
---|
67 | $block['SIZE_CLASS'] = 'one_comment'; |
---|
68 | break; |
---|
69 | case '2' : |
---|
70 | $block['SIZE_CLASS'] = 'two_comment'; |
---|
71 | break; |
---|
72 | case '3' : |
---|
73 | $block['SIZE_CLASS'] = 'three_comment'; |
---|
74 | break; |
---|
75 | } |
---|
76 | |
---|
77 | $block['CR_PATH'] = CR_PATH; |
---|
78 | $block['TEMPLATE'] = dirname(__FILE__).'/cr_stuffs.tpl'; |
---|
79 | |
---|
80 | ?> |
---|