CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
CREATE TABLE catalog ( id INT NOT NULL PRIMARY , pid INT NOT NULL , someData text NOT NULL ) comment = " "; * This source code was highlighted with Source Code Highlighter .
id | pid | someData |
---|---|---|
one | 0 | Catalog |
2 | one | Book 1 |
3 | one | Book 2 |
four | 3 | Chapter 1 |
five | 3 | Chapter 2 |
6 | 3 | Chapter 3 |
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
DELIMITER $$ DROP PROCEDURE IF EXISTS `getIndexToTmpTable`$$ /** main_id - search_id - zlevel - , , - -1 - sublevel - , - 1 */ CREATE PROCEDURE `getIndexToTmpTable` ( in main_id INT , in search_id INT , in zlevel INT , in sublevel INT ) BEGIN DECLARE done INT DEFAULT 0; DECLARE catalog_id INT ; DECLARE catalog_pid INT ; DECLARE cur1 CURSOR FOR select id,pid from catalog where pid=search_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; IF sublevel<=1 THEN /** */ IF zlevel<=0 THEN /** */ SET max_sp_recursion_depth= 15; ELSE SET max_sp_recursion_depth= zlevel+1; END IF ; END IF ; OPEN cur1; IF main_id = search_id THEN /** , */ insert into tmp__index set id = main_id, pid =( select pid from catalog where id=main_id limit 1), rid =main_id, level = sublevel-1; END IF ; /** */ REPEAT FETCH cur1 INTO catalog_id,catalog_pid; IF NOT done THEN /** */ insert into tmp__index set id = catalog_id, pid = catalog_pid, rid = main_id, level = sublevel; /** */ call getIndexToTmpTable(main_id,catalog_id,zlevel,sublevel+1); END IF ; UNTIL done END REPEAT; CLOSE cur1; END $$ DELIMITER ; * This source code was highlighted with Source Code Highlighter .
CREATE TEMPORARY TABLE tmp__index(id int ,pid int ,rid int ); call getIndexToTmpTable(<id_>,<id_>,1,1); select c.* from catalog as c join tmp__index as t on t.rid=c.id * This source code was highlighted with Source Code Highlighter .
CREATE TEMPORARY TABLE tmp__index(id int ,pid int ,rid int ); call getIndexToTmpTable(<id_>,<id_>,1,1); select c.* from catalog as c join tmp__index as t on t.rid=c.id * This source code was highlighted with Source Code Highlighter .
CREATE TEMPORARY TABLE tmp__index(id int ,pid int ,rid int ); call getIndexToTmpTable(<id_>,<id_>,1,1); select c.* from catalog as c join tmp__index as t on t.rid=c.id * This source code was highlighted with Source Code Highlighter .
CREATE TEMPORARY TABLE tmp__index(id int ,pid int ,rid int ); call getIndexToTmpTable(<id_>,<id_>,1,1); select c.* from catalog as c join tmp__index as t on t.rid=c.id * This source code was highlighted with Source Code Highlighter .
CREATE TEMPORARY TABLE tmp__index(id int ,pid int ,rid int ); call getIndexToTmpTable(<id_>,<id_>,1,1); select c.* from catalog as c join tmp__index as t on t.rid=c.id * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
protected $_idToData = null ; protected $_dataArray = null ; /** * * , * $_idToData, $_data * * @param array& $curItemFrom * @param array& $curItemTo */ protected function _recGenTreeResult(array&$curItemFrom,array&$curItemTo) { foreach ($curItemFrom as $id=>&$list) { if (!isset($ this ->_idToData[$id]) || !isset($ this ->_dataArray[ $ this ->_idToData[$id] ])) throw new Exception( 'recursion build error!' ); $curItemTo[] = $ this ->_dataArray[ $ this ->_idToData[$id] ]; $i = count($curItemTo)-1; if (count($list)) { $curItemTo[$i][ 'dir' ] = array(); $ this ->_recGenTreeResult(&$list,&$curItemTo[$i][ 'dir' ]); } } } function listToTree($dataArray) { $ this ->_dataArray = &$dataArray; $ this ->_idToData = array(); $parentList = array(); $rootIds = array(); // // id-> num data foreach ($ this ->_dataArray as $k=>$d) $ this ->_idToData[$d[ 'id' ]] = $k; foreach ($ this ->_dataArray as $k=>$d) { // $pid=>array($id, ...), $parentList[$d[ 'pid' ]][$d[ 'id' ]]= array(); // , ... if (isset($ this ->_idToData[$d[ 'pid' ]])) { // if (isset($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]])) if (empty($parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ])) $parentList[ $ this ->_dataArray[ $ this ->_idToData[$d[ 'pid' ]] ][ 'pid' ]][ $d[ 'pid' ] ] = &$parentList[$d[ 'pid' ]]; } else $rootIds [$d[ 'pid' ] ] = true ; } $result = array(); foreach (array_keys($rootIds) as $pid) $ this ->_recGenTreeResult(&$parentList[$pid],&$result); return $result; } * This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/72700/
All Articles