public function __construct()
 {
     parent::__construct();
     $tzName = $this->getRequestParameter('timeZone') === null ? \common_session_SessionManager::getSession()->getTimeZone() : $this->getRequestParameter('timeZone');
     $this->tz = new \DateTimeZone($tzName);
     $this->scheduleService = DeliveryScheduleService::singleton();
     $this->service = DeliveryAssemblyService::singleton();
     switch ($this->getRequestMethod()) {
         case "GET":
             $this->action = 'get';
             break;
         case "PUT":
             $this->action = 'update';
             break;
         case "POST":
             $this->action = 'create';
             break;
         case "DELETE":
             $this->action = 'deleteDelivery';
             break;
         default:
             $this->sendData(array('message' => 'Not found'), 404);
             exit;
     }
 }
 public function testGetErrors()
 {
     $service = DeliveryScheduleService::singleton();
     $start = new \DateTime();
     $end = new \DateTime();
     $end->modify('+1 day');
     //all fields are valid
     $params = array(TAO_DELIVERY_START_PROP => $start->getTimestamp(), TAO_DELIVERY_END_PROP => $end->getTimestamp(), RDFS_LABEL => 'Delivery name', TAO_DELIVERY_MAXEXEC_PROP => '3');
     $this->assertTrue(empty($service->getErrors($params)));
     //empty end date
     $params[TAO_DELIVERY_END_PROP] = '';
     $errors = $service->getErrors($params);
     $this->assertTrue(isset($errors[TAO_DELIVERY_END_PROP]));
     //all fields are invalid
     $params[TAO_DELIVERY_MAXEXEC_PROP] = 'str';
     $params[RDFS_LABEL] = '';
     $end->modify('-2 day');
     $params[TAO_DELIVERY_END_PROP] = $end->getTimestamp();
     $errors = $service->getErrors($params);
     $this->assertTrue(isset($errors[TAO_DELIVERY_MAXEXEC_PROP]));
     $this->assertTrue(isset($errors[RDFS_LABEL]));
     $this->assertTrue(isset($errors[TAO_DELIVERY_START_PROP]));
 }
 public function __construct()
 {
     parent::__construct();
     $this->scheduleService = DeliveryScheduleService::singleton();
     $this->testTakersService = DeliveryTestTakersService::singleton();
     switch ($this->getRequestMethod()) {
         case "GET":
             $this->action = 'get';
             break;
         case "PUT":
             $this->action = 'update';
             break;
         case "POST":
             $this->action = 'create';
             break;
         case "DELETE":
             $this->sendData(array('message' => 'Method is not implemented'), 501);
             exit;
         default:
             $this->sendData(array('message' => 'Not found'), 404);
             exit;
     }
 }
 public function timeZoneList()
 {
     $this->setData('timeZones', DeliveryScheduleService::singleton()->getTimeZones());
     $this->setView('timeZoneList.tpl');
 }