vytvoreni stromu do pole z jednoho kodu co mam pred s sebou -
// pro tebe nepodstatne
public function getCategoryTree($configuration, $where = '', $order = '') {
// nepodstatne
$order = ((!$order) ? '`sortOrder` ASC' : $order);
// ziskani zaznamu, ktere chces poskladat do stromu
// u tebe to bude proste nejaky select * from ?
$categories = Category::getCategories($configuration, $where, $order);
$tree = array();
$hash = array();
foreach ($categories as $category)
{
$item =
array(
'id' => $category->getId(),
'name' => $category->getName(),
'children' => array()
);
$hash[$category->getId()] = $item;
}
foreach ($categories as $category)
{
if ($category->getParentId() && $hash[$category->getParentId()])
{
$hash[$category->getParentId()]['children'][] =& $hash[$category->getId()];
}
else
{
$tree[$category->getId()] =& $hash[$category->getId()];
}
}
return $tree;
}
kdyz ji nalezite upravis, mohl bys dostat to co potrebujes |