Skip to content

Commit

Permalink
Fix AKSW#27 of unsorted activity streams.
Browse files Browse the repository at this point in the history
Since working offline atm please test this commit.
  • Loading branch information
splattater committed Jun 3, 2013
1 parent 13b8b43 commit 375cf14
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
25 changes: 13 additions & 12 deletions classes/Xodx/ActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,18 +521,19 @@ public function getActivities ($resourceUri)
$activity['context'] = $act['context'];
}

$objectResult = $model->sparqlQuery(
'PREFIX atom: <http://www.w3.org/2005/Atom/> ' .
'PREFIX aair: <http://xmlns.notu.be/aair#> ' .
'PREFIX sioc: <http://rdfs.org/sioc/ns#> ' .
'PREFIX foaf: <http://xmlns.com/foaf/0.1/> ' .
'SELECT ?type ?content ?date ' .
'WHERE { ' .
' <' . $objectUri . '> a ?type ; ' .
' sioc:created_at ?date . ' .
' OPTIONAL {<' . $objectUri . '> sioc:content ?content .} ' .
'} '
);
$objectQuery = 'PREFIX atom: <http://www.w3.org/2005/Atom/> ' . PHP_EOL;
$objectQuery.= 'PREFIX aair: <http://xmlns.notu.be/aair#> ' . PHP_EOL;
$objectQuery.= 'PREFIX sioc: <http://rdfs.org/sioc/ns#> ' . PHP_EOL;
$objectQuery.= 'PREFIX foaf: <http://xmlns.com/foaf/0.1/> ' . PHP_EOL;
$objectQuery.= 'SELECT ?type ?content ?date ' . PHP_EOL;
$objectQuery.= 'WHERE { ' . PHP_EOL;
$objectQuery.= ' <' . $objectUri . '> a ?type ; ' . PHP_EOL;
$objectQuery.= ' sioc:created_at ?date . ' . PHP_EOL;
$objectQuery.= ' OPTIONAL {<' . $objectUri . '> sioc:content ?content .} ' . PHP_EOL;
$objectQuery.= '} ' . PHP_EOL;
$objectQuery.= 'ORDER BY DESC(?date)' . PHP_EOL;

$objectResult = $model->sparqlQuery($objectQuery);

if (count($objectResult) > 0) {
$activity['objectType'] = $objectResult[0]['type'];
Expand Down
10 changes: 9 additions & 1 deletion classes/Xodx/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ public function getActivityStream (Xodx_User $user = null)
$act = $activityController->getActivities($resourceUri);
$activities = array_merge($activities, $act);
}
$tmp = Array();
foreach($activities as &$act) {
$tmp[] = &$act["pubDate"];
}
array_multisort($tmp, $activities);

return $activities;
}

Expand Down Expand Up @@ -436,7 +442,9 @@ public function homeAction ($template)
$template->profileshowName = $profile[0]['name'];
$template->profileshowNick = $profile[0]['nick'];
$template->profileshowActivities = $activities;
$template->profileshowKnows = $knows;
if (count($profile) > 0) {

This comment has been minimized.

Copy link
@white-gecko

white-gecko Jun 4, 2013

Warum count($profile)? sollte es nicht count($knows) sein?

Und wenn du das so machst solltest du in
b95db65#L0R10
und in https://github.com/white-gecko/xodx/blob/develop/templates/user/home.phtml#L95
auch noch ìsset($this->knows) bzw. isset($this->profileshowKnows) überprüfen.

$template->profileshowKnows = $knows;
};
$template->profileshowNews = $news;
$template->addContent('templates/usershow.phtml');
}
Expand Down

0 comments on commit 375cf14

Please sign in to comment.