Пример #1
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ProjectCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $projectMapper = new C3op_Projects_ProjectMapper($db);
         $id = $data['id'];
         $project = $projectMapper->findById($id);
         $project->SetTitle($this->title->GetValue());
         $project->SetClient($this->client->GetValue());
         $project->SetOurResponsible($this->ourResponsible->GetValue());
         $project->SetResponsibleAtClient($this->responsibleAtClient->GetValue());
         $beginDate = $this->beginDate->GetValue();
         $project->SetBeginDate($this->prepareDateValueToSet($beginDate, new C3op_Util_ValidDate(), new C3op_Util_DateConverter()));
         $finishDate = $this->finishDate->GetValue();
         $project->SetFinishDate($this->prepareDateValueToSet($finishDate, new C3op_Util_ValidDate(), new C3op_Util_DateConverter()));
         $project->SetValue($this->value->GetValue());
         $project->SetStatus($this->status->GetValue());
         $project->SetContractNature($this->contractNature->GetValue());
         $project->SetAreaActivity($this->areaActivity->GetValue());
         $project->SetOverhead($this->overhead->GetValue());
         $project->SetManagementFee($this->managementFee->GetValue());
         $project->SetObject($this->object->GetValue());
         $project->SetSummary($this->summary->GetValue());
         $project->SetObservation($this->observation->GetValue());
         $projectMapper->update($project);
     }
 }
Пример #2
0
 public function retrieveTree(C3op_Projects_Project $project, C3op_Projects_ProjectMapper $projectMapper, C3op_Projects_ActionMapper $actionMapper)
 {
     $mainActions = $projectMapper->getAllActionsSubordinatedTo($project);
     $projectTree = array();
     foreach ($mainActions as $actionId) {
         $loopAction = $actionMapper->findById($actionId);
         $obj = new C3op_Projects_ActionTree();
         $actionTree = $obj->retrieveTree($loopAction, $actionMapper);
         $projectTree[$actionId] = $actionTree;
     }
     // get all subordinated actions
     return $projectTree;
 }
Пример #3
0
 private function InitProjectWithCheckedId(C3op_Projects_ProjectMapper $mapper)
 {
     return $mapper->findById($this->checkIdFromGet());
 }
Пример #4
0
 public function testIfCanChangeTitleOfProjectWhenEditing()
 {
     $titleToInsert = 'a project we will change title';
     $p = $this->insertProjectForTesting($titleToInsert, false);
     $projectId = $p->GetId();
     $titleChanged = 'this is better';
     $formData = array('title' => $titleChanged, 'value' => '', 'dateBegin' => '', 'id' => $projectId, 'submit' => true);
     $this->dispatch('/projects/project/edit');
     $updateController = new Projects_ProjectController($this->request->setMethod('POST')->setPost($formData), $this->response, $this->request->getParams());
     $updateController->editAction();
     $otherMapper = new C3op_Projects_ProjectMapper($this->db);
     $projectAfterUpdate = $otherMapper->findById($projectId);
     $this->assertEquals($titleChanged, $projectAfterUpdate->GetTitle());
 }