Database Reference
In-Depth Information
$app->response->headers->set('Content-Type', 'application/json');
echo json_encode($content);
})->name('add-content');
// add a status update
public static function addContent($username, Content $content) {
$tagstr=self::trimContentTags($content->tagstr);
$tags=explode(',', $tagstr);
$queryString = " MATCH (user { username: {u}}) " .
" CREATE UNIQUE (user)-[:CURRENTPOST]->(p:Content { title:{title}, url:{url}, " .
" tagstr:{tagstr}, timestamp:{timestamp}, contentId:{contentId} }) " .
" WITH user, p" .
" FOREACH (tagName in {tags} | " .
" MERGE (t:Tag {wordPhrase:tagName}) " .
" MERGE (p)-[:HAS]->(t) " .
" )" .
" WITH user, p " .
" OPTIONAL MATCH (p)<-[:CURRENTPOST]-(user)-[oldRel:CURRENTPOST]->(oldLP)" .
" DELETE oldRel " .
" CREATE (p)-[:NEXTPOST]->(oldLP) " .
" RETURN p, {u} as username, true as owner ";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'u' => $username,
'title' => $content->title,
'url' => $content->url,
'tagstr' => $tagstr,
'tags' => $tags,
'timestamp' => time(),
'contentId' => uniqid()
));
$result = $query->getResultSet();
return self::returnMappedContent($result);
}
Editing a Status Update
When status updates are displayed, the current user's status updates will contain a link to “Edit” the status. Once
clicked, it will open the form, similar to the “Add Content” link, but will populate the form with the status update
values as well as modify the form button to read “Edit Content”, as shown in Figure 8-11 . As with many similar UI
features, clicking “Cancel” under the heading will remove the values and return the form to its ready state.
 
Search WWH ::




Custom Search