function getAllChildrenLO($id) { global $connect; $query = "select * from ".db_table_name('cdio3_learningoutcomes'). "where parent_id='".db_quote($id)."' and status=1"; $list = db_execute_assoc($query); $children = array(); while (($rt = $list->FetchRow()) != null) { //$children = array ($rt['id']); $grand = getAllChildrenLO($rt['id']); foreach ($grand as $i) { array_push($children, $i); } array_push($children, $rt['id']); } return $children; }
$popupoutput .= "<script type=\"text/javascript\"> \n<!--\n alert(\"".$clang->gT("Item added!","js")."\")\n; window.opener.location.reload(); window.close(); //-->\n</script>\n"; } else { $popupoutput .= genNewLOItemForm($root_id); } } //if no item else { } } else if ($action == 'delete_lo_item') { $id = rhashLOID(returnglobal('id')); $children = getAllChildrenLO($id); array_push($children, $id); $item = implode(",", $children); if (!markDeleted($item)) { $text = "Error deleting record"; safe_die($text); } $popupoutput .= "<script> window.opener.location.reload(); window.close();</script>"; } else { echo $action; }