コード例 #1
0
 public function index_post()
 {
     //checkIsLoggedIn($this);
     $status = 404;
     $return["result"] = "NOOK";
     $arrOptions['publicationId'] = $this->post('publicationId') > 0 ? $this->post('publicationId') : 0;
     $arrOptions['user'] = $this->post('userId');
     $arrOptions['type'] = '2';
     $arrOptions['title'] = $this->post('title');
     $arrOptions['description'] = $this->post('description');
     $arrOptions['creationDate'] = "";
     $arrOptions['expirationDate'] = mdate("%Y/%m/%d %H:%i:%s", $this->post('expirationDate'));
     $arrOptions['category'] = $this->post('categoryId');
     $arrOptions['subcategory'] = $this->post('subcategoryId');
     $arrOptions['views'] = $this->post('views');
     $arrOptions['processState'] = $this->post('processStateId');
     $arrOptions['object'] = $this->post('objectId');
     $arrOptions['quantity'] = $this->post('quantity');
     $arrOptions['image'] = $this->post('image');
     $arrOptions['votes'] = $this->post('votes');
     $arrOptions['sponsors'] = $this->post('sponsors');
     $arrOptions['sponsorsn'] = $this->post('sponsorsn');
     $request = CI_Request::getDataFromArray($arrOptions);
     if ($request != NULL) {
         $arrInfo['user'] = $arrOptions['user'];
         $arrInfo['type'] = $arrOptions['type'];
         $arrInfo['image'] = $arrOptions['image'];
         $arrInfo['sponsors'] = $arrOptions['sponsors'];
         $arrInfo['sponsorsn'] = $arrOptions['sponsorsn'];
         $arrInfo['request'] = $request;
         $id = CI_Request::save($arrInfo);
         if ($id != NULL) {
             $status = 200;
             $return["result"] = "OK";
             $return["data"] = "";
             $return["publicationId"] = $id;
             $myRequest = CI_Request::getData($request);
             $return["data"] = $myRequest;
             if (!empty($arrOptions['sponsorsn'])) {
                 foreach ($arrOptions['sponsorsn'] as $key => $sponsor) {
                     $myMsj = "{$sponsor['label']} Han pedido que seas el padrino de http://localhost/ayudaresfacil/client/build/#/detalle-mi-pedido/{$id} Ingresa para saber mas :)";
                     sendTweet($myMsj);
                 }
             }
             if (!empty($arrOptions['sponsors'])) {
                 foreach ($arrOptions['sponsors'] as $key => $sponsor) {
                     $myMsj = "{$sponsor['label']} Han pedido que seas el padrino de http://localhost/ayudaresfacil/client/build/#/detalle-mi-pedido/{$id} Ingresa para saber mas :)";
                     sendTweet($myMsj);
                 }
             }
         }
     }
     $this->response($return, $status);
 }