mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 21:56:13 +00:00
36f39152e5
--HG-- branch : gsoc2012-achievements
54 lines
No EOL
1.3 KiB
PHP
54 lines
No EOL
1.3 KiB
PHP
<?php
|
|
class AchMenu extends RenderNodeIterator {
|
|
function AchMenu($open = false,$lang = 'en') {
|
|
global $db;
|
|
|
|
$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");
|
|
#MISSING: ORDER by
|
|
$sz = sizeof($res);
|
|
for($i=0;$i<$sz;$i++) {
|
|
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
|
|
}
|
|
}
|
|
}
|
|
|
|
class AchMenuNode extends RenderNodeIterator {
|
|
private $id = false;
|
|
private $parent = false;
|
|
private $name = null;
|
|
private $open = false;
|
|
|
|
function AchMenuNode(&$data,$open,$lang) {
|
|
global $db;
|
|
|
|
$this->id = $data['ac_id'];
|
|
$this->parent = $data['ac_parent'];
|
|
$this->name = $data['acl_name'];
|
|
|
|
$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
|
|
$sz = sizeof($res);
|
|
for($i=0;$i<$sz;$i++) {
|
|
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
|
|
}
|
|
}
|
|
|
|
function getID() {
|
|
return $this->id;
|
|
}
|
|
|
|
function getName() {
|
|
return $this->name;
|
|
}
|
|
|
|
function getParent() {
|
|
return $this->parent;
|
|
}
|
|
|
|
function isOpen() {
|
|
return $this->open;
|
|
}
|
|
}
|
|
?>
|