$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','".$DBc->sqlEscape($lang)."','".$DBc->sqlEscape($txt)."',".mkn($tpl).") ON DUPLICATE KEY UPDATE apl_name='".$DBc->sqlEscape($txt)."',apl_template=".mkn($tpl)."");
if($_USER->getLang()==$lang){
$this->name=$txt;
$this->template=$tpl;
}
}
functiondelete_me(){
global$DBc;
$DBc->sqlQuery("DELETE FROM ach_task WHERE at_id='".$this->getID()."'");
$DBc->sqlQuery("DELETE FROM ach_player_task WHERE apt_task='".$this->getID()."'");
$iter=$this->getIterator();
while($iter->hasNext()){
$curr=$iter->getNext();
$curr->delete_me();
$this->removeChild($curr->getID());
}
}
functionupdate(){
global$DBc;
$DBc->sqlQuery("UPDATE ach_task SET at_parent=".mkn($this->getParentID()).",at_value='".$DBc->sqlEscape($this->getValue())."',at_condition='".$DBc->sqlEscape($this->getCondition())."',at_condition_value=".mkn($this->getConditionValue()).",at_dev='".$this->getDev()."',at_torder='".$this->torder."' WHERE at_id='".$this->getID()."'");
$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).") ON DUPLICATE KEY UPDATE atl_name='".$DBc->sqlEscape($this->getName())."',atl_template=".mkn($this->getTemplate())."");
}
functioninsert(){
global$DBc;
$this->dev=1;
$DBc->sqlQuery("INSERT INTO ach_task (at_achievement,at_parent,at_value,at_condition,at_condition_value,at_dev,at_torder) VALUES ('".$this->getAchievement()."',".mkn($this->getParentID()).",'".$DBc->sqlEscape($this->getValue())."','".$DBc->sqlEscape($this->getCondition())."',".mkn($this->getConditionValue()).",'1','".$this->torder."')");
$id=$DBc->insertID();
$this->setID($id);
$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).")");
}
functionsetAchievement($a){
$this->achievement=$a;
}
functionsetName($name){
$this->name=$name;
}
functionsetTemplate($t){
$this->template=$t;
}
functionsetValue($v){
$this->value=$v;
}
functiongetCondition(){
return$this->condition;
}
functiongetConditionValue(){
return$this->condition_value;
}
functionsetCondition($c){
$this->condition=$c;
}
functionsetConditionValue($v){
$this->condition_value=$v;
}
functiongetTorder(){
return$this->torder;
}
functionsetTorder($t){
$this->torder=$t;
}
functionsetParentID($p,$order=true){#reordering must happen A) after insert B) when updating