khanat-opennel-code/code/web/app/app_achievements/class/AchPerk_class.php

74 lines
1.7 KiB
PHP
Raw Normal View History

<?php
class AchPerk extends RenderNodeIterator {
private $id;
private $parent;
private $achievement;
private $value;
private $name;
private $done;
2012-06-14 09:23:52 +00:00
private $dev;
2012-06-21 20:45:27 +00:00
function AchPerk(&$data) {
global $DBc,$_USER;
$this->id = $data['ap_id'];
2012-06-21 20:45:27 +00:00
$this->parent = $data['this'];
$this->achievement = $data['ap_achievement'];
$this->value = $data['ap_value'];
$this->name = $data['apl_name'];
$this->done = $data['app_date'];
2012-06-14 09:23:52 +00:00
$this->dev = $data['ap_dev'];
$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()."') LEFT JOIN (ach_achievement) ON (aa_id=ao_metalink) WHERE ao_perk='".$this->id."'");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->nodes[] = $this->makeChild($res[$i]);
}
}
2012-06-21 20:45:27 +00:00
function makeChild(&$a) {
return new AchObjective($a);
}
function getID() {
return $this->id;
}
function getParent() {
return $this->parent;
}
function getAchievement() {
return $this->achievement;
}
function getValue() {
return $this->value;
}
function getName() {
return $this->parent->getTemplate(explode(";",$this->name));
}
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);
}
}
?>