public function processRemoveScheduleAction()
 {
     $weekday = (int) $this->_getParam('weekday') - 1;
     $scheduleDate = date('Y-m-d', strtotime($this->_getParam('scheduleDate')));
     $providerId = (int) $this->_getParam('providerId');
     $roomId = (int) $this->_getParam('roomId');
     $scheduleEventId = (int) $this->_getParam('id');
     $weekDates = ScheduleEvent::computeWeekDates($scheduleDate);
     $date = $weekDates['start'];
     if ($weekday > 0) {
         $date = date('Y-m-d', strtotime("+{$weekday} days", strtotime($date)));
     }
     if ($scheduleEventId > 0) {
         $scheduleEvent = new ScheduleEvent();
         $scheduleEvent->scheduleEventId = $scheduleEventId;
         $scheduleEvent->setPersistMode(WebVista_Model_ORM::DELETE);
         $scheduleEvent->persist();
     }
     $start = $date . ' 00:00:00';
     $end = $date . ' 23:59:59';
     $filters = array();
     $filters['providerId'] = $providerId;
     $filters['roomId'] = $roomId;
     $filters['start'] = $start;
     $filters['end'] = $end;
     $scheduleEventIterator = new ScheduleEventIterator(null, false);
     $scheduleEventIterator->setFilters($filters);
     $data = array();
     foreach ($scheduleEventIterator as $row) {
         $data[] = $this->_getEvent($row->scheduleEventId);
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
Ejemplo n.º 2
0
 public function processDeleteEventsAction()
 {
     $ids = $this->_getParam('id');
     $arrIds = explode(',', $ids);
     $scheduleEvent = new ScheduleEvent();
     foreach ($arrIds as $id) {
         $scheduleEvent->scheduleEventId = $id;
         $scheduleEvent->setPersistMode(WebVista_Model_ORM::DELETE);
         $scheduleEvent->persist();
     }
     $data = true;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
 public function processRemoveScheduleAction()
 {
     $weekday = (int) $this->_getParam('weekday') - 1;
     $scheduleDate = date('Y-m-d', strtotime($this->_getParam('scheduleDate')));
     $providerId = (int) $this->_getParam('providerId');
     $roomId = (int) $this->_getParam('roomId');
     $scheduleEventId = (int) $this->_getParam('id');
     $weekDates = ScheduleEvent::computeWeekDates($scheduleDate);
     $date = $weekDates['start'];
     if ($weekday > 0) {
         $date = date('Y-m-d', strtotime("+{$weekday} days", strtotime($date)));
     }
     if ($scheduleEventId > 0) {
         $scheduleEvent = new ScheduleEvent();
         $scheduleEvent->scheduleEventId = $scheduleEventId;
         $scheduleEvent->setPersistMode(WebVista_Model_ORM::DELETE);
         $scheduleEvent->persist();
     }
     $start = $date . ' 00:00:00';
     $end = $date . ' 23:59:59';
     $stmt = $this->_stmtScheduleEvents($providerId, $roomId, $start, $end);
     $data = array();
     while ($row = $stmt->fetch()) {
         $data[] = $this->_getEvent($row['scheduleEventId']);
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }