2012-05-14 18:24:58 +00:00
|
|
|
<?php
|
2012-06-21 18:55:52 +00:00
|
|
|
function ach_render() {
|
2012-12-10 14:07:13 +00:00
|
|
|
global $_USER,$_CONF;
|
2012-06-21 18:55:52 +00:00
|
|
|
|
|
|
|
$c = "<table>
|
|
|
|
<tr>
|
2013-02-15 13:51:41 +00:00
|
|
|
<td>".ach_render_yubopoints()."</td>
|
2012-06-21 18:55:52 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td width='230px'>";
|
|
|
|
|
|
|
|
$menu = new AchMenu($_REQUEST['cat']);
|
|
|
|
|
|
|
|
$c .= ach_render_menu($menu);
|
|
|
|
|
|
|
|
$c .= "</td>
|
|
|
|
<td width='455px'>";
|
|
|
|
|
|
|
|
$open = $menu->getOpenCat();
|
|
|
|
|
|
|
|
if($open != 0) {
|
2013-02-15 13:51:41 +00:00
|
|
|
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);
|
2012-06-21 18:55:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-10 14:07:13 +00:00
|
|
|
$cat = new AchSummary($menu,$_CONF['summary_size']);
|
2012-06-21 18:55:52 +00:00
|
|
|
$c .= ach_render_summary_header();
|
|
|
|
}
|
|
|
|
|
|
|
|
$c .= ach_render_category($cat);
|
|
|
|
if($open == 0) {
|
|
|
|
$c .= ach_render_summary_footer($cat);
|
|
|
|
}
|
|
|
|
|
|
|
|
$c .= "</td>
|
|
|
|
</tr>
|
|
|
|
</table>";
|
|
|
|
|
|
|
|
return $c;
|
|
|
|
}
|
|
|
|
|
2012-06-03 18:53:01 +00:00
|
|
|
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
|
|
|
|
global $_USER;
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2012-06-21 20:03:36 +00:00
|
|
|
$html = "<form method='post' action='?cat=".$cat->getID()."'>
|
2012-06-03 18:53:01 +00:00
|
|
|
<table>
|
|
|
|
<tr>";
|
2013-02-15 13:51:41 +00:00
|
|
|
if($cat->isAllowedCult()) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html.= "<td>
|
2012-06-21 20:03:36 +00:00
|
|
|
<select name='cult'>
|
2012-06-03 18:53:01 +00:00
|
|
|
<option value='c_neutral'"; if($cult == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
|
|
|
<option value='c_kami'"; if($cult == "c_kami") { $html.= " selected='selected'"; } $html .= ">Kami</option>
|
|
|
|
<option value='c_karavan'"; if($cult == "c_karavan") { $html.= " selected='selected'"; } $html .= ">Karavan</option>
|
|
|
|
</select>
|
|
|
|
</td>";
|
|
|
|
}
|
2013-02-15 13:51:41 +00:00
|
|
|
if($cat->isAllowedCiv()) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html.= "<td>
|
2012-06-21 20:03:36 +00:00
|
|
|
<select name='civ'>
|
2012-06-03 18:53:01 +00:00
|
|
|
<option value='c_neutral'"; if($civ == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
|
|
|
<option value='c_fyros'"; if($civ == "c_fyros") { $html.= " selected='selected'"; } $html .= ">Fyros</option>
|
|
|
|
<option value='c_matis'"; if($civ == "c_matis") { $html.= " selected='selected'"; } $html .= ">Matis</option>
|
|
|
|
<option value='c_tryker'"; if($civ == "c_tryker") { $html.= " selected='selected'"; } $html .= ">Tryker</option>
|
|
|
|
<option value='c_zorai'"; if($civ == "c_zorai") { $html.= " selected='selected'"; } $html .= ">Zorai</option>
|
|
|
|
</select>
|
|
|
|
</td>";
|
|
|
|
}
|
2012-06-21 20:03:36 +00:00
|
|
|
$html.= "<td><input type='submit' value='show' /></td></tr><tr><td> </td></tr>
|
2012-06-03 18:53:01 +00:00
|
|
|
</table>
|
2012-06-21 20:03:36 +00:00
|
|
|
</form>
|
2012-06-03 18:53:01 +00:00
|
|
|
|
2012-06-21 20:03:36 +00:00
|
|
|
<font size='12px' color='#FFFFFF'>";
|
2012-06-03 18:53:01 +00:00
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
/*if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
|
2012-06-03 18:53:01 +00:00
|
|
|
#While being of neutral allegiance with the higher powers
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= get_translation('ach_allegiance_neutral_cult',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
|
|
|
elseif($cat->isTiedCiv() && !$cat->isTiedCult() && $civ == "c_neutral") { // xx / neutral
|
|
|
|
#While being of neutral allegiance with the homin civilizations
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= get_translation('ach_allegiance_neutral_civ',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
2013-02-15 13:51:41 +00:00
|
|
|
}*/
|
|
|
|
if(($cult == "c_neutral" || !$cat->isAllowedCult()) && ($civ == "c_neutral" || !$cat->isAllowedCiv())) { // neutral / neutral
|
2012-06-03 18:53:01 +00:00
|
|
|
#While being of neutral allegiance
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= get_translation('ach_allegiance_neutral',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
|
|
|
else { //other
|
|
|
|
#While being aligned with the
|
|
|
|
$html .= get_translation('ach_allegiance_start',$_USER->getLang());
|
2013-02-15 13:51:41 +00:00
|
|
|
if($cat->isAllowedCult() && $cult != "c_neutral") {
|
2012-06-03 18:53:01 +00:00
|
|
|
#CULT
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= "<font color='orange'>".ach_translate_cc($cult)."</font>";
|
2013-02-15 13:51:41 +00:00
|
|
|
if($cat->isAllowedCiv() && $civ != "c_neutral") {
|
2012-06-03 18:53:01 +00:00
|
|
|
#and the CIV
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= get_translation('ach_allegiance_and',$_USER->getLang())." <font color='orange'>".ach_translate_cc($civ)."</font>";
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
|
|
|
}
|
2013-02-15 13:51:41 +00:00
|
|
|
elseif($cat->isAllowedCiv() && $civ != "c_neutral") {
|
2012-06-03 18:53:01 +00:00
|
|
|
#CIV
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= "<font color='orange'>".ach_translate_cc($civ)."</font>";
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#, accomplish the following achievements:
|
2012-06-21 20:03:36 +00:00
|
|
|
$html .= get_translation('ach_allegiance_end',$_USER->getLang())."</font><br><br>";
|
2012-06-03 18:53:01 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_yubopoints() {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $DBc,$_USER,$_CONF;
|
2012-06-03 18:53:01 +00:00
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
$res = $DBc->sqlQuery("SELECT sum(at_value) as anz FROM ach_task,ach_player_task WHERE at_id=apt_task AND apt_player='".$_USER->getID()."'");
|
2012-06-03 18:53:01 +00:00
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
$html = "<font size='32px'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png?cacheid=".$_CONF['image_cdate']."'> ".max(0,$res[0]['anz'])."</font>";
|
2012-06-03 18:53:01 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_facebook() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_twitter() {
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_menu(&$menu,$sub = 0) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html = "";
|
|
|
|
if($sub == 0) {
|
|
|
|
$html = "<table cellpadding='2px'>";
|
|
|
|
}
|
2012-06-25 13:03:14 +00:00
|
|
|
|
|
|
|
$iter = $menu->getIterator();
|
|
|
|
while($iter->hasNext()) {
|
|
|
|
$curr = $iter->getNext();
|
|
|
|
#$sz = $menu->getSize();
|
|
|
|
#for($i=0;$i<$sz;$i++) {
|
|
|
|
#$curr = $menu->getChild($i);
|
2012-06-14 09:23:52 +00:00
|
|
|
if($curr->inDev()) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-24 10:44:24 +00:00
|
|
|
if($sub == 0) {
|
|
|
|
$html .= "<tr><td></td><td bgcolor='#000000'></td></tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$html .= "<tr><td>";
|
2012-06-03 18:53:01 +00:00
|
|
|
if($sub == 0) {
|
2012-12-10 14:07:13 +00:00
|
|
|
$html .= "<img src='".$_CONF['image_url']."pic/menu/ig_".$curr->getImage()."?cacheid=".$_CONF['image_cdate']."' />";
|
2012-06-21 18:55:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-10 14:07:13 +00:00
|
|
|
$html .= "<img src='".$_CONF['image_url']."pic/menu_space.png?cacheid=".$_CONF['image_cdate']."' />";
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= "</td><td><a href='?cat=".$curr->getID()."'><font size='".(16-$sub)."px'";
|
2012-05-27 19:08:28 +00:00
|
|
|
if($curr->isOpen()) {
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= " color='orange'";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= "><b>".$curr->getName()."</b></font></a></td>
|
|
|
|
</tr>";
|
|
|
|
|
2012-06-03 18:53:01 +00:00
|
|
|
if($curr->hasOpenCat() != 0) {
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= ach_render_menu($curr,($sub+4));
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
2012-06-21 18:55:52 +00:00
|
|
|
|
|
|
|
if($sub == 0) {
|
|
|
|
$html .= "<tr><td></td><td bgcolor='#000000'></td></tr></table>";
|
|
|
|
}
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_category(&$cat) {
|
2012-12-10 14:07:13 +00:00
|
|
|
global $_USER;
|
|
|
|
|
2012-05-27 19:08:28 +00:00
|
|
|
$html = "";
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
if($cat->isHeroic() && !$cat->hasDone()) {
|
2012-12-10 14:07:13 +00:00
|
|
|
return "<center style='font-size:24px;'>".get_translation('ach_no_heroic_deeds',$_USER->getLang())."</center>";
|
2012-08-20 13:52:35 +00:00
|
|
|
}
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
if($cat->hasTieAlign_done() || $cat->hasTieAlign_open()) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat);
|
|
|
|
}
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
$iter = $cat->getDone();
|
|
|
|
while($iter->hasNext()) {
|
2012-07-09 10:49:58 +00:00
|
|
|
$curr = $iter->getNext();
|
2012-08-20 13:52:35 +00:00
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_done($cat->getCurrentRace()) || !$curr->isTiedAlign_done($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
2012-06-14 09:23:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= ach_render_achievement_done($curr,$cat);
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
if($cat->isHeroic()) {
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
$iter = $cat->getOpen();
|
|
|
|
while($iter->hasNext()) {
|
2012-07-09 10:49:58 +00:00
|
|
|
$curr = $iter->getNext();
|
2012-08-20 13:52:35 +00:00
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_open($cat->getCurrentRace()) || !$curr->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
2012-06-14 09:23:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= ach_render_achievement_open($curr,$cat);
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
function ach_render_achievement_done(&$ach,&$cat) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html = "
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td width='450px' bgcolor='#D2CBDC88'>
|
|
|
|
<table width='450px' cellpadding='3px'>
|
|
|
|
<tr>
|
2012-12-10 14:07:13 +00:00
|
|
|
<td width='70px'><img src='".$_CONF['image_url']."pic/icon/".$ach->getImage()."?cacheid=".$_CONF['image_cdate']."'></td>
|
2012-06-21 18:55:52 +00:00
|
|
|
<td><center><font size='22px'><b>".$ach->getName()."</b></font></center>
|
2013-02-15 13:51:41 +00:00
|
|
|
<table>".ach_render_task_done($ach,$cat)."</table>
|
2012-06-21 18:55:52 +00:00
|
|
|
</td>
|
2012-08-20 13:52:35 +00:00
|
|
|
<td width='35px'>";
|
2012-12-10 14:07:13 +00:00
|
|
|
if((!$ach->isHeroic() && !$ach->isContest()) && $ach->getValueDone() > 0) {
|
|
|
|
$html .= "<font size='24px' color='#000000'>".$ach->getValueDone()."</font><br><img src='".$_CONF['image_url']."pic/yubo_done.png?cacheid=".$_CONF['image_cdate']."'>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$html .= '<img src="'.$_CONF['image_url'].'pic/star_done.png?cacheid='.$_CONF['image_cdate'].'"><br>';
|
2012-08-20 13:52:35 +00:00
|
|
|
}
|
|
|
|
$html .= "</td>
|
2012-06-21 18:55:52 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr><td> </td></tr>
|
|
|
|
</table>";
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
function ach_render_achievement_open(&$ach,&$cat) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html = "
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td width='450px' bgcolor='#D2CBDC33'>
|
|
|
|
<table width='450px' cellpadding='3px'>
|
|
|
|
<tr>
|
2012-12-10 14:07:13 +00:00
|
|
|
<td width='70px'><img src='".$_CONF['image_url']."pic/icon/grey/".$ach->getImage()."?cacheid=".$_CONF['image_cdate']."'></td>
|
2012-06-21 18:55:52 +00:00
|
|
|
<td><center><font size='22px'><b>".$ach->getName()."</b></font></center>
|
2012-08-20 13:52:35 +00:00
|
|
|
<table>".ach_render_task_open($ach)."</table>
|
2012-06-21 18:55:52 +00:00
|
|
|
</td>
|
2012-12-10 14:07:13 +00:00
|
|
|
<td width='35px'>";
|
|
|
|
if(!$ach->isHeroic() && !$ach->isContest()) {
|
|
|
|
$html .= "<font size='22px' color='#000000'>".$ach->getValueOpen()."</font><br><img src='".$_CONF['image_url']."pic/yubo_pending.png?cacheid=".$_CONF['image_cdate']."'>";
|
|
|
|
}
|
|
|
|
$html .= "</td>
|
2012-06-21 18:55:52 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr><td> </td></tr>
|
|
|
|
</table>";
|
|
|
|
|
2012-05-27 19:08:28 +00:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
function ach_render_task_open(&$ach) {
|
2012-05-27 19:08:28 +00:00
|
|
|
$html = "";
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
$task_list = $ach->getOpen();
|
|
|
|
$task = $task_list->getNext();
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
if($task->inDev()) {
|
2012-06-14 09:23:52 +00:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
if($task->getName() != null) {
|
|
|
|
$html .= "<tr><td><font color='#999999' size='12px'><b>".$task->getDisplayName()."</b></font></td></tr><tr><td> </td></tr>";
|
2012-06-14 09:23:52 +00:00
|
|
|
}
|
2012-08-20 13:52:35 +00:00
|
|
|
if($task->objDrawable()) {
|
|
|
|
$html .= "<tr><td>".ach_render_obj_list($task->getIterator())."</td></tr>";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
function ach_render_task_done(&$ach,&$cat) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
2012-05-27 19:08:28 +00:00
|
|
|
$html = "";
|
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
$task_list = $ach->getDone();
|
|
|
|
while($task_list->hasNext()) {
|
|
|
|
$task = $task_list->getNext();
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
if($task->inDev() || !$task->isTiedRace_open($cat->getCurrentRace()) || !$task->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
2012-06-14 09:23:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2012-12-10 14:07:13 +00:00
|
|
|
$html .= "<tr><td><font color='#66CC00'><b>".$task->getDisplayName()."</b></font><br>( ".date('d.m.Y',$task->getDone())." )";
|
|
|
|
if($task->getValue() > 0) {
|
|
|
|
$html .= " <img src='".$_CONF['image_url']."pic/yubo_done_small.png?cacheid=".$_CONF['image_cdate']."' /> ".$task->getValue();
|
|
|
|
}
|
|
|
|
$html .= "</td></tr>";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
function ach_render_obj_list($obj) {
|
2012-06-21 18:55:52 +00:00
|
|
|
$html = "<table width='90%'>";
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
$skip = false;
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
while($obj->hasNext()) {
|
|
|
|
$elem = $obj->getNext();
|
2012-05-27 19:08:28 +00:00
|
|
|
if(($i%2) == 0) {
|
|
|
|
$html .= "<tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
switch($elem->getDisplay()) {
|
|
|
|
case "meta":
|
|
|
|
$html .= "<td width='50%'>".ach_render_obj_meta($elem)."</td>";
|
|
|
|
break;
|
|
|
|
case "value":
|
|
|
|
if(($i%2) == 1) {
|
|
|
|
$html .= "</tr><tr>";
|
|
|
|
}
|
|
|
|
$html .= "<td colspan='2' width='100%'><center>".ach_render_obj_value($elem)."</center></td>";
|
|
|
|
$i++;
|
|
|
|
break;
|
|
|
|
case "simple":
|
|
|
|
$html .= "<td width='50%'>".ach_render_obj_simple($elem)."</td>";
|
|
|
|
break;
|
|
|
|
case "hidden":
|
|
|
|
default:
|
|
|
|
//do nothing
|
|
|
|
$skip = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(($i%2) == 1) {
|
|
|
|
$html .= "</tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!$skip) {
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
$skip = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(($i%2) == 1) {
|
|
|
|
$html .= "</tr>";
|
|
|
|
}
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= "</table>";
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_obj_simple(&$obj) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
|
|
|
|
2012-05-27 19:08:28 +00:00
|
|
|
$html = "";
|
|
|
|
if($obj->isdone()) {
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= "<table><tr><td><img src='".$_CONF['image_url']."pic/check.png?cacheid=".$_CONF['image_cdate']."' height='10px' /></td><td> <font color='#71BE02;'>";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= "<table><tr><td><img src='".$_CONF['image_url']."pic/pending.png?cacheid=".$_CONF['image_cdate']."' height='10px' /> <font color='#999999;'></td><td>";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
$html .= $obj->getDisplayName()."</font></td></tr></table>";
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_obj_meta(&$obj) {
|
2012-06-21 20:03:36 +00:00
|
|
|
global $_CONF;
|
2012-08-20 13:52:35 +00:00
|
|
|
|
2012-05-27 19:08:28 +00:00
|
|
|
if($obj->isdone()) {
|
|
|
|
$col = "#71BE02";
|
|
|
|
$grey = "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$col = "#999999";
|
|
|
|
$grey = "grey/";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<table cellspacing='0' cellpadding='0'>
|
|
|
|
<tr>
|
2012-12-10 14:07:13 +00:00
|
|
|
<td><img src='".$_CONF['image_url']."pic/icon/".$grey."small/".$obj->getMetaImage()."?cacheid=".$_CONF['image_cdate']."' /></td>
|
|
|
|
<td> </td>
|
|
|
|
<td><font color='".$col."'>".$obj->getDisplayName()."</font></td>
|
2012-05-27 19:08:28 +00:00
|
|
|
</tr>
|
|
|
|
</table>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_obj_value(&$obj) {
|
|
|
|
$html = "";
|
2012-06-03 18:53:01 +00:00
|
|
|
if($obj->getName() != null) {
|
|
|
|
if($obj->isdone()) {
|
|
|
|
$col = "#71BE02";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$col = "#999999";
|
|
|
|
}
|
2012-07-09 17:10:44 +00:00
|
|
|
$html .= "<font color='".$col."'>".$obj->getDisplayName()."</font>";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= ach_render_progressbar($obj->getProgress(),$obj->getValue(),250);
|
2012-06-03 18:53:01 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2012-06-03 18:53:01 +00:00
|
|
|
function ach_render_progressbar($prog,$val,$width) {
|
2012-08-20 13:52:35 +00:00
|
|
|
$hero = false;
|
|
|
|
if($val == false) {
|
|
|
|
$hero = true;
|
|
|
|
$val = $prog;
|
|
|
|
}
|
2012-06-03 18:53:01 +00:00
|
|
|
$val = max(1,$val);
|
2012-05-27 19:08:28 +00:00
|
|
|
$left = floor($width*(100*($prog/$val))/100);
|
2012-06-21 18:55:52 +00:00
|
|
|
$left = max(1,$left);
|
2012-05-27 19:08:28 +00:00
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
$html = "<table width='".($width+12)."px'>
|
|
|
|
<tr>
|
|
|
|
<td width='10px'></td>
|
|
|
|
<td><table cellpadding='1px' width='".($width+2)."px'><tr><td bgcolor='#FFFFFF'>
|
|
|
|
<table width='".$width."px' cellspacing='0' cellpadding='0'>
|
2012-05-27 19:08:28 +00:00
|
|
|
<tr>
|
2012-06-21 18:55:52 +00:00
|
|
|
<td bgcolor='#66CC00' width='".$left."px'><font color='#000000'>";
|
2012-08-20 13:52:35 +00:00
|
|
|
if($hero == false) {
|
|
|
|
if(($prog/$val) > 0.5) {
|
|
|
|
$html .= " ".nf($prog)." / ".nf($val)." ";
|
|
|
|
}
|
|
|
|
$html .= "</font></td>
|
|
|
|
<td align='left' bgcolor='#00000066'><font color='#FFFFFF'>";
|
|
|
|
if(($prog/$val) <= 0.5) {
|
|
|
|
$html .= " ".nf($prog)." / ".nf($val)." ";
|
|
|
|
}
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
2012-08-20 13:52:35 +00:00
|
|
|
else {
|
|
|
|
$html .= " ".nf($prog)." ";
|
2012-05-27 19:08:28 +00:00
|
|
|
}
|
2012-06-21 18:55:52 +00:00
|
|
|
$html .= "</font></td>
|
|
|
|
</tr>
|
|
|
|
</table></td></tr></table></td>
|
2012-05-14 18:24:58 +00:00
|
|
|
</tr>
|
|
|
|
</table>";
|
2012-05-27 19:08:28 +00:00
|
|
|
|
|
|
|
return $html;
|
2012-05-14 18:24:58 +00:00
|
|
|
}
|
2012-06-03 18:53:01 +00:00
|
|
|
|
|
|
|
function ach_render_summary_header() {
|
|
|
|
global $_USER;
|
2012-06-21 18:55:52 +00:00
|
|
|
|
|
|
|
return "<font size='30px' color='#FFFFFF'>".get_translation('ach_summary_header',$_USER->getLang())."</font>";
|
2012-06-03 18:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ach_render_summary_footer(&$summary) {
|
|
|
|
global $_USER;
|
|
|
|
|
|
|
|
$nodes = $summary->getSummary();
|
|
|
|
$html = "";
|
|
|
|
|
|
|
|
$sum_done = 0;
|
|
|
|
$sum_total = 0;
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
foreach($nodes as $elem) {
|
2012-06-21 18:55:52 +00:00
|
|
|
if(($i%2) == 0) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html .= "<tr>";
|
|
|
|
}
|
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
$html .= "<td width='225px'>".$elem[0];
|
2012-08-20 13:52:35 +00:00
|
|
|
if($elem[3] == false) {
|
|
|
|
$html .= ach_render_progressbar($elem[1],$elem[2],150);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$html .= ach_render_progressbar($elem[1],false,150);
|
|
|
|
}
|
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
$html .= "<br></td>";
|
2012-08-20 13:52:35 +00:00
|
|
|
|
2012-06-03 18:53:01 +00:00
|
|
|
$sum_done += $elem[1];
|
|
|
|
$sum_total += $elem[2];
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
if(($i%2) == 2) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html .= "</tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2012-06-21 18:55:52 +00:00
|
|
|
if(($i%2) == 2) {
|
2012-06-03 18:53:01 +00:00
|
|
|
$html .= "</tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$html = "<p />
|
2012-06-21 18:55:52 +00:00
|
|
|
<font size='30px' color='#FFFFFF'>".get_translation('ach_summary_stats',$_USER->getLang())."</font>
|
|
|
|
<table width='450px'>
|
|
|
|
<tr>
|
2012-12-10 14:07:13 +00:00
|
|
|
<td width='450px'>".get_translation('ach_summary_stats_total',$_USER->getLang()).ach_render_progressbar($sum_done,$sum_total,350)."<br></td>
|
2012-06-21 18:55:52 +00:00
|
|
|
</tr>
|
2012-06-03 18:53:01 +00:00
|
|
|
<tr>
|
2012-06-21 18:55:52 +00:00
|
|
|
<td width='450px'><table width='450px'>".$html."</table></td>
|
2012-06-03 18:53:01 +00:00
|
|
|
</tr>
|
|
|
|
</table>";
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
2012-05-14 18:24:58 +00:00
|
|
|
?>
|