$pathtosection = explode('_', $fullpathselected); foreach ($pathtosection as $idcursor) { if ($idcursor && !in_array($idcursor, $expandedsectionarray)) { $expandedsectionarray[] = $idcursor; } } $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray); } if ($section && GETPOST('sectionexpand') == 'false') { // We removed all expanded sections that are child of the closed section $oldexpandedsectionarray = $expandedsectionarray; $expandedsectionarray = array(); // Reset foreach ($oldexpandedsectionarray as $sectioncursor) { // is_in_subtree(fulltree,sectionparent,sectionchild) if ($sectioncursor && !is_in_subtree($sqltree, $section, $sectioncursor)) { $expandedsectionarray[] = $sectioncursor; } } $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray); } //print $_SESSION['dol_ecmexpandedsectionarray'].'<br>'; $nbofentries = 0; $oldvallevel = 0; $var = true; foreach ($sqltree as $key => $val) { $var = false; $ecmdirstatic->id = $val['id']; $ecmdirstatic->ref = $val['label']; // Refresh cache if (preg_match('/refresh/i', $action)) {
if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array { $expandedsectionarray[]=$idcursor; } } $_SESSION['dol_ecmexpandedsectionarray']=join(',',$expandedsectionarray); } if ($section && $_GET['sectionexpand'] == 'false') { // We removed all expanded sections that are child of the closed section $oldexpandedsectionarray=$expandedsectionarray; $expandedsectionarray=array(); // Reset foreach($oldexpandedsectionarray as $sectioncursor) { // is_in_subtree(fulltree,sectionparent,sectionchild) if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; } $_SESSION['dol_ecmexpandedsectionarray']=join(',',$expandedsectionarray); } //print $_SESSION['dol_ecmexpandedsectionarray'].'<br>'; $nbofentries=0; $oldvallevel=0; $var=true; foreach($sqltree as $key => $val) { $var=false; $ecmdirstatic->id=$val['id']; $ecmdirstatic->ref=$val['label'];