Select Git revision
messages.php
-
Eric Rasmussen authored
rename our copy of messages plugin to messages_unl since the core elgg messages plugin is now being pulled into mod automatically and we now have a naming conflict
Eric Rasmussen authoredrename our copy of messages plugin to messages_unl since the core elgg messages plugin is now being pulled into mod automatically and we now have a naming conflict
messages.php 6.52 KiB
<?php
/**
* Elgg messages individual view
*
* @package ElggMessages
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*
*
* @uses $vars['entity'] Optionally, the message to view
* @uses get_input('type') If the user accesses the message from their sentbox, this variable is passed
* and used to make sure the correct icon and name is displayed
*/
// set some variables to use below
if(get_input("type") == "sent"){
// send back to the users sentbox
$url = $vars['url'] . "mod/messages/sent.php";
//this is used on the delete link so we know which type of message it is
$type = "sent";
} else {
//send back to the users inbox
$url = $vars['url'] . "pg/messages/" . $vars['user']->username;
//this is used on the delete link so we know which type of message it is
$type = "inbox";
}
if (isloggedin())
if (isset($vars['entity'])) {
if ($vars['entity']->toID == $vars['user']->guid
|| $vars['entity']->owner_guid == $vars['user']->guid) {
?>
<!-- get the correct return url -->
<div id="messages_return"><!-- start of messages_return div -->
<p><a href="<?php echo $url; ?>">« <?php echo elgg_echo('messages:back'); ?></a></p>
</div><!-- end of messages_return div -->
<div class="messages_single"><!-- start of the message div -->
<div class="messages_single_icon"><!-- start of the message_user_icon div -->
<!-- get the user icon, name and date -->
<?php
// we need a different user icon and name depending on whether the user is reading the message
// from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
// the message. If it is the sentbox, the icon and name will be the user the message was sent to
if($type == "sent"){
//get an instance of the user who the message has been sent to so we can access the name and icon
$user_object = get_entity($vars['entity']->toId);
//get the icon
echo " " . elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
//get the name
echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:to').": <b>" . $user_object->name . "</b><br />";
}else{
//get the icon
echo " " . elgg_view("profile/icon",array('entity' => get_entity($vars['entity']->fromId), 'size' => 'tiny'));
//get the name
echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . get_entity($vars['entity']->fromId)->name . "</b><br />";
}
?>
<!-- get the time the message was sent -->