예제 #1
0
 /**
  * Action Reschedule
  * Used for drag & drop
  */
 protected function action_reschedule()
 {
     $this->view = 'json';
     $commit = true;
     if (!$this->retrieveCurrentBean('Save')) {
         return;
     }
     $_REQUEST['parent_name'] = $this->currentBean->parent_name;
     $dateField = "date_start";
     if ($this->currentBean->module_dir == "Tasks") {
         $dateField = "date_due";
     }
     if (!empty($_REQUEST['calendar_style']) && $_REQUEST['calendar_style'] == "basic") {
         list($tmp, $time) = explode(" ", $this->currentBean->{$dateField});
         list($date, $tmp) = explode(" ", $_REQUEST['datetime']);
         $_REQUEST['datetime'] = $date . " " . $time;
     }
     $_POST[$dateField] = $_REQUEST['datetime'];
     if ($this->currentBean->module_dir == "Tasks" && !empty($this->currentBean->date_start)) {
         if ($GLOBALS['timedate']->fromUser($_POST['date_due'])->ts < $GLOBALS['timedate']->fromUser($this->currentBean->date_start)->ts) {
             $this->view_object_map['jsonData'] = array('access' => 'no', 'errorMessage' => $GLOBALS['mod_strings']['LBL_DATE_END_ERROR']);
             $commit = false;
         }
     }
     if ($commit) {
         require_once 'include/formbase.php';
         $this->currentBean = populateFromPost("", $this->currentBean);
         $this->currentBean->save();
         $this->currentBean->retrieve($_REQUEST['record']);
         $this->view_object_map['jsonData'] = CalendarUtils::get_sendback_array($this->currentBean);
     }
 }