Перенес функции в класс
This commit is contained in:
parent
5e1362d103
commit
5e6d39d638
8 changed files with 488 additions and 491 deletions
|
|
@ -4,9 +4,6 @@
|
|||
* Преобразование дерева из модели Plain в массив массивов (Adjacency List)
|
||||
*/
|
||||
|
||||
require_once 'functions.php';
|
||||
|
||||
|
||||
/**
|
||||
* Обходит таблицу как дерево
|
||||
* $fn ($name, $index, $rows, $cc)
|
||||
|
|
@ -23,10 +20,10 @@ function tableTreeWalk($level, $table, $fn) {
|
|||
if (empty ($level)) return $table;
|
||||
$name = array_shift ($level);
|
||||
|
||||
$keys = key_unique_values($name, $table);
|
||||
$keys = Functions::key_unique_values($name, $table);
|
||||
$data = array ();
|
||||
foreach ($keys as $index) {
|
||||
list($rows, $table) = partition (lcurry('__index', $index, $name), $table);
|
||||
list($rows, $table) = Functions::partition (Functions::lcurry(['Functions', '__index'], $index, $name), $table);
|
||||
// $rows = array_filter ($table, lcurry('__index', intval($index), $name));
|
||||
//$rows = array_filter ($table, create_function ('$x', 'return __index ('.intval($index).', \''.$name.'\', $x);'));
|
||||
$data[$index] = call_user_func ($fn, $name, $index, $rows, tableTreeWalk ($level, $rows, $fn));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue