public function get_parents($id = 0, $without_main_parrent = false)
{
if (intval($id) == 0) {
return false;
}
$ids = array();
$get = array();
$get['id'] = $id;
if (isset($without_main_parrent) and $without_main_parrent == true) {
$get['parent'] = '[neq]0';
}
$content_parents = $this->get($get);
if (!empty($content_parents)) {
foreach ($content_parents as $item) {
if (intval($item['id']) != 0) {
$ids[] = $item['parent'];
}
if ($item['parent'] != $item['id'] and intval($item['parent'] != 0)) {
$next = $this->get_parents($item['parent'], $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;
}
}