Example #1
0
         $movement = $params['movement'];
         $dt = $params['datetime'];
         $report = new DeviceReport();
         $p = new Position();
         $p->setAtt($pos['att']);
         $p->setLat($pos['lat']);
         $p->setLng($pos['lng']);
         $p->setDateTime($pos['dt']);
         $p->setAccuracy($pos['acy']);
         // 			$p->setEnable($pos['gpsStatus']);
         // 			var_dump($p);
         $report->setUserId($params['id']);
         $report->setPosition($p);
         $report->setBatt($batt);
         $report->setSignal($signal);
         $report->setMovement($movement);
         $report->setDateTime($dt);
         $report->setGPS($pos['gpsStatus']);
         // 			var_dump($report);
         // 			var_dump($report->getPosition());
         $ctr = new ClientController();
         $result = $ctr->regularReport($report);
     }
     break;
 case "submitPanic":
     $ctr = new ClientController();
     if (validate_input_param($params, array('userId'))) {
         try {
             $result = $ctr->submitPanic($params['userId']);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
Example #2
0
 /**
  * Get location by date
  * @param unknown $userId
  * @param unknown $date
  * @throws SSSException
  * @return array
  */
 public function getLocationsByDate($userId, $date)
 {
     $sp = "sp_student_location_getByDate";
     $params = new SDMDBParameters();
     $params->add($userId);
     $params->add($date);
     // 		var_dump($params);
     $result = $this->handler->execute_stored_procedure($sp, $params, 'array');
     $ret = false;
     // 				var_dump($result);
     if ($result && $result['response']['system']['errorNo'] == 0) {
         if (isset($result['response']['resultSet'])) {
             $deviceReports = array();
             foreach ($result['response']['resultSet'] as $dataRow) {
                 // 					$student = new Student();
                 // 					$student->setClassId($dataRow['class_id']);
                 // 					$student->setId($dataRow['user_id']);
                 // 					$student->setName($dataRow['login_name']);
                 // 					$student->setStudentId($dataRow['student_id']);
                 // 					$device = new Device();
                 // 					$device->setWifiMacAddress($dataRow['wifi_address']);
                 $position = new Position();
                 $position->setAccuracy($dataRow['gps_accuracy']);
                 $position->setAtt($dataRow['altitude']);
                 $position->setDateTime($dataRow['gps_Dt']);
                 // 					$position->setEnable($dataRow['gps_accuracy']);
                 $position->setLat($dataRow['latitude']);
                 $position->setLng($dataRow['longitude']);
                 // 					$position->setPlace($dataRow['gps_accuracy']);
                 $deviceReport = new DeviceReport();
                 $deviceReport->setBatt($dataRow['battery_status']);
                 $deviceReport->setDateTime($dataRow['report_dt']);
                 $deviceReport->setSignal($dataRow['network_coverage_status']);
                 $deviceReport->setMovement($dataRow['movement_status']);
                 $deviceReport->setUserId($dataRow['user_id']);
                 $deviceReport->setId($dataRow['report_id']);
                 $deviceReport->setGPS($dataRow['gps_status']);
                 $deviceReport->setPlaceStatus($dataRow['place_status']);
                 $deviceReport->setPosition($position);
                 // 					$student->setDevice($device);
                 // 					$student->setReport($deviceReport);
                 array_push($deviceReports, $deviceReport);
             }
             // 				var_dump($students);
             return $deviceReports;
         } else {
             $ret = false;
         }
     } else {
         throw new SSSException(ErrorFactory::ERR_DB_EXECUTE);
     }
     return $ret;
 }