Exemplo n.º 1
0
 public function getStudent($studentId)
 {
     $studentMod = new StudentModel();
     try {
         $student = $studentMod->getStudentWithStatus($studentId);
         // 			var_dump($students);
         if ($student === FALSE) {
             $ret['data']['student'] = null;
         } else {
             $ret['data']['student'] = DataConvertor::objectToArray($student);
         }
         $ret['result'] = "success";
         return $ret;
     } catch (SSSException $e) {
         return $e->getError();
     }
 }
Exemplo n.º 2
0
 public function exportObserveeLocationsByDate($userId, $date)
 {
     try {
         // 			print 1;
         $studMod = new StudentModel();
         $deviceReports = $studMod->getStudentLocationsByDate($userId, $date);
         if ($deviceReports === FALSE) {
             // 				print 2;
             return ErrorFactory::getError(ErrorFactory::ERR_RECORD_NOT_FOUND);
         } else {
             // 				print 3;
             $ret['result'] = 'success';
             $reportArray = DataConvertor::objectArrayToArray($deviceReports);
             $csvMgr = new CSVManager();
             // 				$filename = $csvMgr->genCSV("location", $reportArray);
             $filename = $csvMgr->genCSV("location" . $date . ".csv", $reportArray);
             $ret['result'] = 'success';
             $ret['data'] = $filename;
             return $ret;
         }
     } catch (SSSException $e) {
         return $e->getError();
     }
 }