function setunsetstep($group, $step) { include_once 'backend/backend.php'; $backend = new backend(); $retorno = array(FALSE, "Error no se pudo actualizar"); $result = false; $groupoptions = get_proyectstructure($group); $alloptions = get_proyectstructure(); $existe = array_contain($groupoptions, $step, 0); if ($existe) { ///Dar de baja al paso en el grupo $estructura = ""; for ($i = 0; $i < sizeof($groupoptions); $i++) { if ($groupoptions[$i][0] != $step) { $estructura .= $estructura != "" ? "|" : ""; $estructura .= $groupoptions[$i][0]; for ($e = 0; $e < sizeof($groupoptions[$i][1]); $e++) { $estructura .= "," . $groupoptions[$i][1][$e]; } } } $result = $backend->update_groupstructure($group, $estructura); } else { ///Agregar el paso al grupo $newstep = ""; $estructura = ""; switch ($step) { case "2": $newstep = "2,1,2,3,35,4,5,6,7"; break; case "3": $newstep = "3,8,9,11,15,29,30"; break; case "4": $newstep = "4,16,17,18,19"; break; case "5": $newstep = "5,20,36"; break; case "6": $newstep = "6,22"; break; } for ($i = 0; $i < sizeof($alloptions); $i++) { $existe = array_contain($groupoptions, $alloptions[$i][0][0], 0); if ($existe) { $estructura .= $estructura != "" ? "|" : ""; $estructura .= $alloptions[$i][0][0]; for ($e = 0; $e < sizeof($groupoptions[$existe - 1][1]); $e++) { $estructura .= "," . $groupoptions[$existe - 1][1][$e]; } } else { if ($step == $alloptions[$i][0][0]) { $estructura .= $estructura != "" ? "|" : ""; $estructura .= $newstep; } } } $result = $backend->update_groupstructure($group, $estructura); } if ($result) { return array(true, "Grupo actualizado."); } return $retorno; }