コード例 #1
0
 /**
  * @param  Version $version
  * @param          $year
  *
  * @return float|null
  */
 public function parseContributionFee(Version $version, $year)
 {
     //Cast to ints as some values can originate form templates (== twig > might be string)
     $year = (int) $year;
     /**
      * Based on the invoiceMethod we return or a percentage or the contribution
      */
     $fee = $this->getProjectService()->findProjectFeeByYear($year);
     switch ($this->getInvoiceService()->findInvoiceMethod($version->getProject()->getCall()->getProgram())->getId()) {
         case Method::METHOD_PERCENTAGE:
             return $fee->getPercentage() / 100;
         case Method::METHOD_CONTRIBUTION:
             return $fee->getContribution();
     }
 }
コード例 #2
0
 /**
  * @param Version $version
  *
  * @return array
  */
 private function parseProjectEvaluation(Version $version)
 {
     $rows = [];
     $cols = [];
     $cols['dt'] = ['width' => 3000, 'align' => ''];
     $cols['di'] = ['width' => 2000, 'align' => ''];
     $cols['dd'] = ['width' => $this->tableWidth - 5000, 'align' => ''];
     $countries = $this->getGeneralService()->findCountryByProject($version->getProject(), AffiliationService::WHICH_ONLY_ACTIVE);
     $evaluationType = $this->getEvaluationService()->findEntityById('Evaluation\\Type', $version->getVersionType()->getEvaluationType());
     $evaluation = new CreateEvaluation();
     $pluginServiceManager = new HelperPluginManager();
     $pluginServiceManager->setServiceLocator($this->getServiceLocator());
     $evaluation->setServiceLocator($pluginServiceManager);
     $evaluationResult = $evaluation->create([$version->getProject()], $evaluationType, Evaluation::DISPLAY_EFFORT, MatrixFilter::SOURCE_VERSION);
     $rows[] = ['dt' => 'Country', 'di' => 'Evaluation', 'dd' => 'Review'];
     foreach ($countries as $country) {
         $projectEvaluation = $evaluationResult[$country->getId()][$version->getProject()->getId()];
         $evaluation = $projectEvaluation['evaluation'];
         $rows[] = ['dt' => $country, 'di' => $evaluation->getStatus()->getStatusEvaluation(), 'dd' => $evaluation->getDescription()];
     }
     return ['cols' => $cols, 'rows' => $rows];
 }