getAmount(); $beneficiaryId = $event->getBeneficiary()->getId(); if (!isset($this->beneficiaries[$beneficiaryId])) $this->beneficiaries[$beneficiaryId] = $amount; else $this->beneficiaries[$beneficiaryId] += $amount; foreach ($event->getContext() as $ctx) { if (!isset($this->contexts[$ctx->getId()])) $this->contexts[$ctx->getId()] = $amount; else $this->contexts[$ctx->getId()] += $amount; } $this->total += $amount; } public function getTotal() { return $this->total; } public function getBeneficiaries() { $result = array(); foreach ($this->beneficiaries as $i => $amount) array_push($result, array(Beneficiary::Get($i), $amount)); usort($result, function($a, $b) { return $b[1] -$a[1]; }); return $result; } public function getContexts() { $result = array(); foreach ($this->contexts as $i => $amount) { array_push($result, array(Context::Get($i), $amount)); } usort($result, function($a, $b) { return $b[1] -$a[1]; }); return $result; } private $beneficiaries = array(); private $contexts = array(); private $total = 0; } function printContext($ctx) { $result = ""; return $result; } function printEvent($e, $totalAmount) { $id = $e->getId(); $amount = $e->getAmount(); $date = $e->getPaymentDate()->format("d/m/Y"); $label = $e->getLabel(); $beneficiary = $e->getBeneficiary()->getLabel(); $context = printContext($e->getContext()); echo "${date}"; echo "${label}"; echo "${beneficiary}"; echo "${context}"; echo "${amount}"; echo " Edit Duplicate Delete "; $totalAmount->add($e); } $totalAmount = new Total(); ?>
DateLabelBeneficiaryContextAmountAction
TotalgetTotal(); ?>
getBeneficiaries() as $i) { echo ""; } ?>
BeneficiaryAmount
" .$i[0]->getLabel() ."" .$i[1] ."
getContexts() as $i) { echo ""; } ?>
ContextAmount
" .$i[0]->getLabel() ."" .$i[1] ."