/** * @param Task $task * @return array */ private function createRow(Task $task) { $row = array(); array_push($row, $task->getId()); array_push($row, $task->getDataString()); array_push($row, $task->getOraText()); array_push($row, $task->getClient()); if ($task->getDistance() == 0 || $task->getDistance() == null) { array_push($row, $task->getTraseu()); } else { array_push($row, $task->getTraseu() . " " . $task->getDistance() . "km"); } //array_push($row, $task->getDateTime()->format("d/m/Y")); array_push($row, $task->getVehicle() . ": " . $task->getVehicleNo()); array_push($row, $task->getSofer()); array_push($row, $task->getBani()); array_push($row, $task->getDetalii()); return $row; }
private function getTaskInfoFromInput() { $task = new Task(); $input = Input::get("input"); if (isset($input['id'])) { $task->setId(HTML::entities($input["id"])); } if (isset($input['client'])) { $task->setClient(HTML::entities(trim($input["client"]))); } if (isset($input['traseu'])) { $task->setTraseu(HTML::entities(trim($input["traseu"]))); } if (isset($input['detalii'])) { $task->setDetalii(HTML::entities(trim($input["detalii"]))); } if (isset($input['vehicle'])) { $task->setVehicle(HTML::entities($input["vehicle"])); } $task->setCursa(HTML::entities($input["cursa"])); $task->setSofer(HTML::entities($input["sofer"])); $task->setBani(HTML::entities($input["bani"])); $task->setDataString(HTML::entities($input["dataText"])); $task->setOraText(HTML::entities($input["ora"])); $task->setDistance(HTML::entities($input["distance"])); $task->setVehicleNo(HTML::entities($input["vehicleNo"])); $task->setSofer(trim($task->getSofer())); $task->setBani(trim($task->getBani())); $task->setVehicleNo(trim($task->getVehicleNo())); $hourTransformed = 60; //1 minut is nice for the long ones if (strcmp($task->getCursa(), "scurt") == 0) { //numai pt cele scurte try { if (strlen($task->getOraText()) > 0) { $hourSplitted = explode(':', $task->getOraText()); $hourTransformed = $hourSplitted[0] * 3600; //add the hours //all in seconds $hourTransformed += $hourSplitted[1] * 60; // add the minutes } } catch (\Exception $e) { //can't afford an error here } } $date = new \DateTime(); $date->setTimestamp(HTML::entities($input["data"]) / 1000 + $hourTransformed); $task->setDateTime($date); return $task; }
public static function generateFullTextTask(Task $task) { return $task->getClient() . " : " . $task->getTraseu() . " : " . $task->getSofer() . ":" . $task->getVehicleNo() . " : " . $task->getDataString(); }