diff --git a/code/web/app/app_achievements/class/AchCategory_class.php b/code/web/app/app_achievements/class/AchCategory_class.php index 995cb6a2a..a513a738d 100644 --- a/code/web/app/app_achievements/class/AchCategory_class.php +++ b/code/web/app/app_achievements/class/AchCategory_class.php @@ -3,14 +3,27 @@ private $id = false; private $ties_cult; private $ties_civ; + private $cult; + private $civ; - function AchCategory($id,$cult,$civ) { + function AchCategory($id,$cult = null,$civ = null) { global $DBc,$_USER; - $this->id = $id; + if($cult == null) { + $cult = $_USER->getCult(); + } + + if($civ == null) { + $civ = $_USER->getCiv(); + } + + $this->cult = $cult; + $this->civ = $civ; + + $this->id = mysql_real_escape_string($id); + + $res = $DBc->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND (aa_parent IS NULL OR NOT EXISTS (SELECT * FROM ach_perk WHERE ap_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$_USER->getID()."' AND app_perk=ap_id))) AND (aa_tie_race IS NULL OR aa_tie_race='".$_USER->getRace()."') AND (aa_tie_cult IS NULL OR aa_tie_cult='".mysql_real_escape_string($cult)."') AND (aa_tie_civ IS NULL OR aa_tie_civ='".mysql_real_escape_string($civ)."') ORDER by aal_name ASC"); - $res = $DBc->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL AND (aa_tie_race IS NULL OR aa_tie_race='".$_USER->getParam('race')."') AND (aa_tie_cult IS NULL OR aa_tie_cult='".$cult."') AND (aa_tie_civ IS NULL OR aa_tie_civ='".$civ."') ORDER by aal_name ASC"); - #MISSING: or parent is done $sz = sizeof($res); for($i=0;$i<$sz;$i++) { #echo "Y"; @@ -26,10 +39,10 @@ $this->nodes[] = $tmp; } - $res = $DBc->sqlQuery("SELECT count(*) FROM ach_achievement WHERE aa_tie_cult IS NOT NULL"); + $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 = $res[0]['anz']; - $res = $DBc->sqlQuery("SELECT count(*) FROM ach_achievement WHERE aa_tie_civ IS NOT NULL"); + $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 = $res[0]['anz']; } @@ -44,5 +57,13 @@ function isTiedCiv() { return ($this->ties_civ > 0); } + + function getCurrentCiv() { + return $this->civ; + } + + function getCurrentCult() { + return $this->cult; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/class/RyzomUser_class.php b/code/web/app/app_achievements/class/RyzomUser_class.php index e2ac7ed7e..2b0d6b972 100644 --- a/code/web/app/app_achievements/class/RyzomUser_class.php +++ b/code/web/app/app_achievements/class/RyzomUser_class.php @@ -21,5 +21,21 @@ function getParam($p) { return $this->data[$p]; } + + function getRace() { + return $this->data['race']; + } + + function getCiv() { + return $this->data['civilization']; + } + + function getCult() { + return $this->data['cult']; + } + + function getName() { + return $this->data['name']; + } } ?> \ No newline at end of file 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 6a8f05a06..8ab9f8903 100644 --- a/code/web/app/app_achievements/include/ach_render_web.php +++ b/code/web/app/app_achievements/include/ach_render_web.php @@ -4,8 +4,79 @@ return number_format($n, 0, '.', ','); } - function ach_render_tiebar($cult = "neutral", $civ = "neutral") { + function ach_translate_cc($cc = 'c_neutral') { global $_USER; + + $t = array(); + $t['c_matis'] = 'Matis'; + $t['c_tryker'] = 'Tryker'; + $t['c_fyros'] = 'Fyros'; + $t['c_zorai'] = 'Zorai'; + $t['c_kami'] = 'Kami'; + $t['c_karavan'] = 'Karavan'; + $t['c_neutral'] = get_translation('ach_c_neutral',$_USER->getLang()); + + return $t[$cc]; + } + + function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",$cat) { + global $_USER; + + $html = " + +
+ + + $open = $menu->getOpenCat(); if($open != 0) { - if($_REQUEST['cult']) { - $cult = mysql_real_escape_string($_REQUEST['cult']); - } - else { - $cult = $_USER->getParam('cult'); - } - - if($_REQUEST['civ']) { - $civ = mysql_real_escape_string($_REQUEST['civ']); - } - else { - $civ = $_USER->getParam('civ'); - } - $cat = new AchCategory($open,$cult,$civ); + $cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']); } else { $cat = new AchSummary($menu,8); diff --git a/code/web/app/app_achievements/lang.php b/code/web/app/app_achievements/lang.php index b3a4fa97b..7ad7241e2 100644 --- a/code/web/app/app_achievements/lang.php +++ b/code/web/app/app_achievements/lang.php @@ -1,4 +1,4 @@ - @@ -29,6 +29,41 @@ $__texts = array ( 'de' => '', 'ru' => '', ), + 'ach_c_neutral' => + array ( + 'en' => 'neutral', + 'fr' => '', + 'de' => '', + 'ru' => '', + ), + 'ach_allegiance_neutral' => + array ( + 'en' => 'While being of %s allegiance', + 'fr' => '', + 'de' => '', + 'ru' => '', + ), + 'ach_allegiance_start' => + array ( + 'en' => 'While being aligned with the ', + 'fr' => '', + 'de' => '', + 'ru' => '', + ), + 'ach_allegiance_and' => + array ( + 'en' => ' and the ', + 'fr' => '', + 'de' => '', + 'ru' => '', + ), + 'ach_allegiance_end' => + array ( + 'en' => ', accomplish the following achievements:', + 'fr' => '', + 'de' => '', + 'ru' => '', + ), );
+