public function get_children($id = 0, $without_main_parrent = false)
{
if (intval($id) == 0) {
return false;
}
$table = $this->tables['content'];
$ids = array();
$data = array();
$id = intval($id);
$get = array();
$get['parent'] = $id;
if (isset($without_main_parrent) and $without_main_parrent == true) {
$get['parent'] = '[neq]0';
}
// $q = " SELECT id, parent FROM $table WHERE parent={$id} " . $with_main_parrent_q;
// $taxonomies = $this->app->database_manager->query($q, $cache_id = __FUNCTION__ . crc32($q), $cache_group = 'content/' . $id);
$taxonomies = $this->get($get);
// $taxonomies = $taxonomies->get()->toArray();
if (!empty($taxonomies)) {
foreach ($taxonomies as $item) {
if (intval($item['id']) != 0) {
$ids[] = $item['id'];
}
if ($item['parent'] != $item['id'] and intval($item['parent'] != 0)) {
$next = $this->get_children($item['id'], $without_main_parrent);
if (!empty($next)) {
foreach ($next as $n) {
if ($n != '' and $n != 0) {
$ids[] = $n;
}
}
}
}
}
}
if (!empty($ids)) {
$ids = array_unique($ids);
return $ids;
} else {
return false;
}
}