2012-05-25 09:48:56 +00:00
< ? php
2012-06-24 10:44:24 +00:00
class AchObjective extends Parentum {
2012-08-20 13:52:35 +00:00
protected $task ;
2012-06-25 13:03:14 +00:00
protected $condition ;
protected $value ;
protected $name ;
protected $display ;
protected $done ;
protected $progress ;
protected $meta_image ;
2012-08-20 13:52:35 +00:00
protected $metalink ;
2012-05-25 09:48:56 +00:00
2012-06-25 13:03:14 +00:00
function AchObjective ( $data , $parent ) {
2012-12-10 14:07:13 +00:00
global $DBc , $_USER , $_CONF ;
2012-07-08 16:11:25 +00:00
parent :: __construct ();
2012-06-25 13:03:14 +00:00
$this -> setParent ( $parent );
$this -> setID ( $data [ 'ao_id' ]);
2012-08-20 13:52:35 +00:00
$this -> task = $data [ 'ao_task' ];
2012-05-25 09:48:56 +00:00
$this -> condition = $data [ 'ao_condition' ];
$this -> value = $data [ 'ao_value' ];
$this -> name = $data [ 'aol_name' ];
$this -> display = $data [ 'ao_display' ];
2012-05-27 19:08:28 +00:00
$this -> done = $data [ 'apo_date' ];
2012-06-21 20:03:36 +00:00
$this -> meta_image = $data [ 'aa_image' ];
2012-08-20 13:52:35 +00:00
$this -> metalink = $data [ 'ao_metalink' ];
if ( $this -> metalink != null ) {
$this -> name = $data [ 'aal_name' ];
2012-12-10 14:07:13 +00:00
if ( $this -> name == null ) {
$res = $DBc -> sqlQuery ( " SELECT * FROM ach_achievement_lang WHERE aal_lang=' " . $_CONF [ 'default_lang' ] . " ' AND aal_achievement=' " . $this -> metalink . " ' " );
$this -> name = $res [ 0 ][ 'aal_name' ];
}
}
else {
if ( $this -> name == null ) {
$res = $DBc -> sqlQuery ( " SELECT * FROM ach_objective_lang WHERE aol_lang='en' AND aol_objective=' " . $this -> id . " ' " );
$this -> name = $res [ 0 ][ 'aol_name' ];
}
2012-08-20 13:52:35 +00:00
}
2012-05-27 19:08:28 +00:00
$this -> progress = $this -> value ;
if ( ! $this -> isDone ()) {
2012-08-07 15:41:50 +00:00
$res = $DBc -> sqlQuery ( " SELECT sum(apa_value) as anz FROM ach_player_atom,ach_atom WHERE apa_atom=atom_id AND atom_objective=' " . $this -> id . " ' AND apa_player=' " . $_USER -> getID () . " ' " );
2012-05-27 19:08:28 +00:00
$this -> progress = $res [ 0 ][ 'anz' ];
}
2012-05-25 09:48:56 +00:00
}
2012-07-08 16:11:25 +00:00
#@override: Parentum::makeChild()
2012-06-25 13:03:14 +00:00
protected function makeChild ( $a ) {
2012-06-24 10:44:24 +00:00
return null ;
}
2012-06-21 20:03:36 +00:00
function getMetaImage () {
return $this -> meta_image ;
}
2012-08-20 13:52:35 +00:00
function getMetalink () {
return $this -> metalink ;
}
function getTask () {
return $this -> task ;
2012-05-25 09:48:56 +00:00
}
function getCondition () {
return $this -> condition ;
}
function getValue () {
return $this -> value ;
}
2012-05-27 19:08:28 +00:00
function getProgress () {
return $this -> progress ;
}
2012-05-25 09:48:56 +00:00
function getName () {
return $this -> name ;
}
2012-07-01 18:04:01 +00:00
function getDisplayName () {
2012-08-20 13:52:35 +00:00
if ( substr ( $this -> name , 0 , 1 ) == " ! " ) {
return substr ( $this -> name , 1 );
}
2012-07-01 18:04:01 +00:00
return $this -> parent -> fillTemplate ( explode ( " ; " , $this -> name ));
}
2012-05-25 09:48:56 +00:00
function getDisplay () {
return $this -> display ;
}
2012-05-27 19:08:28 +00:00
function isDone () {
return ( $this -> done > 0 );
}
function getDone () {
return $this -> done ;
}
2012-05-25 09:48:56 +00:00
}
?>