1 <?php
2 /**
3 * XLRstats : Real Time Player Stats (http://www.xlrstats.com)
4 * (CC) BY-NC-SA 2005-2013, Mark Weirath, Özgür Uysal
5 *
6 * Licensed under the Creative Commons BY-NC-SA 3.0 License
7 * Redistributions of files must retain the above copyright notice.
8 *
9 * @link http://www.xlrstats.com
10 * @license Creative Commons BY-NC-SA 3.0 License (http://creativecommons.org/licenses/by-nc-sa/3.0/)
11 * @package app.Controller
12 * @since XLRstats v3.0
13 * @version 0.1
14 */
15
16 class WeeklyStatsController extends AppController {
17
18 /**
19 * Sets models we are using
20 *
21 * @var array
22 */
23 public $uses = array('PlayerStat', 'WeeklyStat');
24
25 //-------------------------------------------------------------------
26
27 /**
28 * Returns player's weekly stats
29 *
30 * @param null $playerID
31 * @return null
32 */
33 public function view($playerID = null) {
34 $player = $this->PlayerStat->find('first', array(
35 'conditions' => array(
36 'PlayerStat.id' => $playerID,
37 )
38 )
39 );
40
41 $b3ID = $player['Player']['id'];
42
43 $weeklyStats = $this->WeeklyStat->find('all', array(
44 'conditions' => array(
45 'WeeklyStat.client_id' => $b3ID
46 )
47 )
48 );
49
50 if ($this->request->is('requested')) {
51 return $weeklyStats;
52 } else {
53 $this->set('weeklyStats', $weeklyStats);
54 }
55
56 $this->layout = 'ajax';
57 return null;
58 }
59
60 }
61