index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. if (cfr('EXPORT')) {
  3. $export = new Export();
  4. //viewing channel export interface
  5. if (ubRouting::checkGet($export::ROUTE_CHANNEL)) {
  6. $channelId = ubRouting::get($export::ROUTE_CHANNEL, 'gigasafe');
  7. $acl = new ACL();
  8. if ($acl->isMyChannel(ubRouting::get($export::ROUTE_CHANNEL))) {
  9. //deleting record
  10. if (ubRouting::checkGet($export::ROUTE_DELETE)) {
  11. $deletionResult = $export->deleteRecording(ubRouting::get($export::ROUTE_DELETE));
  12. if (empty($deletionResult)) {
  13. ubRouting::nav($export::URL_ME . '&' . $export::ROUTE_CHANNEL . '=' . ubRouting::get($export::ROUTE_CHANNEL));
  14. } else {
  15. show_error($deletionResult);
  16. }
  17. }
  18. //show scheduling confirmation notification
  19. if (ubRouting::checkGet(array($export::ROUTE_SCHED_OK, $export::ROUTE_CHANNEL))) {
  20. show_window('', $export->renderExportScheduledNotify($channelId));
  21. }
  22. //run export if required
  23. if (ubRouting::checkPost(array($export::PROUTE_DATE_EXPORT, $export::PROUTE_TIME_FROM, $export::PROUTE_TIME_TO))) {
  24. $exportChannel = ubRouting::get($export::ROUTE_CHANNEL, 'gigasafe');
  25. $exportDate = ubRouting::post($export::PROUTE_DATE_EXPORT);
  26. $exportTimeFrom = ubRouting::post($export::PROUTE_TIME_FROM);
  27. $exportTimeTo = ubRouting::post($export::PROUTE_TIME_TO);
  28. $exportRequestResult = $export->requestExport($exportChannel, $exportDate, $exportTimeFrom, $exportTimeTo);
  29. if (!empty($exportRequestResult)) {
  30. show_error($exportRequestResult);
  31. } else {
  32. //redirect to success scheduling confirmation
  33. ubRouting::nav($export::URL_ME . '&' . $export::ROUTE_CHANNEL . '=' . $exportChannel . '&' . $export::ROUTE_SCHED_OK . '=true');
  34. }
  35. }
  36. //export interface here
  37. $channelName = $export->getCameraComment($channelId);
  38. show_window(__('Save records') . ': ' . $channelName, $export->renderExportLookup($channelId));
  39. //rendering schedule if not empty
  40. $exportSchedule = $export->renderScheduledExports();
  41. if ($exportSchedule) {
  42. show_window(__('Your scheduled records saving'), $exportSchedule);
  43. }
  44. //already saved records here
  45. show_window(__('Your saved records'), $export->renderAvailableRecords($channelId));
  46. } else {
  47. show_error(__('Access denied'));
  48. }
  49. }
  50. //rendering channels list
  51. if (!ubRouting::checkGet($export::ROUTE_CHANNEL)) {
  52. show_window(__('Save records'), $export->renderCamerasList());
  53. }
  54. } else {
  55. show_error(__('Access denied'));
  56. }