Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 630 | Rev 6388 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 630 Rev 3138
Línea 25... Línea 25...
25
use LeadersLinked\Model\Message;
25
use LeadersLinked\Model\Message;
26
use LeadersLinked\Model\Connection;
26
use LeadersLinked\Model\Connection;
27
use LeadersLinked\Model\Notification;
27
use LeadersLinked\Model\Notification;
28
use LeadersLinked\Mapper\UserExperienceMapper;
28
use LeadersLinked\Mapper\UserExperienceMapper;
29
use Laminas\Db\Sql\Select;
29
use Laminas\Db\Sql\Select;
-
 
30
use LeadersLinked\Mapper\UtilMapper;
Línea 30... Línea 31...
30
 
31
 
31
class UserNotification
32
class UserNotification
32
{
33
{
33
    const NOTIFICATION_TYPE_UNREAD = 'unread';
34
    const NOTIFICATION_TYPE_UNREAD = 'unread';
Línea 140... Línea 141...
140
     * @param string $notification_type
141
     * @param string $notification_type
141
     * @return string
142
     * @return string
142
     */
143
     */
143
    public function getNotifications($currentPage = 1, $notification_type = self::NOTIFICATION_TYPE_REGULAR) 
144
    public function getNotifications($currentPage = 1, $notification_type = self::NOTIFICATION_TYPE_REGULAR) 
144
    {
145
    {
-
 
146
        
-
 
147
        $utilMapper = UtilMapper::getInstance($this->adapter);
-
 
148
        $now = $utilMapper->getDatebaseNow();
-
 
149
        
145
        $content = '';
150
        $content = '';
Línea 146... Línea 151...
146
 
151
 
147
        $queryMapper = QueryMapper::getInstance($this->adapter);
152
        $queryMapper = QueryMapper::getInstance($this->adapter);
148
        $select = $queryMapper->getSql()->select(NotificationMapper::_TABLE);
153
        $select = $queryMapper->getSql()->select(NotificationMapper::_TABLE);
Línea 165... Línea 170...
165
            $notificationMapper = NotificationMapper::getInstance($this->adapter);
170
            $notificationMapper = NotificationMapper::getInstance($this->adapter);
Línea 166... Línea 171...
166
 
171
 
167
            foreach ($items as $item) 
172
            foreach ($items as $item) 
Línea 168... Línea 173...
168
            {
173
            {
169
                
174
                
170
                $time_ago               = Functions::timeElapsedString(strtotime($item['added_on']));
175
                $time_ago               = Functions::timeAgo($item['added_on'],  $now);
171
                $type                   = $item['type'];
176
                $type                   = $item['type'];
172
                $action_by_user_id      = (int) $item['action_by_user_id'];
177
                $action_by_user_id      = (int) $item['action_by_user_id'];
173
                $action_by_user_name    = '';
178
                $action_by_user_name    = '';
Línea 333... Línea 338...
333
     * @param int $currentPage
338
     * @param int $currentPage
334
     * @return array
339
     * @return array
335
     */
340
     */
336
    public function getMessages(int $currentPage = 1) 
341
    public function getMessages(int $currentPage = 1) 
337
    {
342
    {
338
 
-
 
-
 
343
        $utilMapper = UtilMapper::getInstance($this->adapter);
-
 
344
        $now = $utilMapper->getDatebaseNow();
Línea 339... Línea 345...
339
        
345
        
340
        $queryMapper = QueryMapper::getInstance($this->adapter);
346
        $queryMapper = QueryMapper::getInstance($this->adapter);
341
        $select = $queryMapper->getSql()->select(MessageMapper::_TABLE);
347
        $select = $queryMapper->getSql()->select(MessageMapper::_TABLE);
342
        $select->where->equalTo('user_id', $this->session_user_id)->and->equalTo('receiver_status', Message::STATUS_NORMAL); 
348
        $select->where->equalTo('user_id', $this->session_user_id)->and->equalTo('receiver_status', Message::STATUS_NORMAL); 
Línea 372... Línea 378...
372
 
378
 
373
                array_push($messages, [
379
                array_push($messages, [
374
                    'title'         => $action_by_user_name,
380
                    'title'         => $action_by_user_name,
375
                    'text'          => $item['message'],
381
                    'text'          => $item['message'],
376
                    'url'           => $this->url('messaging/thread', ['conversation_id' => Functions::encryptIt($item['conversation_id'])] ).'/#message',
382
                    'url'           => $this->url('messaging/thread', ['conversation_id' => Functions::encryptIt($item['conversation_id'])] ).'/#message',
377
                    'time'          => Functions::timeElapsedString(strtotime($item['sent_on'])),
383
                    'time'          => Functions::timeAgo($item['sent_on'], $now),
378
                    'image'         => $user_img,
384
                    'image'         => $user_img,
379
                    'active_class'  => $item['is_read'] == Message::YES ? 'active' : ''
385
                    'active_class'  => $item['is_read'] == Message::YES ? 'active' : ''
Línea 380... Línea 386...
380
                ]);
386
                ]);