Example #1
0
File: Plugin.php Project: n8b/VMN
 /**
  * System init callback
  * @return void
  */
 public function init()
 {
     hypeInbox()->config->registerLabels();
     elgg_register_menu_item('page', array('name' => 'message_types', 'text' => elgg_echo('admin:inbox:message_types'), 'href' => 'admin/inbox/message_types', 'priority' => 500, 'contexts' => array('admin'), 'section' => 'configure'));
     elgg_register_css('inbox.base.css', elgg_get_simplecache_url('css', 'framework/inbox/stylesheet.css'));
     elgg_unregister_page_handler('messages', 'messages_page_handler');
     elgg_register_page_handler($this->config->pagehandler_id, array($this->router, 'handlePages'));
     $action_path = $this->plugin->getPath() . '/actions/';
     elgg_register_action("hypeInbox/settings/save", $action_path . 'settings/save.php', 'admin');
     elgg_register_action('inbox/admin/import', $action_path . 'admin/import.php', 'admin');
     elgg_register_action('messages/send', $action_path . 'messages/send.php');
     elgg_register_action('messages/delete', $action_path . 'messages/delete.php');
     elgg_register_action('messages/markread', $action_path . 'messages/markread.php');
     elgg_register_action('messages/markunread', $action_path . 'messages/markunread.php');
     // Third party integrations
     elgg_register_plugin_hook_handler('config:user_types', 'framework:inbox', array($this->hooks, 'filterUserTypes'));
     // Menu
     elgg_register_plugin_hook_handler('register', 'menu:page', array($this->hooks, 'setupPageMenu'));
     elgg_register_plugin_hook_handler('register', 'menu:inbox', array($this->hooks, 'setupInboxMenu'));
     elgg_register_plugin_hook_handler('register', 'menu:inbox:thread', array($this->hooks, 'setupInboxThreadMenu'));
     elgg_register_plugin_hook_handler('register', 'menu:entity', array($this->hooks, 'setupMessageMenu'));
     // Replace user hover menu items
     elgg_unregister_plugin_hook_handler('register', 'menu:user_hover', 'messages_user_hover_menu');
     elgg_register_plugin_hook_handler('register', 'menu:user_hover', array($this->hooks, 'setupUserHoverMenu'));
     // URLs
     elgg_register_plugin_hook_handler('entity:url', 'object', array($this->hooks, 'handleMessageURL'));
     elgg_register_plugin_hook_handler('entity:icon:url', 'object', array($this->hooks, 'handleMessageIconURL'));
 }
Example #2
0
 /**
  * Returns ruleset object
  * @return Ruleset
  */
 public function getRuleset()
 {
     if (!isset($this->ruleset)) {
         $this->ruleset = hypeInbox()->config->getRuleset($this->getMessageType());
     }
     return $this->ruleset;
 }
Example #3
0
File: Config.php Project: n8b/VMN
 /**
  * Filters an array of configured sender and recipient types
  * These will be used when applying message type rules
  * - 'validation' callback function will be used to identify whether or not a user belongs to that user type group 
  *    (user entity will be passed to this callback function)
  * - 'getter' callback function will be used to populate tokeninput options
  * 
  * Use 'config:user_types','framework:inbox' plugin hook to extend this array
  * Callbacks should only return an array with 'joins' and 'wheres'. User table will be joined automatically with 'ue' prefix
  * @return array
  */
 public function getUserTypes()
 {
     if (!isset($this->userTypes)) {
         $config = array('all' => array(), 'admin' => array('validator' => array(hypeInbox()->model, 'isAdminUser'), 'getter' => array(hypeInbox()->model, 'getAdminQueryOptions')));
         $this->userTypes = elgg_trigger_plugin_hook('config:user_types', 'framework:inbox', null, $config);
     }
     return $this->userTypes;
 }
Example #4
0
<?php

