Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
edit.php
Go to the documentation of this file.
1 <?php
2 
3 $guid = elgg_extract('guid', $vars);
4 
5 elgg_gatekeeper();
6 
7 if (!$guid) {
8  register_error(elgg_echo('generic_comment:notfound'));
10 }
12 if (!($comment instanceof \ElggComment) || !$comment->canEdit()) {
13  register_error(elgg_echo('generic_comment:notfound'));
15 }
16 
17 $target = $comment->getContainerEntity();
18 if (!($target instanceof \ElggEntity)) {
19  register_error(elgg_echo('generic_comment:notfound'));
21 }
22 
23 $title = elgg_echo('generic_comments:edit');
26 
27 $params = array(
28  'entity' => $target,
29  'comment' => $comment,
30 );
31 $content = elgg_view_form('comment/save', null, $params);
32 
33 $params = array(
34  'content' => $content,
35  'title' => $title,
36  'filter' => '',
37 );
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1302
if(!$guid) $comment
Definition: edit.php:11
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:679
if(!elgg_instanceof($entity, 'user')||!$entity->canEdit()) $content
Definition: edit.php:20
$vars['entity']
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
if(!($comment instanceof\ElggComment)||!$comment->canEdit()) $target
Definition: edit.php:17
const REFERER
Definition: elgglib.php:2029
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
$guid
Definition: edit.php:9
$body
Definition: edit.php:31
$title
Definition: edit.php:12
getDisplayName()
{}
Definition: ElggObject.php:169
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
if($entity->hasIcon('master')) $params
Definition: edit.php:27
getURL()
Gets the URL for this entity.
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204
elgg_view_page($title, $body, $page_shell= 'default', $vars=array())
Assembles and outputs a full page.
Definition: views.php:437