Database Reference
In-Depth Information
if(!empty($userscontent)){
$tag = $app->request()->get('tag');
# if the user's content was requested
if($userscontent === "true"){
$contents = Content::getUserContentWithTag($_SESSION['username'],$tag);
# if the user's friends' content was requested
}else{
$contents = Content::getFollowingContentWithTag(
$_SESSION['username'],$tag);
}
}
$app->view()->setData(array('contents'=>$contents,
'userTags'=>$userTags,
'tagsInNetwork'=>$tagsInNetwork,
'title'=>'Interest'));
$app->render('graphs/interest/index.mustache');
})->name('interest');
Filtering Managed Content
Once the list of tags for the user and for the group she follows has been provided, the content can be filtered based of
the generated tag links, as shown in Figure 8-12 . If a tag is clicked on the inside of the “My Interests” section, then the
getUserContentWithTag method, displayed in Listing 8-35, will be called.
Listing 8-35. Get the Content of the Current User Based on a Tag
public static function getUserContentWithTag($username,$wp){
$queryString = " MATCH (u:User {username: {u} })-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-p " .
" WITH DISTINCT u,p" .
" MATCH p-[:HAS]-(t:Tag {wordPhrase : {wp} } )" .
" RETURN p.contentId as contentId, p.title as title, p.tagstr as tagstr, " .
" p.timestamp as timestamp, p.url as url, u.username as username, true as owner" .
" ORDER BY p.timestamp DESC";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'u' => $username,
'wp' => $wp
));
$result = $query->getResultSet();
foreach($result as $row){
$row->timestampAsStr = date('n/d/Y',$row['timestamp']) .
' at ' . date('g:i A',$row['timestamp']);
}
return $result;
}
 
Search WWH ::




Custom Search