function Area($user, $status) { $answer; date_default_timezone_set("America/Mexico_City"); $now = date("H:i:s"); $now = date("H:i:s", strtotime("9:25:00")); $late = date("H:i:s", strtotime($now) - 10 * 60); //Retraso //echo ($now."<br>"); //echo ($late."<br>"); //Obtencion de horario $s = array(); $query = 'select * from horario where idUsuario = "' . $user . '" and horaInicio > cast("' . $late . '" as time) order by horaInicio'; $horario = QueryReturn($query); if ($horario) { if ($horario->num_rows > 0) { while ($row = $horario->fetch_assoc()) { $row['horaInicio'] = date("H:i:s", strtotime($row['horaInicio'])); $row['horaFin'] = date("H:i:s", strtotime($row['horaFin'])); array_push($s, $row); } } } //Obtencion de horario /* echo "<pre>"; print_r($s); echo "</pre>"; */ $dif = 0; $difnext = 0; $nextitem = 0; if (!empty($s)) { $zona = $s[0]['zonaDestino']; $dif = dif($now, $s[0]['horaInicio']); if ($dif > 0) { //Tiempo antes de alguna clase que asigna algo $nextitem = 1; //echo "<div>Faltan ".$dif." minutos, ".($dif/60)." horas para la siguiente clase</div>"; /* if(count($s) > 1){//Hay mas clases $difnext = dif($s[0]['horaFin'],$s[1]['horaInicio']); //echo "<div>Hay ".$difnext." minutos, ".($difnext/60)." horas entre clases</div>"; if($difnext < 20){// Tiempo entre la clase proxima y la siguiente que considera ambas $nextitem = 2; $zona = array(); array_push($zona,$s[0]['zonaDestino']); array_push($zona,$s[1]['zonaDestino']); } } */ $answer = getClosest($zona, $status, $nextitem); } } return $answer; }
exec("particle call {$photonName} setheight " . $presets[$previousPosition]['height']); } elseif ($cmd == "down" && isset($presets[$nextPosition])) { // Go down one position exec('notify-send -i ' . $presets[$nextPosition]['icon'] . ' "Moving desk to ' . $nextPosition . '"'); exec("particle call {$photonName} setheight " . $presets[$nextPosition]['height']); } elseif (isset($presets[$cmd])) { // go to the preset exec('notify-send -i ' . $presets[$cmd]['icon'] . ' "Moving desk to ' . $cmd . '"'); exec("particle call {$photonName} setheight " . $presets[$cmd]['height']); } } else { if ($standingTime > 0 && $totalTime > 0) { echo " Time Standing: " . convertToHoursMins($standingTime) . " - " . number_format($standingTime / $totalTime * 100, 1) . "%\n"; } if ($sittingTime > 0 && $totalTime > 0) { echo " Time Sitting: " . convertToHoursMins($sittingTime) . " - " . number_format($sittingTime / $totalTime * 100, 1) . "%\n"; } echo " Time at desk: " . convertToHoursMins($totalTime) . "\n\n"; $currentHeight = exec("particle call {$photonName} getheight"); echo " Current Height: " . $currentHeight . "cm\n"; $currentPosition = getClosest($currentHeight, $presets); $previousPosition = getPrevious($currentPosition, $presets); $nextPosition = getNext($currentPosition, $presets); if (!is_null($previousPosition)) { echo " Up Position: " . $previousPosition . " (" . $presets[$previousPosition]['height'] . "cm)\n"; } echo " Current Position: " . $currentPosition . " (" . $presets[$currentPosition]['height'] . "cm)\n"; if (!is_null($nextPosition)) { echo " Down Position: " . $nextPosition . " (" . $presets[$nextPosition]['height'] . "cm)\n"; } }