|
|
@@ -40,7 +40,7 @@ class Route_UserMsgs extends RouteBase {
|
|
|
}
|
|
|
|
|
|
public function userMsgs($usrLogin) {
|
|
|
- $msgsList = $this->_getMsgs('inbox', $usrLogin);
|
|
|
+ $msgsList = $this->getMsgs('inbox', $usrLogin);
|
|
|
$totalReadMsgs = 0;
|
|
|
$totalUnreadMsgs = 0;
|
|
|
foreach ($msgsList as $ind => $msg) {
|
|
|
@@ -50,8 +50,8 @@ class Route_UserMsgs extends RouteBase {
|
|
|
$totalUnreadMsgs++;
|
|
|
}
|
|
|
}
|
|
|
- $sentMsgsList = $this->_getMsgs('sent', $usrLogin);
|
|
|
- $removedMsgsList = $this->_getMsgs('removed', $usrLogin);
|
|
|
+ $sentMsgsList = $this->getMsgs('sent', $usrLogin);
|
|
|
+ $removedMsgsList = $this->getMsgs('removed', $usrLogin);
|
|
|
?>
|
|
|
<style type="text/css">
|
|
|
.tblMsgsListItem { cursor:pointer; }
|
|
|
@@ -220,7 +220,7 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
if (!in_array($listType, array('inbox','sent','removed'))) throw new HttpException("Wrong param listType", 404);
|
|
|
|
|
|
$resultData = new stdClass();
|
|
|
- $resultData->msgs = $this->_getMsgs($listType, $usrLogin, $lastMsgId);
|
|
|
+ $resultData->msgs = $this->getMsgs($listType, $usrLogin, $lastMsgId);
|
|
|
$resultData->keysOrder = array_keys($resultData->msgs);
|
|
|
echo json_encode($resultData);
|
|
|
}
|
|
|
@@ -305,7 +305,7 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
<?php
|
|
|
}
|
|
|
|
|
|
- public function _getMsgs($filterType, $usrLogin, $lastMsgId = null) {
|
|
|
+ public function getMsgs($filterType, $usrLogin, $lastMsgId = null) {
|
|
|
$lastMsgId = (int)$lastMsgId;
|
|
|
$msgsRoute = Router::getRoute('Msgs');
|
|
|
$msgsList = array();
|
|
|
@@ -327,6 +327,12 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
and m.`A_STATUS` in('WAITING', 'NORMAL')
|
|
|
";
|
|
|
break;
|
|
|
+ case 'unread':
|
|
|
+ $sqlWhereAddFilter = "
|
|
|
+ and ({$sqlFilerMsgsForUser})
|
|
|
+ and m.`A_STATUS` in('WAITING')
|
|
|
+ ";
|
|
|
+ break;
|
|
|
case 'sent':
|
|
|
$sqlWhereAddFilter = "
|
|
|
and m.`A_RECORD_CREATE_AUTHOR`='{$usrLogin}'
|