private function _tree($upid = 0, $force = 0, $addn = ' ') { $and = $force == 1 ? " and upid='{$upid}' " : ""; $list = Lua::get_more("select * from lua_category where systemname='" . SYSNAME . "' {$and} order by vieworder asc,id desc"); $back = array(); if ($list) { foreach ($list as $v) { $out[$v['id']] = $v; } $tree = new Tree($out); $tree->field = 'name'; $back = $tree->get($upid, 0, $addn); } return $back; }
private function _tree($lua = 'category', $perm) { $lua = $lua ? $lua : 'category'; $list = Lua::get_more("select * from lua_" . $lua . " where systemname='" . $perm . "' order by vieworder asc,id desc"); $back = array(); if ($list) { foreach ($list as $v) { $out[$v['id']] = $v; } $tree = new Tree($out); $tree->field = 'name'; $back = $tree->get(0, 0, ' '); } return $back; }
private function _tree($id) { $list = Lua::get_more("select * from lua_model_table where model_id='{$id}'"); $back = array(); if ($list) { foreach ($list as $v) { $out[$v['id']] = $v; } $tree = new Tree($out); $back = $tree->get(0, 0, ' '); } return $back; }
function testDataEntry() { $t1 = new Tree(); $t1->set("/master/test", "xyz"); $this->assertEqual($t1->get("/master/test"), "xyz", "Il valore di /master/test non e' xyz!!"); $t1->merge("/master/first_test", array("first" => "my_first_value")); $t1->merge("/master/second_test", array("second" => "my_second_value")); $this->assertEqual($t1->get("/master/first_test/first"), "my_first_value", "Il valore di test non corrisponde!!"); $this->assertEqual($t1->get("/master/second_test/second"), "my_second_value", "Il valore di test non corrisponde!!"); }