* @copyright Curverider Ltd 2008-2010
* @link http://elgg.com/
*
* @uses $vars['entity'] An array of messages to view
* @uses $vars['page_view'] This is the page the messages are being accessed from; inbox or sentbox
*
*/
$limit = $vars['limit']; if (empty($limit)) $limit = 10;
$offset = $vars['offset']; if (!isset($offset)) $offset = 0;
// If there are any messages to view, view them
if (isloggedin())
if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
// get the correct display for the inbox view
if($vars['page_view'] == "inbox") {
$counter = 0;
foreach($vars['entity'] as $message) {
if ($message->owner_guid == $vars['user']->guid || $message->toId == $vars['user']->guid) {
//make sure to only display the messages that have not been 'deleted' (1 = deleted)
if($message->hiddenFrom != 1){
// check to see if the message has been read, if so, set the correct container class
if($message->readYet == 1){
echo "
";
}else{
echo "
";
}
// get the icon of the user who owns the message
$from = get_entity($message->fromId);
echo "
"; // close the message container
}//end of hiddenFrom if statement
} // end of user check
$counter++;
if ($counter == $limit) break;
}//end of for each loop
}//end of inbox if statement
// get the correct display for the sentbox view
if($vars['page_view'] == "sent") {
$counter = 0;
foreach($vars['entity'] as $message) {
//make sure to only display the messages that have not been 'deleted' (1 = deleted)
if($message->hiddenTo != 1){
//get the correct user entity
$user = get_entity($message->toId);
echo "
";
//get the icon for the user the message was sent to
echo "