|
@@ -285,5 +285,42 @@ class OltReportController extends Controller
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function oltReportAction($oltServerId, $oltDeviceId) {
|
|
|
+
|
|
|
+ $em = $this->get('doctrine')->getManager();
|
|
|
+
|
|
|
+ $reports = $em->getRepository('StatsBundle:Report')->createQueryBuilder('r')
|
|
|
+ ->select('r')
|
|
|
+ ->where('r.deviceServer = :oltServerId')
|
|
|
+ ->andWhere('r.deviceId = :oltDeviceId')
|
|
|
+ ->andWhere('r.deviceType = :deviceType')
|
|
|
+ ->andWhere('r.created >= :created')
|
|
|
+ ->setParameter('oltServerId', $oltServerId)
|
|
|
+ ->setParameter('oltDeviceId', $oltDeviceId)
|
|
|
+ ->setParameter('deviceType', 'FTTHBundle\Entity\OLT')
|
|
|
+ ->setParameter('created', date("Y-m-d 00:00:00",strtotime("-5 days")))
|
|
|
+ ->orderBy('r.id', 'DESC')
|
|
|
+ ->getQuery()->getResult();
|
|
|
+
|
|
|
+ $results = array();
|
|
|
+ foreach($reports as $report) {
|
|
|
+ $row = array();
|
|
|
+ $row['type'] = $report->getReportType();
|
|
|
+ $row['time'] = $report->getCreated()->format('Y-m-d H:i:s');
|
|
|
+ $aux = json_decode($report->getExtraData(),true);
|
|
|
+ if(isset($aux['msg'])) {
|
|
|
+ $row['msg'] = $aux['msg'];
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $results[] = $row;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return $this->render('StatsBundle:Device:Report/reportList.html.twig', array(
|
|
|
+ 'results' => $results
|
|
|
+ ));
|
|
|
+ }
|
|
|
|
|
|
}
|