1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
| 1. / 2. / ...
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('wars');
$cs_get = cs_get('catid,squadid');
$cs_option = cs_sql_option(__FILE__,'wars');
$data = array();
$join = 'wars fls INNER JOIN {pre}_categories cat ON fls.categories_id = cat.categories_id';
$select = 'war.games_id AS games_id, cln.clans_short AS clans_short, war.wars_score1 AS wars_score1, '
. 'war.wars_score2 AS wars_score2, cln.clans_id AS clans_id, war.wars_date AS wars_date, sqd.squads_name AS squads_name, sqd.squads_id AS sqauds_id, '
. 'war.wars_id AS wars_id, cat.categories_id AS categories_id, cat.categories_name AS categories_name';
$from = 'wars war INNER JOIN {pre}_categories cat ON war.categories_id = cat.categories_id '
. 'INNER JOIN {pre}_clans cln ON war.clans_id = cln.clans_id INNER JOIN {pre}_squads sqd ON war.squads_id = sqd.squads_id';
$order = 'wars_date DESC';
$where = empty($cs_get['squadid']) ? 'war.wars_status = \'played\'' : 'war.wars_status = \'played\' AND war.squads_id = ' . $cs_get['squadid'];
if(!empty($cs_get['catid'])) {
$where .= ' AND war.categories_id = ' . $cs_get['catid'];
}
$cs_wars = cs_sql_select(__FILE__,$from,$select,$where,$order,0,$cs_option['max_navlist2']);
if (!empty($cs_wars)) {
if($cs_option['max_navlist'] == 1)
$cs_wars = array(0 => $cs_wars);
$all = count($cs_wars);
for ($i = 0; $i < $all; $i++) {
$cs_wars[$i]['game_icon'] = file_exists('uploads/games/' . $cs_wars[$i]['games_id'] . '.png') ?
cs_html_img('uploads/games/' . $cs_wars[$i]['games_id'] . '.png') : '';
$team1 = cs_secure($cs_wars[$i]['squads_name']);
$team2 = cs_secure($cs_wars[$i]['clans_short']);
$cs_wars[$i]['matchup'] = cs_link($secure_short,'wars','view','id=' . $cs_wars[$i]['wars_id']);
$cs_wars[$i]['team1'] = cs_link($team1,'squads','view','id=' . $cs_wars[$i]['sqauds_id']);
$cs_wars[$i]['team2'] = cs_link($team2,'clans','view','id=' . $cs_wars[$i]['clans_id']);
$result = $cs_wars[$i]['wars_score1'] - $cs_wars[$i]['wars_score2'];
$color = $result >= 1 ? 'win' : 'loss';
$color = empty($result) ? 'draw' : $color;
$color_1 = $result >= 1 ? 'green' : 'red';
$color_1 = empty($result) ? 'orange' : $color_1;
$color_2 = $result <= 1 ? 'green' : 'red';
$color_2 = empty($result) ? 'orange' : $color_2;
$cs_wars[$i]['color_1'] = $color_1;
$cs_wars[$i]['color_2'] = $color_2;
$cs_wars[$i]['date'] = cs_date('unix',$cs_wars[$i]['wars_date']);
$cs_wars[$i]['category_name'] = cs_secure($cs_wars[$i]['categories_name']);
$wars['enemy']['url'] = $enemylink = cs_html_link('http://' . $cs_clan['clans_url'],cs_secure($cs_clan['clans_url']));
}
$data['wars'] = $cs_wars;
echo cs_subtemplate(__FILE__,$data,'wars','navlist2');
wars/navlist2.tpl
{loop:wars}
<table onclick="location.href='{url:wars_view}/id/{wars:wars_id}'" style="cursor: pointer;" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="leftf" width="90%">
<div style="float: left;">{wars:category_name}</div>
<div style="float: right;">{wars:date}</div>
</td>
</tr>
<tr>
<td width="90%">
<div style="float: left;"><strong>{wars:team1} vs. {wars:team2}</strong></div>
<div style="float: right;"><span style="color: {wars:color_1};">{wars:wars_score1}</span> : <span style="color: {wars:color_2};">{wars:wars_score2}</span></div>
</td>
</tr>
</table>
{stop:wars}
}
else
echo $cs_lang['no_data']; |