diff options
author | Camil Staps | 2016-08-01 14:11:06 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-01 14:11:06 +0200 |
commit | 46198a89ccc8e6750a37e1b9127f57238242fadf (patch) | |
tree | de6c0bc2f55b759a0db6471fc0b820ee5433e648 /include/home.php | |
parent | Use Model::search in child::get* methods (diff) |
Array shorthands
Diffstat (limited to 'include/home.php')
-rw-r--r-- | include/home.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/home.php b/include/home.php index b42ec8e..05846cf 100644 --- a/include/home.php +++ b/include/home.php @@ -155,7 +155,7 @@ require('./header.php'); <div class="panel-body"> <?php $offers = Offer::search($_pdo, ["`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()"]); - $list = array(); + $list = []; foreach ($offers as $offer) { $start = BusinessAdmin::formatDate($offer->start_date, false); $end = BusinessAdmin::formatDate($offer->end_date, false); @@ -166,7 +166,7 @@ require('./header.php'); // We want to sort on percentage (DESC) and secondly end date (ASC) so start date (DESC) $base = str_pad($percentage, 3, '0', STR_PAD_LEFT) . $offer->start_date; for ($i = 0; isset($list["$base-$i"]); $i++); - $list["$base-$i"] = array( + $list["$base-$i"] = [ 'start' => $start, 'end' => $end, 'id' => $offer->id, @@ -174,7 +174,7 @@ require('./header.php'); 'percentage' => $percentage, 'price_excl' => Constants::invoice_valuta . $offer->calculate(Calculatable::SUBTOTAL), 'price_incl' => Constants::invoice_valuta . $offer->calculate(Calculatable::TOTAL) - ); + ]; } krsort($list, SORT_STRING); foreach ($list as $item) { @@ -301,28 +301,28 @@ require('./header.php'); <ul class="timeline"> <?php $offers = Offer::search($_pdo, ['`accepted`=1']); - $list = array(); - $sort_list = array(); + $list = []; + $sort_list = []; foreach ($offers as $offer) { - $temp = array( + $temp = [ 'id' => $offer->id, 'contact' => $offer->getContact()->name, 'assignments' => '', 'assignments_header' => '' - ); + ]; foreach ($offer->getAssignments() as $assignment) { $temp['assignments'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/><p>{$assignment->getHTMLDescription()}</p>"; $temp['assignments_header'] .= "<b>{$assignment->title}</b><br/><span class='smaller'>(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)</span><br/>"; } - $list[] = array_merge($temp, array('type' => 'start', 'time' => $offer->start_date, 'description' => 'Offer started')); + $list[] = array_merge($temp, ['type' => 'start', 'time' => $offer->start_date, 'description' => 'Offer started']); $sort_list[] = $offer->start_date . $offer->id . 0; - $list[] = array_merge($temp, array('type' => 'end', 'time' => $offer->end_date, 'description' => 'Offer ended')); + $list[] = array_merge($temp, ['type' => 'end', 'time' => $offer->end_date, 'description' => 'Offer ended']); $sort_list[] = $offer->end_date . $offer->id . 1; if ($offer->invoice_date > 0) { - $list[] = array_merge($temp, array('type' => 'invoice', 'time' => $offer->invoice_date, 'description' => 'Invoice sent')); + $list[] = array_merge($temp, ['type' => 'invoice', 'time' => $offer->invoice_date, 'description' => 'Invoice sent']); $sort_list[] = $offer->invoice_date . $offer->id . 2; if ($offer->getPaymentReceived() > 0) { - $list[] = array_merge($temp, array('type' => 'payment_received', 'time' => $offer->getPaymentReceived(), 'description' => 'Payment received')); + $list[] = array_merge($temp, ['type' => 'payment_received', 'time' => $offer->getPaymentReceived(), 'description' => 'Payment received']); $sort_list[] = $offer->getPaymentReceived() . $offer->id . 3; } } |