function HTTP_POST()
 {
     $json = new paloSantoJSON();
     if (!isset($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/x-www-form-urlencoded') {
         header('HTTP/1.1 415 Unsupported Media Type');
         $json->set_status("ERROR");
         $json->set_error('Please POST standard URL encoding only');
         return $json->createJSON();
     }
     $pCore_Calendar = new core_Calendar();
     $startdate = isset($_POST["startdate"]) ? $_POST["startdate"] : NULL;
     $enddate = isset($_POST["enddate"]) ? $_POST["enddate"] : NULL;
     $subject = isset($_POST["subject"]) ? $_POST["subject"] : NULL;
     $description = isset($_POST["description"]) ? $_POST["description"] : NULL;
     $asterisk_call = isset($_POST["asterisk_call"]) ? $_POST["asterisk_call"] : NULL;
     $recording = isset($_POST["recording"]) ? $_POST["description"] : NULL;
     $call_to = isset($_POST["call_to"]) ? $_POST["call_to"] : NULL;
     $reminder_timer = isset($_POST["reminder_timer"]) ? $_POST["reminder_timer"] : NULL;
     $emails_notification = isset($_POST["emails_notification"]) ? $_POST["emails_notification"] : NULL;
     $color = isset($_POST["color"]) ? $_POST["color"] : NULL;
     $result = $pCore_Calendar->addCalendarEvent($startdate, $enddate, $subject, $description, $asterisk_call, $recording, $call_to, $reminder_timer, $emails_notification, $color, TRUE);
     if ($result !== FALSE) {
         Header('HTTP/1.1 201 Created');
         Header('Location: /rest.php/calendar/CalendarEvent/' . $result);
     } else {
         $error = $pCore_Calendar->getError();
         if ($error["fc"] == "DBERROR") {
             header("HTTP/1.1 500 Internal Server Error");
         } else {
             header("HTTP/1.1 400 Bad Request");
         }
         $json->set_status("ERROR");
         $json->set_error($error);
         return $json->createJSON();
     }
 }
Ejemplo n.º 2
0
 /**
  * Function that implements the SOAP call to add a new one-time event in the calendar of the registered user. If an
  * error exists a SOAP fault is thrown
  * 
  * @param mixed request:
  *                  startdate:           (datetime) Starting date and time of event
  *                  enddate:             (datetime) Ending date and time of event
  *                  subject:             (string)   Subject of event
  *                  description:         (string) Long description of event
  *                  asterisk_call:       (bool) TRUE if must be generated reminder call
  *                  recording:           (string,optional) Name of the recording used to call. It is required if asterisk_call
  *                                                         is TRUE The file must exist in the recording directory for the
  *                                                         extension associated with the user.
  *                  call_to:             (string,optional) Extension to which call for Reminder. If omitted, assume the associated 
  *                                                         extension registered user. Not applicable unless asterisk_call is TRUE.
  *                  reminder_timer:      (string,optional) Number of minutes before which will make the call reminder. Applies if 
  *                                                         Asterisk_call is TRUE. By default it is assumed 0. Normal values ​​are 
  *                                                         10/30/60 minutes.
  *                  emails_notification: (array(string)) Zero or more emails will be notified with a message when creating the 
  *                                                       event.
  *                  color:               (string,optional) Color for the event
  * @return mixed    Array with boolean data, true if was successful or false if an error exists
  */
 public function addCalendarEvent($request)
 {
     $return = parent::addCalendarEvent($request->startdate, $request->enddate, $request->subject, $request->description, $request->asterisk_call, $request->recording, $request->call_to, $request->reminder_time, $request->emails_notification, $request->color);
     if (!$return) {
         $eMSG = parent::getError();
         $this->objSOAPServer->fault($eMSG['fc'], $eMSG['fm'], $eMSG['cn'], $eMSG['fd'], 'fault');
     }
     return array("return" => $return);
 }