コード例 #1
0
 public function removeAllMessages()
 {
     parent::removeAllMessages();
     $this->setFlashMessages();
 }
コード例 #2
0
ファイル: message.inc.php プロジェクト: norter/Game
 function __construct()
 {
     $this->MessageClass = MessageClass::getMessageClasses();
     parent::__construct();
 }
コード例 #3
0
ファイル: message.html.php プロジェクト: agatho/uaenhanced
function messages_getMessages($caveID, $deletebox, $box)
{
    global $params, $config;
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'messagebox.ihtml');
    // Nachrichten löschen
    $deleted = 0;
    // checkboxes checked
    if (is_array($deletebox)) {
        // mail and delete
        if (isset($params->POST->mail_and_delete)) {
            $deleted = messages_mailAndDeleteMessages($deletebox);
        } else {
            if (isset($params->POST->delete)) {
                $deleted = messages_deleteMessages($deletebox);
            }
        }
    }
    // delete all
    if (isset($params->POST->delete_all)) {
        $deleted = messages_deleteAllMessages($box, $params->POST->messageClass);
    }
    // show number of deleted messages
    if ($deleted > 0) {
        tmpl_set($template, '/STATUS_MESSAGE/status_message', sprintf(_('%d Nachricht(en) erfolgreich gelöscht.'), $deleted));
    }
    // flag messages
    if (isset($params->POST->flag)) {
        messages_flag($params->POST->id);
    }
    // unflag messages
    if (isset($params->POST->unflag)) {
        messages_unflag($params->POST->id);
    }
    // verschiedene Boxes werden hier behandelt... //
    $boxes = array(BOX_INCOMING => array('boxname' => _('Posteingang'), 'von_an' => _('Absender')), BOX_OUTGOING => array('boxname' => _('Postausgang'), 'von_an' => _('Empfänger')));
    if (!isset($boxes[$box])) {
        $box = BOX_INCOMING;
    }
    $classes = array();
    foreach (MessageClass::getMessageClasses() as $id => $text) {
        if ($id != 1001) {
            $classes[] = array('id' => $id, 'text' => $text);
        }
    }
    tmpl_set($template, array('/boxname' => $boxes[$box]['boxname'], '/von_an' => $boxes[$box]['von_an'], '/MESSAGECLASS' => $classes));
    /////////////////////////////////////////////////
    // get row_count
    $row_count = 50;
    // errechne offset
    $offset = isset($params->POST->offset) ? intval($params->POST->offset) : 0;
    switch ($box) {
        default:
        case BOX_INCOMING:
            $message_count = messages_getIncomingMessagesCount();
            break;
        case BOX_OUTGOING:
            $message_count = messages_getOutgoingMessagesCount();
            break;
    }
    // offset "normalisieren"
    if ($offset < 0) {
        $offset = 0;
    }
    if ($offset > $message_count - 1) {
        $offset = $message_count;
    }
    // Nachrichten einlesen und ausgeben
    $nachrichten = array();
    switch ($box) {
        default:
        case BOX_INCOMING:
            $nachrichten = messages_getIncomingMessages($offset, $row_count);
            break;
        case BOX_OUTGOING:
            $nachrichten = messages_getOutgoingMessages($offset, $row_count);
            break;
    }
    tmpl_set($template, '/MESSAGE', $nachrichten);
    // vor-zurück Knopf
    if ($offset - $row_count >= 0) {
        tmpl_set($template, '/PREVIOUS', array('offset' => $offset - $row_count, 'box' => $box, 'modus' => MESSAGES));
    } else {
        tmpl_set($template, '/PREVIOUS_DEACTIVATED/dummy', ' ');
    }
    if ($offset + $row_count <= $message_count - 1) {
        tmpl_set($template, '/NEXT', array('offset' => $offset + $row_count, 'box' => $box, 'modus' => MESSAGES));
    } else {
        tmpl_set($template, '/NEXT_DEACTIVATED/dummy', ' ');
    }
    // Anzeige welche Nachrichten man sieht
    tmpl_set($template, array('message_min' => $message_count == 0 ? 0 : $offset + 1, 'message_max' => min($offset + $row_count, $message_count), 'message_count' => $message_count));
    /////////////////////////////////////////////////
    tmpl_set($template, '/HIDDEN', array(array('arg' => "modus", 'value' => MESSAGES), array('arg' => "box", 'value' => $box)));
    return tmpl_parse($template);
}
コード例 #4
0
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    </head>
    <body>
        <h1>Test Message</h1>
        <div class="text-primary" style="font-size:20px; margin-left:20px;">
        <?php 
// put your code here
include './models/IMessage.php';
include './models/MessageClass.php';
$message = new MessageClass();
$message->addMessage('test', 'my test message');
var_dump($message->getAllMessages());
echo '<br />';
var_dump($message instanceof IMessage);
echo '<br />';
var_dump($message->removeMessage('test'));
echo '<br />';
var_dump($message->getAllMessages());
?>
        </div>
    </body>
</html>
コード例 #5
0
ファイル: message.inc.php プロジェクト: agatho/uaenhanced
/**
 * Delete all messages of a given box.
 */
function messages_deleteAllMessages($boxID, $messageClass = FALSE)
{
    global $db, $params;
    if ($messageClass == -2) {
        // no class selected
        return 0;
    }
    switch ($boxID) {
        case BOX_INCOMING:
            $deletor = 'recipient';
            break;
        case BOX_OUTGOING:
            $deletor = 'sender';
            break;
        default:
            return 0;
    }
    $playerID = $params->SESSION->player->playerID;
    $uaMessageClass = MessageClass::getMessageClasses();
    // messageClass set
    if (isset($uaMessageClass[$messageClass])) {
        $sql = sprintf('UPDATE Message SET ' . 'senderDeleted    = senderDeleted    OR (senderID    = %d), ' . 'recipientDeleted = recipientDeleted OR (recipientID = %d) ' . 'WHERE messageClass != 1001 AND messageClass = %d ' . 'AND %sID = %d', $playerID, $playerID, $messageClass, $deletor, $playerID);
    } else {
        $sql = sprintf('UPDATE Message SET ' . 'senderDeleted    = senderDeleted    OR (senderID    = %d), ' . 'recipientDeleted = recipientDeleted OR (recipientID = %d) ' . 'WHERE messageClass != 1001 ' . 'AND %sID = %d', $playerID, $playerID, $deletor, $playerID);
    }
    $dbresult = $db->query($sql);
    return $db->affected_rows();
}