Ejemplo n.º 1
0
        ?>
        <?php 
        if ($j == 0) {
            ?>
            <p><strong>Chủ đề : <?php 
            echo $item['title'];
            ?>
</strong> <a href="<?php 
            echo Yii::app()->createUrl('wMessage/Notification');
            ?>
" title="Đóng & Trở về" style="float: right; margin: 5px; color: #C02222; "><span class="glyphicon glyphicon-remove-circle"></span></a></p>
            <?php 
        }
        ?>
        <?php 
        $listUser = WMessageSendto::getUserInbox($item["idmessage"], $item["idmessagecontent"]);
        $check = FALSE;
        if (Yii::app()->user->name == $item["username"]) {
            $check = TRUE;
        }
        $str_user = "";
        $firstUser = "";
        if (!empty($listUser)) {
            $i = 0;
            foreach ($listUser as $itemUser) {
                if ($itemUser["username"] == Yii::app()->user->name) {
                    $check = TRUE;
                }
                if (!empty($itemUser["fullname"])) {
                    $str_user .= $itemUser["fullname"] . '(' . $itemUser["username"] . ')' . ', ';
                } else {
Ejemplo n.º 2
0
            <?php 
    foreach ($data as $item) {
        ?>
            <?php 
        $dataContentNew = WMessageContent::getInfoMessageNew($item["id"]);
        ?>
            <tr id="row_<?php 
        echo $item["id"];
        ?>
" class="<?php 
        echo $item["status"] == 0 ? "active" : "";
        ?>
">
                <td class="mail-select">
                    <?php 
        $total = WMessageSendto::getTotalNoRead($item["id"]);
        if ($total > 0) {
            ?>
                    <span style="padding: 2px 6px; background: #C20B0B; color: white; text-align: center; border-radius: 50%;"><?php 
            echo $total;
            ?>
</span>
                    <?php 
        }
        ?>
                </td>
                <td class="sender visible-lg visible-md">
                    <a href="<?php 
        echo Yii::app()->createUrl('wMessage/view', array('idmessage' => $item["id"]));
        ?>
" style="font-size: 13px;" data-idmessage="<?php 
Ejemplo n.º 3
0
                <?php 
}
?>

                <a href="<?php 
echo Yii::app()->createUrl('wMessage/Notification');
?>
" style="background: #5bc0de;" class="btn btn-info btn-flat btn-block">View All Notification</a>
            </div>

        </div>

    </li>
    <li class="dropdown lv1">
        <?php 
$dataTotalMessage = WMessageSendto::getTotalReadMessage("message");
?>
        <a href="javascript:;" data-toggle="dropdown" role="button" aria-expanded="false" style="position: relative;">
            <img src="<?php 
echo Yii::app()->theme->baseUrl;
?>
/img/email.png" />
            <?php 
if (count($dataTotalMessage) != 0) {
    ?>
            <span class="badge bg-warning" style="position: absolute; background: #E35B5A; top: -7px; right: -7px; font-size: 11px; padding: 3px 6px; "><?php 
    echo !empty($dataTotalMessage) ? count($dataTotalMessage) : 0;
    ?>
</span>
            <?php 
}
Ejemplo n.º 4
0
        </div>
    </div>
</div>

<div class="panel panel-default" style="margin-top: 10px;">
    <div class="panel-body no-padd">
        <div class="list-group no-margn mail-nav" style="border-top: 1px solid rgba(227, 227, 227, 0.19);">
            <a href="<?php 
echo Yii::app()->createUrl("wMessage/Notification");
?>
" class="list-group-item <?php 
echo (!empty($active) and $active == 3) ? "on" : "";
?>
">
                <?php 
$countNotifi = count(WMessageSendto::getTotalReadMessage("notifi"));
?>
                <?php 
if ($countNotifi > 0) {
    ?>
                <span style="background: #C20B0B" class="badge bg-blue text-white" id="totalnotifi"><?php 
    echo $countNotifi;
    ?>
</span>
                <?php 
}
?>
                <?php 
echo Yii::t('web/home', 'Notification');
?>
            </a>
 public function actionRemoveAllMessage()
 {
     $typemessage = isset($_REQUEST["typemessage"]) ? $_REQUEST["typemessage"] : "notifi";
     $listid = isset($_REQUEST["listid"]) ? $_REQUEST["listid"] : NULL;
     $json = array("result" => "true");
     if (!empty($listid)) {
         foreach ($listid as $item) {
             $model = WMessageSendto::model()->find("id_message=" . $item["id"] . ' AND type_message="' . $typemessage . '"');
             if (!empty($model)) {
                 $comm = Yii::app()->db->createCommand();
                 $comm->reset();
                 $comm->delete('pls_message_sendto', 'id_message=' . $item["id"] . ' AND  type_message="' . $typemessage . '"');
                 $comm->reset();
                 $comm->delete('pls_message_content', 'id_message=' . $item["id"]);
                 $comm->reset();
                 $comm->delete('pls_message', 'id=' . $item["id"]);
             }
         }
     }
     echo json_encode($json);
 }
Ejemplo n.º 6
0
 public static function SendMessage($title, $content, $typeSend = "notifi", $iduserFrom = NULL, $iduserTo)
 {
     $titlemessage = $title;
     $contentmessage = $content;
     if (empty($iduserFrom)) {
         $iduserFrom = WUser::getIDMinUser();
     }
     $date = date('Y-m-d H:i:s');
     if (!empty($iduserTo)) {
         $message = new WMessage();
         $message->status = 1;
         $message->title = $titlemessage;
         $message->created_by = $iduserFrom;
         $message->created_date = $date;
         $message->type_message = $typeSend;
         if ($message->save()) {
             $idmessage = $message->id;
             $messgetTrash = new WMessageTrash();
             $messgetTrash->id_message = $idmessage;
             $messgetTrash->trash = 0;
             $messgetTrash->save();
             $messageContent = new WMessageContent();
             $messageContent->created_date = $date;
             $messageContent->content = $contentmessage;
             $messageContent->id_message = $idmessage;
             $messageContent->created_by = $iduserFrom;
             $messageContent->status = 1;
             if ($messageContent->save()) {
                 $idmessagecontent = $messageContent->id;
                 if (!empty($iduserTo)) {
                     $dataUser = WUser::getUserByUsername($iduserTo);
                     $messageSendto = new WMessageSendto();
                     $messageSendto->id_message = $idmessage;
                     $messageSendto->id_message_content = $idmessagecontent;
                     $messageSendto->id_user_to = $iduserTo;
                     $messageSendto->type_message = $typeSend;
                     $messageSendto->status = 0;
                     $messageSendto->trash = 0;
                     if ($messageSendto->save()) {
                     } else {
                         echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 03. Mời bạn thử lại'));
                         die;
                     }
                 }
             } else {
                 echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 02. Mời bạn thử lại'));
                 die;
             }
         } else {
             echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 01. Mời bạn thử lại'));
             die;
         }
     } else {
         echo json_encode(array('result' => 'false', 'html' => 'Không có User nào cần gửi'));
     }
 }