2012-05-25 09:48:56 +00:00
< ? php
class AchPerk extends RenderNodeIterator {
private $id ;
private $parent ;
private $achievement ;
private $value ;
private $name ;
2012-05-27 19:08:28 +00:00
private $done ;
2012-06-14 09:23:52 +00:00
private $dev ;
2012-05-25 09:48:56 +00:00
2012-05-31 13:15:36 +00:00
function AchPerk ( & $data , & $parent ) {
global $DBc , $_USER ;
2012-05-25 09:48:56 +00:00
$this -> id = $data [ 'ap_id' ];
2012-05-31 13:15:36 +00:00
$this -> parent = $parent ;
2012-05-25 09:48:56 +00:00
$this -> achievement = $data [ 'ap_achievement' ];
$this -> value = $data [ 'ap_value' ];
$this -> name = $data [ 'apl_name' ];
2012-05-27 19:08:28 +00:00
$this -> done = $data [ 'app_date' ];
2012-06-14 09:23:52 +00:00
$this -> dev = $data [ 'ap_dev' ];
2012-05-25 09:48:56 +00:00
2012-05-31 13:15:36 +00:00
$res = $DBc -> sqlQuery ( " SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang=' " . $_USER -> getLang () . " ' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player=' " . $_USER -> getID () . " ') WHERE ao_perk=' " . $this -> id . " ' " );
2012-05-25 09:48:56 +00:00
$sz = sizeof ( $res );
for ( $i = 0 ; $i < $sz ; $i ++ ) {
2012-06-21 18:55:52 +00:00
$this -> nodes [] = $this -> makeChild ( $res [ $i ]);
2012-05-25 09:48:56 +00:00
}
}
2012-06-21 18:55:52 +00:00
private function makeChild ( & $a ) {
return new AchObjective ( $a );
}
2012-05-25 09:48:56 +00:00
function getID () {
return $this -> id ;
}
function getParent () {
return $this -> parent ;
}
function getAchievement () {
return $this -> achievement ;
}
function getValue () {
return $this -> value ;
}
function getName () {
2012-05-31 13:15:36 +00:00
return $this -> parent -> getTemplate ( explode ( " ; " , $this -> name ));
2012-05-25 09:48:56 +00:00
}
2012-05-27 19:08:28 +00:00
function objDrawable () {
foreach ( $this -> nodes as $elem ) {
if ( $elem -> getDisplay () != " hidden " ) {
return true ;
}
}
return false ;
}
function isDone () {
return ( $this -> done > 0 );
}
function getDone () {
return $this -> done ;
}
2012-06-14 09:23:52 +00:00
function inDev () {
return ( $this -> dev == 1 );
}
2012-05-25 09:48:56 +00:00
}
?>