Permalink
Browse files

* sorting

  • Loading branch information...
1 parent ddfa4f2 commit 397571f77622249bbe6611333cb19de343cedc6e @rolwi committed Feb 29, 2012
@@ -56,10 +56,10 @@ public function frameResponse(\FrameResponseObject $frameResponseObject) {
$years = array();
foreach ($entries as $entry){
$dates = getdate(strtotime($entry->getRawData($entry->entryAttributes["date"])));
- $sortedEntries[$dates["year"]] []= $entry;
+ $sortedEntries[$dates["year"]] [] = $entry;
$years [$dates["year"]]= $dates["year"];
}
-
+ krsort($years);
$html = "<br>";
foreach ($years as $year){
$html .= "<h1>{$year}:</h1>";
@@ -9,19 +9,26 @@ class Portfolios {
private $entryContainer;
private function __construct($user, $portfolioContainer, $entryContainer) {
- $this->user = $user;
- $this->portfolioContainer = $portfolioContainer;
- $this->entryContainer = $entryContainer;
+ $this->user = $user;
+ $this->portfolioContainer = $portfolioContainer;
+ $this->entryContainer = $entryContainer;
}
public function getAllEntries() {
- $all = $this->getEntriesContainer()->get_inventory_filtered(
- array(array('+', 'class', CLASS_ROOM)));
- $allEntries = array();
- foreach ($all as $room) {
- $allEntries[] = Entry::getEntryByRoom($room);
- }
- return $allEntries;
+ $all = $this->getEntriesContainer()->get_inventory_filtered(
+ array(array('+', 'class', CLASS_ROOM)));
+ $tmpEntries = array();
+ foreach ($all as $room) {
+ $tmpEntries[] = Entry::getEntryByRoom($room);
+ }
+ $sortedEntries = array();
+ $i = 1;
+ foreach ($tmpEntries as $entry) {
+ $dates = getdate(strtotime($entry->getRawData($entry->entryAttributes["date"])));
+ $sortedEntries[$dates[0] . $i++] = $entry;
+ }
+ krsort($sortedEntries);
+ return $sortedEntries;
}
public function getAchievedCompetences() {

0 comments on commit 397571f

Please sign in to comment.