mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-05 23:09:04 +00:00
#1740 replaced child node lists with doubly linked lists; various minor changes
--HG-- branch : gsoc2012-achievements
This commit is contained in:
parent
ec524af567
commit
2fb14c96eb
33 changed files with 404 additions and 278 deletions
|
@ -193,7 +193,7 @@
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = $r->getLeft();
|
$p = $r;
|
||||||
while($p->getLeft() != null) {
|
while($p->getLeft() != null) {
|
||||||
$p = $p->getLeft();
|
$p = $p->getLeft();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class AchAchievement extends AchList {
|
class AchAchievement extends AchList {
|
||||||
use Node,InDev;
|
use InDev;
|
||||||
|
|
||||||
protected $parent_id;
|
protected $parent_id;
|
||||||
protected $category;
|
protected $category;
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
function AchAchievement($data,$parent) {
|
function AchAchievement($data,$parent) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->setParent($parent);
|
$this->setParent($parent);
|
||||||
$this->setID($data['aa_id']);
|
$this->setID($data['aa_id']);
|
||||||
$this->parent_id = $data['aa_parent'];
|
$this->parent_id = $data['aa_parent'];
|
||||||
|
@ -27,7 +29,7 @@
|
||||||
$this->dev = $data['aa_dev'];
|
$this->dev = $data['aa_dev'];
|
||||||
|
|
||||||
$res = $DBc->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$_USER->getLang()."' AND apl_perk=ap_id) LEFT JOIN (ach_player_perk) ON (app_perk=ap_id AND app_player='".$_USER->getID()."') WHERE ap_achievement='".$this->id."' AND ap_parent IS NULL");
|
$res = $DBc->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$_USER->getLang()."' AND apl_perk=ap_id) LEFT JOIN (ach_player_perk) ON (app_perk=ap_id AND app_player='".$_USER->getID()."') WHERE ap_achievement='".$this->id."' AND ap_parent IS NULL");
|
||||||
#MISSING: or parent is done
|
|
||||||
$sz = sizeof($res);
|
$sz = sizeof($res);
|
||||||
for($i=0;$i<$sz;$i++) {
|
for($i=0;$i<$sz;$i++) {
|
||||||
$tmp = $this->makeChild($res[$i]);
|
$tmp = $this->makeChild($res[$i]);
|
||||||
|
@ -45,6 +47,15 @@
|
||||||
return new AchPerk($a,$this);
|
return new AchPerk($a,$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unlockedByParent() {
|
||||||
|
if($this->parent_id != null) {
|
||||||
|
$tmp = $this->parent->getChildByID($this->parent_id);
|
||||||
|
return ($tmp->hasOpen() == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function getParentID() {
|
function getParentID() {
|
||||||
return $this->parent_id;
|
return $this->parent_id;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +84,7 @@
|
||||||
$val = 0;
|
$val = 0;
|
||||||
$iter = $this->getDone();
|
$iter = $this->getDone();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $this->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
$val += $curr->getValue();
|
$val += $curr->getValue();
|
||||||
}
|
}
|
||||||
return $val;
|
return $val;
|
||||||
|
@ -82,7 +93,7 @@
|
||||||
function getValueOpen() {
|
function getValueOpen() {
|
||||||
$iter = $this->getOpen();
|
$iter = $this->getOpen();
|
||||||
if($iter->hasNext()) {
|
if($iter->hasNext()) {
|
||||||
$curr = $this->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
return $curr->getValue();
|
return $curr->getValue();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
class AchCategory extends AchList implements Tieable {
|
class AchCategory extends AchList implements Tieable {
|
||||||
protected $id;
|
#protected $id;
|
||||||
protected $ties_cult;
|
protected $ties_cult;
|
||||||
protected $ties_civ;
|
protected $ties_civ;
|
||||||
|
protected $ties_race;
|
||||||
|
protected $ties_race_dev;
|
||||||
protected $ties_cult_dev;
|
protected $ties_cult_dev;
|
||||||
protected $ties_civ_dev;
|
protected $ties_civ_dev;
|
||||||
protected $cult;
|
protected $cult;
|
||||||
protected $civ;
|
protected $civ;
|
||||||
|
|
||||||
function AchCategory($id,$cult = null,$civ = null) {
|
function AchCategory($id,$race = null,$cult = null,$civ = null) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$civ = mysql_real_escape_string($civ);
|
$civ = mysql_real_escape_string($civ);
|
||||||
$cult = mysql_real_escape_string($cult);
|
$cult = mysql_real_escape_string($cult);
|
||||||
|
$race = mysql_real_escape_string($race);
|
||||||
|
|
||||||
|
if($race == null) {
|
||||||
|
$race = $_USER->getRace();
|
||||||
|
}
|
||||||
|
|
||||||
if($cult == null) {
|
if($cult == null) {
|
||||||
$cult = $_USER->getCult();
|
$cult = $_USER->getCult();
|
||||||
|
@ -27,27 +36,33 @@
|
||||||
|
|
||||||
$this->id = mysql_real_escape_string($id);
|
$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 LIKE '".$_USER->getRace()."') AND (aa_tie_cult IS NULL OR aa_tie_cult LIKE '".$cult."') AND (aa_tie_civ IS NULL OR aa_tie_civ LIKE '".$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 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 LIKE '".$race."') AND (aa_tie_cult IS NULL OR aa_tie_cult LIKE '".$cult."') AND (aa_tie_civ IS NULL OR aa_tie_civ LIKE '".$civ."') ORDER by aal_name ASC");
|
||||||
#parent!!!!
|
|
||||||
|
|
||||||
$sz = sizeof($res);
|
$sz = sizeof($res);
|
||||||
for($i=0;$i<$sz;$i++) {
|
for($i=0;$i<$sz;$i++) {
|
||||||
$tmp = $this->makeChild($res[$i]);
|
$tmp = $this->makeChild($res[$i]);
|
||||||
|
|
||||||
if($tmp->hasOpen()) {
|
if($tmp->hasOpen()) {
|
||||||
$this->addOpen($tmp);
|
$this->addOpen($tmp); #AchList::addOpen()
|
||||||
}
|
}
|
||||||
if($tmp->hasDone()) {
|
if($tmp->hasDone()) {
|
||||||
$this->addDone($tmp);
|
$this->addDone($tmp); #AchList::addDone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//load counts for tie determination
|
||||||
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
|
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
|
||||||
$this->ties_cult = $res[0]['anz'];
|
$this->ties_cult = $res[0]['anz'];
|
||||||
|
|
||||||
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
|
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
|
||||||
$this->ties_civ = $res[0]['anz'];
|
$this->ties_civ = $res[0]['anz'];
|
||||||
|
|
||||||
|
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
|
||||||
|
$this->ties_race = $res[0]['anz'];
|
||||||
|
|
||||||
|
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."'");
|
||||||
|
$this->ties_race_dev = $res[0]['anz'];
|
||||||
|
|
||||||
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."'");
|
$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_dev = $res[0]['anz'];
|
$this->ties_cult_dev = $res[0]['anz'];
|
||||||
|
|
||||||
|
@ -55,13 +70,14 @@
|
||||||
$this->ties_civ_dev = $res[0]['anz'];
|
$this->ties_civ_dev = $res[0]['anz'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return new AchAchievement($a,$this);
|
return new AchAchievement($a,$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getID() {
|
#function getID() {
|
||||||
return $this->id;
|
# return $this->id;
|
||||||
}
|
#}
|
||||||
|
|
||||||
function isTiedCult() {
|
function isTiedCult() {
|
||||||
return ($this->ties_cult > 0);
|
return ($this->ties_cult > 0);
|
||||||
|
|
|
@ -6,95 +6,78 @@
|
||||||
child_open and child_done refer to the index set in Parentum::nodes[]
|
child_open and child_done refer to the index set in Parentum::nodes[]
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
|
|
||||||
protected $child_done = array();
|
protected $child_done;
|
||||||
protected $child_open = array();
|
protected $child_open;
|
||||||
|
|
||||||
|
function AchList() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->child_done = new DLL();
|
||||||
|
$this->child_open = new DLL();
|
||||||
|
}
|
||||||
|
|
||||||
final function getDone() {
|
final function getDone() {
|
||||||
return new NodeIterator($this->child_done);
|
return $this->child_done->getIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
final function getOpen() {
|
final function getOpen() {
|
||||||
return new NodeIterator($this->child_open);
|
return $this->child_open->getIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
final function hasOpen() {
|
final function hasOpen() {
|
||||||
return (sizeof($this->child_open) != 0);
|
#echo "hasOpen: ".$this->child_open->getSize()."<br>";
|
||||||
|
return ($this->child_open->getSize() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function hasDone() {
|
final function hasDone() {
|
||||||
return (sizeof($this->child_done) != 0);
|
#echo "hasDone: ".$this->child_done->getSize()."<br>";
|
||||||
|
return ($this->child_done->getSize() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function addOpen($n) {
|
final function addOpen($data) {
|
||||||
$this->child_open[] = $this->addChild($n);
|
$this->child_open->addNode($data);
|
||||||
|
$this->addChild($data); #Parentum::addChild()
|
||||||
}
|
}
|
||||||
|
|
||||||
final function addDone($n) {
|
final function addDone($data) {
|
||||||
$this->child_done[] = $this->addChild($n);
|
$this->child_done->addNode($data);
|
||||||
|
$this->addChild($data); #Parentum::addChild()
|
||||||
}
|
}
|
||||||
|
|
||||||
final function setChildDone($idx) {
|
final function setChildDone($id) {
|
||||||
$this->addChildDone($idx);
|
$this->addChildDone($id);
|
||||||
$this->removeChildOpen($idx);
|
$this->removeChildOpen($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function addChildDone($idx) {
|
final function setChildOpen($id) {
|
||||||
echo "try adding done child: ".$idx;
|
$this->addChildOpen($id);
|
||||||
if(!in_array($idx,$this->child_done)) {
|
$this->removeChildDone($id);
|
||||||
$this->child_done[] = $idx;
|
|
||||||
echo " ... done<br>";
|
|
||||||
}
|
|
||||||
echo var_export($this->child_done,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final function removeChildDone($idx) {
|
final function addChildDone($id) {
|
||||||
echo "try removing done child: ".$idx;
|
$data = $this->getChildDataByID($id);
|
||||||
|
$this->child_done->addNode($data);
|
||||||
foreach($this->child_done as $key=>$elem) {
|
|
||||||
if($elem == $idx) {
|
|
||||||
unset($this->child_done[$key]);
|
|
||||||
echo " ... done<br>";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo var_export($this->child_done,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final function setChildOpen($idx) {
|
final function addChildOpen($id) {
|
||||||
$this->addChildOpen($idx);
|
$data = $this->getChildDataByID($id);
|
||||||
$this->removeChildDone($idx);
|
$this->child_open->addNode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function addChildOpen($idx) {
|
final function removeChildDone($id) {
|
||||||
echo "try adding open child: ".$idx;
|
$this->child_done->removeNode($id);
|
||||||
if(!in_array($idx,$this->child_open)) {
|
|
||||||
$this->child_open[] = $idx;
|
|
||||||
echo " ... done<br>";
|
|
||||||
}
|
|
||||||
echo var_export($this->child_open,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final function removeChildOpen($idx) {
|
final function removeChildOpen($id) {
|
||||||
echo "try removing open child: ".$idx;
|
$this->child_open->removeNode($id);
|
||||||
|
|
||||||
foreach($this->child_open as $key=>$elem) {
|
|
||||||
if($elem == $idx) {
|
|
||||||
unset($this->child_open[$key]);
|
|
||||||
echo " ... done<br>";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo var_export($this->child_open,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#@OVERRIDE Parentum::removeChild()
|
#@OVERRIDE Parentum::removeChild()
|
||||||
function removeChild($id) {
|
function removeChild($id) {
|
||||||
$n = parent::removeChild($id);
|
parent::removeChild($id);
|
||||||
if($n != false && $n != null) {
|
|
||||||
unset($this->child_open[$n->getIdx()]);
|
$this->child_open->removeNode($id);
|
||||||
unset($this->child_done[$n->getIdx()]);
|
$this->child_done->removeNode($id);
|
||||||
}
|
|
||||||
return $n;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,17 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
class AchMenuNode extends Parentum {
|
class AchMenuNode extends Parentum {
|
||||||
use Node;
|
use InDev;
|
||||||
|
|
||||||
protected $parent_id;
|
protected $parent_id;
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $open;
|
protected $open;
|
||||||
protected $image;
|
protected $image;
|
||||||
protected $order;
|
protected $order;
|
||||||
protected $dev;
|
|
||||||
|
|
||||||
function AchMenuNode($data,$parent) {
|
function AchMenuNode($data,$parent) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->setParent($parent);
|
$this->setParent($parent);
|
||||||
$this->setID($data['ac_id']);
|
$this->setID($data['ac_id']);
|
||||||
$this->parent_id = $data['ac_parent'];
|
$this->parent_id = $data['ac_parent'];
|
||||||
|
@ -26,10 +27,11 @@
|
||||||
$sz = sizeof($res);
|
$sz = sizeof($res);
|
||||||
for($i=0;$i<$sz;$i++) {
|
for($i=0;$i<$sz;$i++) {
|
||||||
$res[$i]['open'] = $data['open'];
|
$res[$i]['open'] = $data['open'];
|
||||||
$this->nodes[] = $this->makeChild($res[$i]);
|
$this->addChild($this->makeChild($res[$i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return new AchMenuNode($a,$this);
|
return new AchMenuNode($a,$this);
|
||||||
}
|
}
|
||||||
|
@ -47,8 +49,10 @@
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->nodes as $elem) {
|
$iter = $this->getIterator();
|
||||||
$res = $elem->hasOpenCat();
|
while($iter->hasNext()) {
|
||||||
|
$curr = $iter->getNext();
|
||||||
|
$res = $curr->hasOpenCat();
|
||||||
if($res != 0) {
|
if($res != 0) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -67,13 +71,5 @@
|
||||||
function getOrder() {
|
function getOrder() {
|
||||||
return $this->order;
|
return $this->order;
|
||||||
}
|
}
|
||||||
|
|
||||||
function inDev() { // check if dev flag is set
|
|
||||||
return ($this->dev == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDev() {
|
|
||||||
return $this->dev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -10,6 +10,8 @@
|
||||||
function AchMenu($open = false) {
|
function AchMenu($open = false) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->open = $open;
|
$this->open = $open;
|
||||||
|
|
||||||
// the summary page is autogenerated and has no database entry. We add it manually here.
|
// the summary page is autogenerated and has no database entry. We add it manually here.
|
||||||
|
@ -29,6 +31,8 @@
|
||||||
$res[$i]['open'] = $open;
|
$res[$i]['open'] = $open;
|
||||||
$this->addChild($this->makeChild($res[$i]));
|
$this->addChild($this->makeChild($res[$i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#echo var_export($this->nodes->findNode(1),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOpen() { // just returns the previously set ID of the currently open MenuNode
|
function getOpen() { // just returns the previously set ID of the currently open MenuNode
|
||||||
|
@ -36,8 +40,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOpenCat() { // finds the currently open MenuNode and returns it's ID. If not found the result will be 0 instead.
|
function getOpenCat() { // finds the currently open MenuNode and returns it's ID. If not found the result will be 0 instead.
|
||||||
foreach($this->nodes as $elem) {
|
$iter = $this->getIterator();
|
||||||
$res = $elem->hasOpenCat();
|
while($iter->hasNext()) {
|
||||||
|
$curr = $iter->getNext();
|
||||||
|
$res = $curr->hasOpenCat();
|
||||||
if($res != 0) {
|
if($res != 0) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +51,7 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return new AchMenuNode($a,$this);
|
return new AchMenuNode($a,$this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class AchObjective extends Parentum {
|
class AchObjective extends Parentum {
|
||||||
use Node;
|
|
||||||
|
|
||||||
protected $perk;
|
protected $perk;
|
||||||
protected $condition;
|
protected $condition;
|
||||||
protected $value;
|
protected $value;
|
||||||
|
@ -14,6 +12,8 @@
|
||||||
function AchObjective($data,$parent) {
|
function AchObjective($data,$parent) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->setParent($parent);
|
$this->setParent($parent);
|
||||||
$this->setID($data['ao_id']);
|
$this->setID($data['ao_id']);
|
||||||
$this->perk = $data['ao_perk'];
|
$this->perk = $data['ao_perk'];
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override: Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class AchPerk extends Parentum {
|
class AchPerk extends Parentum {
|
||||||
use Node,InDev;
|
use InDev;
|
||||||
|
|
||||||
protected $achievement;
|
protected $achievement;
|
||||||
protected $value;
|
protected $value;
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
function AchPerk($data,$parent) {
|
function AchPerk($data,$parent) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->setParent($parent);
|
$this->setParent($parent);
|
||||||
$this->setID($data['ap_id']);
|
$this->setID($data['ap_id']);
|
||||||
$this->achievement = $data['ap_achievement'];
|
$this->achievement = $data['ap_achievement'];
|
||||||
|
@ -29,6 +31,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return new AchObjective($a,$this);
|
return new AchObjective($a,$this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
function AchSummary(&$menu,$size = 10) {
|
function AchSummary(&$menu,$size = 10) {
|
||||||
global $DBc,$_USER;
|
global $DBc,$_USER;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->menu = $menu;
|
$this->menu = $menu;
|
||||||
|
|
||||||
//read all recent perks of user
|
//read all recent perks of user
|
||||||
|
@ -21,6 +23,7 @@
|
||||||
#echo var_export($this->child_done,true);
|
#echo var_export($this->child_done,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#@override: Parentum::makeChild()
|
||||||
protected function makeChild($a) {
|
protected function makeChild($a) {
|
||||||
return new AchAchievement($a,$this);
|
return new AchAchievement($a,$this);
|
||||||
}
|
}
|
||||||
|
|
174
code/web/app/app_achievements/class/DLL_class.php
Normal file
174
code/web/app/app_achievements/class/DLL_class.php
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
<?php
|
||||||
|
class DLL {
|
||||||
|
private $first;
|
||||||
|
private $last;
|
||||||
|
private $size;
|
||||||
|
private $avl;
|
||||||
|
|
||||||
|
function DLL() {
|
||||||
|
$this->avl = new AVLTree();
|
||||||
|
|
||||||
|
$this->first = null;
|
||||||
|
$this->last = null;
|
||||||
|
|
||||||
|
$this->size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIterator() {
|
||||||
|
return new NodeIterator($this->first);
|
||||||
|
}
|
||||||
|
|
||||||
|
final function getSize() {
|
||||||
|
return $this->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function isEmpty() {
|
||||||
|
return ($this->size == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFirst() {
|
||||||
|
return $this->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLast() {
|
||||||
|
return $this->last;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addNode($data,$before = null) {
|
||||||
|
if($this->findNode($data->getID()) != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$n = new DLLnode($data);
|
||||||
|
if($before == null) {
|
||||||
|
//insert as last
|
||||||
|
if($this->last != null) {
|
||||||
|
$this->last->setChild($n);
|
||||||
|
}
|
||||||
|
$n->setParent($this->last);
|
||||||
|
$this->last = $n;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//insert before
|
||||||
|
$b = $this->findNode($before);
|
||||||
|
if($b != null) {
|
||||||
|
if($b == $this->first) {
|
||||||
|
$this->first = $n;
|
||||||
|
}
|
||||||
|
$tmp = $b->getParent();
|
||||||
|
$b->setParent($n);
|
||||||
|
$n->setChild($b);
|
||||||
|
if($tmp != null) {
|
||||||
|
$tmp->setChild($n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->first == null) {
|
||||||
|
$this->first = $n;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->avl->insert($n);
|
||||||
|
$this->size++;
|
||||||
|
|
||||||
|
#$this->avl->inorder();
|
||||||
|
#echo "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeNode($id) {
|
||||||
|
echo "rid: ".$id."<br>";
|
||||||
|
$this->avl->inorder();
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
|
$n = $this->findNode($id);
|
||||||
|
if($n != null) {
|
||||||
|
echo "removed; ";
|
||||||
|
$p = $n->getParent();
|
||||||
|
$c = $n->getChild();
|
||||||
|
|
||||||
|
if($c != null) {
|
||||||
|
$c->setParent($p);
|
||||||
|
if($p != null) {
|
||||||
|
$p->setChild($c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if($p != null) {
|
||||||
|
$p->setChild(null);
|
||||||
|
}
|
||||||
|
$this->last = $p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($p == null) {
|
||||||
|
if($c != null) {
|
||||||
|
$c->setParent(null);
|
||||||
|
$this->first = $c;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->first = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->avl->remove($id);
|
||||||
|
$this->size--;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->avl->inorder();
|
||||||
|
echo "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function findNode($id) {
|
||||||
|
return $this->avl->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*function storeOrder() {
|
||||||
|
$iter = $this->getIterator();
|
||||||
|
$i = 0;
|
||||||
|
while($iter->hasNext()) {
|
||||||
|
$curr = $iter->getNext();
|
||||||
|
$curr->StoreOrder($i);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
class DLLnode {
|
||||||
|
private $parent;
|
||||||
|
private $child;
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
function DLLNode($d) {
|
||||||
|
$this->parent = null;
|
||||||
|
$this->child = null;
|
||||||
|
$this->data = $d;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function getParent() {
|
||||||
|
return $this->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function setParent($p) {
|
||||||
|
$this->parent = $p;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function getChild() {
|
||||||
|
return $this->child;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function setChild($c) {
|
||||||
|
$this->child = $c;
|
||||||
|
}
|
||||||
|
|
||||||
|
final function getIterator() {
|
||||||
|
return new NodeIterator($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
#function ListStoreOrder($i) {
|
||||||
|
# $this->data->setListOrder($i);
|
||||||
|
# $this->data->update();
|
||||||
|
#}
|
||||||
|
|
||||||
|
function getID() {
|
||||||
|
return $this->data->getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -11,26 +11,37 @@
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
private $nodes;
|
private $node;
|
||||||
private $curr;
|
#private $curr;
|
||||||
|
|
||||||
function NodeIterator(&$nodes) {
|
function NodeIterator($node) {
|
||||||
$this->nodes = $nodes;
|
$this->node = $node;
|
||||||
$this->curr = 0;
|
#$this->curr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasNext() {
|
function hasNext() {
|
||||||
$tmp = array_keys($this->nodes);
|
#$tmp = array_keys($this->nodes);
|
||||||
return isset($this->nodes[$tmp[$this->curr]]);
|
#return isset($this->nodes[$tmp[$this->curr]]);
|
||||||
|
if($this->node == null) {
|
||||||
|
#echo "empty";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if($this->node->getChild() == null) {
|
||||||
|
# return false;
|
||||||
|
#}
|
||||||
|
|
||||||
|
#echo "true";
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNext() {
|
function getNext() {
|
||||||
$tmp = array_keys($this->nodes);
|
#$tmp = array_keys($this->nodes);
|
||||||
return $this->nodes[$tmp[$this->curr++]];
|
#return $this->nodes[$tmp[$this->curr++]];
|
||||||
}
|
$n = $this->node;
|
||||||
|
$this->node = $this->node->getChild();
|
||||||
function first() {
|
return $n->data;
|
||||||
$this->curr = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,31 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
trait Node {
|
abstract class Node {
|
||||||
/*---------------------------
|
/*---------------------------
|
||||||
This trait provides basic functionality common to nodes.
|
This class provides basic functionality common to nodes.
|
||||||
|
|
||||||
Every node has an id, and InDeX and a parent.
|
Every node has an id and a parent.
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
|
|
||||||
protected $idx;
|
|
||||||
protected $id;
|
protected $id;
|
||||||
protected $parent;
|
protected $parent;
|
||||||
|
|
||||||
|
function Node() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
final function getID() {
|
final function getID() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function getIdx() {
|
|
||||||
return $this->idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
final function getParent() {
|
final function getParent() {
|
||||||
return $this->parent;
|
return $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function setIdx($i) {
|
|
||||||
$this->idx = $i;
|
|
||||||
}
|
|
||||||
|
|
||||||
final function setID($id) {
|
final function setID($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
abstract class Parentum {
|
abstract class Parentum extends Node {
|
||||||
/*---------------------------
|
/*---------------------------
|
||||||
This class allows external access to the child-node list.
|
This class allows external access to the child-node list.
|
||||||
Use the NodeIterator to iterate through the list since
|
Use the NodeIterator to iterate through the list since
|
||||||
|
@ -9,80 +9,41 @@
|
||||||
functions removeChild() and findChild(). init() must be called
|
functions removeChild() and findChild(). init() must be called
|
||||||
before adding any nodes!
|
before adding any nodes!
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
protected $nodes = array();
|
protected $nodes;
|
||||||
protected $avl = null;
|
|
||||||
|
|
||||||
protected function init() {
|
function Parentum() {
|
||||||
#echo "init()";
|
parent::__construct();
|
||||||
$this->nodes = array();
|
$this->nodes = new DLL(); // Doubly Linked List
|
||||||
$this->avl = new AVLTree();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function makeChild($args); // overwriteable child generator; allows to define child type (eg.: admin classes that inherit from base class)
|
abstract protected function makeChild($args); // overwriteable child generator; allows to define child type (eg.: admin classes that inherit from base class)
|
||||||
|
|
||||||
final function getSize() {
|
function isEmpty() {
|
||||||
return sizeof($this->nodes);
|
return $this->nodes->isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
final function isEmpty() {
|
function addChild($data) {
|
||||||
return (sizeof($this->nodes) == 0);
|
$this->nodes->addNode($data);
|
||||||
}
|
|
||||||
|
|
||||||
final function getIterator() {
|
|
||||||
return new NodeIterator($this->nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
final function addChild($n) {
|
|
||||||
$tmp = sizeof($this->nodes);
|
|
||||||
$n->setIdx($tmp);
|
|
||||||
$this->nodes[] = $n;
|
|
||||||
if($this->avl != null) {
|
|
||||||
$this->avl->insert($n);
|
|
||||||
}
|
|
||||||
return $tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeChild($id) {
|
function removeChild($id) {
|
||||||
if($this->isEmpty()) {
|
$this->nodes->removeNode($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getChildByID($id) {
|
||||||
|
return $this->nodes->findNode($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getChildDataByID($id) {
|
||||||
|
$tmp = $this->getChildByID($id);
|
||||||
|
if($tmp != null) {
|
||||||
|
return $tmp->data;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->avl == null) {
|
function getIterator() {
|
||||||
return false;
|
return $this->nodes->getIterator();
|
||||||
}
|
|
||||||
$n = $this->avl->remove($id);
|
|
||||||
|
|
||||||
#echo var_export($n,true);
|
|
||||||
if($n != null) {
|
|
||||||
if($n->getIdx() != null) {
|
|
||||||
unset($this->nodes[$n->getIdx()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $n;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final function getChildByID($id) {
|
|
||||||
if($this->isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->avl == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#$this->avl->inorder();
|
|
||||||
|
|
||||||
return $this->avl->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
final function getChildByIdx($idx) {
|
|
||||||
if($this->isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $this->nodes[$idx];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -24,7 +24,7 @@
|
||||||
$open = $menu->getOpenCat();
|
$open = $menu->getOpenCat();
|
||||||
|
|
||||||
if($open != 0) {
|
if($open != 0) {
|
||||||
$cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']);
|
$cat = new AchCategory($open,'matis',$_REQUEST['cult'],$_REQUEST['civ']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$cat = new AchSummary($menu,8);
|
$cat = new AchSummary($menu,8);
|
||||||
|
@ -160,6 +160,7 @@
|
||||||
$iter = $menu->getIterator();
|
$iter = $menu->getIterator();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $iter->getNext();
|
$curr = $iter->getNext();
|
||||||
|
#$curr = $curr->data;
|
||||||
#$sz = $menu->getSize();
|
#$sz = $menu->getSize();
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
# $curr = $menu->getChild($i);
|
# $curr = $menu->getChild($i);
|
||||||
|
@ -195,7 +196,7 @@
|
||||||
|
|
||||||
$iter = $cat->getDone();
|
$iter = $cat->getDone();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $cat->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
#$sz = sizeof($tmp);
|
#$sz = sizeof($tmp);
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
#echo "A";
|
#echo "A";
|
||||||
|
@ -207,7 +208,7 @@
|
||||||
|
|
||||||
$iter = $cat->getOpen();
|
$iter = $cat->getOpen();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $cat->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
#$sz = sizeof($tmp);
|
#$sz = sizeof($tmp);
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
#echo "B";
|
#echo "B";
|
||||||
|
@ -295,7 +296,7 @@
|
||||||
$html = "";
|
$html = "";
|
||||||
|
|
||||||
$perk_list = $ach->getOpen();
|
$perk_list = $ach->getOpen();
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
|
|
||||||
#$perk = $ach->getChild($perk_list[0]);
|
#$perk = $ach->getChild($perk_list[0]);
|
||||||
|
|
||||||
|
@ -319,7 +320,7 @@
|
||||||
|
|
||||||
$perk_list = $ach->getDone();
|
$perk_list = $ach->getDone();
|
||||||
while($perk_list->hasNext()) {
|
while($perk_list->hasNext()) {
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
#foreach($perk_list as $elem) {
|
#foreach($perk_list as $elem) {
|
||||||
#$perk = $ach->getChild($elem);
|
#$perk = $ach->getChild($elem);
|
||||||
if($perk->inDev()) {
|
if($perk->inDev()) {
|
||||||
|
|
|
@ -34,12 +34,15 @@ else {
|
||||||
}
|
}
|
||||||
require_once("include/ach_render_common.php");
|
require_once("include/ach_render_common.php");
|
||||||
|
|
||||||
|
require_once("class/DLL_class.php");
|
||||||
|
require_once("class/InDev_trait.php");
|
||||||
|
require_once("class/Node_abstract.php");
|
||||||
require_once("class/AVLTree_class.php");
|
require_once("class/AVLTree_class.php");
|
||||||
require_once("class/Parentum_abstract.php");
|
require_once("class/Parentum_abstract.php");
|
||||||
require_once("class/AchList_abstract.php");
|
require_once("class/AchList_abstract.php");
|
||||||
require_once("class/Tieable_inter.php");
|
require_once("class/Tieable_inter.php");
|
||||||
require_once("class/NodeIterator_class.php");
|
require_once("class/NodeIterator_class.php");
|
||||||
require_once("class/Node_trait.php");
|
|
||||||
|
|
||||||
require_once("class/AchMenu_class.php");
|
require_once("class/AchMenu_class.php");
|
||||||
require_once("class/AchMenuNode_class.php");
|
require_once("class/AchMenuNode_class.php");
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use AdmDispatcher;
|
use AdmDispatcher;
|
||||||
|
|
||||||
function AdmAchievement($data,$parent) {
|
function AdmAchievement($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class AdmAtom implements ADM {
|
class AdmAtom extends Node implements ADM {
|
||||||
use Node;
|
|
||||||
|
|
||||||
protected $objective;
|
protected $objective;
|
||||||
protected $mandatory;
|
protected $mandatory;
|
||||||
protected $ruleset;
|
protected $ruleset;
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
class AdmCategory extends AchCategory {
|
class AdmCategory extends AchCategory {
|
||||||
use AdmDispatcher;
|
use AdmDispatcher;
|
||||||
|
|
||||||
function AdmCategory($id,$cult = null,$civ = null) {
|
function AdmCategory($id,$race,$cult = null,$civ = null) {
|
||||||
$this->init();
|
parent::__construct($id,$race,$cult,$civ);
|
||||||
parent::__construct($id,$cult,$civ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function makeChild($d) {
|
protected function makeChild($d) {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNode($id) {
|
function removeNode($id) {
|
||||||
$res = $this->getChildByID($id);
|
$res = $this->getChildDataByID($id);
|
||||||
if($res != null) {
|
if($res != null) {
|
||||||
$res->delete_me();
|
$res->delete_me();
|
||||||
$this->removeChild($id);
|
$this->removeChild($id);
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNode($id) { // PROBABLY USELESS!
|
function updateNode($id) { // PROBABLY USELESS!
|
||||||
$res = $this->getChildByID($id);
|
$res = $this->getChildDataByID($id);
|
||||||
if($res != null) {
|
if($res != null) {
|
||||||
$res->update();
|
$res->update();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
$tmp = explode(";",$pid);
|
$tmp = explode(";",$pid);
|
||||||
if($tmp[0] == $this->getID()) {
|
if($tmp[0] == $this->getID()) {
|
||||||
if(sizeof($tmp) > 1) {
|
if(sizeof($tmp) > 1) {
|
||||||
$c = $this->getChildByID($tmp[1]);
|
$c = $this->getChildDataByID($tmp[1]);
|
||||||
if($c != null) {
|
if($c != null) {
|
||||||
unset($tmp[0]);
|
unset($tmp[0]);
|
||||||
return $c->getElementByPath(implode(";",$tmp));
|
return $c->getElementByPath(implode(";",$tmp));
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
private $ach_count;
|
private $ach_count;
|
||||||
|
|
||||||
function AdmMenuNode($data,$parent) {
|
function AdmMenuNode($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
|
|
||||||
global $DBc;
|
global $DBc;
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNode($id) { // try to find the child node that has the given ID. Return null on failure.
|
function getNode($id) { // try to find the child node that has the given ID. Return null on failure.
|
||||||
$res = $this->getChildByID($id);
|
$res = $this->getChildDataByID($id);
|
||||||
if($res != null) {
|
if($res != null) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -65,15 +64,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function unsetChild($id) { // remove child with given ID from nodes list; unset should destruct.
|
|
||||||
foreach($this->nodes as $key=>$elem) {
|
|
||||||
if($elem->getID() == $id) {
|
|
||||||
unset($this->nodes[$key]);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
function insertChild(&$n) { // insert a new child
|
function insertChild(&$n) { // insert a new child
|
||||||
// insert command to create database entry
|
// insert command to create database entry
|
||||||
$n->insert();
|
$n->insert();
|
||||||
|
@ -105,21 +95,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInDev($tf) {
|
|
||||||
if($tf == true) {
|
|
||||||
$this->setDev(1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->setDev(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function setDev($d) {
|
|
||||||
$this->dev = $d;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function setOrder($o) {
|
private function setOrder($o) {
|
||||||
$this->order = $o;
|
$this->order = $o;
|
||||||
$this->update();
|
$this->update();
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use AdmDispatcher;
|
use AdmDispatcher;
|
||||||
|
|
||||||
function AdmMenu($open) {
|
function AdmMenu($open) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($open);
|
parent::__construct($open);
|
||||||
|
|
||||||
#$this->drawTree();
|
#$this->drawTree();
|
||||||
|
@ -65,7 +64,7 @@
|
||||||
|
|
||||||
function getNode($id) { // try to find the MenuNode that has the given ID. Return null on failure.
|
function getNode($id) { // try to find the MenuNode that has the given ID. Return null on failure.
|
||||||
#echo "<br>getNode(".$id.")";
|
#echo "<br>getNode(".$id.")";
|
||||||
$res = $this->getChildByID($id);
|
$res = $this->getChildDataByID($id);
|
||||||
if($res != null) {
|
if($res != null) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use AdmDispatcher;
|
use AdmDispatcher;
|
||||||
|
|
||||||
function AdmObjective($data,$parent) {
|
function AdmObjective($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
|
|
||||||
global $DBc;
|
global $DBc;
|
||||||
|
@ -11,7 +10,7 @@
|
||||||
$res = $DBc->sqlQuery("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->getID()."'");
|
$res = $DBc->sqlQuery("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->getID()."'");
|
||||||
$sz = sizeof($res);
|
$sz = sizeof($res);
|
||||||
for($i=0;$i<$sz;$i++) {
|
for($i=0;$i<$sz;$i++) {
|
||||||
$this->nodes[] = $this->makeChild($res[$i]);
|
$this->addChild($this->makeChild($res[$i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
protected $condition_value;
|
protected $condition_value;
|
||||||
|
|
||||||
function AdmPerk($data,$parent) {
|
function AdmPerk($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
|
|
||||||
$this->condition = $data["ap_condition"];
|
$this->condition = $data["ap_condition"];
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use CSRDispatcher;
|
use CSRDispatcher;
|
||||||
|
|
||||||
function CSRAchievement($data,$parent) {
|
function CSRAchievement($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +15,10 @@
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $iter->getNext();
|
$curr = $iter->getNext();
|
||||||
$curr->grant($pid);
|
$curr->grant($pid);
|
||||||
$this->setChildDone($curr->getIdx());
|
$this->setChildDone($curr->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parent->setChildDone($this->idx);
|
$this->parent->setChildDone($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deny($pid) {
|
function deny($pid) {
|
||||||
|
@ -27,34 +26,34 @@
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $iter->getNext();
|
$curr = $iter->getNext();
|
||||||
$curr->deny($pid);
|
$curr->deny($pid);
|
||||||
$this->setChildOpen($curr->getIdx());
|
$this->setChildOpen($curr->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parent->setChildOpen($this->idx);
|
$this->parent->setChildOpen($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPerkDone($idx) {
|
function setPerkDone($id) {
|
||||||
echo "perk<br>";
|
echo "perk<br>";
|
||||||
$this->setChildDone($idx);
|
$this->setChildDone($id);
|
||||||
|
|
||||||
echo "ach<br>";
|
echo "ach<br>";
|
||||||
|
|
||||||
$this->parent->addChildDone($this->idx);
|
$this->parent->addChildDone($this->id);
|
||||||
|
|
||||||
if(!$this->hasOpen()) {
|
if(!$this->hasOpen()) {
|
||||||
$this->parent->removeChildOpen($this->idx);
|
$this->parent->removeChildOpen($this->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPerkOpen($idx) {
|
function setPerkOpen($id) {
|
||||||
echo "perk<br>";
|
echo "perk<br>";
|
||||||
$this->setChildOpen($idx);
|
$this->setChildOpen($id);
|
||||||
echo "ach<br>";
|
echo "ach<br>";
|
||||||
|
|
||||||
$this->parent->addChildOpen($this->idx);
|
$this->parent->addChildOpen($this->id);
|
||||||
|
|
||||||
if(!$this->hasDone()) {
|
if(!$this->hasDone()) {
|
||||||
$this->parent->removeChildDone($this->idx);
|
$this->parent->removeChildDone($this->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class CSRAtom implements CSR {
|
class CSRAtom extends Node implements CSR {
|
||||||
use Node;
|
|
||||||
|
|
||||||
function CSRAtom($data,$parent) {
|
function CSRAtom($data,$parent) {
|
||||||
$this->id = $data['atom_id'];
|
$this->id = $data['atom_id'];
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
class CSRCategory extends AchCategory implements CSR {
|
class CSRCategory extends AchCategory implements CSR {
|
||||||
use CSRDispatcher;
|
use CSRDispatcher;
|
||||||
|
|
||||||
function CSRCategory($id,$cult = null,$civ = null) {
|
function CSRCategory($id,$race,$cult = null,$civ = null) {
|
||||||
$this->init();
|
parent::__construct($id,$race,$cult,$civ);
|
||||||
parent::__construct($id,$cult,$civ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function makeChild($d) {
|
protected function makeChild($d) {
|
||||||
|
@ -16,7 +15,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function deny($id) {
|
function deny($id) {
|
||||||
return false; // category can't grant!
|
return false; // category can't deny!
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function setAchOpen($idx,$state) {
|
/*function setAchOpen($idx,$state) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//get child with the next level id and dispatch
|
//get child with the next level id and dispatch
|
||||||
$tmp = explode(";",$path);
|
$tmp = explode(";",$path);
|
||||||
|
|
||||||
$c = $this->getChildByID($tmp[1]);
|
$c = $this->getChildDataByID($tmp[1]);
|
||||||
#echo "...".$tmp[1];
|
#echo "...".$tmp[1];
|
||||||
if($c != null) { // check if it's really own child
|
if($c != null) { // check if it's really own child
|
||||||
unset($tmp[0]);
|
unset($tmp[0]);
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
if($tmp[0] == $this->getID()) { // it's my id!
|
if($tmp[0] == $this->getID()) { // it's my id!
|
||||||
|
|
||||||
$c = $this->getChildByID($tmp[1]);
|
$c = $this->getChildDataByID($tmp[1]);
|
||||||
if($c != null) { // check if it's really own child
|
if($c != null) { // check if it's really own child
|
||||||
unset($tmp[0]);
|
unset($tmp[0]);
|
||||||
$c->denyNode(implode(";",$tmp),$player);
|
$c->denyNode(implode(";",$tmp),$player);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#private $nodes;
|
#private $nodes;
|
||||||
|
|
||||||
function CSRObjective($data,$parent) {
|
function CSRObjective($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
|
|
||||||
global $DBc;
|
global $DBc;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use CSRDispatcher;
|
use CSRDispatcher;
|
||||||
|
|
||||||
function CSRPerk($data,$parent) {
|
function CSRPerk($data,$parent) {
|
||||||
$this->init();
|
|
||||||
parent::__construct($data,$parent);
|
parent::__construct($data,$parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
$DBc->sqlQuery("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$this->getID()."','".$pid."','".time()."')");
|
$DBc->sqlQuery("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$this->getID()."','".$pid."','".time()."')");
|
||||||
$this->done = time();
|
$this->done = time();
|
||||||
#echo $this->idx."<br>";
|
#echo $this->idx."<br>";
|
||||||
$this->parent->setPerkDone($this->idx);
|
$this->parent->setPerkDone($this->id);
|
||||||
|
|
||||||
$iter = $this->getIterator();
|
$iter = $this->getIterator();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
|
@ -31,7 +30,7 @@
|
||||||
|
|
||||||
$DBc->sqlQuery("DELETE FROM ach_player_perk WHERE app_perk='".$this->getID()."' AND app_player='".$pid."'");
|
$DBc->sqlQuery("DELETE FROM ach_player_perk WHERE app_perk='".$this->getID()."' AND app_player='".$pid."'");
|
||||||
$this->done = 0;
|
$this->done = 0;
|
||||||
$this->parent->setPerkOpen($this->idx);
|
$this->parent->setPerkOpen($this->id);
|
||||||
|
|
||||||
$iter = $this->getIterator();
|
$iter = $this->getIterator();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
|
|
||||||
$iter = $cat->getOpen();
|
$iter = $cat->getOpen();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $cat->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
#$sz = sizeof($tmp);
|
#$sz = sizeof($tmp);
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
#echo "B";
|
#echo "B";
|
||||||
|
@ -333,7 +333,7 @@
|
||||||
<option value='null' selected='selected'>[set as main perk]</option>";
|
<option value='null' selected='selected'>[set as main perk]</option>";
|
||||||
$iter = $ach->getOpen();
|
$iter = $ach->getOpen();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $ach->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
$html .= "<option value='".$curr->getID()."'>".$curr->getName()."</option>";
|
$html .= "<option value='".$curr->getID()."'>".$curr->getName()."</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@
|
||||||
$perk_list = $ach->getOpen();
|
$perk_list = $ach->getOpen();
|
||||||
while($perk_list->hasNext()) {
|
while($perk_list->hasNext()) {
|
||||||
|
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
|
|
||||||
#$perk = $ach->getChild($perk_list[0]);
|
#$perk = $ach->getChild($perk_list[0]);
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@
|
||||||
$par = $perk->getParent();
|
$par = $perk->getParent();
|
||||||
$iter = $par->getOpen();
|
$iter = $par->getOpen();
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $par->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
$html .= "<option value='".$curr->getID()."'>".$curr->getName()."</option>";
|
$html .= "<option value='".$curr->getID()."'>".$curr->getName()."</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@
|
||||||
|
|
||||||
$perk_list = $ach->getDone();
|
$perk_list = $ach->getDone();
|
||||||
while($perk_list->hasNext()) {
|
while($perk_list->hasNext()) {
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
#foreach($perk_list as $elem) {
|
#foreach($perk_list as $elem) {
|
||||||
#$perk = $ach->getChild($elem);
|
#$perk = $ach->getChild($elem);
|
||||||
if($perk->inDev()) {
|
if($perk->inDev()) {
|
||||||
|
@ -588,7 +588,7 @@
|
||||||
#if(($i%2) == 1) {
|
#if(($i%2) == 1) {
|
||||||
# $html .= "</tr><tr>";
|
# $html .= "</tr><tr>";
|
||||||
#}
|
#}
|
||||||
$html .= "<td><center>".ach_render_obj_value($elem)."</center></td>";
|
$html .= "<td>".ach_render_obj_value($elem)."</td>";
|
||||||
#$i++;
|
#$i++;
|
||||||
break;
|
break;
|
||||||
case "simple":
|
case "simple":
|
||||||
|
@ -601,7 +601,7 @@
|
||||||
#if(($i%2) == 1) {
|
#if(($i%2) == 1) {
|
||||||
# $html .= "</tr><tr>";
|
# $html .= "</tr><tr>";
|
||||||
#}
|
#}
|
||||||
$html .= "<td><center>".ach_render_obj_hidden($elem)."</center></td>";
|
$html .= "<td>".ach_render_obj_hidden($elem)."</td>";
|
||||||
#$i++;
|
#$i++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,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()."'");
|
$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 = "<div style='display:block;border-bottom:1px solid #000000;'><span style='font-size:32px;'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png'> ".$res[0]['anz']."</span></div>";
|
$html = "<div style='display:block;border-bottom:1px solid #000000;'><span style='font-size:32px;'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png'> ".max(0,$res[0]['anz'])."</span></div>";
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
@ -132,9 +132,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$iter = $cat->getDone();
|
$iter = $cat->getDone();
|
||||||
echo "<br>done: ".var_export($iter,true)."<br>";
|
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$curr = $cat->getChildByIdx($iter->getNext());
|
$curr = $iter->getNext();
|
||||||
|
|
||||||
#$sz = sizeof($tmp);
|
#$sz = sizeof($tmp);
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
|
@ -146,11 +146,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$iter = $cat->getOpen();
|
$iter = $cat->getOpen();
|
||||||
echo "<br>open: ".var_export($iter,true)."<br>";
|
|
||||||
while($iter->hasNext()) {
|
while($iter->hasNext()) {
|
||||||
$tmp = $iter->getNext();
|
$curr = $iter->getNext();
|
||||||
$curr = $cat->getChildByIdx($tmp);
|
|
||||||
echo "<b>".$tmp."-".$curr->getIdx()."</b><br>";
|
|
||||||
#$sz = sizeof($tmp);
|
#$sz = sizeof($tmp);
|
||||||
#for($i=0;$i<$sz;$i++) {
|
#for($i=0;$i<$sz;$i++) {
|
||||||
#echo "B";
|
#echo "B";
|
||||||
|
@ -238,10 +237,8 @@
|
||||||
$html = "";
|
$html = "";
|
||||||
|
|
||||||
$perk_list = $ach->getOpen();
|
$perk_list = $ach->getOpen();
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
|
|
||||||
echo "<b>".$ach->getIdx()."</b>";
|
|
||||||
echo "<br>".var_export($perk_list,true)."<br>";
|
|
||||||
|
|
||||||
#$perk = $ach->getChild($perk_list[0]);
|
#$perk = $ach->getChild($perk_list[0]);
|
||||||
|
|
||||||
|
@ -274,7 +271,7 @@
|
||||||
|
|
||||||
$perk_list = $ach->getDone();
|
$perk_list = $ach->getDone();
|
||||||
while($perk_list->hasNext()) {
|
while($perk_list->hasNext()) {
|
||||||
$perk = $ach->getChildByIdx($perk_list->getNext());
|
$perk = $perk_list->getNext();
|
||||||
#foreach($perk_list as $elem) {
|
#foreach($perk_list as $elem) {
|
||||||
#$perk = $ach->getChild($elem);
|
#$perk = $ach->getChild($elem);
|
||||||
if($perk->inDev()) {
|
if($perk->inDev()) {
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
if($_REQUEST['ac_id'] > 0 && $_REQUEST['confirm'] == "delete") {
|
if($_REQUEST['ac_id'] > 0 && $_REQUEST['confirm'] == "delete") {
|
||||||
$curr = $menu->getNode($_REQUEST['ac_id']);
|
$curr = $menu->getChildDataByID($_REQUEST['ac_id']);
|
||||||
$html .= "<div style='display:block;'>
|
$html .= "<div style='display:block;'>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Are you sure you want to delete this category?</legend>";
|
<legend>Are you sure you want to delete this category?</legend>";
|
||||||
|
|
|
@ -36,12 +36,13 @@ require_once("class/mySQL_class.php");
|
||||||
#require_once("include/ach_render_csr.php");
|
#require_once("include/ach_render_csr.php");
|
||||||
require_once($_CONF['app_achievements_path']."include/ach_render_common.php");
|
require_once($_CONF['app_achievements_path']."include/ach_render_common.php");
|
||||||
|
|
||||||
|
require_once($_CONF['app_achievements_path']."class/DLL_class.php");
|
||||||
|
require_once($_CONF['app_achievements_path']."class/Node_abstract.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/AVLTree_class.php");
|
require_once($_CONF['app_achievements_path']."class/AVLTree_class.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/Parentum_abstract.php");
|
require_once($_CONF['app_achievements_path']."class/Parentum_abstract.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/AchList_abstract.php");
|
require_once($_CONF['app_achievements_path']."class/AchList_abstract.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/Tieable_inter.php");
|
require_once($_CONF['app_achievements_path']."class/Tieable_inter.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/NodeIterator_class.php");
|
require_once($_CONF['app_achievements_path']."class/NodeIterator_class.php");
|
||||||
require_once($_CONF['app_achievements_path']."class/Node_trait.php");
|
|
||||||
require_once($_CONF['app_achievements_path']."class/InDev_trait.php");
|
require_once($_CONF['app_achievements_path']."class/InDev_trait.php");
|
||||||
|
|
||||||
require_once($_CONF['app_achievements_path']."class/AchMenu_class.php");
|
require_once($_CONF['app_achievements_path']."class/AchMenu_class.php");
|
||||||
|
@ -208,10 +209,10 @@ $c .= "</div></td>
|
||||||
$open = $menu->getOpenCat();
|
$open = $menu->getOpenCat();
|
||||||
|
|
||||||
if($open != 0) {
|
if($open != 0) {
|
||||||
$cat = new AdmCategory($open,$_REQUEST['cult'],$_REQUEST['civ']);
|
$cat = new AdmCategory($open,'',$_REQUEST['cult'],$_REQUEST['civ']);
|
||||||
|
|
||||||
if($_REQUEST['act'] == "ach_move") {
|
if($_REQUEST['act'] == "ach_move") {
|
||||||
$ach = $cat->getChildByID($_REQUEST['id']);
|
$ach = $cat->getChildDataByID($_REQUEST['id']);
|
||||||
if($ach != null) {
|
if($ach != null) {
|
||||||
$ach->setCategory($_REQUEST['new_cat']);
|
$ach->setCategory($_REQUEST['new_cat']);
|
||||||
$ach->update();
|
$ach->update();
|
||||||
|
@ -240,7 +241,7 @@ $c .= "</div></td>
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_REQUEST['act'] == "ach_update") {
|
if($_REQUEST['act'] == "ach_update") {
|
||||||
$ach = $cat->getChildByID($_REQUEST['id']);
|
$ach = $cat->getChildDataByID($_REQUEST['id']);
|
||||||
|
|
||||||
if($ach != null) {
|
if($ach != null) {
|
||||||
$ach->setName($_REQUEST['aal_name']);
|
$ach->setName($_REQUEST['aal_name']);
|
||||||
|
@ -254,7 +255,7 @@ $c .= "</div></td>
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_REQUEST['act'] == "perk_insert") {
|
if($_REQUEST['act'] == "perk_insert") {
|
||||||
$ach = $cat->getChildByID($_REQUEST['id']);
|
$ach = $cat->getChildDataByID($_REQUEST['id']);
|
||||||
if($ach != null) {
|
if($ach != null) {
|
||||||
$perk = new AdmPerk(array(),$ach);
|
$perk = new AdmPerk(array(),$ach);
|
||||||
$perk->setAchievement($ach->getID());
|
$perk->setAchievement($ach->getID());
|
||||||
|
|
Loading…
Reference in a new issue