Loading module/Oscar/src/Oscar/Entity/Project.php +31 −48 Changes for module/Oscar/src/Oscar/Entity/Project.php: 31 added lines, 48 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace Oscar\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Oscar\Utils\StringUtils; use phpDocumentor\Reflection\Types\Integer; use Zend\Form\Annotation; use Zend\Permissions\Acl\Resource\ResourceInterface; use ZendTest\Code\Annotation\TestAsset\DoctrineAnnotation; Loading Loading @@ -106,13 +107,6 @@ class Project implements ResourceInterface */ protected $partners; // /** // * Discipline // * @var Discipline // * @ORM\ManyToOne(targetEntity="Discipline") // */ // protected $discipline; /** * Discipline * @var Discipline Loading @@ -128,7 +122,6 @@ class Project implements ResourceInterface $this->grants = new ArrayCollection(); $this->members = new ArrayCollection(); $this->partners = new ArrayCollection(); // $this->disciplines = new ArrayCollection(); } Loading Loading @@ -172,35 +165,17 @@ class Project implements ResourceInterface return $end; } // /** // * @param Discipline $discipline // * @return $this // */ // public function addDiscipline(Discipline $discipline) // { // if( !$this->disciplines->contains($discipline) ){ // $this->disciplines->add($discipline); // } // return $this; // } // // /** // * @param Discipline $discipline // * @return $this // */ // public function removeDiscipline(Discipline $discipline) // { // $this->disciplines->removeElement($discipline); // return $this; // } // // /** // * @return ArrayCollection|Discipline // */ // public function getDisciplines() // { // return $this->disciplines; // } public function getAmount() :?float { if( $this->getActivities()->count() == 0 ){ return null; } $amount = 0.0; foreach ($this->getActivities() as $activity) { $amount += $activity->getAmount(); } return $amount; } /** * @param \Oscar\Entity\ProjectMember $projectMember Loading Loading @@ -276,7 +251,6 @@ class Project implements ResourceInterface } /** * Test si l'organisation est présente dans le projet, avec le role si l' * argument $role est spécifié. Loading Loading @@ -313,13 +287,17 @@ class Project implements ResourceInterface private function getPartnersByType($type, $deep = false) { $needed = in_array($type, $this->_partnersSpecialsTypes) ? $type : 'non-special'; $needed = in_array( $type, $this->_partnersSpecialsTypes ) ? $type : 'non-special'; if ($this->_partnersByType === null) { $this->_partnersByType = array(); foreach ($this->partners as $partner) { $key = !in_array($partner->getRole(), $this->_partnersSpecialsTypes) ? 'non-special' : $partner->getRole(); $key = !in_array( $partner->getRole(), $this->_partnersSpecialsTypes ) ? 'non-special' : $partner->getRole(); if (!isset($this->_partnersByType[$key])) { $this->_partnersByType[$key] = array(); } Loading Loading @@ -375,7 +353,8 @@ class Project implements ResourceInterface return $persons; } public function getPersonsDeep(){ public function getPersonsDeep() { $persons = []; foreach ($this->getMembers(true) as $member) { $persons[] = $member; Loading @@ -390,7 +369,8 @@ class Project implements ResourceInterface return $persons; } public function getOrganizations( $deep = false ){ public function getOrganizations($deep = false) { $organisations = []; foreach ($this->getPartners(true) as $partner) { $organisations[] = $partner; Loading @@ -406,7 +386,8 @@ class Project implements ResourceInterface return $organisations; } public function getOrganisationsDeep(){ public function getOrganisationsDeep() { return $this->getOrganizations(true); } Loading Loading @@ -769,23 +750,26 @@ class Project implements ResourceInterface private $_pfi; public function getPFI() { if ($this->_pfi === null) { $this->_pfi = []; /** @var Activity $activity */ foreach ($this->getActivities() as $activity) { if( $activity->getCodeEOTP() ) if ($activity->getCodeEOTP()) { $this->_pfi[] = $activity->getCodeEOTP(); } } } return implode(', ', array_unique($this->_pfi)); } /** * @return Activity[] */ public function getActivities(){ public function getActivities() { return $this->getGrants(); } Loading @@ -808,7 +792,6 @@ class Project implements ResourceInterface } public function toJson() { return json_encode($this->toArray()); Loading module/Oscar/view/oscar/project/show.phtml +5 −0 Changes for module/Oscar/view/oscar/project/show.phtml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,6 +50,11 @@ h2.tv-serie-label { border-bottom: none; } </abbr> <?php endif; ?> <?= $project->getLabel() ?> <div class="budget montant"> <small><em>Montant</em></small><br> <strong><?= $this->currency($project->getAmount()) ?></strong> </div> </h1> </header> Loading Loading
module/Oscar/src/Oscar/Entity/Project.php +31 −48 Changes for module/Oscar/src/Oscar/Entity/Project.php: 31 added lines, 48 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace Oscar\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Oscar\Utils\StringUtils; use phpDocumentor\Reflection\Types\Integer; use Zend\Form\Annotation; use Zend\Permissions\Acl\Resource\ResourceInterface; use ZendTest\Code\Annotation\TestAsset\DoctrineAnnotation; Loading Loading @@ -106,13 +107,6 @@ class Project implements ResourceInterface */ protected $partners; // /** // * Discipline // * @var Discipline // * @ORM\ManyToOne(targetEntity="Discipline") // */ // protected $discipline; /** * Discipline * @var Discipline Loading @@ -128,7 +122,6 @@ class Project implements ResourceInterface $this->grants = new ArrayCollection(); $this->members = new ArrayCollection(); $this->partners = new ArrayCollection(); // $this->disciplines = new ArrayCollection(); } Loading Loading @@ -172,35 +165,17 @@ class Project implements ResourceInterface return $end; } // /** // * @param Discipline $discipline // * @return $this // */ // public function addDiscipline(Discipline $discipline) // { // if( !$this->disciplines->contains($discipline) ){ // $this->disciplines->add($discipline); // } // return $this; // } // // /** // * @param Discipline $discipline // * @return $this // */ // public function removeDiscipline(Discipline $discipline) // { // $this->disciplines->removeElement($discipline); // return $this; // } // // /** // * @return ArrayCollection|Discipline // */ // public function getDisciplines() // { // return $this->disciplines; // } public function getAmount() :?float { if( $this->getActivities()->count() == 0 ){ return null; } $amount = 0.0; foreach ($this->getActivities() as $activity) { $amount += $activity->getAmount(); } return $amount; } /** * @param \Oscar\Entity\ProjectMember $projectMember Loading Loading @@ -276,7 +251,6 @@ class Project implements ResourceInterface } /** * Test si l'organisation est présente dans le projet, avec le role si l' * argument $role est spécifié. Loading Loading @@ -313,13 +287,17 @@ class Project implements ResourceInterface private function getPartnersByType($type, $deep = false) { $needed = in_array($type, $this->_partnersSpecialsTypes) ? $type : 'non-special'; $needed = in_array( $type, $this->_partnersSpecialsTypes ) ? $type : 'non-special'; if ($this->_partnersByType === null) { $this->_partnersByType = array(); foreach ($this->partners as $partner) { $key = !in_array($partner->getRole(), $this->_partnersSpecialsTypes) ? 'non-special' : $partner->getRole(); $key = !in_array( $partner->getRole(), $this->_partnersSpecialsTypes ) ? 'non-special' : $partner->getRole(); if (!isset($this->_partnersByType[$key])) { $this->_partnersByType[$key] = array(); } Loading Loading @@ -375,7 +353,8 @@ class Project implements ResourceInterface return $persons; } public function getPersonsDeep(){ public function getPersonsDeep() { $persons = []; foreach ($this->getMembers(true) as $member) { $persons[] = $member; Loading @@ -390,7 +369,8 @@ class Project implements ResourceInterface return $persons; } public function getOrganizations( $deep = false ){ public function getOrganizations($deep = false) { $organisations = []; foreach ($this->getPartners(true) as $partner) { $organisations[] = $partner; Loading @@ -406,7 +386,8 @@ class Project implements ResourceInterface return $organisations; } public function getOrganisationsDeep(){ public function getOrganisationsDeep() { return $this->getOrganizations(true); } Loading Loading @@ -769,23 +750,26 @@ class Project implements ResourceInterface private $_pfi; public function getPFI() { if ($this->_pfi === null) { $this->_pfi = []; /** @var Activity $activity */ foreach ($this->getActivities() as $activity) { if( $activity->getCodeEOTP() ) if ($activity->getCodeEOTP()) { $this->_pfi[] = $activity->getCodeEOTP(); } } } return implode(', ', array_unique($this->_pfi)); } /** * @return Activity[] */ public function getActivities(){ public function getActivities() { return $this->getGrants(); } Loading @@ -808,7 +792,6 @@ class Project implements ResourceInterface } public function toJson() { return json_encode($this->toArray()); Loading
module/Oscar/view/oscar/project/show.phtml +5 −0 Changes for module/Oscar/view/oscar/project/show.phtml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,6 +50,11 @@ h2.tv-serie-label { border-bottom: none; } </abbr> <?php endif; ?> <?= $project->getLabel() ?> <div class="budget montant"> <small><em>Montant</em></small><br> <strong><?= $this->currency($project->getAmount()) ?></strong> </div> </h1> </header> Loading