예제 #1
0
 public function getUserTo()
 {
     $userTo = CI_User::getById($this->userTo)[0];
     $myUserTo = new stdClass();
     $myUserTo->id = $userTo->getId();
     $myUserTo->name = $userTo->getName();
     $myUserTo->email = $userTo->getEmail();
     $myUserTo->profileImage = 'http://www.gravatar.com/avatar/' . md5($userTo->getGravatarEmail());
     return $myUserTo;
 }
예제 #2
0
 public function index_delete()
 {
     checkIsLoggedIn($this);
     $status = 404;
     $return["data"] = "";
     $return["result"] = "NOOK";
     $id = $this->input->post('id') > 0 ? $this->input->post('id') : 0;
     if ($id > 0) {
         $user = CI_User::getById($id);
         if ($user->delete()) {
             $status = 200;
             $return["result"] = "OK";
         }
     }
     $this->response($return, $status);
 }
예제 #3
0
 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);
 }