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 .= " + "; + $html .= ""; + } + else { + $html .= ""; } - $html .= " - -
"; if($sub == 0) { - $html .= "getID()."'>isOpen()) { - $html .= "color:orange;"; + $html .= " color='orange'"; } - $html .= "'>".$curr->getName()."
"; + $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 = "
+ + +
+ - - + + $html .= " + +
"; + "; if(($prog/$val) > 0.85) { $html .= " ".nf($prog)." / ".nf($val)." "; } - $html .= ""; + $html .= ""; if(($prog/$val) <= 0.85) { $html .= " ".nf($prog)." / ".nf($val)." "; } - $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())." +
+ + + - + - ".$html."
".get_translation('ach_summary_stats_total',$_USER->getLang())."
".ach_render_progressbar($sum_done,$sum_total,350)."
".get_translation('ach_summary_stats_total',$_USER->getLang())."
".ach_render_progressbar($sum_done,$sum_total,450)."
".$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 .= ""; if($sub == 0) { - $html .= ""; + $html .= ""; } $html .= "
getImage().'">
'.$ach->getName().'
'.$ach->getValueDone().'
@@ -214,7 +256,7 @@
- +
'.$ach->getName().'
'.$ach->getValueOpen().'
diff --git a/code/web/app/app_achievements/index.php b/code/web/app/app_achievements/index.php index a13db6659..7b89a9f84 100644 --- a/code/web/app/app_achievements/index.php +++ b/code/web/app/app_achievements/index.php @@ -5,8 +5,8 @@ ini_set("display_errors","1"); define('APP_NAME', 'app_achievements'); -require_once('../config.php'); -include_once('../lang.php'); +require_once('../webig/config.php'); +include_once('../webig/lang.php'); include_once('lang.php'); require_once('conf.php'); @@ -20,6 +20,7 @@ $user['name'] = 'Talvela'; $user['race'] = "r_matis"; $user['civilization'] = "c_neutral"; $user['cult'] = "c_neutral"; +$user['ig'] = ($_REQUEST['ig']==1); require_once("class/RyzomUser_class.php"); $_USER = new RyzomUser($user); @@ -47,7 +48,7 @@ require_once("class/AchObjective_class.php"); // Update user acces on Db //$db = ryDB::getInstance(APP_NAME); -$DBc = ryDB::getInstance(APP_NAME); +$DBc = ryDB::getInstance("ahufler"); /*$db->setDbDefs('test', array('id' => SQL_DEF_INT, 'num_access' => SQL_DEF_INT)); $num_access = $db->querySingleAssoc('test', array('id' => $user['id'])); @@ -61,44 +62,8 @@ $c = _t('access', $num_access['num_access']).'
';*/ #$c = var_export($user,true); -$c = "
- - - - - - - -
".ach_render_yubopoints(1)."
"; - #$_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,1); -} -$c .= "
"; -echo ryzom_app_render("achievements", $c, $_USER->isIG()); +echo ryzom_app_render("achievements", ach_render(), $_USER->isIG()); ?> diff --git a/code/web/app/app_achievements/pic/check.png b/code/web/app/app_achievements/pic/check.png index c40307f2e..2e454932a 100644 Binary files a/code/web/app/app_achievements/pic/check.png and b/code/web/app/app_achievements/pic/check.png differ diff --git a/code/web/app/app_achievements/pic/icon/grey/small/test.png b/code/web/app/app_achievements/pic/icon/grey/small/test.png new file mode 100644 index 000000000..dbae22758 Binary files /dev/null and b/code/web/app/app_achievements/pic/icon/grey/small/test.png differ diff --git a/code/web/app/app_achievements/pic/icon/grey/test.png b/code/web/app/app_achievements/pic/icon/grey/test.png index f0feccd76..3db714d2c 100644 Binary files a/code/web/app/app_achievements/pic/icon/grey/test.png and b/code/web/app/app_achievements/pic/icon/grey/test.png differ diff --git a/code/web/app/app_achievements/pic/icon/small/test.png b/code/web/app/app_achievements/pic/icon/small/test.png new file mode 100644 index 000000000..1419298cf Binary files /dev/null and b/code/web/app/app_achievements/pic/icon/small/test.png differ diff --git a/code/web/app/app_achievements/pic/menu/ig_test.png b/code/web/app/app_achievements/pic/menu/ig_test.png new file mode 100644 index 000000000..a3085a681 Binary files /dev/null and b/code/web/app/app_achievements/pic/menu/ig_test.png differ diff --git a/code/web/app/app_achievements/pic/menu_space.png b/code/web/app/app_achievements/pic/menu_space.png new file mode 100644 index 000000000..b104b9014 Binary files /dev/null and b/code/web/app/app_achievements/pic/menu_space.png differ diff --git a/code/web/app/app_achievements/pic/yubo_done_small.png b/code/web/app/app_achievements/pic/yubo_done_small.png new file mode 100644 index 000000000..f5dc1b3e8 Binary files /dev/null and b/code/web/app/app_achievements/pic/yubo_done_small.png differ