score.class.php 1.11 KB
Newer Older
maryam's avatar
done  
maryam committed
1
<?php
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
require_once("./models/score.class.php");
require_once("./models/user.class.php");
class Score{
	private $user;
	private $languages = array();
	private $global = true;
	private $view = './views/score.html';
	private $mode = '';

	public function __construct(){
		$this->user = user::getInstance();
		require_once('./sys/db.class.php');
		$this->db = db::getInstance();
		include_once('./sys/load_iso.php');
		$this->lang_iso = new IsoLang();

		$sql = "SELECT DISTINCT `langue` FROM `score` WHERE `score`.`userid` = '".$this->user->id."'";
		$this->db->query($sql);
		if($this->db->has_result()){
			while($tempObj = $this->db->fetch_object()){
				$this->languages[$tempObj->langue] =
					new ScoreTable($this->user, $tempObj->langue);
				$this->languages[$tempObj->langue]->get_score_table(false);
			}
			$this->languages[GlobalScoreTable::ALL_LANG] =
				new GlobalScoreTable($this->user);
			$this->languages[GlobalScoreTable::ALL_LANG]->get_score_table(false);
		}
	}

	public function set_mode($mode){
		$this->mode = $mode;
	}

	public function process(){
		$theScore = $this;
		include($this->view);
		return true;
	}
maryam's avatar
done  
maryam committed
41
}