public static function user_count_unread_mails($login) { $user = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login); $mails = $user->get_mails(); $unread = 0; $tnr = array(); $i = 0; foreach ($mails as $mail) { $tnr[$i] = lms_steam::is_reader($mail, $user, TRUE); $i++; } $result = $GLOBALS["STEAM"]->buffer_flush(); $i = 0; foreach ($mails as $mail) { if (!$result[$tnr[$i]]) { $unread++; } $i++; } return $unread; }
} $content->setCurrentBlock("BLOCK_MESSAGES_AVAILABLE"); $content->setVariable("CONFIRMATION_MESSAGE", gettext("Are you sure you want delete this?")); $content->setVariable("SUBJECT", gettext("Subject")); $content->setVariable("SELECT_ALL", gettext("Select all")); $content->setVariable("DELETE", gettext("Delete")); $attributequery = array(OBJ_NAME, OBJ_CREATION_TIME); if ($is_sent) { $attributequery[] = "mailto"; } // Query the receivers too $data_tnr = array(); for ($i = $start; $i < $end; $i++) { $data_tnr[$i] = array(); $message = $messages[$i]; $data_tnr[$i]["IS_READ"] = lms_steam::is_reader($message, $user, TRUE); $data_tnr[$i]["CREATOR"] = $message->get_creator(TRUE); $data_tnr[$i]["ATTRIBUTES"] = $message->get_attributes($attributequery, TRUE); } $data_result = $GLOBALS["STEAM"]->buffer_flush(); $message_sender_html = array(); if (!$is_sent) { $sender_tnr = array(); for ($i = $start; $i < $end; $i++) { $sender_tnr[$i] = $data_result[$data_tnr[$i]["CREATOR"]]->get_attributes(array(OBJ_NAME, OBJ_ICON, USER_FIRSTNAME, USER_FULLNAME), TRUE); } $sender_result = $GLOBALS["STEAM"]->buffer_flush(); for ($i = $start; $i < $end; $i++) { $message = $messages[$i]; $message_unread = !$data_result[$data_tnr[$i]["IS_READ"]]; $unread_start = $message_unread ? "<strong>" : "";