Esempio n. 1
0
 public function eventsignoffAction()
 {
     try {
         $this->_helper->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         //_event_id, _operator_id,_item_id
         if (false === ($notify_id = $this->_getParam('param1', false))) {
             throw new Exception('Tampered URI');
         }
         $status = $_POST['status'];
         $comment = $_POST['comment'];
         $date = $_POST['date'];
         if (strpos($date, '/')) {
             //is in dd/mm/yyyy format
             $dateArr = explode('/', $date);
             //divide date
             $date = date("Y-m-d", strtotime($dateArr[1] . '/' . $dateArr[0] . '/' . $dateArr[2]));
             //set month first then day
         }
         $form = new Gyuser_Model_CRMTasks();
         $data = $form->signOffEvent($notify_id, $status, $comment);
         if ($status == 2) {
             $form->delayTheEvent($notify_id, $date);
         }
         if ($data) {
             $return['status'] = 'success';
             $return['html'] = $form->getEventAsHtml($notify_id);
         } else {
             $return['status'] = 'error';
             $return['message'] = 'Esta tarea ya fue realizada por otro operador. Por favor refresque la página para ver el estado actual de las tareas pendientes.';
         }
         echo json_encode($return);
     } catch (Exception $e) {
         echo $e;
     }
 }