Beispiel #1
0
 /**
  * @param $data
  * @param array $actionsSet
  * @return array
  */
 private function getStatuses($data, $actionsSet)
 {
     $statuses = TaskService::getTaskStatus();
     if (!$data) {
         $statuses = [TaskService::STATUS_NEW => 'New'];
     } else {
         if (!empty($actionsSet[TaskService::ACTION_CHANGE_STATUS])) {
             $statuses = TaskService::getTaskStatus();
             if ($actionsSet[TaskService::ACTION_CHANGE_STATUS] == 2) {
                 unset($statuses[TaskService::STATUS_NEW]);
                 unset($statuses[TaskService::STATUS_VERIFIED]);
                 unset($statuses[TaskService::STATUS_CANCEL]);
             }
         }
     }
     return $statuses;
 }
Beispiel #2
0
 private function setStatusSelect()
 {
     return [0 => '-- All Statuses --', Task::STATUS_ALL_OPEN => '-- All Open --'] + Task::getTaskStatus();
 }
 public function getTasksAction()
 {
     /**
      * @todo: Split this method to 5 separate methods on one per every type: "doing', "verifying", "created", "team"
      */
     /**
      * @var $taskService \DDD\Service\Task
      * @var $dataSet \DDD\Domain\Task\Task[]
      */
     $taskService = $this->getServiceLocator()->get('service_task');
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $type = $this->params()->fromQuery('type', 'doing');
     $loggedInUserID = $auth->getIdentity()->id;
     $dataSet = $taskService->getUDList($loggedInUserID, $type);
     $preparedData = [];
     if ($dataSet->count()) {
         foreach ($dataSet as $row) {
             $rowClass = $location = '';
             if (strtotime($row->getEndDate()) <= strtotime(date('Y-m-j 23:59')) && $row->getTask_status() < Task::STATUS_DONE) {
                 $rowClass = 'danger';
             }
             if ($row->getProperty_name()) {
                 $location = $row->getProperty_name() . ' (' . $row->getUnit_number() . ')';
             } elseif ($row->getBuildingName()) {
                 $location = $row->getBuildingName();
             }
             $actions = '<a href="/task/edit/' . $row->getId() . '" class="btn btn-xs btn-primary hidden-xs" target="_blank" data-html-content="View"></a>';
             $actions .= '<a href="/task/edit/' . $row->getId() . '" class="btn btn-xs btn-primary visible-xs-block" target="_blank"><span class="glyphicon glyphicon-chevron-right"></span></a>';
             if ($type == 'verifying') {
                 $actions .= ' <a href="/task/edit/' . $row->getId() . '" class="btn btn-xs btn-success btn-task-verify hidden-xs" data-task-id="' . $row->getId() . '">Verify</a>';
             }
             $statusTitle = Task::getTaskStatus()[$row->getTask_status()];
             $statusLabelClass = Task::getTaskStatusLabelClass($row->getTask_status());
             $statusTitleFirstCharacter = substr($statusTitle, 0, 1);
             $statusHtml = '<label class="task-label label ' . $statusLabelClass . '" title = "' . $statusTitle . '">' . $statusTitleFirstCharacter . '</label>';
             $preparedData[] = ["0" => Task::getTaskPriorityLabeled()[$row->getPriority()], "1" => $statusHtml, "2" => $row->getCreation_date() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getCreation_date())) : '', "3" => strlen($row->getTitle()) > 20 ? substr($row->getTitle(), 0, 20) . '...' : $row->getTitle(), "4" => $row->getResponsibleName(), "5" => $location, "6" => $row->getTaskType(), "7" => $row->getEndDate() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getEndDate())) : '', "8" => $row->getTeamName(), "9" => $actions, "DT_RowClass" => $rowClass];
         }
         return new JsonModel(["aaData" => $preparedData]);
     } else {
         return new JsonModel(["aaData" => []]);
     }
 }
Beispiel #4
0
 public function ajaxGetReservationTasksAction()
 {
     /**
      * @var \DDD\Service\Booking\BookingTicket $bookingTicketService
      * @var \DDD\Dao\Task\Task $tasksDao
      * @var \DDD\Service\Task $taskService
      */
     $tasksDao = $this->getServiceLocator()->get('dao_task_task');
     $taskService = $this->getServiceLocator()->get('service_task');
     $request = $this->params();
     $currentPage = $request->fromQuery('start') / $request->fromQuery('length') + 1;
     $results = $tasksDao->getTasksOnReservationForDatatable((int) $request->fromQuery('reservationId'), (int) $request->fromQuery('start'), (int) $request->fromQuery('length'), $request->fromQuery('order'), $request->fromQuery('search'), $request->fromQuery('all', '1'));
     $tasks = $results['result'];
     $tasksCount = $results['total'];
     //        $tasksCount = $tasksDao->getTasksCountOnReservationForDatatable((integer)$request->fromQuery('reservationId'), $request->fromQuery('search')['value'], $request->fromQuery('all', '1'));
     foreach ($tasks as $row) {
         $rowClass = '';
         if (strtotime($row->getEndDate()) <= strtotime(date('Y-m-j 23:59')) && $row->getTask_status() < TaskService::STATUS_DONE) {
             $rowClass = 'danger';
         }
         $permissions = $taskService->composeUserTaskPermissions($row->getId());
         $result[] = [TaskService::getTaskPriorityLabeled()[$row->getPriority()], TaskService::getTaskStatus()[$row->getTask_status()], $row->getStartDate() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getStartDate())) : '', $row->getEndDate() ? date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getEndDate())) : '', strlen($row->getTitle()) > 30 ? substr($row->getTitle(), 0, 30) . '...' : $row->getTitle(), $row->getTaskType(), $row->getCreatorName(), $row->getResponsibleName(), count($permissions) ? '<a href="/task/edit/' . $row->getId() . '" class="btn btn-xs btn-primary" target="_blank">View</a>' : '', "DT_RowClass" => $rowClass];
     }
     if (!isset($result) or $result === null) {
         $result = [];
     }
     $resultArray = ['sEcho' => $request->fromQuery('sEcho'), 'iTotalRecords' => $tasksCount, 'iTotalDisplayRecords' => $tasksCount, 'iDisplayStart' => ($currentPage - 1) * (int) $request->fromQuery('start'), 'iDisplayLength' => (int) $request->fromQuery('length'), 'aaData' => $result];
     return new JsonModel($resultArray);
 }