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())); }
private function eraseUser() { $message_m = new \Models\Messages(\lib\Register::get('id')); $messages = $message_m->getMessages(); if (!empty($messages)) { foreach ($messages as $message) { $message_m->deleteMessages($message->getId()); } } $user_e = new \models\User(\lib\Register::get('id')); $user_e->delete(); $user = new \models\Users(\lib\Register::get('id')); $user->delete(); Location::To(URL . 'logout'); }