diff --git a/code/web/app/app_achievements/class/AchAchievement_class.php b/code/web/app/app_achievements/class/AchAchievement_class.php
index ebc52e0ca..94925ba4f 100644
--- a/code/web/app/app_achievements/class/AchAchievement_class.php
+++ b/code/web/app/app_achievements/class/AchAchievement_class.php
@@ -32,7 +32,7 @@
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
#echo "Z";
- $tmp = new AchPerk($res[$i],$this);
+ $tmp = $this->makeChild($res[$i],$this);
#echo var_export($tmp,true);
@@ -52,6 +52,10 @@
#echo "X-".$this->hasOpen();
}
+ private function makeChild(&$a,$b) {
+ return new AchPerk($a,$b);
+ }
+
function getID() {
return $this->id;
}
diff --git a/code/web/app/app_achievements/class/AchCategory_class.php b/code/web/app/app_achievements/class/AchCategory_class.php
index b6763d61e..c4b51ff68 100644
--- a/code/web/app/app_achievements/class/AchCategory_class.php
+++ b/code/web/app/app_achievements/class/AchCategory_class.php
@@ -29,7 +29,7 @@
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
#echo "Y";
- $tmp = new AchAchievement($res[$i]);
+ $tmp = $this->makeChild($res[$i]);
#echo var_export($tmp,true);
if($tmp->hasOpen()) {
$this->child_open[] = sizeof($this->nodes);
@@ -54,6 +54,10 @@
$this->ties_civ_dev = $res[0]['anz'];
}
+ private function makeChild(&$a) {
+ return new AchAchievement($a);
+ }
+
function getID() {
return $this->id;
}
diff --git a/code/web/app/app_achievements/class/AchMenu_class.php b/code/web/app/app_achievements/class/AchMenu_class.php
index 68f850452..e30682af5 100644
--- a/code/web/app/app_achievements/class/AchMenu_class.php
+++ b/code/web/app/app_achievements/class/AchMenu_class.php
@@ -11,15 +11,15 @@
$tmp['ac_id'] = 0;
$tmp['ac_parent'] = null;
$tmp['acl_name'] = get_translation('ach_summary',$_USER->getLang());
- $tmp['ac_image'] = "";
+ $tmp['ac_image'] = "test.png";
$tmp['ac_order'] = -1;
- $this->nodes[] = new AchMenuNode($tmp,$open,$lang);
+ $this->nodes[] = new AchMenuNode($tmp,$open);
$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++) {
- $this->nodes[] = new AchMenuNode($res[$i],$open);
+ $this->nodes[] = $this->makeChild($res[$i],$open);
}
}
@@ -36,6 +36,10 @@
}
return 0;
}
+
+ private function makeChild(&$a,$b) {
+ return new AchMenuNode($a,$b);
+ }
}
class AchMenuNode extends RenderNodeIterator {
@@ -61,10 +65,14 @@
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
- $this->nodes[] = new AchMenuNode($res[$i],$open);
+ $this->nodes[] = $this->makeChild($res[$i],$open);
}
}
+ private function makeChild(&$a,$b) {
+ return new AchMenuNode($a,$b);
+ }
+
function getID() {
return $this->id;
}
diff --git a/code/web/app/app_achievements/class/AchPerk_class.php b/code/web/app/app_achievements/class/AchPerk_class.php
index 0d12c1690..a007c729b 100644
--- a/code/web/app/app_achievements/class/AchPerk_class.php
+++ b/code/web/app/app_achievements/class/AchPerk_class.php
@@ -22,10 +22,14 @@
$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()."') WHERE ao_perk='".$this->id."'");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
- $this->nodes[] = new AchObjective($res[$i]);
+ $this->nodes[] = $this->makeChild($res[$i]);
}
}
+ private function makeChild(&$a) {
+ return new AchObjective($a);
+ }
+
function getID() {
return $this->id;
}
diff --git a/code/web/app/app_achievements/class/AchSummary_class.php b/code/web/app/app_achievements/class/AchSummary_class.php
index 95720cec2..8a227eea9 100644
--- a/code/web/app/app_achievements/class/AchSummary_class.php
+++ b/code/web/app/app_achievements/class/AchSummary_class.php
@@ -15,13 +15,17 @@
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
- $tmp = new AchAchievement($res[$i]);
+ $tmp = $this->makeChild($res[$i]);
$this->child_done[] = sizeof($this->nodes);
$this->nodes[] = $tmp;
}
}
+ private function makeChild(&$a) {
+ return new AchAchievement($a);
+ }
+
function getSummary() {
if(!is_array($this->stats)) { // only load if needed
//now we have to find the # of perks for each main menu entry
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 5c59935a7..b93b11b97 100644
--- a/code/web/app/app_achievements/include/ach_render_ig.php
+++ b/code/web/app/app_achievements/include/ach_render_ig.php
@@ -1,4 +1,46 @@
+
+ ".ach_render_yubopoints($user['id'])." |
+
+
+
+
+
+ ";
+
+ $menu = new AchMenu($_REQUEST['cat']);
+
+ $c .= ach_render_menu($menu);
+
+ $c .= " |
+ ";
+
+ $open = $menu->getOpenCat();
+
+ if($open != 0) {
+ $cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']);
+ }
+ else {
+ $cat = new AchSummary($menu,8);
+ $c .= ach_render_summary_header();
+ }
+
+ $c .= ach_render_category($cat);
+ if($open == 0) {
+ $c .= ach_render_summary_footer($cat);
+ }
+
+ $c .= " |
+
+
";
+
+ return $c;
+ }
+
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
global $_USER;
@@ -37,8 +79,6 @@
";
- #ERROR: big flaw in logics if only one tie applies
-
if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
#While being of neutral allegiance with the higher powers
$html .= get_translation('ach_allegiance_neutral_cult',$_USER->getLang(),array("
".get_translation('ach_c_neutral',$_USER->getLang()).""));
@@ -78,7 +118,7 @@
$res = $DBc->sqlQuery("SELECT sum(ap_value) as anz FROM ach_perk,ach_player_perk WHERE ap_id=app_perk AND app_player='".$_USER->getID()."'");
- $html = "
".$_USER->getName()." ".$res[0]['anz']." ";
+ $html = "
".$_USER->getName()." ".$res[0]['anz']."";
return $html;
}
@@ -92,50 +132,45 @@
}
function ach_render_menu(&$menu,$sub = 0) {
- $html = "";
-
+ $html = "";
+ if($sub == 0) {
+ $html = "
";
+ }
$sz = $menu->getSize();
for($i=0;$i<$sz;$i++) {
$curr = $menu->getChild($i);
if($curr->inDev()) {
continue;
}
- $html .= "";
+ $html .= ">".$curr->getName()."
+ ";
+
if($curr->hasOpenCat() != 0) {
- $html .= "".ach_render_menu($curr,($sub+4))."
";
+ $html .= ach_render_menu($curr,($sub+4));
}
}
+
+ if($sub == 0) {
+ $html .= " | |
";
+ }
return $html;
}
function ach_render_category(&$cat) {
+ #return "";
$html = "";
if($cat->isTiedCult() || $cat->isTiedCiv()) {
@@ -166,9 +201,25 @@
}
function ach_render_achievement_done(&$ach) {
- $html = "";
+ $html = "
+
+
+
+
+
+ |
+ ".$ach->getName()."
+ ".ach_render_perk_done($ach)."
+ |
+ ".$ach->getValueDone()."
|
+
+
+ |
+
+ |
+
";
- $html .= '
+ /*$html .= '
|
|
@@ -179,7 +230,7 @@
- |
+ |
'.$ach->getName().' |
'.$ach->getValueDone().'
@@ -195,7 +246,7 @@
| |
|
- ';
+ |
';*/
return $html;
}
@@ -203,7 +254,25 @@
function ach_render_achievement_open(&$ach) {
$html = "";
- $html .= '
+ $html = "
+
+
+
+
+
+ |
+ ".$ach->getName()."
+ ".ach_render_perk_open($ach)."
+ |
+ ".$ach->getValueOpen()."
|
+
+
+ |
+
+ |
+
";
+
+ /*$html .= '
|
|
@@ -214,7 +283,7 @@
- |
+ |
'.$ach->getName().' |
'.$ach->getValueOpen().'
@@ -230,7 +299,7 @@
| |
|
- ';
+ |
';*/
return $html;
}
@@ -248,10 +317,10 @@
}
if($perk->getName() != null) {
- $html .= "".$perk->getName()."";
+ $html .= "".$perk->getName()." |
|
";
}
if($perk->objDrawable()) {
- $html .= ach_render_obj_list($perk->getChildren());
+ $html .= "".ach_render_obj_list($perk->getChildren())." |
";
}
return $html;
@@ -267,14 +336,14 @@
if($perk->inDev()) {
continue;
}
- $html .= "".$perk->getName()." ( ".date('d.m.Y',$perk->getDone())." )
".$perk->getValue()."
";
+ $html .= "".$perk->getName()." ( ".date('d.m.Y',$perk->getDone())." ) ".$perk->getValue()." |
";
}
return $html;
}
function ach_render_obj_list(&$obj) {
- $html = "";
+ $html = "";
$i = 0;
$skip = false;
@@ -320,7 +389,7 @@
$html .= "";
}
- $html .= "
";
+ $html .= "
";
return $html;
}
@@ -328,13 +397,13 @@
function ach_render_obj_simple(&$obj) {
$html = "";
if($obj->isdone()) {
- $html .= " ";
+ $html .= " ";
}
else {
- $html .= " ";
+ $html .= " ";
}
- $html .= $obj->getName()."";
+ $html .= $obj->getName()."";
return $html;
}
@@ -352,8 +421,8 @@
return "
- |
- ".$obj->getName()." |
+ |
+ ".$obj->getName()." |
";
}
@@ -367,10 +436,10 @@
else {
$col = "#999999";
}
- $html .= "".$obj->getName()."
";
+ $html .= "".$obj->getName()."";
}
- $html .= ach_render_progressbar($obj->getProgress(),$obj->getValue(),350);
+ $html .= ach_render_progressbar($obj->getProgress(),$obj->getValue(),250);
return $html;
}
@@ -378,20 +447,26 @@
function ach_render_progressbar($prog,$val,$width) {
$val = max(1,$val);
$left = floor($width*(100*($prog/$val))/100);
+ $left = max(1,$left);
- $html = "
-
+ $html = "
- ";
+ | |
+
+
+
+ ";
if(($prog/$val) > 0.85) {
$html .= " ".nf($prog)." / ".nf($val)." ";
}
- $html .= " |
- ";
+ $html .= " |
+ ";
if(($prog/$val) <= 0.85) {
$html .= " ".nf($prog)." / ".nf($val)." ";
}
- $html .= " |
+ $html .= "
+
+ |
|
";
@@ -400,8 +475,8 @@
function ach_render_summary_header() {
global $_USER;
-
- return "".get_translation('ach_summary_header',$_USER->getLang())."
";
+
+ return "".get_translation('ach_summary_header',$_USER->getLang())."";
}
function ach_render_summary_footer(&$summary) {
@@ -415,32 +490,34 @@
$i = 0;
foreach($nodes as $elem) {
- if(($i%3) == 0) {
+ if(($i%2) == 0) {
$html .= "";
}
- $html .= "".$elem[0]." ".ach_render_progressbar($elem[1],$elem[2],200)." | ";
+ $html .= "".$elem[0]." ".ach_render_progressbar($elem[1],$elem[2],150)." | ";
$sum_done += $elem[1];
$sum_total += $elem[2];
- if(($i%3) == 2) {
+ if(($i%2) == 2) {
$html .= "
";
}
$i++;
}
- if(($i%3) == 2) {
+ if(($i%2) == 2) {
$html .= "";
}
$html = "
- ".get_translation('ach_summary_stats',$_USER->getLang())."
-
+ ".get_translation('ach_summary_stats',$_USER->getLang())."
+
- ".get_translation('ach_summary_stats_total',$_USER->getLang())." ".ach_render_progressbar($sum_done,$sum_total,450)."
|
+ ".get_translation('ach_summary_stats_total',$_USER->getLang())." ".ach_render_progressbar($sum_done,$sum_total,350)."
|
+
+
+ |
- ".$html."
";
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 5c59935a7..a66f15254 100644
--- a/code/web/app/app_achievements/include/ach_render_web.php
+++ b/code/web/app/app_achievements/include/ach_render_web.php
@@ -1,4 +1,48 @@
+
+ ".ach_render_yubopoints($user['id'])." |
+
+
+ ";
+ #$_REQUEST['mid'] = 1;
+
+ $menu = new AchMenu($_REQUEST['cat']);
+
+ $c .= ach_render_menu($menu);
+
+ $c .= " |
+ ";
+
+ /*for($i=0;$i<15;$i++) {
+ $c .= ach_render_box_done("Bejeweled");
+ }*/
+
+ $open = $menu->getOpenCat();
+
+ if($open != 0) {
+ $cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']);
+ }
+ else {
+ $cat = new AchSummary($menu,8);
+ $c .= ach_render_summary_header();
+ }
+
+ $c .= ach_render_category($cat);
+ if($open == 0) {
+ $c .= ach_render_summary_footer($cat);
+ }
+
+ $c .= " |
+
+
";
+
+ return $c;
+ }
+
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
global $_USER;
@@ -37,8 +81,6 @@
";
- #ERROR: big flaw in logics if only one tie applies
-
if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
#While being of neutral allegiance with the higher powers
$html .= get_translation('ach_allegiance_neutral_cult',$_USER->getLang(),array("
".get_translation('ach_c_neutral',$_USER->getLang()).""));
@@ -118,7 +160,7 @@
$html .= "