This commit is contained in:
Némunaire 2013-10-10 05:52:48 +02:00
parent b64257a80e
commit 38ed722d15
3 changed files with 145 additions and 149 deletions

View file

@ -4,18 +4,17 @@ if(!defined('ONYX')) exit;
class Exercice
{
var $id=null;
var $id = null;
var $theme;
var $require;
var $level;
var $points;
var $statement;
var $files;
var $keys;
var $files = array();
var $keys = array();
function Exercice($id=null)
{
if (!empty($id))
{
$db = new BDD();
@ -78,13 +77,12 @@ class Exercice
$format = $key['format'];
$value = $key['value'];
if (isset($key['id']))
$kid = $key['id'];
$kid = intval($key['id']);
else
$kid = NULL;
$kid = 0;
$db->escape($format);
$db->escape($value);
$db->escape($kid);
if (empty($kid))
{
@ -142,15 +140,18 @@ class Exercice
function add_key($format, $value)
{
$key = ["format" => $format, "value" => $value];
if (isset($key))
$this->keys[] = $key;
$this->keys[] = array(
"format" => $format,
"value" => $value
);
}
function add_file($path, $name, $sha1)
{
$file = ["path" => $path, "name" => $name, "sha1" => $sha1];
if (isset($file))
$this->files[] = $file;
$this->files[] = array(
"path" => $path,
"name" => $name,
"sha1" => $sha1
);
}
}

View file

@ -4,8 +4,7 @@ if(!defined('ONYX')) exit;
class Theme
{
var $id=null;
var $id = null;
var $title;
function Theme($id=null)

View file

@ -2,7 +2,8 @@
if(!defined('ONYX')) exit;
class User {
class User
{
var $id = null;
var $firstname;
var $lastname;
@ -12,7 +13,8 @@ class User {
var $points = null;
var $nb_themes = null;
function User ($id=null) {
function User ($id=null)
{
if (!empty($id))
{
$db = new BDD();
@ -64,33 +66,27 @@ class User {
return ($aff == 1);
}
function get_id()
{
function get_id() {
return $this->id;
}
function get_firstname()
{
function get_firstname() {
return $this->firstname;
}
function get_lastname()
{
function get_lastname() {
return $this->lastname;
}
function get_username()
{
function get_username() {
return $this->username;
}
function get_company()
{
function get_company() {
return $this->company;
}
function get_auth_level()
{
function get_auth_level() {
return $this->auth_level;
}
@ -105,12 +101,12 @@ class User {
LEFT OUTER JOIN solved s ON e.id = s.id_exercice
WHERE s.id_user = " . intval($this->id) . "
GROUP BY s.id_user");
$db->deconnexion();
if (!empty($res))
{
$this->points = $res['sum_points'];
}
$db->deconnexion();
}
}