Exemple #1
0
 public function message()
 {
     $http = new Http();
     $id = $http->post('id');
     if ($http->isActive('user_id')) {
         $user_id = $http->post('user_id');
         $user = new Users($user_id);
         $messages_m = new Messages($user_id);
     } else {
         $message_m = new Message($id);
         $message_m->setReaded(true);
         $message_m->writeData(true);
         $messages_m = new Messages($message_m->getUserId());
         $user = new Users($message_m->getUserId());
     }
     $messages = $messages_m->getMessages(false, false, true);
     $array_messages = array();
     if (!empty($messages)) {
         foreach ($messages as $key => $m) {
             if (!$m->getDisplaySeller()) {
                 continue;
             }
             $array_messages[$key]['id'] = $m->getId();
             $array_messages[$key]['message'] = $m->getMessage();
             $array_messages[$key]['date'] = $m->getDate();
         }
     }
     echo $this->render('adminmessage', array('messages' => $array_messages, 'user' => $user->getLogin(), 'user_id' => $user->getId()));
 }