if (array_key_exists($d->pId, $this->demoDataMap) && $this->demoDataMap[$d->pId]) { $this->demoDataMap[$d->pId]->nodes[] = $d; } else { $this->demoDataList[] = $d; } } } } ?> [<?php $pId = "-1"; if (array_key_exists('prod_id', $_REQUEST)) { $pId = $_REQUEST['prod_id']; } if ($pId == null || $pId == "") { $pId = "-1"; } $d = new DemoData(); $nodes = $d->getDataByPId($pId); for ($i = 0; $i < count($nodes); $i++) { if ($i > 0) { echo ","; } echo "{ 'prod_id': '" . $nodes[$i]->id . "', 'prod_code': '" . $nodes[$i]->code . "', 'name': '" . $nodes[$i]->name . "', 'prod_parent_id': '" . $nodes[$i]->pId . "', 'prod_state': '" . $nodes[$i]->state . "'"; if ($nodes[$i]->nodes != null && count($nodes[$i]->nodes) > 0) { echo ", isParent:true"; } echo "}"; } ?> ]