From 4766f36a4d74924f21ff329c4318ce4e069ffa04 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 3 Mar 2010 17:53:05 +0000 Subject: Pulled in the interface changes. git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/messageboard/ajax_endpoint/load.php | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 mod/messageboard/ajax_endpoint/load.php (limited to 'mod/messageboard/ajax_endpoint') diff --git a/mod/messageboard/ajax_endpoint/load.php b/mod/messageboard/ajax_endpoint/load.php new file mode 100644 index 000000000..5bba34681 --- /dev/null +++ b/mod/messageboard/ajax_endpoint/load.php @@ -0,0 +1,73 @@ + + * @copyright Curverider Ltd 2008-2010 - 2009 + * @link http://elgg.com/ + */ + + // Load Elgg engine will not include plugins + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + + //get the required info + + //the actual message + $message = get_input('messageboard_content'); + //the number of messages to display + $numToDisplay = get_input('numToDisplay'); + //get the full page owner entity + $user = get_entity($_POST['pageOwner']); + + //stage one - if a message was posted, add it as an annotation + if($message){ + + // If posting the comment was successful, send message + if ($user->annotate('messageboard',$message,$user->access_id, $_SESSION['user']->getGUID())) { + + global $CONFIG; + + if ($user->getGUID() != $_SESSION['user']->getGUID()) + notify_user($user->getGUID(), $_SESSION['user']->getGUID(), elgg_echo('messageboard:email:subject'), + sprintf( + elgg_echo('messageboard:email:body'), + $_SESSION['user']->name, + $message, + $CONFIG->wwwroot . "pg/messageboard/" . $user->username, + $_SESSION['user']->name, + $_SESSION['user']->getURL() + ) + ); + + // add to river + add_to_river('river/object/messageboard/create','messageboard',$_SESSION['user']->guid,$user->guid); + }else{ + register_error(elgg_echo("messageboard:failure")); + } + + } else { + + echo elgg_echo('messageboard:somethingwentwrong'); + + } + + //step two - grab the latest messageboard contents, this will include the message above, unless an issue + //has occurred. + $contents = $user->getAnnotations('messageboard', $numToDisplay, 0, 'desc'); + + //step three - display the latest results + if($contents){ + + foreach($contents as $content) { + + echo elgg_view("messageboard/messageboard_content", array('annotation' => $content)); + + } + + } + + +?> \ No newline at end of file -- cgit v1.2.3