$res=$DBc->sqlQuery("SELECT DISTINCT aa_id,ach.*,(SELECT aal_name FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_name FROM ach_achievement as ach,ach_perk,ach_player_perk WHERE ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id ORDER by app_date DESC LIMIT 0,".($size-1));
$sz=sizeof($res);
for($i=0;$i<$sz;$i++){
$tmp=newAchAchievement($res[$i]);
$this->child_done[]=sizeof($this->nodes);
$this->nodes[]=$tmp;
}
}
functiongetSummary(){
if(!is_array($this->stats)){// only load if needed
//now we have to find the # of perks for each main menu entry
$res=$DBc->sqlQuery("SELECT count(ap_id) as anz FROM ach_perk,ach_achievement,ach_player_perk WHERE aa_category='".$node->getID()."' AND ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id");
$done+=$res[0]["anz"];
$res=$DBc->sqlQuery("SELECT count(ap_id) as anz FROM ach_perk,ach_achievement WHERE aa_category='".$node->getID()."' AND ap_achievement=aa_id");