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 MonthlyStatsController extends AppController {
17
18 /**
19 * Models used
20 *
21 * @var array
22 */
23 public $uses = array('PlayerStat', 'MonthlyStat');
24
25 //-------------------------------------------------------------------
26
27 /**
28 * Returns player's monthly 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 $monthlyStats = $this->MonthlyStat->find('all', array(
44 'conditions' => array(
45 'MonthlyStat.client_id' => $b3ID
46 )
47 )
48 );
49
50 if ($this->request->is('requested')) {
51 return $monthlyStats;
52 } else {
53 $this->set('monthlyStats', $monthlyStats);
54 }
55 $this->layout = 'ajax';
56
57 return null;
58 }
59
60 }