Пример #1
0
 public function index_post()
 {
     //checkIsLoggedIn($this);
     $status = 404;
     $return["result"] = "NOOK";
     $return["data"] = "";
     $datestring = "%Y/%m/%d %H:%i:%s";
     $currDate = mdate($datestring, now());
     $arrOptions['userFrom'] = $this->post('userFrom');
     $arrOptions['userTo'] = $this->post('userTo');
     $arrOptions['publication'] = $this->post('publication');
     $arrOptions['conversationId'] = $this->post('conversationId');
     $arrOptions['text'] = $this->post('text');
     $message = new CI_Message();
     $message->setUserFrom($arrOptions['userFrom']);
     $message->setUserTo($arrOptions['userTo']);
     $message->setPublication($arrOptions['publication']);
     $message->setConversationId($arrOptions['conversationId']);
     $message->setText($arrOptions['text']);
     if ($message->save()) {
         $myMessage = new stdClass();
         $myMessage->id = $message->getId();
         $myMessage->userTo = $message->getUserTo();
         $myMessage->userFrom = $message->getUserFrom();
         $myMessage->publication = $message->getPublication();
         $myMessage->conversationId = $message->getConversationId();
         $myMessage->FAQ = $message->getFAQ();
         $myMessage->commonState = $message->getCommonState();
         $myMessage->subject = $message->getSubject();
         $myMessage->text = $message->getText();
         $myMessage->createDate = $message->getCreateDate();
         $myMessage->updateDate = $message->getUpdateDate();
         $status = 200;
         $return["result"] = "OK";
         $return["data"] = $myMessage;
     }
     $this->response($return, $status);
 }