use hypeJunction\Inbox\Message;
$limit = get_input('limit', 20);
$offset = get_input('offset', 0);
$ha = access_get_show_hidden_status();
access_show_hidden_entities(true);
$messages = array();
$batch = hypeInbox()->model->getUnhashedMessages(array('limit' => $limit, 'offset' => $offset));
foreach ($batch as $message) {
    $messages[] = $message;
}
if (empty($messages)) {
    print json_encode(array('complete' => true));
    forward(REFERER);
}
$site = elgg_get_site_entity();
foreach ($messages as $msg) {
    if (!$msg instanceof Message) {
        continue;
    }
    $msg->msgHash = $msg->calcHash();
    $msg->msgType = Message::TYPE_PRIVATE;
    elgg_log("Updated message {$msg->guid} (hash : {$msg->msgHash}; type : {$msg->msgType}");
    if (!$msg->save()) {
        $offset++;
    }
}
print json_encode(array('offset' => $offset));
access_show_hidden_entities($ha);
forward(REFERER);
Example #5
0
 /**
  * Add unread notifications count to the ajax responses
  *
  * @param string $hook   "output"
  * @param string $type   "ajax"
  * @param array  $return Ajax output
  * @param array  $params Hook params
  * @return array
  */
 public static function setUnreadMessagesCount($hook, $type, $return, $params)
 {
     $return['inbox']['unread'] = (int) hypeInbox()->model->countUnreadMessages();
     return $return;
 }
Example #6
0
 /**
  * Checks if the message is persistent (i.e. can not be deleted)
  * @return bool
  */
 public function isPersistent()
 {
     return hypeInbox()->config->getRuleset($this->msgType)->isPersistent();
 }
Example #7
0
 /**
  * @deprecated 6.0
  */
 public static function factory()
 {
     return hypeInbox();
 }
Example #8
0
<?php

use hypeJunction\Inbox\Message;
$entity = elgg_extract('entity', $vars, false);
if (!$entity instanceof Message) {
    return true;
}
elgg_push_context('inbox-reply');
$form_vars = hypeInbox()->model->prepareFormValues($entity->getParticipantGuids(), $entity->getMessageType(), $entity);
$form = elgg_view('framework/inbox/compose', $form_vars);
$user = elgg_get_logged_in_user_entity();
$size = elgg_extract('size', $vars, 'small');
$icon = elgg_view_entity_icon($user, $size, array('use_hover' => elgg_extract('full_view', $vars, false)));
$content = elgg_format_element('div', ['class' => 'inbox-message-icon'], $icon);
$content .= elgg_format_element('div', ['class' => 'inbox-message-content'], $form);
echo elgg_format_element('div', ['class' => 'inbox-thread-reply-form inbox-message', 'id' => 'reply'], $content);
elgg_pop_context();
Example #9
0
File: compose.php Project: n8b/VMN
<?php

