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.
| 1. / 2. / ...
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('pets');
$cs_post = cs_post('where,start,sort');
$cs_get = cs_get('where,start,sort');
$data = array();
$games_id = empty($cs_get['where']) ? 0 : $cs_get['where'];
if (!empty($cs_post['where'])) $games_id = $cs_post['where'];
$start = empty($cs_get['start']) ? 0 : $cs_get['start'];
if (!empty($cs_post['start'])) $start = $cs_post['start'];
$sort = empty($cs_get['sort']) ? 1 : $cs_get['sort'];
if (!empty($cs_post['sort'])) $sort = $cs_post['sort'];
$where = !empty($games_id) ? 'games_id = "' . $games_id . '"' : 0;
$data['count']['all'] = cs_sql_count(__FILE__,'pets');
$data['lang']['curr_pets'] = sprintf($cs_lang['curr_pets'],$data['count']['all']);
$cs_sort = array();
$cs_sort[1] = 'pets_name ASC';
$cs_sort[2] = 'pets_name DESC';
$cs_sort[3] = 'pets_material ASC';
$cs_sort[4] = 'pets_material DESC';
$cs_sort[5] = 'pets_effect ASC';
$cs_sort[6] = 'pets_effect DESC';
$cs_sort[7] = 'pets_exp ASC';
$cs_sort[8] = 'pets_exp DESC';
$cs_sort[9] = 'pets_level ASC';
$cs_sort[10] = 'pets_level DESC';
$order = $cs_sort[$sort];
$pets_count = cs_sql_count(__FILE__,'pets',$where);
$sort = empty($_GET['sort']) ? 1 : (int) $_GET['sort'];
$start = empty($_GET['start']) ? 0 : (int) $_GET['start'];
$data['head']['count_pets'] = $pets_count;
$data['head']['pages'] = cs_pages('pets','list',$pets_count,$start,$games_id,$sort);
$cs_games = cs_sql_select(__FILE__,'games','games_id, games_name',0,'games_name',0,0);
$data['head']['dropdown'] = cs_dropdown('where','games_name',$cs_games,$games_id,'games_id');
$data['head']['getmsg'] = cs_getmsg();
$data['pages']['list'] = cs_pages('pets','list',$data['count']['all'],$start,$games_id,0,$sort);
$data['sort']['name'] = cs_sort('pets','list',$start,$games_id,1,$sort);
$data['sort']['material'] = cs_sort('pets','list',$start,$games_id,3,$sort);
$data['sort']['effect'] = cs_sort('pets','list',$start,$games_id,5,$sort);
$data['sort']['exp'] = cs_sort('pets','list',$start,$games_id,7,$sort);
$data['sort']['level'] = cs_sort('pets','list',$start,$games_id,9,$sort);
$cells = 'pets_id, pets_name, pets_material, pets_effect, pets_exp, pets_level';
$data['pets'] = cs_sql_select(__FILE__,'pets',$cells,$where,$order,$start,$account['users_limit']);
$loop_pets = count($data['pets']);
for($run=0; $run<$loop_pets; $run++){
$data['pets'][$run]['id'] = $data['pets'][$run]['pets_id'];
$data['pets'][$run]['name'] = $data['pets'][$run]['pets_name'];
$data['pets'][$run]['material'] = $data['pets'][$run]['pets_material'];
$data['pets'][$run]['effect'] = $data['pets'][$run]['pets_effect'];
$data['pets'][$run]['exp'] = $data['pets'][$run]['pets_exp'];
$data['pets'][$run]['level'] = $data['pets'][$run]['pets_level'];
}
echo cs_subtemplate(__FILE__,$data,'pets','list'); |