public function load()
 {
     $deviceId = $_REQUEST['device_id'];
     $devicesManager = DevicesManager::getInstance();
     $deviceDto = $devicesManager->selectByPK($deviceId);
     $this->addParam('deviceDto', $deviceDto);
 }
Exemplo n.º 2
0
 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new DevicesManager();
     }
     return self::$instance;
 }
Exemplo n.º 3
0
 public function load()
 {
     $devicesManager = DevicesManager::getInstance();
     $devicesDtos = $devicesManager->selectAll();
     $devices = array();
     foreach ($devicesDtos as $deviceDto) {
         $devices[] = $devicesManager->convertToDeviceObject($deviceDto);
     }
     $this->addParam('devices', $devices);
 }
 public function service()
 {
     $devicesManager = DevicesManager::getInstance();
     $devicesDtos = $devicesManager->selectAll();
     $devices = array();
     foreach ($devicesDtos as $deviceDto) {
         $devices[] = $devicesManager->convertToDeviceObject($deviceDto);
     }
     $this->ok(array('devices' => $devices));
 }
Exemplo n.º 5
0
 public function service()
 {
     list($serialNumber, $deviceTitle, $amd100Qty, $amd200Qty, $amd500Qty, $server_ping_url, $not_working, $server_host) = $this->validateFields();
     $devicesManager = DevicesManager::getInstance();
     $devicesManager->updateDeviceParameters($serialNumber, $deviceTitle, $amd100Qty, $amd200Qty, $amd500Qty, $server_ping_url, $not_working, $server_host);
     $deviceDto = $devicesManager->getBySerialNumber($serialNumber);
     $deviceId = $deviceDto->getId();
     $devicePendingActionsManager = DevicePendingActionsManager::getInstance();
     $deviceNotSentActionObjects = $devicePendingActionsManager->getDeviceNotSentActionObjects($deviceId);
     $devicePendingActionsManager->setDeviceNotSentActionsAsSent($deviceId);
     $this->ok(array('actions' => $deviceNotSentActionObjects));
 }
 public function service()
 {
     $devicesManager = DevicesManager::getInstance();
     $carwashDevicesManager = CarwashDevicesManager::getInstance();
     $carwashDeviceDtos = $carwashDevicesManager->selectByField('carwash_id', $this->getUserId());
     $deviceIds = array();
     foreach ($carwashDeviceDtos as $carwashDeviceDto) {
         $deviceId = $carwashDeviceDto->getDeviceId();
         $deviceIds[] = $deviceId;
     }
     $devicesDtos = $devicesManager->selectByPKs($deviceIds);
     $devices = array();
     foreach ($devicesDtos as $deviceDto) {
         $devices[] = $devicesManager->convertToDeviceObject($deviceDto);
     }
     $this->ok(array('devices' => $devices));
 }
Exemplo n.º 7
0
 public function load()
 {
     $carwashManager = CarwashManager::getInstance();
     $devicesManager = DevicesManager::getInstance();
     $devicesDtos = $devicesManager->selectAll();
     $devicesDtosMappedById = $devicesManager->mapDtosById($devicesDtos);
     $carwashDevicesManager = CarwashDevicesManager::getInstance();
     $carwashDtos = $carwashManager->selectAll();
     $this->addParam('carwashDtos', $carwashDtos);
     $carwashDeviceIdsArray = array();
     foreach ($carwashDtos as $carwashDto) {
         $carwashId = $carwashDto->getId();
         $carwashDeviceIdsArray[$carwashId] = $carwashDevicesManager->getCarwashDevicesIdsArray($carwashId);
     }
     $this->addParam("carwashDeviceIdsArray", $carwashDeviceIdsArray);
     $this->addParam("allDevicesMappedById", $devicesDtosMappedById);
 }
 public function service()
 {
     $deviceId = intval($_REQUEST['device_id']);
     $devicesManager = DevicesManager::getInstance();
     $deviceDto = $devicesManager->selectByPK($deviceId);
     if (isset($deviceDto)) {
         $deviceCounterHistoryManager = DeviceCounterHistoryManager::getInstance();
         $devicePendingActionsManager = DevicePendingActionsManager::getInstance();
         $jasonAction = new stdClass();
         $jasonAction->action = "reset_counter";
         $devicePendingActionsManager->addDeviceAction($deviceId, json_encode($jasonAction));
         $deviceCounterHistoryManager->addRow($deviceId, $deviceDto->getAmd100Qty(), $deviceDto->getAmd200Qty(), $deviceDto->getAmd500Qty());
         $devicesManager->resetDeviceCounter($deviceId);
         $this->ok();
     }
     $this->error();
 }
 public function load()
 {
     $devicesManager = DevicesManager::getInstance();
     $carwashDevicesManager = CarwashDevicesManager::getInstance();
     $carwashDeviceDtos = $carwashDevicesManager->selectByField('carwash_id', $this->getUserId());
     $deviceIds = array();
     foreach ($carwashDeviceDtos as $carwashDeviceDto) {
         $deviceId = $carwashDeviceDto->getDeviceId();
         $deviceIds[] = $deviceId;
     }
     $devicesDtos = $devicesManager->selectByPKs($deviceIds);
     $this->addParam('devicesDtos', $devicesDtos);
     $selectedDeviceId = 0;
     if (isset($this->args[0])) {
         $selectedDeviceId = intval($this->args[0]);
         $selectedDevicesDto = $devicesManager->selectByPK($selectedDeviceId);
         $this->addParam("selectedDeviceDto", $selectedDevicesDto);
         $deviceCounterHistoryManager = DeviceCounterHistoryManager::getInstance();
         $deviceCounterHistory = $deviceCounterHistoryManager->selectByField('device_id', $selectedDeviceId, "datetime", false);
         $this->addParam('deviceCounterHistory', $deviceCounterHistory);
     }
 }