aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/pages
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages/pages')
-rw-r--r--mod/messages/pages/messages/inbox.php48
-rw-r--r--mod/messages/pages/messages/read.php60
-rw-r--r--mod/messages/pages/messages/send.php27
-rw-r--r--mod/messages/pages/messages/sent.php48
4 files changed, 183 insertions, 0 deletions
diff --git a/mod/messages/pages/messages/inbox.php b/mod/messages/pages/messages/inbox.php
new file mode 100644
index 000000000..de5b8b231
--- /dev/null
+++ b/mod/messages/pages/messages/inbox.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Elgg messages inbox page
+ *
+ * @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_page_owner_entity();
+
+if (!$page_owner || !$page_owner->canEdit()) {
+ $guid = 0;
+ if($page_owner){
+ $guid = $page_owner->getGUID();
+ }
+ register_error(elgg_echo("pageownerunavailable", array($guid)));
+ forward();
+}
+
+elgg_push_breadcrumb(elgg_echo('messages:inbox'));
+
+elgg_register_title_button();
+
+$title = elgg_echo('messages:user', array($page_owner->name));
+
+$list = elgg_list_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'messages',
+ 'metadata_name' => 'toId',
+ 'metadata_value' => elgg_get_page_owner_guid(),
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ 'full_view' => false,
+));
+
+$body_vars = array(
+ 'folder' => 'inbox',
+ 'list' => $list,
+);
+$content = elgg_view_form('messages/process', array(), $body_vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => elgg_echo('messages:inbox'),
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/messages/pages/messages/read.php b/mod/messages/pages/messages/read.php
new file mode 100644
index 000000000..4223c6bac
--- /dev/null
+++ b/mod/messages/pages/messages/read.php
@@ -0,0 +1,60 @@
+<?php
+/**
+* Read a message page
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$message = get_entity(get_input('guid'));
+if (!$message || !elgg_instanceof($message, "object", "messages")) {
+ forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
+}
+
+// mark the message as read
+$message->readYet = true;
+
+elgg_set_page_owner_guid($message->getOwnerGUID());
+$page_owner = elgg_get_page_owner_entity();
+
+$title = $message->title;
+
+$inbox = false;
+if ($page_owner->getGUID() == $message->toId) {
+ $inbox = true;
+ elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
+} else {
+ elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
+}
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_entity($message, array('full_view' => true));
+if ($inbox) {
+ $form_params = array(
+ 'id' => 'messages-reply-form',
+ 'class' => 'hidden mtl',
+ 'action' => 'action/messages/send',
+ );
+ $body_params = array('message' => $message);
+ $content .= elgg_view_form('messages/reply', $form_params, $body_params);
+ $from_user = get_user($message->fromId);
+
+ if ((elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) && $from_user) {
+ elgg_register_menu_item('title', array(
+ 'name' => 'reply',
+ 'href' => '#messages-reply-form',
+ 'text' => elgg_echo('messages:answer'),
+ 'link_class' => 'elgg-button elgg-button-action',
+ 'rel' => 'toggle',
+ ));
+ }
+}
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/messages/pages/messages/send.php b/mod/messages/pages/messages/send.php
new file mode 100644
index 000000000..b46d0ba52
--- /dev/null
+++ b/mod/messages/pages/messages/send.php
@@ -0,0 +1,27 @@
+<?php
+/**
+* Compose a message
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_logged_in_user_entity();
+elgg_set_page_owner_guid($page_owner->getGUID());
+
+$title = elgg_echo('messages:add');
+
+elgg_push_breadcrumb($title);
+
+$params = messages_prepare_form_vars((int)get_input('send_to'));
+$params['friends'] = $page_owner->getFriends('', 50);
+$content = elgg_view_form('messages/send', array(), $params);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/messages/pages/messages/sent.php b/mod/messages/pages/messages/sent.php
new file mode 100644
index 000000000..3d08cd5ee
--- /dev/null
+++ b/mod/messages/pages/messages/sent.php
@@ -0,0 +1,48 @@
+<?php
+/**
+* Elgg sent messages page
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_page_owner_entity();
+
+if (!$page_owner || !$page_owner->canEdit()) {
+ $guid = 0;
+ if($page_owner){
+ $guid = $page_owner->getGUID();
+ }
+ register_error(elgg_echo("pageownerunavailable", array($guid)));
+ forward();
+}
+
+elgg_push_breadcrumb(elgg_echo('messages:sent'));
+
+elgg_register_title_button();
+
+$title = elgg_echo('messages:sentmessages', array($page_owner->name));
+
+$list = elgg_list_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'messages',
+ 'metadata_name' => 'fromId',
+ 'metadata_value' => elgg_get_page_owner_guid(),
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ 'full_view' => false,
+));
+
+$body_vars = array(
+ 'folder' => 'sent',
+ 'list' => $list,
+);
+$content = elgg_view_form('messages/process', array(), $body_vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);