From 6017025058eead48f6cf9ddf9786741e02ff68a8 Mon Sep 17 00:00:00 2001 From: SirCotare Date: Fri, 15 Feb 2013 14:51:41 +0100 Subject: [PATCH] #1470 updated achievements app to latest live version --HG-- branch : gsoc2012-achievements --- .../class/AchAchievement_class.php | 111 ++++++++++---- .../class/AchCategory_class.php | 142 ++++++++++++------ .../class/AchSummary_class.php | 56 ++++++- .../app_achievements/class/AchTask_class.php | 82 +++++++--- .../class/RyzomUser_class.php | 6 +- .../app_achievements/class/Tieable_inter.php | 24 ++- .../include/ach_render_ig.php | 62 +++++--- .../include/ach_render_web.php | 60 +++++--- code/web/app/app_achievements/index.php | 2 +- 9 files changed, 397 insertions(+), 148 deletions(-) diff --git a/code/web/app/app_achievements/class/AchAchievement_class.php b/code/web/app/app_achievements/class/AchAchievement_class.php index 746a57c0a..8fc2753f7 100644 --- a/code/web/app/app_achievements/class/AchAchievement_class.php +++ b/code/web/app/app_achievements/class/AchAchievement_class.php @@ -4,7 +4,7 @@ * open and done. */ - class AchAchievement extends AchList { + class AchAchievement extends AchList implements Tieable { ######################### # PHP 5.3 compatible # InDev_trait replaces this in PHP 5.4 @@ -44,7 +44,7 @@ protected $template; protected $sticky; - function AchAchievement($data,$parent) { + function AchAchievement($data,&$parent) { global $DBc,$_USER,$_CONF; parent::__construct(); @@ -68,7 +68,7 @@ $this->template = $res[0]['aal_template']; } - $res = $DBc->sqlQuery("SELECT * FROM ach_task LEFT JOIN (ach_task_lang) ON (atl_lang='".$_USER->getLang()."' AND atl_task=at_id) LEFT JOIN (ach_player_task) ON (apt_task=at_id AND apt_player='".$_USER->getID()."') WHERE at_achievement='".$this->id."' ORDER by at_torder ASC"); + $res = $DBc->sqlQuery("SELECT * FROM ach_task LEFT JOIN (ach_task_lang) ON (atl_lang='".$_USER->getLang()."' AND atl_task=at_id) LEFT JOIN (ach_player_task) ON (apt_task=at_id AND apt_player='".$_USER->getID()."') WHERE at_achievement='".$this->id."' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$parent->getCurrentCult().'|'.$parent->getCurrentCiv()."')) ORDER by at_torder ASC"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { @@ -112,12 +112,64 @@ return $this->parent_id; } - function getTieRace() { + function hasTieRace_open() { + #return $this->tie_race; + $iter = $this->child_open->getIterator(); + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieRace_open() && !$curr->inDev()) { + return true; + } + } + + return false; + } + + function hasTieAlign_open() { + #return $this->tie_civ; + $iter = $this->child_open->getIterator(); + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieAlign_open() && !$curr->inDev()) { + return true; + } + } + + return false; + } + + function hasTieRace_done() { + #return $this->tie_race; + $iter = $this->child_done->getIterator(); + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieRace_done() && !$curr->inDev()) { + return true; + } + } + + return false; + } + + function hasTieAlign_done() { + #return $this->tie_civ; + $iter = $this->child_done->getIterator(); + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieAlign_done() && !$curr->inDev()) { + return true; + } + } + + return false; + } + + function hasTieRaceDev() { #return $this->tie_race; $iter = $this->nodes->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->hasTieRace()) { + if($curr->hasTieRaceDev()) { return true; } } @@ -125,12 +177,12 @@ return false; } - function getTieCiv() { + function hasTieAlignDev() { #return $this->tie_civ; $iter = $this->nodes->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->hasTieCiv()) { + if($curr->hasTieAlignDev()) { return true; } } @@ -138,25 +190,14 @@ return false; } - function getTieCult() { - #return $this->tie_cult; - $iter = $this->nodes->getIterator(); - while($iter->hasNext()) { - $curr = $iter->getNext(); - if($curr->hasTieCult()) { - return true; - } - } - return false; - } - function isTiedRace($r) { + function isTiedRace_open($r) { #return $this->tie_race; - $iter = $this->nodes->getIterator(); + $iter = $this->child_open->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->isTiedRace($r)) { + if($curr->isTiedRace_open($r)) { return true; } } @@ -164,12 +205,12 @@ return false; } - function isTiedCiv($c) { + function isTiedAlign_open($cult,$civ) { #return $this->tie_civ; - $iter = $this->nodes->getIterator(); + $iter = $this->child_open->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->isTiedCiv($c)) { + if($curr->isTiedAlign_open($cult,$civ)) { return true; } } @@ -177,12 +218,12 @@ return false; } - function isTiedCult($c) { - #return $this->tie_cult; - $iter = $this->nodes->getIterator(); + function isTiedRace_done($r) { + #return $this->tie_race; + $iter = $this->child_done->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->isTiedCult($c)) { + if($curr->isTiedRace_done($r)) { return true; } } @@ -190,6 +231,20 @@ return false; } + function isTiedAlign_done($cult,$civ) { + #return $this->tie_civ; + $iter = $this->child_done->getIterator(); + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->isTiedAlign_done($cult,$civ)) { + return true; + } + } + + return false; + } + + function getImage() { return $this->image; } diff --git a/code/web/app/app_achievements/class/AchCategory_class.php b/code/web/app/app_achievements/class/AchCategory_class.php index 87e004b53..34ab628b7 100644 --- a/code/web/app/app_achievements/class/AchCategory_class.php +++ b/code/web/app/app_achievements/class/AchCategory_class.php @@ -4,28 +4,34 @@ */ class AchCategory extends AchList implements Tieable { - protected $ties_cult; - protected $ties_civ; - protected $ties_race; + protected $ties_align_done; + protected $ties_race_done; + protected $ties_align_open; + protected $ties_race_open; protected $ties_race_dev; - protected $ties_cult_dev; - protected $ties_civ_dev; + protected $ties_align_dev; protected $cult; protected $civ; protected $race; protected $heroic; protected $contest; + protected $allow_civ; + protected $allow_cult; - function AchCategory($id,$race = null,$cult = null,$civ = null) { + function AchCategory($id,$race = null,$cult = "c_neutral",$civ = "c_neutral") { global $DBc,$_USER; parent::__construct(); - $civ = $DBc->sqlEscape($civ); - $cult = $DBc->sqlEscape($cult); + if($civ != "%") { + $civ = $DBc->sqlEscape($civ); + } + if($cult != "%") { + $cult = $DBc->sqlEscape($cult); + } $race = $DBc->sqlEscape($race); - if($race == null) { + /*if($race == null) { $race = $_USER->getRace(); } @@ -35,10 +41,11 @@ if($civ == null) { $civ = $_USER->getCiv(); - } + }*/ $this->cult = $cult; $this->civ = $civ; + $this->rave = $race; $this->id = $DBc->sqlEscape($id); @@ -56,61 +63,78 @@ } } - $res = $DBc->sqlQuery("SELECT ac_heroic,ac_contest FROM ach_category WHERE ac_id='".$this->id."'"); + $res = $DBc->sqlQuery("SELECT ac_heroic,ac_contest,ac_allow_civ,ac_allow_cult FROM ach_category WHERE ac_id='".$this->id."'"); $this->heroic = $res[0]['ac_heroic']; $this->contest = $res[0]['ac_contest']; - - //load counts for tie determination - /*$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'"); - $this->ties_cult = $res[0]['anz']; + $this->allow_civ = $res[0]['ac_allow_civ']; + $this->allow_cult = $res[0]['ac_allow_cult']; - $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'"); - $this->ties_civ = $res[0]['anz']; - - $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'"); - $this->ties_race = $res[0]['anz']; - - $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."'"); - $this->ties_race_dev = $res[0]['anz']; - - $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."'"); - $this->ties_cult_dev = $res[0]['anz']; - - $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."'"); - $this->ties_civ_dev = $res[0]['anz'];*/ $iter = $this->nodes->getIterator(); $tmp = false; while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->getTieRace()) { + if($curr->hasTieRace_open() && !$curr->inDev()) { $tmp = true; break; } } - $this->ties_race = $tmp; + $this->ties_race_open = $tmp; $iter = $this->nodes->getIterator(); $tmp = false; while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->getTieCiv()) { + if($curr->hasTieAlign_open() && !$curr->inDev()) { $tmp = true; break; } } - $this->ties_civ = $tmp; + $this->ties_align_open = $tmp; $iter = $this->nodes->getIterator(); $tmp = false; while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->getTieCult()) { + if($curr->hasTieRace_done() && !$curr->inDev()) { $tmp = true; break; } } - $this->ties_cult = $tmp; + $this->ties_race_done = $tmp; + + $iter = $this->nodes->getIterator(); + $tmp = false; + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieAlign_done() && !$curr->inDev()) { + $tmp = true; + break; + } + } + $this->ties_align_done = $tmp; + + $iter = $this->nodes->getIterator(); + $tmp = false; + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieRaceDev()) { + $tmp = true; + break; + } + } + $this->ties_race_dev = $tmp; + + $iter = $this->nodes->getIterator(); + $tmp = false; + while($iter->hasNext()) { + $curr = $iter->getNext(); + if($curr->hasTieAlignDev()) { + $tmp = true; + break; + } + } + $this->ties_align_dev = $tmp; } #@override Parentum::makeChild() @@ -118,28 +142,36 @@ return new AchAchievement($a,$this); } - function isTiedRace() { - return ($this->ties_race > 0); + function isAllowedCult() { + return ($this->allow_cult == 1); } - function isTiedCult() { - return ($this->ties_cult > 0); + function isAllowedCiv() { + return ($this->allow_civ == 1); } - function isTiedCiv() { - return ($this->ties_civ > 0); + function hasTieRace_open() { + return $this->ties_race_open; } - function isTiedRaceDev() { - return ($this->ties_race_dev > 0); + function hasTieAlign_open() { + return $this->ties_align_open; } - function isTiedCultDev() { - return ($this->ties_cult_dev > 0); + function hasTieRace_done() { + return $this->ties_race_done; } - function isTiedCivDev() { - return ($this->ties_civ_dev > 0); + function hasTieAlign_done() { + return $this->ties_align_done; + } + + function hasTieRaceDev() { + return $this->ties_race_dev; + } + + function hasTieAlignDev() { + return $this->ties_align_dev; } function getCurrentCiv() { @@ -154,6 +186,22 @@ return $this->race; } + function isTiedRace_open($r) { + return null; + } + + function isTiedAlign_open($cult,$civ) { + return null; + } + + function isTiedRace_done($r) { + return null; + } + + function isTiedAlign_done($cult,$civ) { + return null; + } + function isHeroic() { return ($this->heroic == 1); } diff --git a/code/web/app/app_achievements/class/AchSummary_class.php b/code/web/app/app_achievements/class/AchSummary_class.php index 9b85e4ddf..040e0a887 100644 --- a/code/web/app/app_achievements/class/AchSummary_class.php +++ b/code/web/app/app_achievements/class/AchSummary_class.php @@ -15,7 +15,7 @@ //read all recent tasks of user //make distinct achievement list - $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, (SELECT aal_template FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_template FROM ach_achievement as ach,ach_task,ach_player_task WHERE at_achievement=aa_id AND apt_player='".$_USER->getID()."' AND apt_task=at_id ORDER by apt_date DESC LIMIT 0,".$size); + $res = $DBc->sqlQuery("SELECT DISTINCT apt_date,aa_id,ach.*,(SELECT aal_name FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_name, (SELECT aal_template FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_template FROM ach_achievement as ach,ach_task,ach_player_task WHERE at_achievement=aa_id AND ach.aa_dev='0' AND apt_player='".$_USER->getID()."' AND apt_task=at_id ORDER by apt_date DESC LIMIT 0,".$size); #echo var_export($res,true); @@ -107,6 +107,10 @@ return "c_neutral"; } + function getCurrentRace() { + return "r_matis"; + } + function isHeroic() { return false; } @@ -114,5 +118,55 @@ function isContest() { return false; } + + function hasTieRace_open() + { + return false; + } + + function hasTieAlign_open() + { + return false; + } + + function hasTieRace_done() + { + return false; + } + + function hasTieAlign_done() + { + return false; + } + + function hasTieRaceDev() + { + return false; + } + + function hasTieAlignDev() + { + return false; + } + + function isTiedRace_open($r) + { + return true; + } + + function isTiedAlign_open($cult, $civ) + { + return true; + } + + function isTiedRace_done($r) + { + return true; + } + + function isTiedAlign_done($cult, $civ) + { + return true; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/class/AchTask_class.php b/code/web/app/app_achievements/class/AchTask_class.php index b8f71b2dc..3ffbaf523 100644 --- a/code/web/app/app_achievements/class/AchTask_class.php +++ b/code/web/app/app_achievements/class/AchTask_class.php @@ -1,5 +1,5 @@ tie_race[] = $res[$i]['attr_race']; } - $res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'"); + /*$res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'"); $sz = sizeof($res); $this->tie_cult = array(); @@ -102,6 +103,14 @@ $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']; } } @@ -119,6 +128,7 @@ $this->addChild($curr); $this->heritage_list->insert($curr); } + return true; } #@override Parentum::makeChild() @@ -141,36 +151,74 @@ } function hasTieRace() { + if($this->dev == 1) { + return false; + } return (sizeof($this->tie_race) != 0); } - function hasTieCult() { - return (sizeof($this->tie_cult) != 0); + function hasTieAlign() { + if($this->dev == 1) { + return false; + } + return (sizeof($this->tie_align) != 0); } - function hasTieCiv() { - return (sizeof($this->tie_civ) != 0); + function hasTieRace_open() { + return $this->hasTieRace(); + } + + function hasTieRace_done() { + return $this->hasTieRace(); + } + + function hasTieAlign_open() { + return $this->hasTieAlign(); + } + + function hasTieAlign_done() { + return $this->hasTieAlign(); + } + + function hasTieRaceDev() { + return (sizeof($this->tie_race) != 0); + } + + function hasTieAlignDev() { + return (sizeof($this->tie_align) != 0); } function isTiedRace($r) { if(sizeof($this->tie_race) == 0) { return true; } - return in_array($r,$this->race); + return in_array($r,$this->tie_race); } - function isTiedCult($c) { - if(sizeof($this->tie_cult) == 0) { + function isTiedAlign($cult,$civ) { + if($cult == "%" || $civ == "%") { return true; } - return in_array($c,$this->tie_cult); + if(sizeof($this->tie_align) == 0) { + return true; + } + return in_array(($cult.'|'.$civ),$this->tie_align); } - function isTiedCiv($c) { - if(sizeof($this->tie_civ) == 0) { - return true; - } - return in_array($c,$this->tie_civ); + function isTiedRace_open($r) { + return $this->isTiedRace($r); + } + + function isTiedRace_done($r) { + return $this->isTiedRace($r); + } + + function isTiedAlign_done($cult,$civ) { + return $this->isTiedAlign($cult,$civ); + } + + function isTiedAlign_open($cult,$civ) { + return $this->isTiedAlign($cult,$civ); } function getAchievement() { diff --git a/code/web/app/app_achievements/class/RyzomUser_class.php b/code/web/app/app_achievements/class/RyzomUser_class.php index df7449ef6..83fece663 100644 --- a/code/web/app/app_achievements/class/RyzomUser_class.php +++ b/code/web/app/app_achievements/class/RyzomUser_class.php @@ -23,15 +23,15 @@ } function getRace() { - return $this->data['race']; + return 'r_'.$this->data['race']; } function getCiv() { - return $this->data['civilization']; + return 'c_'.$this->data['civ']; } function getCult() { - return $this->data['cult']; + return 'c_'.$this->data['cult']; } function getName() { diff --git a/code/web/app/app_achievements/class/Tieable_inter.php b/code/web/app/app_achievements/class/Tieable_inter.php index 75b86ad80..92cc5914c 100644 --- a/code/web/app/app_achievements/class/Tieable_inter.php +++ b/code/web/app/app_achievements/class/Tieable_inter.php @@ -6,12 +6,28 @@ on a user's cult of civ allegiance. ---------------------------*/ - function isTiedCult(); + function hasTieRace_open(); - function isTiedCiv(); + function hasTieAlign_open(); - function getCurrentCiv(); + function hasTieRace_done(); - function getCurrentCult(); + function hasTieAlign_done(); + + function hasTieRaceDev(); + + function hasTieAlignDev(); + + function isTiedRace_open($r); + + function isTiedAlign_open($cult,$civ); + + function isTiedRace_done($r); + + function isTiedAlign_done($cult,$civ); + + #function getCurrentCiv(); + + #function getCurrentCult(); } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/include/ach_render_ig.php b/code/web/app/app_achievements/include/ach_render_ig.php index 2653793f9..b87f4258a 100644 --- a/code/web/app/app_achievements/include/ach_render_ig.php +++ b/code/web/app/app_achievements/include/ach_render_ig.php @@ -4,7 +4,7 @@ $c = " - +
".ach_render_yubopoints($_USER->getID())."".ach_render_yubopoints()."
@@ -22,7 +22,21 @@ $open = $menu->getOpenCat(); if($open != 0) { - $cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']); + if($_REQUEST['cult']) { + $cult = $_REQUEST['cult']; + } + else { + $cult = $_USER->getCult(); + } + + if($_REQUEST['civ']) { + $civ = $_REQUEST['civ']; + } + else { + $civ = $_USER->getCiv(); + } + + $cat = new AchCategory($open,$_USER->getRace(),$cult,$civ); } else { $cat = new AchSummary($menu,$_CONF['summary_size']); @@ -47,7 +61,7 @@ $html = "
"; - if($cat->isTiedCult()) { + if($cat->isAllowedCult()) { $html.= ""; } - if($cat->isTiedCiv()) { + if($cat->isAllowedCiv()) { $html.= "
getID()."'>isOpen()) { $html .= " color='orange'"; } @@ -181,7 +195,7 @@ return "
".get_translation('ach_no_heroic_deeds',$_USER->getLang())."
"; } - if($cat->isTiedCult() || $cat->isTiedCiv()) { + if($cat->hasTieAlign_done() || $cat->hasTieAlign_open()) { $html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat); } @@ -189,10 +203,10 @@ while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->inDev() || !$curr->parentDone()) { + if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_done($cat->getCurrentRace()) || !$curr->isTiedAlign_done($cat->getCurrentCult(),$cat->getCurrentCiv())) { continue; } - $html .= ach_render_achievement_done($curr); + $html .= ach_render_achievement_done($curr,$cat); } if($cat->isHeroic()) { @@ -203,16 +217,16 @@ while($iter->hasNext()) { $curr = $iter->getNext(); - if($curr->inDev() || !$curr->parentDone()) { + if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_open($cat->getCurrentRace()) || !$curr->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) { continue; } - $html .= ach_render_achievement_open($curr); + $html .= ach_render_achievement_open($curr,$cat); } return $html; } - function ach_render_achievement_done(&$ach) { + function ach_render_achievement_done(&$ach,&$cat) { global $_CONF; $html = " @@ -223,7 +237,7 @@
getImage()."?cacheid=".$_CONF['image_cdate']."'>
".$ach->getName()."
- ".ach_render_task_done($ach)."
+ ".ach_render_task_done($ach,$cat)."
"; if((!$ach->isHeroic() && !$ach->isContest()) && $ach->getValueDone() > 0) { @@ -243,7 +257,7 @@ return $html; } - function ach_render_achievement_open(&$ach) { + function ach_render_achievement_open(&$ach,&$cat) { global $_CONF; $html = " @@ -291,7 +305,7 @@ return $html; } - function ach_render_task_done(&$ach) { + function ach_render_task_done(&$ach,&$cat) { global $_CONF; $html = ""; @@ -299,7 +313,7 @@ while($task_list->hasNext()) { $task = $task_list->getNext(); - if($task->inDev()) { + if($task->inDev() || !$task->isTiedRace_open($cat->getCurrentRace()) || !$task->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) { continue; } $html .= "
".$task->getDisplayName()."
( ".date('d.m.Y',$task->getDone())." )"; @@ -370,13 +384,13 @@ $html = ""; if($obj->isdone()) { - $html .= " "; + $html .= "
 "; } else { - $html .= " "; + $html .= "
 "; } - $html .= $obj->getDisplayName().""; + $html .= $obj->getDisplayName()."
"; return $html; } diff --git a/code/web/app/app_achievements/include/ach_render_web.php b/code/web/app/app_achievements/include/ach_render_web.php index 4a077eaca..b3206a4dc 100644 --- a/code/web/app/app_achievements/include/ach_render_web.php +++ b/code/web/app/app_achievements/include/ach_render_web.php @@ -1,12 +1,12 @@
-
".ach_render_yubopoints($user['id'])."
+
".ach_render_yubopoints()."
".ach_render_facebook()."
@@ -31,7 +31,21 @@ $open = $menu->getOpenCat(); if($open != 0) { - $cat = new AchCategory($open,null,$_REQUEST['cult'],$_REQUEST['civ']); + if($_REQUEST['cult']) { + $cult = $_REQUEST['cult']; + } + else { + $cult = $_USER->getCult(); + } + + if($_REQUEST['civ']) { + $civ = $_REQUEST['civ']; + } + else { + $civ = $_USER->getCiv(); + } + + $cat = new AchCategory($open,$_USER->getRace(),$cult,$civ); } else { #die($_CONF['summary_size']); @@ -51,7 +65,7 @@ return $c; } - function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) { + function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral", &$cat) { global $_USER; $html = "