Example #1
0
 public function detailAction()
 {
     $actionsList = array();
     $this->initActionMapper();
     $this->initProjectMapper();
     $this->initHumanResourceMapper();
     $actionToBeDetailed = $this->initActionWithCheckedId($this->actionMapper);
     $projectToBeDetailed = $this->projectMapper->findById($actionToBeDetailed->getProject());
     $humanResourcesList = $this->GetHumanResourcesList($actionToBeDetailed);
     $immediateBreed = $this->actionMapper->getActionsSubordinatedTo($actionToBeDetailed);
     foreach ($immediateBreed as $actionId) {
         $loopAction = $this->actionMapper->findById($actionId);
         $nextBreed = $this->actionMapper->getActionsSubordinatedTo($loopAction);
         if (count($nextBreed) > 0) {
             $broodMessage = count($nextBreed) . " ações diretamente subordinadas";
             if (count($nextBreed) == 1) {
                 $broodMessage = count($nextBreed) . " ação diretamente subordinada";
             }
         } else {
             $broodMessage = "sem ações diretamente subordinadas";
         }
         $rejectLink = $this->ManageRejectReceiptLink($loopAction);
         $actionTitle = sprintf("<a href='/projects/action/detail/?id=%d'>%s</a>", $actionId, $loopAction->GetTitle());
         $actionsList[$actionId] = array('id' => $actionId, 'title' => $actionTitle, 'brood' => $broodMessage, 'editLink' => '/projects/action/edit/?id=' . $actionId, 'done' => $loopAction->GetDone(), 'finishDate' => C3op_Util_DateDisplay::FormatDateToShow($loopAction->GetRealFinishDate()), 'status' => $loopAction->GetStatus(), 'rejectLink' => $rejectLink);
     }
     $id = $actionToBeDetailed->GetId();
     $msgStart = "";
     $msgAcknowledgement = "";
     $linkAcknowledgement = "";
     if ($actionToBeDetailed->GetStatus() == C3op_Projects_ActionStatusConstants::STATUS_IN_EXECUTION) {
         $msgStart = "Iniciada em " . $actionToBeDetailed->GetRealBeginDate();
         $obj = new C3op_Projects_ActionStartMode($actionToBeDetailed, $this->actionMapper);
         if ($obj->isUnacknowledged()) {
             $msgAcknowledgement = " (confirma?)";
             $linkAcknowledgement = "javascript:passIdToAjax('/projects/action/acknowledge-start', '{$id}', acknowledgeStartResponse);";
         }
     }
     $msgDone = "";
     $linkDone = "";
     if ($actionToBeDetailed->GetStatus() == C3op_Projects_ActionStatusConstants::STATUS_DONE) {
         $msgDone = "Ação realizada";
         $linkDone = "";
         $acceptLink = "";
     } elseif ($actionToBeDetailed->GetStatus() == C3op_Projects_ActionStatusConstants::STATUS_RECEIVED) {
         $msgDone = "Ação recebida em " . $actionToBeDetailed->GetReceiptDate($this->actionMapper);
         $linkDone = "";
         $acceptLink = $this->ManageAcceptanceLink($actionToBeDetailed);
     } else {
         $msgDone = "Confirma que ação foi entregue ao IETS";
         $linkDone = "javascript:passIdToAjax('/projects/action/acknowledge-receipt', '{$id}', acknowledgeReceiptResponse);";
     }
     $rejectLink = $this->ManageRejectReceiptLink($actionToBeDetailed);
     $acceptLink = $this->ManageAcceptanceLink($actionToBeDetailed);
     $actionInfo = array('projectTitle' => $projectToBeDetailed->GetTitle(), 'projectDetailLink' => '/projects/project/detail/?id=' . $projectToBeDetailed->GetId(), 'editLinkProject' => '/projects/project/edit/?id=' . $projectToBeDetailed->GetId(), 'actionTitle' => $actionToBeDetailed->GetTitle(), 'actionsList' => $actionsList, 'humanResourcesList' => $humanResourcesList, 'id' => $actionToBeDetailed->GetId(), 'linkActionCreate' => '/projects/action/create/?subordinatedTo=' . $actionToBeDetailed->GetId(), 'editLink' => '/projects/action/edit/?id=' . $actionToBeDetailed->GetId(), 'linkDone' => $linkDone, 'rejectLink' => $rejectLink, 'acceptLink' => $acceptLink, 'finishDate' => C3op_Util_DateDisplay::FormatDateToShow($actionToBeDetailed->GetRealFinishDate()), 'msgDone' => $msgDone, 'msgStart' => $msgStart, 'linkAcknowledgement' => $linkAcknowledgement, 'msgAcknowledgement' => $msgAcknowledgement);
     if ($actionToBeDetailed->GetSubordinatedTo() > 0) {
         $actionInfo['parentLink'] = '/projects/action/detail/?id=' . $actionToBeDetailed->GetSubordinatedTo();
         if (!isset($this->actionMapper)) {
             $this->actionMapper = new C3op_Projects_ActionMapper($this->db);
         }
         $parent = $this->actionMapper->FindById($actionToBeDetailed->GetSubordinatedTo());
         $actionInfo['parentTitle'] = $parent->GetTitle();
     }
     $this->view->actionInfo = $actionInfo;
 }
Example #2
0
 public function getAllUnacknowledgededActions(C3op_Projects_Project $p, C3op_Projects_ActionMapper $actionMapper)
 {
     $result = array();
     foreach ($this->db->query(sprintf('SELECT a.id
                 FROM projects_actions a
                 INNER JOIN projects_actions_dates d
                 ON a.id = d.action
                 WHERE a.status = %d AND a.project = %d ORDER BY d.real_begin_date', C3op_Projects_ActionStatusConstants::STATUS_IN_EXECUTION, $p->GetId())) as $row) {
         $action = $actionMapper->findById($row['id']);
         $obj = new C3op_Projects_ActionStartMode($action, $actionMapper);
         if ($obj->isUnacknowledged()) {
             $result[] = $row['id'];
         }
     }
     return $result;
 }