diff --git a/code/web/app/app_achievements/_doc/app_achievements.sql b/code/web/app/app_achievements/_doc/app_achievements.sql index 79d22f5f3..15d92eb41 100644 --- a/code/web/app/app_achievements/_doc/app_achievements.sql +++ b/code/web/app/app_achievements/_doc/app_achievements.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 25. Mai 2012 um 11:46 +-- Erstellungszeit: 27. Mai 2012 um 21:05 -- Server Version: 5.1.46 -- PHP-Version: 5.3.2 @@ -32,9 +32,9 @@ CREATE TABLE IF NOT EXISTS `ach_achievement` ( `aa_tie_race` varchar(64) COLLATE utf8_bin DEFAULT NULL, `aa_tie_cult` varchar(64) COLLATE utf8_bin DEFAULT NULL, `aa_tie_civ` varchar(64) COLLATE utf8_bin DEFAULT NULL, - `aa_image` varchar(255) COLLATE utf8_bin NOT NULL, + `aa_image` varchar(64) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`aa_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=5 ; -- -------------------------------------------------------- @@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `ach_atom` ( `atom_ruleset` blob NOT NULL, `atom_primary` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`atom_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ; -- -------------------------------------------------------- @@ -73,8 +73,10 @@ CREATE TABLE IF NOT EXISTS `ach_atom` ( CREATE TABLE IF NOT EXISTS `ach_category` ( `ac_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `ac_parent` bigint(20) unsigned DEFAULT NULL, + `ac_order` smallint(5) unsigned NOT NULL, + `ac_image` varchar(64) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`ac_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; -- -------------------------------------------------------- @@ -100,9 +102,9 @@ CREATE TABLE IF NOT EXISTS `ach_objective` ( `ao_perk` bigint(20) unsigned NOT NULL, `ao_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL, `ao_value` int(10) unsigned DEFAULT NULL, - `ao_display` enum('simple','meta','value') COLLATE utf8_bin NOT NULL DEFAULT 'simple', + `ao_display` enum('simple','meta','value','hidden') COLLATE utf8_bin NOT NULL DEFAULT 'hidden', PRIMARY KEY (`ao_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=14 ; -- -------------------------------------------------------- @@ -130,7 +132,7 @@ CREATE TABLE IF NOT EXISTS `ach_perk` ( `ap_value` int(10) unsigned NOT NULL, PRIMARY KEY (`ap_id`), UNIQUE KEY `ap_parent` (`ap_parent`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ; -- -------------------------------------------------------- @@ -156,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `ach_player_atom` ( `apa_player` bigint(20) unsigned NOT NULL, `apa_date` bigint(20) unsigned NOT NULL, `apa_expire` blob NOT NULL, - PRIMARY KEY (`apa_atom`,`apa_player`) + KEY `apa_atom` (`apa_atom`,`apa_player`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- diff --git a/code/web/app/app_achievements/_doc/devshot_001.jpg b/code/web/app/app_achievements/_doc/devshot_001.jpg new file mode 100644 index 000000000..e8777e896 Binary files /dev/null and b/code/web/app/app_achievements/_doc/devshot_001.jpg differ diff --git a/code/web/app/app_achievements/_doc/testdata.sql b/code/web/app/app_achievements/_doc/testdata.sql new file mode 100644 index 000000000..92a0074f5 --- /dev/null +++ b/code/web/app/app_achievements/_doc/testdata.sql @@ -0,0 +1,159 @@ +-- phpMyAdmin SQL Dump +-- version 3.3.3 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 27. Mai 2012 um 21:06 +-- Server Version: 5.1.46 +-- PHP-Version: 5.3.2 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `app_achievements` +-- + +-- +-- Daten für Tabelle `ach_achievement` +-- + +INSERT INTO `ach_achievement` (`aa_id`, `aa_category`, `aa_parent`, `aa_tie_race`, `aa_tie_cult`, `aa_tie_civ`, `aa_image`) VALUES +(1, 1, NULL, NULL, NULL, NULL, ''), +(2, 1, NULL, NULL, NULL, NULL, ''), +(3, 1, NULL, NULL, NULL, NULL, ''), +(4, 1, NULL, NULL, NULL, NULL, ''); + +-- +-- Daten für Tabelle `ach_achievement_lang` +-- + +INSERT INTO `ach_achievement_lang` (`aal_achievement`, `aal_lang`, `aal_name`) VALUES +(1, 'en', 'Kill the Bait'), +(2, 'en', 'Grill the Bill'), +(3, 'en', 'Killing Spree'), +(4, 'en', 'The Burning Desert'); + +-- +-- Daten für Tabelle `ach_atom` +-- + +INSERT INTO `ach_atom` (`atom_id`, `atom_objective`, `atom_mandatory`, `atom_ruleset`, `atom_primary`) VALUES +(1, 13, 0, '', 0); + +-- +-- Daten für Tabelle `ach_category` +-- + +INSERT INTO `ach_category` (`ac_id`, `ac_parent`, `ac_order`, `ac_image`) VALUES +(1, NULL, 0, ''), +(2, NULL, 0, ''), +(3, 1, 0, ''), +(4, 1, 0, ''), +(5, 1, 0, ''); + +-- +-- Daten für Tabelle `ach_category_lang` +-- + +INSERT INTO `ach_category_lang` (`acl_category`, `acl_lang`, `acl_name`) VALUES +(1, 'en', 'Exploration'), +(2, 'en', 'Occupations'), +(3, 'en', 'Aeden Aqueous'), +(4, 'en', 'Burning Desert'), +(5, 'en', 'Witherings'); + +-- +-- Daten für Tabelle `ach_objective` +-- + +INSERT INTO `ach_objective` (`ao_id`, `ao_perk`, `ao_condition`, `ao_value`, `ao_display`) VALUES +(1, 1, 'all', NULL, 'simple'), +(2, 1, 'all', NULL, 'simple'), +(3, 1, 'all', NULL, 'simple'), +(4, 1, 'all', NULL, 'simple'), +(5, 1, 'all', NULL, 'simple'), +(6, 2, 'all', NULL, 'hidden'), +(7, 3, 'all', 30, 'value'), +(8, 4, 'all', NULL, 'meta'), +(9, 4, 'all', NULL, 'meta'), +(10, 4, 'all', NULL, 'meta'), +(11, 4, 'all', NULL, 'meta'), +(12, 4, 'all', NULL, 'meta'), +(13, 3, 'all', 30, 'value'); + +-- +-- Daten für Tabelle `ach_objective_lang` +-- + +INSERT INTO `ach_objective_lang` (`aol_objective`, `aol_lang`, `aol_name`) VALUES +(1, 'en', 'Kill A'), +(2, 'en', 'Kill B'), +(3, 'en', 'Kill C'), +(4, 'en', 'Kill D'), +(5, 'en', 'Kill E'), +(7, 'en', 'Kill 30 random Yubos'), +(8, 'en', 'Meta A'), +(9, 'en', 'Meta B'), +(10, 'en', 'Meta C'), +(11, 'en', 'Meta D'), +(12, 'en', 'Meta E'), +(13, 'en', 'Kill 30 random Gingos'); + +-- +-- Daten für Tabelle `ach_perk` +-- + +INSERT INTO `ach_perk` (`ap_id`, `ap_achievement`, `ap_parent`, `ap_value`) VALUES +(1, 1, NULL, 50), +(2, 2, NULL, 10), +(3, 3, NULL, 10), +(4, 4, NULL, 20), +(5, 2, NULL, 10), +(6, 2, NULL, 10); + +-- +-- Daten für Tabelle `ach_perk_lang` +-- + +INSERT INTO `ach_perk_lang` (`apl_perk`, `apl_lang`, `apl_name`) VALUES +(1, 'en', 'Murder every boss listed below'), +(2, 'en', 'Grill "Bill the Vile"'), +(3, 'en', 'Kill 30 of each mob type listed below'), +(4, 'en', 'Explore all regions of the Burning Desert'), +(5, 'en', 'Grill "Peter the Pan"'), +(6, 'en', 'Grill "Ivan the Slayer"'); + +-- +-- Daten für Tabelle `ach_player_atom` +-- + +INSERT INTO `ach_player_atom` (`apa_atom`, `apa_player`, `apa_date`, `apa_expire`) VALUES +(1, 1, 0, ''); + +-- +-- Daten für Tabelle `ach_player_objective` +-- + +INSERT INTO `ach_player_objective` (`apo_objective`, `apo_player`, `apo_date`) VALUES +(4, 1, 500), +(7, 1, 500), +(11, 1, 500); + +-- +-- Daten für Tabelle `ach_player_perk` +-- + +INSERT INTO `ach_player_perk` (`app_perk`, `app_player`, `app_date`) VALUES +(2, 1, 600), +(5, 1, 100); + +-- +-- Daten für Tabelle `ach_player_valuecache` +-- + diff --git a/code/web/app/app_achievements/include/AchAchievement_class.php b/code/web/app/app_achievements/include/AchAchievement_class.php index 4b92d9ffc..532d6c160 100644 --- a/code/web/app/app_achievements/include/AchAchievement_class.php +++ b/code/web/app/app_achievements/include/AchAchievement_class.php @@ -9,7 +9,7 @@ private $image; private $name; - function AchAchievement(&$data,$lang) { + function AchAchievement(&$data,$lang,$user) { global $db; $this->id = $data['aa_id']; @@ -20,23 +20,33 @@ $this->tie_cult = $data['aa_tie_cult']; $this->image = $data['aa_image']; $this->name = $data['aal_name']; + $this->done = $data['']; - $res = $db->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$lang."' AND apl_achievement=ap_id) WHERE ap_achievement='".$this->id."' AND ap_parent IS NULL"); + #echo $this->id; + + $res = $db->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$lang."' AND apl_perk=ap_id) LEFT JOIN (ach_player_perk) ON (app_perk=ap_id AND app_player='".$user."') WHERE ap_achievement='".$this->id."' AND ap_parent IS NULL"); #MISSING: or parent is done $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $tmp = new AchPerk($res[$i],$lang); + #echo "Z"; + $tmp = new AchPerk($res[$i],$lang,$user); - $this->child_open[] = sizeof($this->nodes); - $this->nodes[] = $tmp; - /*if($res[$i]['']) { + #echo var_export($tmp,true); + + + if($tmp->isDone()) { + $this->child_done[] = sizeof($this->nodes); } else { - - }*/ + $this->child_open[] = sizeof($this->nodes); + } + $this->nodes[] = $tmp; #MISSING: divide into groups -> open/done } + + #echo var_export($this->child_open,true); + #echo "X-".$this->hasOpen(); } function getID() { @@ -67,12 +77,16 @@ return $this->name; } - function getValue() { + function getValueDone() { $val = 0; foreach($this->child_done as $elem) { $val += $this->nodes[$elem]->getValue(); } return $val; } + + function getValueOpen() { + return $this->nodes[$this->child_open[0]]->getValue(); + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/include/AchCategory_class.php b/code/web/app/app_achievements/include/AchCategory_class.php index d7b27fd6c..a18f523af 100644 --- a/code/web/app/app_achievements/include/AchCategory_class.php +++ b/code/web/app/app_achievements/include/AchCategory_class.php @@ -2,16 +2,18 @@ class AchCategory extends AchList { private $id = false; - function AchCategory($id,$lang = 'en') { + function AchCategory($id,$user = 0,$lang = 'en') { global $db; $this->id = $id; - $res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL"); + $res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL ORDER by aal_name ASC"); #MISSING: or parent is done $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $tmp = new AchAchievement($res[$i],$lang); + #echo "Y"; + $tmp = new AchAchievement($res[$i],$lang,$user); + #echo var_export($tmp,true); if($tmp->hasOpen()) { $this->child_open[] = sizeof($this->nodes); } diff --git a/code/web/app/app_achievements/include/AchCommon_class.php b/code/web/app/app_achievements/include/AchCommon_class.php index f0c0778b6..e2200c5c5 100644 --- a/code/web/app/app_achievements/include/AchCommon_class.php +++ b/code/web/app/app_achievements/include/AchCommon_class.php @@ -1,6 +1,6 @@ nodes); @@ -20,8 +20,8 @@ } abstract class AchList extends RenderNodeIterator { - private $child_done = array(); - private $child_open = array(); + protected $child_done = array(); + protected $child_open = array(); function getDone() { return $this->child_done; diff --git a/code/web/app/app_achievements/include/AchMenu_class.php b/code/web/app/app_achievements/include/AchMenu_class.php index be9fd49fc..9ae468406 100644 --- a/code/web/app/app_achievements/include/AchMenu_class.php +++ b/code/web/app/app_achievements/include/AchMenu_class.php @@ -1,22 +1,32 @@ sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' AND acl_category=ac_id) WHERE ac_parent IS NULL"); - #MISSING: ORDER by + $this->open = $open; + + $res = $db->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' 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,$lang); } } + + function getCat() { + return $this->open; + } } class AchMenuNode extends RenderNodeIterator { - private $id = false; - private $parent = false; - private $name = null; - private $open = false; + private $id; + private $parent; + private $name; + private $open; + private $image; + private $order; function AchMenuNode(&$data,$open,$lang) { global $db; @@ -24,11 +34,12 @@ $this->id = $data['ac_id']; $this->parent = $data['ac_parent']; $this->name = $data['acl_name']; - + $this->image = $data['ac_image']; + $this->order = $data['ac_order']; $this->open = ($open==$data['ac_id']); - $res = $db->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' AND acl_category=ac_id) WHERE ac_parent='".$this->id."'"); - #MISSING: ORDER by + $res = $db->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' AND acl_category=ac_id) WHERE ac_parent='".$this->id."' ORDER by ac_order ASC, acl_name ASC"); + $sz = sizeof($res); for($i=0;$i<$sz;$i++) { $this->nodes[] = new AchMenuNode($res[$i],$open,$lang); @@ -50,5 +61,13 @@ function isOpen() { return $this->open; } + + function getImage() { + return $this->image; + } + + function getOrder() { + return $this->order; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/include/AchObjective_class.php b/code/web/app/app_achievements/include/AchObjective_class.php index dd7d6616f..d8a596b8c 100644 --- a/code/web/app/app_achievements/include/AchObjective_class.php +++ b/code/web/app/app_achievements/include/AchObjective_class.php @@ -6,14 +6,26 @@ private $value; private $name; private $display; + private $done; + private $progress; + + function AchObjective(&$data,$lang,$user) { + global $db; - function AchObjective(&$data,$lang) { $this->id = $data['ao_id']; $this->perk = $data['ao_perk']; $this->condition = $data['ao_condition']; $this->value = $data['ao_value']; $this->name = $data['aol_name']; $this->display = $data['ao_display']; + $this->done = $data['apo_date']; + + $this->progress = $this->value; + + if(!$this->isDone()) { + $res = $db->sqlQuery("SELECT count(*) as anz FROM ach_player_atom,ach_atom WHERE apa_atom=atom_id AND atom_objective='".$this->id."' AND apa_player='".$user."'"); + $this->progress = $res[0]['anz']; + } } function getID() { @@ -32,6 +44,10 @@ return $this->value; } + function getProgress() { + return $this->progress; + } + function getName() { return $this->name; } @@ -39,5 +55,13 @@ function getDisplay() { return $this->display; } + + function isDone() { + return ($this->done > 0); + } + + function getDone() { + return $this->done; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/include/AchPerk_class.php b/code/web/app/app_achievements/include/AchPerk_class.php index 196d3bae5..30adff2e6 100644 --- a/code/web/app/app_achievements/include/AchPerk_class.php +++ b/code/web/app/app_achievements/include/AchPerk_class.php @@ -5,8 +5,9 @@ private $achievement; private $value; private $name; + private $done; - function AchPerk(&$data,$lang) { + function AchPerk(&$data,$lang,$user) { global $db; $this->id = $data['ap_id']; @@ -14,11 +15,12 @@ $this->achievement = $data['ap_achievement']; $this->value = $data['ap_value']; $this->name = $data['apl_name']; + $this->done = $data['app_date']; - $res = $db->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$lang."' AND aol_objective=ao_id) WHERE ao_perk='".$this->id."'"); + $res = $db->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$lang."' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player='".$user."') WHERE ao_perk='".$this->id."'"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $this->nodes[] = new AchObjective($res[$i],$lang); + $this->nodes[] = new AchObjective($res[$i],$lang,$user); } } @@ -41,5 +43,22 @@ function getName() { return $this->name; } + + function objDrawable() { + foreach($this->nodes as $elem) { + if($elem->getDisplay() != "hidden") { + return true; + } + } + return false; + } + + function isDone() { + return ($this->done > 0); + } + + function getDone() { + return $this->done; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/include/AchSummary_class.php b/code/web/app/app_achievements/include/AchSummary_class.php index 160854106..ba402726a 100644 --- a/code/web/app/app_achievements/include/AchSummary_class.php +++ b/code/web/app/app_achievements/include/AchSummary_class.php @@ -4,7 +4,7 @@ function AchSummary($size = 10,$lang = 'en') { global $db; - $res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL"); + $res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_parent IS NULL"); #MISSING: or parent is done #MISSING: player's status on achievement $sz = sizeof($res); 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 36f0fdbf6..4abf20f83 100644 --- a/code/web/app/app_achievements/include/ach_render_ig.php +++ b/code/web/app/app_achievements/include/ach_render_ig.php @@ -1,21 +1,285 @@ - - - - + + function ach_render_tiebar($cult = "neutral", $civ = "neutral") { + + } + + function ach_render_menu(&$menu,$sub = 0) { + $html = ""; + + $sz = $menu->getSize(); + for($i=0;$i<$sz;$i++) { + $curr = $menu->getChild($i); + $html .= "
- - - -
- - - -
".$content."
+ + + + +
".$curr->getName()."
+
".ach_render_menu($curr,($sub+4))."
"; + } + + return $html; + } + + function ach_render_category(&$cat) { + $html = ""; + + $tmp = $cat->getDone(); + $sz = sizeof($tmp); + for($i=0;$i<$sz;$i++) { + #echo "A"; + $html .= ach_render_achievement_done($cat->getChild($tmp[$i])); + } + + $tmp = $cat->getOpen(); + $sz = sizeof($tmp); + for($i=0;$i<$sz;$i++) { + #echo "B"; + $html .= ach_render_achievement_open($cat->getChild($tmp[$i])); + } + + return $html; + } + + function ach_render_achievement_done(&$ach) { + $html = ""; + + $html .= '
+ + + + -
+ + + +
+ + + + +
'.$ach->getName().'
+ '.$ach->getValueDone().'
+
'; + $html .= ach_render_perk_done($ach); + $html .= '
+ + + + + + + + +
'; + + return $html; + } + + function ach_render_achievement_open(&$ach) { + $html = ""; + + $html .= '
+ + + + + + + + + + + + + + + +
+
+ + + + +
'.$ach->getName().'
+ '.$ach->getValueOpen().'
+
'; + $html .= ach_render_perk_open($ach); + $html .= '
+
'; + + return $html; + } + + function ach_render_perk_open(&$ach) { + #echo var_export($perk_list,true); + $html = ""; + + $perk_list = $ach->getOpen(); + + $perk = $ach->getChild($perk_list[0]); + + $html .= "".$perk->getName().""; + if($perk->objDrawable()) { + $html .= "
".ach_render_obj_list($perk->getChildren()); + } + + return $html; + } + + function ach_render_perk_done(&$ach) { + $html = ""; + + $perk_list = $ach->getDone(); + + foreach($perk_list as $elem) { + $perk = $ach->getChild($elem); + $html .= "
".$perk->getName()." ( ".date('d.m.Y',$perk->getDone())." ) ".$perk->getValue()."
"; + } + /*if($perk->objDrawable()) { + $html .= "
".ach_render_obj_list($perk->getChildren()); + }*/ + + return $html; + } + + function ach_render_obj_list(&$obj) { + $html = "
"; + + $i = 0; + $skip = false; + + foreach($obj as $elem) { + if(($i%2) == 0) { + $html .= ""; + } + + switch($elem->getDisplay()) { + case "meta": + $html .= ""; + break; + case "value": + if(($i%2) == 1) { + $html .= ""; + } + $html .= ""; + $i++; + break; + case "simple": + $html .= ""; + break; + case "hidden": + default: + //do nothing + $skip = true; + break; + } + + if(($i%2) == 1) { + $html .= ""; + } + + + if(!$skip) { + $i++; + } + $skip = false; + } + + if(($i%2) == 1) { + $html .= ""; + } + + $html .= "
".ach_render_obj_meta($elem)."
".ach_render_obj_value($elem)."
".ach_render_obj_simple($elem)."
"; + + return $html; + } + + function ach_render_obj_simple(&$obj) { + $html = ""; + if($obj->isdone()) { + $html .= " "; + } + else { + $html .= " "; + } + + $html .= $obj->getName().""; + + return $html; + } + + function ach_render_obj_meta(&$obj) { + $html = ""; + if($obj->isdone()) { + $col = "#71BE02"; + $grey = ""; + } + else { + $col = "#999999"; + $grey = "grey/"; + } + + return " + + + + +
 ".$obj->getName()."
"; + } + + function ach_render_obj_value(&$obj) { + $html = ""; + if($obj->isdone()) { + $col = "#71BE02"; + } + else { + $col = "#999999"; + } + $html .= "
".$obj->getName()."
"; + + $val = $obj->getValue(); + $prog = $obj->getProgress(); + + $width = 350; + $left = floor($width*(100*($prog/$val))/100); + + $html .= " + + + +
"; + if(($prog/$val) > 0.85) { + $html .= " ".$prog." / ".$val." "; + } + $html .= ""; + if(($prog/$val) <= 0.85) { + $html .= " ".$prog." / ".$val." "; + } + $html .= "
"; + + return $html; } ?> \ 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 ba40f27c0..4abf20f83 100644 --- a/code/web/app/app_achievements/include/ach_render_web.php +++ b/code/web/app/app_achievements/include/ach_render_web.php @@ -1,103 +1,41 @@ - - - - - - - - - - - - - - - -
-
- - - - - - - - -

'.$content.'

- 50
-
10
Equip a full set of at least quality 50 jewels
03.01.2012
10
Equip a full set of at least quality 100 jewels
03.01.2012
10
Equip a full set of at least quality 150 jewels
03.01.2012
10
Equip a full set of at least quality 200 jewels
03.01.2012
10
Equip a full set of at least quality 250 jewels
03.01.2012
-
'; - } - - function ach_render_box_pending($name,$content) { - return '
- - - - - - - - - - - - - - - -
-
- - - - - - - - -

'.$name.'

- 50
-
10
Equip a full set of at least quality 50 jewels
03.01.2012
10
Equip a full set of at least quality 100 jewels
03.01.2012
10
Equip a full set of at least quality 150 jewels
03.01.2012
10
Equip a full set of at least quality 200 jewels
03.01.2012
10
Equip a full set of at least quality 250 jewels
03.01.2012
-
'; - } - - function ach_render_obj_list($list) { - //group - //columnize - //draw - } - - function ach_render_obj_meta($obj) { - - } - - function ach_render_obj_simple($obj) { - return $obj->getName(); - } - - function ach_render_obj_value($obj) { - - } function ach_render_tiebar($cult = "neutral", $civ = "neutral") { } - function ach_render_menu(&$menu) { - $html = ""; + function ach_render_menu(&$menu,$sub = 0) { + $html = ""; $sz = $menu->getSize(); for($i=0;$i<$sz;$i++) { $curr = $menu->getChild($i); - $html .= "
".ach_render_menu($curr)."
"; + $html .= " + + + + +
".$curr->getName()."
+
".ach_render_menu($curr,($sub+4))."
"; } return $html; @@ -109,12 +47,14 @@ $tmp = $cat->getDone(); $sz = sizeof($tmp); for($i=0;$i<$sz;$i++) { + #echo "A"; $html .= ach_render_achievement_done($cat->getChild($tmp[$i])); } - $tmp = $cat->getDone(); + $tmp = $cat->getOpen(); $sz = sizeof($tmp); for($i=0;$i<$sz;$i++) { + #echo "B"; $html .= ach_render_achievement_open($cat->getChild($tmp[$i])); } @@ -122,7 +62,38 @@ } function ach_render_achievement_done(&$ach) { + $html = ""; + $html .= '
+ + + + + + + + + + + + + + + +
+
+ + + + +
'.$ach->getName().'
+ '.$ach->getValueDone().'
+
'; + $html .= ach_render_perk_done($ach); + $html .= '
+
'; + + return $html; } function ach_render_achievement_open(&$ach) { @@ -137,16 +108,16 @@ -
+
- - - + + - '; - $html .= ach_render_perk_open($ach->getOpen()); - $html .= '

'.$ach->getName().'

- '.$ach->getValue().'
+
'.$ach->getName().'
+ '.$ach->getValueOpen().'
+ '; + $html .= ach_render_perk_open($ach); + $html .= ' @@ -160,28 +131,155 @@ return $html; } - function ach_render_perk_open(&$perk_list) { + function ach_render_perk_open(&$ach) { + #echo var_export($perk_list,true); $html = ""; - $perk = $perk_list[0]; + $perk_list = $ach->getOpen(); - $html .= $perk->getName()."
"; - $html .= ach_render_obj_list($perk->getChildren()); + $perk = $ach->getChild($perk_list[0]); - return $html; - } - - function ach_render_perk_done() { - - } - - function ach_render_obj_list(&$obj) { - $html = ""; - - foreach($obj as $elem) { - $html .= "-".$elem->getName()."
"; + $html .= "".$perk->getName().""; + if($perk->objDrawable()) { + $html .= "
".ach_render_obj_list($perk->getChildren()); } return $html; } + + function ach_render_perk_done(&$ach) { + $html = ""; + + $perk_list = $ach->getDone(); + + foreach($perk_list as $elem) { + $perk = $ach->getChild($elem); + $html .= "
".$perk->getName()." ( ".date('d.m.Y',$perk->getDone())." ) ".$perk->getValue()."
"; + } + /*if($perk->objDrawable()) { + $html .= "
".ach_render_obj_list($perk->getChildren()); + }*/ + + return $html; + } + + function ach_render_obj_list(&$obj) { + $html = "
"; + + $i = 0; + $skip = false; + + foreach($obj as $elem) { + if(($i%2) == 0) { + $html .= ""; + } + + switch($elem->getDisplay()) { + case "meta": + $html .= ""; + break; + case "value": + if(($i%2) == 1) { + $html .= ""; + } + $html .= ""; + $i++; + break; + case "simple": + $html .= ""; + break; + case "hidden": + default: + //do nothing + $skip = true; + break; + } + + if(($i%2) == 1) { + $html .= ""; + } + + + if(!$skip) { + $i++; + } + $skip = false; + } + + if(($i%2) == 1) { + $html .= ""; + } + + $html .= "
".ach_render_obj_meta($elem)."
".ach_render_obj_value($elem)."
".ach_render_obj_simple($elem)."
"; + + return $html; + } + + function ach_render_obj_simple(&$obj) { + $html = ""; + if($obj->isdone()) { + $html .= " "; + } + else { + $html .= " "; + } + + $html .= $obj->getName().""; + + return $html; + } + + function ach_render_obj_meta(&$obj) { + $html = ""; + if($obj->isdone()) { + $col = "#71BE02"; + $grey = ""; + } + else { + $col = "#999999"; + $grey = "grey/"; + } + + return " + + + + +
 ".$obj->getName()."
"; + } + + function ach_render_obj_value(&$obj) { + $html = ""; + if($obj->isdone()) { + $col = "#71BE02"; + } + else { + $col = "#999999"; + } + $html .= "
".$obj->getName()."
"; + + $val = $obj->getValue(); + $prog = $obj->getProgress(); + + $width = 350; + $left = floor($width*(100*($prog/$val))/100); + + $html .= " + + + + + +
"; + if(($prog/$val) > 0.85) { + $html .= " ".$prog." / ".$val." "; + } + $html .= ""; + if(($prog/$val) <= 0.85) { + $html .= " ".$prog." / ".$val." "; + } + $html .= "
"; + + return $html; + } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/index.php b/code/web/app/app_achievements/index.php index d4a9d92a8..5287f2275 100644 --- a/code/web/app/app_achievements/index.php +++ b/code/web/app/app_achievements/index.php @@ -1,14 +1,17 @@ setDbDefs('test', array('id' => SQL_DEF_INT, 'num_access' => SQL_DEF_INT)); @@ -37,29 +46,30 @@ else // Content $c = _t('access', $num_access['num_access']).'
';*/ -$c = var_export($user,true); +#$c = var_export($user,true); -$c .= "
+$c = "
- - +
"; +
"; + $_REQUEST['mid'] = 1; $menu = new AchMenu($_REQUEST['mid'],$user['lang']); $c .= ach_render_menu($menu); -$c .= "
"; +$c .= ""; /*for($i=0;$i<15;$i++) { $c .= ach_render_box_done("Bejeweled"); }*/ -if($menu->isSelected()) { - $cat = new AchCategory($menu->getCat(),$user['lang']); -} -else { - $cat = new AchSummary(12,$user['lang']); -} +#if($menu->isSelected()) { + $cat = new AchCategory($menu->getCat(),1,$user['lang']); +#} +#else { +# $cat = new AchSummary(12,$user['lang']); +#} $c .= ach_render_category($cat); diff --git a/code/web/app/app_achievements/pic/check.png b/code/web/app/app_achievements/pic/check.png new file mode 100644 index 000000000..c40307f2e Binary files /dev/null and b/code/web/app/app_achievements/pic/check.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 new file mode 100644 index 000000000..f0feccd76 Binary files /dev/null and b/code/web/app/app_achievements/pic/icon/grey/test.png differ diff --git a/code/web/app/app_achievements/pic/icon/test.png b/code/web/app/app_achievements/pic/icon/test.png new file mode 100644 index 000000000..9e0e8f14a Binary files /dev/null and b/code/web/app/app_achievements/pic/icon/test.png differ diff --git a/code/web/app/app_achievements/pic/menu/test.png b/code/web/app/app_achievements/pic/menu/test.png new file mode 100644 index 000000000..49154892f Binary files /dev/null and b/code/web/app/app_achievements/pic/menu/test.png differ diff --git a/code/web/app/app_achievements/pic/pending.png b/code/web/app/app_achievements/pic/pending.png new file mode 100644 index 000000000..451521d93 Binary files /dev/null and b/code/web/app/app_achievements/pic/pending.png differ diff --git a/code/web/app/app_achievements/pic/yubo_done.png b/code/web/app/app_achievements/pic/yubo_done.png index ff47009c9..8707db016 100644 Binary files a/code/web/app/app_achievements/pic/yubo_done.png and b/code/web/app/app_achievements/pic/yubo_done.png differ diff --git a/code/web/app/app_achievements/pic/yubo_pending.png b/code/web/app/app_achievements/pic/yubo_pending.png index 3cbcb656e..df66d1248 100644 Binary files a/code/web/app/app_achievements/pic/yubo_pending.png and b/code/web/app/app_achievements/pic/yubo_pending.png differ