Ejemplo n.º 1
0
            $type = 0;
    }
    // Sending mail section.
    if ($message && $messenger) {
        if ($to_clan && $has_clan) {
            $type = 1;
            $target_id_list = $clan->getMemberIds();
            $passfail = Message::sendToGroup($ninja, $target_id_list, $message, $type);
            $message_sent_to = 'your clan';
            $message_to = 'clan';
        } elseif ((bool) $target_id) {
            Message::create(['send_from' => $ninja->id(), 'send_to' => $target_id, 'message' => $message, 'type' => $type]);
            $message_sent_to = $to;
            $message_to = 'individual';
            $type = 0;
        }
    }
    // An illuminate collection object.
    $messages = Message::findByReceiver($ninja, $type, $limit, $offset);
    $message_count = Message::countByReceiver($ninja, $type);
    // To count all the messages
    $pages = ceil($message_count / $limit);
    // Total pages.
    $current_page = $page;
    Message::markAsRead($ninja, $type);
    // mark messages as read for next viewing.
    // TODO: Handle "send" ing to specific, known users.
    $individual_or_clan = $message_to == 'individual' || $message_to == 'clan';
    $parts = compact('command', 'message_sent_to', 'messages', 'current_tab', 'to', 'has_clan', 'type', 'messages_type', 'individual_or_clan', 'pages', 'current_page', 'message_to', 'informational');
    display_page('messages.tpl', 'Messages', $parts, ['quickstat' => false]);
}