function AchObjective($data, $parent) { global $DBc, $_USER, $_CONF; parent::__construct(); $this->setParent($parent); $this->setID($data['ao_id']); $this->task = $data['ao_task']; $this->condition = $data['ao_condition']; $this->value = $data['ao_value']; $this->name = $data['aol_name']; $this->display = $data['ao_display']; $this->done = $data['apo_date']; $this->meta_image = $data['aa_image']; $this->metalink = $data['ao_metalink']; if ($this->metalink != null) { $this->name = $data['aal_name']; 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']; } } $this->progress = $this->value; if (!$this->isDone()) { $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() . "'"); $this->progress = $res[0]['anz']; } }
function AchTask($data, $parent) { global $DBc, $_USER, $_CONF; parent::__construct(); #$this->heritage_list = array(); $this->setParent($parent); $this->setID($data['at_id']); $this->achievement = $data['at_achievement']; $this->value = $data['at_value']; $this->name = $data['atl_name']; $this->done = $data['apt_date']; $this->dev = $data['at_dev']; $this->template = $data['atl_template']; $this->parent_id = $data['at_parent']; $this->inherit_obj = $data['at_inherit']; if ($this->inherit_obj == 1) { $this->heritage_list = new AVLTree(); } else { $this->heritage_list = null; } if ($this->name == null) { $res = $DBc->sqlQuery("SELECT * FROM ach_task_lang WHERE atl_lang='" . $_CONF['default_lang'] . "' AND atl_task='" . $this->id . "'"); $this->name = $res[0]['atl_name']; $this->template = $res[0]['atl_template']; } $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,ach_achievement_lang) ON (aa_id=ao_metalink AND aa_id=aal_achievement AND aal_lang='" . $_USER->getLang() . "') WHERE ao_task='" . $this->id . "' ORDER by aol_name ASC,aal_name ASC"); $sz = sizeof($res); for ($i = 0; $i < $sz; $i++) { $this->addChild($this->makeChild($res[$i])); } //load ties $res = $DBc->sqlQuery("SELECT attr_race FROM ach_task_tie_race WHERE attr_task='" . $this->id . "'"); $sz = sizeof($res); $this->tie_race = array(); for ($i = 0; $i < $sz; $i++) { $this->tie_race[] = $res[$i]['attr_race']; } /*$res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'"); $sz = sizeof($res); $this->tie_cult = array(); for($i=0;$i<$sz;$i++) { $this->tie_cult[] = $res[$i]['attcult_cult']; } $res = $DBc->sqlQuery("SELECT attciv_civ FROM ach_task_tie_civ WHERE attciv_task='".$this->id."'"); $sz = sizeof($res); $this->tie_civ = array(); for($i=0;$i<$sz;$i++) { $this->tie_civ[] = $res[$i]['attciv_civ']; }*/ $res = $DBc->sqlQuery("SELECT atta_alignment FROM ach_task_tie_align WHERE atta_task='" . $this->id . "'"); $sz = sizeof($res); $this->tie_align = array(); for ($i = 0; $i < $sz; $i++) { $this->tie_align[] = $res[$i]['atta_alignment']; } }
function AchMenu($open = false) { global $DBc, $_USER; parent::__construct(); $this->open = $open; // the summary page is autogenerated and has no database entry. We add it manually here. $tmp = array(); $tmp['ac_id'] = 0; $tmp['ac_parent'] = null; $tmp['acl_name'] = get_translation('ach_summary', $_USER->getLang()); $tmp['ac_image'] = "summary.png"; $tmp['ac_order'] = -1; $tmp['open'] = $open; $this->addChild(new AchMenuNode($tmp, $this)); $res = $DBc->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='" . $_USER->getLang() . "' AND acl_category=ac_id) WHERE ac_parent IS NULL ORDER by ac_order ASC, acl_name ASC"); $sz = sizeof($res); for ($i = 0; $i < $sz; $i++) { $res[$i]['open'] = $open; $this->addChild($this->makeChild($res[$i])); } }
function AchMenuNode($data, $parent) { global $DBc, $_USER, $_CONF; parent::__construct(); $this->setParent($parent); $this->setID($data['ac_id']); $this->parent_id = $data['ac_parent']; $this->name = $data['acl_name']; $this->image = $data['ac_image']; $this->order = $data['ac_order']; $this->open = $this->id == $data['open']; $this->dev = $data['ac_dev']; if ($this->name == null) { $res = $DBc->sqlQuery("SELECT * FROM ach_category_lang WHERE acl_lang='" . $_CONF['default_lang'] . "' AND acl_category='" . $this->id . "'"); $this->name = $res[0]['acl_name']; } $res = $DBc->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='" . $_USER->getLang() . "' AND acl_category=ac_id) WHERE ac_parent='" . $this->id . "' ORDER by ac_order ASC, acl_name ASC"); $sz = sizeof($res); for ($i = 0; $i < $sz; $i++) { $res[$i]['open'] = $data['open']; $this->addChild($this->makeChild($res[$i])); } }
function AchList() { parent::__construct(); $this->child_done = new DLL(); $this->child_open = new DLL(); }