use hypeJunction\Inbox\Message;
$user = elgg_get_logged_in_user_entity();
$message_type = elgg_extract('message_type', $vars, Message::TYPE_PRIVATE);
$outtypes = hypeInbox()->model->getOutgoingMessageTypes($user);
if (!in_array($message_type, $outtypes)) {
    //echo elgg_echo('actionunauthorized');
    return;
}
$action = "messages/send/{$message_type}";
$form = elgg_view_exists("forms/{$action}") ? $action : "messages/send";
echo elgg_view_form($form, array('action' => elgg_action_exists($action) ? "action/{$action}" : "action/messages/send"), $vars);
Example #10
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if ($this->entity instanceof Message) {
         $this->message_hash = $this->entity->getHash();
         $this->message_type = $this->entity->getMessageType();
     } else {
         if (!$this->message_type) {
             $this->message_type = Message::TYPE_PRIVATE;
         }
     }
     // files being uploaded via $_FILES
     $uploads = UploadHandler::handle('attachments');
     if ($uploads) {
         foreach ($uploads as $upload) {
             if ($upload instanceof ElggFile) {
                 $this->attachment_guids[] = $upload->guid;
             }
         }
     }
     $this->attachments = Group::create($this->attachment_guids)->entities();
     $access_id = AccessCollection::create(array($this->sender_guid, $this->recipient_guids))->getCollectionId();
     foreach ($this->attachments as $attachment) {
         $attachment->origin = 'messages';
         $attachment->access_id = $access_id;
         $attachment->save();
     }
     $guid = Message::factory(array('sender' => $this->sender_guid, 'recipients' => $this->recipient_guids, 'subject' => $this->subject, 'body' => $this->body, 'message_hash' => $this->message_hash, 'attachments' => $this->attachments))->send();
     $this->entity = $guid ? get_entity($guid) : false;
     if (!$this->entity) {
         // delete attachment if message failed to send
         foreach ($this->attachments as $attachment) {
             $attachment->delete();
         }
         $this->result->addError(elgg_echo('inbox:send:error:generic'));
         return;
     }
     $sender = $this->entity->getSender();
     $this->message_type = $this->entity->getMessageType();
     $this->message_hash = $this->entity->getHash();
     $ruleset = hypeInbox()->config->getRuleset($this->message_type);
     $this->attachments = array_map(array(hypeInbox()->model, 'getLinkTag'), $this->attachments);
     $body = array_filter(array($ruleset->hasSubject() ? $this->entity->subject : '', $this->entity->getBody(), implode(', ', array_filter($this->attachments))));
     $notification_body = implode(PHP_EOL, $body);
     foreach ($this->recipient_guids as $recipient_guid) {
         $recipient = get_entity($recipient_guid);
         if (!$recipient) {
             continue;
         }
         $type_label = strtolower($ruleset->getSingularLabel($recipient->language));
         $subject = elgg_echo('inbox:notification:subject', array($type_label), $recipient->language);
         $notification = elgg_echo('inbox:notification:body', array($type_label, $sender->name, $notification_body, elgg_view('output/url', array('href' => $this->entity->getURL())), $sender->name, elgg_view('output/url', array('href' => elgg_normalize_url("messages/thread/{$this->message_hash}#reply")))), $recipient->language);
         $summary = elgg_echo('inbox:notification:summary', array($type_label), $recipient->language);
         notify_user($recipient->guid, $sender->guid, $subject, $notification, array('action' => 'send', 'object' => $this->entity, 'summary' => $summary));
     }
     $this->result->addMessage(elgg_echo('inbox:send:success'));
     $this->result->setForwardURL($this->entity->getURL());
 }
Example #11
0
 /**
  * Setup topbar menu
  *
  * @param string         $hook   "register"
  * @param string         $type   "menu:topbar"
  * @param ElggMenuItem[] $return  Menu
  * @param array          $params  Hook params
  * @return ElggMenuItem[]
  */
 public static function setupTopbarMenu($hook, $type, $return, $params)
 {
     if (!elgg_is_logged_in()) {
         return;
     }
     $count = hypeInbox()->model->countUnreadMessages();
     if ($count > 99) {
         $count = '99+';
     }
     $text = elgg_view_icon('envelope');
     $counter = elgg_format_element('span', ['id' => 'inbox-new', 'class' => $count ? 'inbox-unread-count' : 'inbox-unread-count hidden'], $count);
     $return[] = ElggMenuItem::factory(array('name' => 'inbox', 'href' => 'messages#inbox-popup', 'text' => $text . $counter, 'priority' => 600, 'tooltip' => elgg_echo('inbox:thread:unread', array($count)), 'rel' => 'popup', 'id' => 'inbox-popup-link'));
     return $return;
 }
Example #12
0
<?php

