public function notify_post() { $status = 404; $return['result'] = 'NOOK'; $return['data'] = ''; $id = $this->input->post('id'); $donations = CI_Donation::getById($id); if (empty($donations)) { $this->response($return, $status); } $donation = $donations[0]; $publication = CI_Request::getById($donation->getPublicationId())[0]; $publicationId = $donation->getPublicationId(); $userIdTo = $donation->getUserId(); $userIdFrom = $publication->userId; $ownerPublication = CI_User::getById($userIdFrom)[0]; $ownerDonation = CI_User::getById($userIdTo)[0]; $options['donatedObjects'] = $donation->getDonatedObjects(); $options['nameOwnerPublication'] = $ownerPublication->getName(); $options['nameOwnerDonation'] = $ownerDonation->getName(); $options['publicationTitle'] = $publication->title; $options['personalDataOwnerDonation'] = $ownerDonation->getPersonalData(); $notifyMessage = new CI_Message(); $notifyMessage->setUserIdTo($userIdTo); $notifyMessage->setUserIdFrom($userIdFrom); $notifyMessage->setPublicationId($publicationId); $notifyMessage->setCommonState('N'); $notifyMessage->setNotifyText($options); if ($notifyMessage->save()) { $status = 200; $return['result'] = 'OK'; $return['data'] = $donation; } $this->response($return, $status); }