$entity = elgg_extract('entity', $vars);
$ha = access_get_show_hidden_status();
access_show_hidden_entities(true);
$messages = hypeInbox()->model->getUnhashedMessages(array('count' => true));
access_show_hidden_entities($ha);
if ($messages) {
    echo elgg_view('framework/inbox/admin/import', array('count' => $messages));
}
echo elgg_view_input('select', ['name' => 'params[enable_html]', 'value' => $entity->enable_html, 'options_values' => [0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')], 'label' => elgg_echo('inbox:settings:enable_html'), 'help' => elgg_echo('inbox:settings:enable_html:help')]);
Example #13
0
File: Router.php Project: n8b/VMN
 /**
  * Returns page handler ID
  * @return string
  */
 public function getPageHandlerId()
 {
     return hypeInbox()->config->get('pagehandler_id', 'messages');
 }
Example #14
0
<?php

elgg_require_js('framework/inbox/admin');
$message_types = hypeInbox()->config->getMessageTypes();
foreach ($message_types as $type => $options) {
    $title = elgg_echo("item:object:message:{$type}:plural") . " ({$type})";
    $options['name'] = $type;
    $body = '<div class="inbox-folder-options">';
    $body .= elgg_view('forms/framework/inbox/message_type', $options);
    $body .= '</div>';
    $body = '<div class="pal">' . $body . '</div>';
    $form .= elgg_view_module('widget', $title, $body);
}
$title = elgg_echo("item:object:message:create");
$body = '<div class="inbox-folder-options">';
$body .= elgg_view('forms/framework/inbox/message_type');
$body .= '</div>';
$body = '<div class="pal">' . $body . '</div>';
$form .= elgg_view_module('widget', $title, $body);
$form .= '<div class="elgg-foot">';
$form .= elgg_view('input/submit', array('value' => elgg_echo('save')));
$form .= '</div>';
echo elgg_view('input/form', array('action' => 'action/hypeInbox/settings/save', 'body' => $form));
Example #15
0
    $body = elgg_strip_tags($body);
}
$message_hash = '';
$message_type = get_input('message_type', Message::TYPE_PRIVATE);
if ($original_message instanceof Message) {
    $message_hash = $original_message->getHash();
    $message_type = $original_message->getMessageType();
}
$message = Message::factory(array('sender' => $sender_guid, 'recipients' => $recipient_guids, 'subject' => $subject, 'body' => $body, 'hash' => $message_hash, 'message_type' => $message_type));
$guid = $message->send();
if (!$guid) {
    register_error(elgg_echo('inbox:send:error:generic'));
    forward(REFERRER);
}
$new_message = get_entity($guid);
$sender = $new_message->getSender();
$message_type = $new_message->getMessageType();
$message_hash = $new_message->getHash();
$ruleset = hypeInbox()->config->getRuleset($message_type);
$recipients = $new_message->getRecipients();
foreach ($recipients as $recipient) {
    if ($recipient->guid == $sender->guid) {
        continue;
    }
    $type_label = strtolower($ruleset->getSingularLabel($recipient->language));
    $subject = elgg_echo('inbox:notification:subject', array($type_label), $recipient->language);
    $notification = elgg_echo('inbox:notification:body', array($type_label, $sender->name, $body, elgg_view('output/url', array('href' => $new_message->getURL())), $sender->name, elgg_view('output/url', array('href' => elgg_normalize_url("messages/thread/{$message_hash}#reply")))), $recipient->language);
    notify_user($recipient->guid, $sender->guid, $subject, $notification, array('attachments' => $attachments, 'template' => 'messages_send', 'action' => 'send', 'object' => $new_message, 'recipients' => $recipients));
}
system_message(elgg_echo('inbox:send:success'));
forward($new_message->getURL());
Example #16
0
    echo '<div><label>' . elgg_view('input/checkbox', array('name' => "message_types[{$name}][attachments]", 'checked' => elgg_extract('attachments', $vars, false), 'value' => 1, 'default' => false)) . elgg_echo("item:object:message:setting:attachments") . '</label></div>';
    echo '<br />';
}
echo '<div><label>' . elgg_view('input/checkbox', array('name' => "message_types[{$name}][multiple]", 'checked' => elgg_extract('multiple', $vars, false), 'value' => 1, 'default' => false)) . elgg_echo("item:object:message:setting:multiple") . '</label></div>';
echo '<br />';
// allowed recipients and senders
$types = hypeInbox()->config->getUserTypes();
foreach ($types as $t => $opts) {
    $user_types_options[$t] = elgg_echo("inbox:user_type:{$t}");
}
$relationships = hypeInbox()->config->getUserRelationships();
$user_relationships_options = array('all' => '');
foreach ($relationships as $r) {
    $user_relationships_options[$r] = $r;
}
$group_relationships = hypeInbox()->config->getUserGroupRelationships();
$user_group_relationships_options = array('all' => '');
foreach ($group_relationships as $r) {
    $user_group_relationships_options[$r] = $r;
}
$policy = elgg_extract('policy', $vars, array(''));
echo '<label>' . elgg_echo('item:object:message:setting:policy') . '</label>';
echo '<div class="elgg-text-help">' . elgg_echo('item:object:message:setting:policy:help') . '</div>';
echo '<div class="clearfix">';
echo '<div class="elgg-col elgg-col-1of6">' . elgg_echo('inbox:sender') . '</div>';
echo '<div class="elgg-col elgg-col-1of6">' . elgg_echo('inbox:recipient') . '</div>';
echo '<div class="elgg-col elgg-col-1of6">' . elgg_echo('inbox:relationship') . '</div>';
echo '<div class="elgg-col elgg-col-1of6">' . elgg_echo('inbox:inverse_relationship') . '</div>';
echo '<div class="elgg-col elgg-col-1of6">' . elgg_echo('inbox:group_relationship') . '</div>';
echo '</div>';
foreach ($policy as $p) {
Example #17
0
<?php

use hypeJunction\Inbox\Message;
$guid = elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid);
$message = get_entity($guid);
elgg_require_js('framework/inbox/user');
$message_type = $message->msgType;
$subject = $message->getDisplayName();
$type_label = elgg_echo("item:object:message:{$message_type}:plural");
$type_url = "messages/inbox/{$page_owner->username}?message_type={$message_type}";
elgg_push_breadcrumb(elgg_echo('inbox'), "messages/inbox/{$page_owner->username}");
elgg_push_breadcrumb(elgg_echo('inbox:message_type', array($type_label)), $type_url);
elgg_push_breadcrumb(elgg_get_excerpt($subject, 50));
$params = array('entity' => $message, 'message_type' => $message_type);
$menu_items = hypeInbox()->hooks->setupInboxThreadMenu(null, null, array(), array('entity' => $message));
foreach ($menu_items as $item) {
    elgg_register_menu_item('title', $item);
}
$thread = elgg_view('framework/inbox/thread', $params);
if (elgg_is_xhr()) {
    echo $thread;
} else {
    $content = elgg_view('framework/inbox/participants', $params);
    $content .= elgg_view('framework/inbox/controls/thread', $params);
    $content .= $thread;
    $content .= elgg_view('framework/inbox/reply', $params);
    $content = elgg_format_element('div', ['class' => 'inbox-message-block'], $content);
    $layout = elgg_view_layout('content', array('title' => $subject, 'filter' => false, 'content' => $content, 'sidebar' => elgg_view('framework/inbox/sidebar', $params), 'class' => 'inbox-layout inbox-thread-layout'));
    echo elgg_view_page($title, $layout);
}
Example #18
0
<?php

use hypeJunction\Inbox\Message;
elgg_gatekeeper();
elgg_require_js('framework/inbox/user');
$guid = get_input('guid');
$message = get_entity($guid);
if ($message instanceof Message) {
    $recipients = $message->getParticipantGuids();
    $message_type = $message->getMessageType();
    $action = 'reply';
} else {
    $recipients = get_input('send_to');
    $message_type = get_input('message_type', Message::TYPE_PRIVATE);
    $action = 'compose';
}
$params = hypeInbox()->model->prepareFormValues($recipients, $message_type, $entity);
$title = elgg_echo("inbox:{$action}:message_type", array(elgg_echo("item:object:message:{$message_type}:singular")));
$type_label = elgg_echo("item:object:message:{$message_type}:plural");
$type_url = "messages/inbox/{$page_owner->username}?message_type={$message_type}";
elgg_push_breadcrumb(elgg_echo('inbox'), "messages/inbox/{$page_owner->username}");
elgg_push_breadcrumb(elgg_echo('inbox:message_type', array($type_label)), $type_url);
elgg_push_breadcrumb($title);
$layout = elgg_view_layout('content', array('title' => $title, 'filter' => false, 'content' => elgg_view('framework/inbox/compose', $params), 'sidebar' => elgg_view('framework/inbox/sidebar', $params), 'class' => 'inbox-layout inbox-form-layout'));
echo elgg_view_page($title, $layout);
Example #19
0
File: start.php Project: n8b/VMN
<?php

/**
 * Enhanced inbox for Elgg
 *
 * @package hypeJunction
 * @subpackage hypeInbox
 *
 * @author Ismayil Khayredinov <*****@*****.**>
 */
require_once __DIR__ . '/autoloader.php';
hypeInbox()->boot();
Example #20
0
File: Model.php Project: n8b/VMN
 /**
  * Prepare compose form variables
  *
  * @param integer    $recipient_guids GUIDs of recipients if any
  * @param string     $message_type    Type of the message being composed
  * @param ElggObject $entity          Message to which the reply is to be sent
  * @return array An array of form variables
  */
 public function prepareFormValues($recipient_guids = null, $message_type = null, $entity = null)
 {
     if (!$message_type) {
         $message_type = Message::TYPE_PRIVATE;
     }
     $recipient_guids = Group::create($recipient_guids)->guids();
     $ruleset = hypeInbox()->config->getRuleset($message_type);
     $values = array('entity' => $entity, 'multiple' => $ruleset->allowsMultipleRecipients(), 'has_subject' => $ruleset->hasSubject(), 'allows_attachments' => $ruleset->allowsAttachments(), 'subject' => $entity ? "Re: {$entity->title}" : '', 'body' => '', 'recipient_guids' => $recipient_guids, 'message_type' => $message_type);
     if (elgg_is_sticky_form('messages')) {
         $sticky = elgg_get_sticky_values('messages');
         foreach ($sticky as $field => $value) {
             if ($field == 'recipient_guids' && is_string($value)) {
                 $value = string_to_tag_array($value);
             }
             $values[$field] = $value;
         }
     }
     elgg_clear_sticky_form('messages');
     return $values;
 }
Example #21
0
<?php

$message_type = elgg_extract('message_type', $vars, hypeJunction\Inbox\Message::TYPE_PRIVATE);
$filter_context = elgg_extract('filter_context', $vars, $message_type);
$user = elgg_get_page_owner_entity();
$tabs = array('sent' => array('text' => elgg_echo('inbox:sent'), 'href' => "messages/sent/{$user->username}", 'priority' => 900), 'search' => array('text' => elgg_echo('inbox:search'), 'href' => "messages/search/{$user->username}", 'priority' => 950));
$message_types = hypeInbox()->model->getIncomingMessageTypes($user);
if ($message_types) {
    foreach ($message_types as $type) {
        $text = elgg_echo("item:object:message:{$type}:plural");
        $count = hypeInbox()->model->countUnreadMessages($type, $user);
        if ($count) {
            $text .= ' <span class="inbox-unread-count">' . $count . '</span>';
        }
        $tabs[$type] = array('text' => $text, 'href' => "messages/inbox/{$user->username}?message_type={$type}", 'priority' => 500);
    }
}
foreach ($tabs as $name => $tab) {
    $tab['name'] = $name;
    $tab['selected'] = $filter_context == $name;
    elgg_register_menu_item('filter', $tab);
}
echo elgg_view_menu('filter', ['sort_by' => 'priority', 'class' => 'elgg-menu-hz']);
Example #22
0
<?php

use hypeJunction\Inbox\Message;
$page_owner = elgg_get_page_owner_entity();
if (!$page_owner || !$page_owner->canEdit()) {
    forward('', '404');
}
$message_type = get_input('message_type', Message::TYPE_PRIVATE);
elgg_require_js('framework/inbox/user');
$type_label = elgg_echo("item:object:message:{$message_type}:plural");
$type_url = "messages/inbox/{$page_owner->username}?message_type={$message_type}";
elgg_push_breadcrumb(elgg_echo('inbox'), "messages/inbox/{$page_owner->username}");
elgg_push_breadcrumb(elgg_echo('inbox:message_type', array($type_label)), $type_url);
$outgoing_message_types = hypeInbox()->model->getOutgoingMessageTypes();
foreach ($outgoing_message_types as $mt) {
    elgg_register_menu_item('title', array('name' => $mt == HYPEINBOX_PRIVATE ? "send" : "compose:{$mt}", 'text' => elgg_echo('inbox:new', array(elgg_echo("item:object:message:{$mt}:singular"))), 'href' => elgg_http_add_url_query_elements('messages/compose', array('message_type' => $mt, 'send_to' => get_input('send_to', null))), 'link_class' => 'elgg-button elgg-button-action'));
}
$params = array('message_type' => $message_type);
$content = elgg_view('framework/inbox/inbox', $params);
if (elgg_is_xhr()) {
    echo $content;
} else {
    $layout = elgg_view_layout('content', array('title' => elgg_echo('inbox:inbox'), 'filter' => elgg_view('framework/inbox/filters/inbox', $params), 'content' => $content, 'sidebar' => elgg_view('framework/inbox/sidebar', $params), 'class' => 'inbox-layout'));
    echo elgg_view_page($title, $layout);
}
Example #23
0
<?php

require_once dirname(dirname(__FILE__)) . '/autoloader.php';
$translations = array('admin:inbox' => 'Inbox Settings', 'admin:inbox:message_types' => 'Message Types', 'item:object:message:create' => 'Add new message type', 'item:object:message:name' => 'Unique type name', 'item:object:message:setting:multiple' => 'Allow multiple recipients', 'item:object:message:setting:attachments' => 'Allow file attachments', 'item:object:message:setting:persistent' => 'Make persistent (can not be deleted by recipient)', 'item:object:message:setting:no_subject' => 'Disable subject line', 'item:object:message:setting:policy' => 'Communication policy', 'item:object:message:setting:policy:help' => 'Specifies sets of users between which this communication can occur.
		"Sender" and "Recipient" fields specify types of users (based on their "roles" on the site).
		"Relationship to recipient" specifies the type of relationship that must exist between the Sender and the Recipient for this communication to be permissible (e.g. Sender must be a friend of the Recipient).
		"Inverse relationship" specifies that the type of relationship should be inversed (e.g. Recipient must be a friend of the Sender for the Sender to be able to contact the Recipient)
		"Relationship of the sender to the group" creates an additional level of filtering, whereas 1) the Recipient must be a member of a group and 2) the Sender must have a specified relationship with that group (e.g. setting this to "member" would indicate that this type of communication can only occur between members of the same group)
	', 'item:object:message:all' => 'All Messages', 'inbox:admin:import' => 'Import older messages', 'inbox:admin:import_stats' => '%s messages are lacking metadata information required for hypeInbox compatibility', 'inbox:admin:import_start' => 'Start Import', 'inbox:admin:import_complete' => 'Import complete', 'inbox:user_type:all' => 'Any user', 'inbox:user_type:admin' => 'Administrator', 'inbox:user_type:editor' => 'Editor', 'inbox:user_type:supervisor' => 'Supervisor', 'inbox:user_type:observer' => 'Observer', 'item:object:message:label:singular' => 'Label (singular)', 'item:object:message:label:plural' => 'Label (plural)', 'inbox:send' => 'Send %s', 'inbox:sender' => 'Sender', 'inbox:relationship' => 'Relationship to recipient', 'inbox:recipient' => 'Recipient', 'inbox:inverse_relationship' => 'Inverse relationship', 'inbox:relationship' => 'Relationship to recipient', 'inbox:group_relationship' => 'Relationship of the sender to the group that the recipient is a member of', 'inbox' => 'Messages', 'inbox:all' => 'All messages', 'inbox:inbox' => 'Inbox', 'inbox:sent' => 'Sent messages', 'inbox:compose' => 'Compose', 'inbox:new' => 'New %s', 'inbox:compose:message_type' => 'Compose a %s', 'inbox:reply' => 'Reply', 'inbox:reply:message_type' => 'Reply to a %s', 'inbox:reply:prefix' => 'Re:', 'inbox:message_type' => '%s', 'inbox:message_type:sent' => 'Sent %s', 'inbox:conversation:user' => 'Conversation with %s', 'inbox:conversation:group' => 'Group conversation', 'inbox:usersettings:grouping' => 'Group inbox messages by sender', 'inbox:group' => 'Group', 'inbox:dontgroup' => 'Don\'t Group', 'inbox:message_not_found' => 'Message not found', 'inbox:untitled' => 'Untitled', 'inbox:me' => 'me', 'inbox:recipients:others' => '%s others', 'inbox:thread' => 'View all %s messages in this thread', 'inbox:thread:count' => '%s messages', 'inbox:thread:unread' => '%s new', 'inbox:thread:new' => 'New message', 'inbox:thread:participants' => 'Members in this thread', 'inbox:attachments:count' => '%s attachments', 'inbox:message' => 'Message: %s', 'inbox:conversation' => 'Conversation between you and %s', 'inbox:nomessages' => 'There are no messages in this thread', 'inbox:load:before' => 'Load earlier messages', 'inbox:load:after' => 'Load newer messages', 'inbox:delete' => 'Delete', 'inbox:markread' => 'Mark as read', 'inbox:markunread' => 'Mark as unread', 'inbox:delete:success' => '%s messages were successfully deleted', 'inbox:delete:success:single' => 'Message was successfully deleted', 'inbox:delete:error' => 'Messages could not be deleted', 'inbox:delete:inbox:confirm' => 'Are you sure you want to delete all selected messages?', 'inbox:delete:thread:confirm' => 'Are you sure you want to delete all messages in this thread?', 'inbox:delete:message:confirm' => 'Are you sure you want to delete this message?', 'inbox:markread:success' => '%s messages were marked as read', 'inbox:markread:success:single' => 'Message was marked as read', 'inbox:markread:error' => 'Messages could not be marked as read', 'inbox:markunread:success' => '%s messages were marked as unread', 'inbox:markunread:success:single' => 'Message was marked as unread', 'inbox:markunread:error' => 'Messages could not be marked as unread', 'inbox:error:notfound' => '%s messages could not be found', 'inbox:error:persistent' => '%s messages cound not be delete due to their read-only setting', 'inbox:error:unknown' => '%s messages could not be deleted because of an unknown error', 'inbox:send:success' => 'Message was successfully sent', 'inbox:send:error:no_recipients' => 'No recipients were selected', 'inbox:send:error:no_body' => 'You need add a message body', 'inbox:send:error:generic' => 'An unknown error ocurred while sending the message', 'inbox:user:unknown' => 'Unknown', 'inbox:form:toggle_all' => 'Toggle all', 'inbox:message:recipient' => 'Recipient', 'inbox:message:recipients' => 'Recipients', 'inbox:message:subject' => 'Subject', 'inbox:message:body' => 'Message', 'inbox:message:attachments' => 'Attachments', 'inbox:message:attachments:add' => 'Add attachments', 'inbox:message:send' => 'Send', 'inbox:notification:subject' => 'You have a new %s', 'inbox:notification:body' => "You have a new %s from %s. It reads:\n\n\n\t%s\n\n\n\tTo view your messages, click here:\n\n\t%s\n\n\tTo send %s a message, click here:\n\n\t%s\n\n\tPlease do not reply to this email.", 'inbox:empty' => 'Your inbox is empty', 'inbox:settings:enable_html' => 'Enable HTML in messages', 'inbox:settings:enable_html:help' => 'HTML messages should only be enabled if your site supports outgoing HTML emails', 'inbox:byline' => 'From %s', 'inbox:to' => 'To %s', 'inbox:byline:thread' => 'Last message from %s', 'inbox:search' => 'Search');
$message_types = hypeInbox()->config->getMessageTypes();
// Register label translations for custom message types
foreach ($message_types as $type => $options) {
    $ruleset = hypeInbox()->config->getRuleset($type);
    $translations[$ruleset->getSingularLabel(false)] = $ruleset->getSingularLabel('en');
    $translations[$ruleset->getPluralLabel(false)] = $ruleset->getPluralLabel('en');
}
return $translations;
Example #24
0
File: Policy.php Project: n8b/VMN
 /**
  * Sets recipient type and callbacks
  * 
  * @param string $type
  * @return Policy
  */
 public function setRecipientType($type)
 {
     $usertypes = hypeInbox()->config->getUserTypes();
     $this->recipient = new stdClass();
     $this->recipient->type = $type;
     $this->recipient->validator = elgg_extract('validator', $usertypes[$type]);
     $this->recipient->getter = elgg_extract('getter', $usertypes[$type]);
     return $this;
 }
Example #25
0
 public static function search($term)
 {
     return hypeInbox()->model->searchRecipients($term);
 }