You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CamerasController.php 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace App\Http\Controller;
  3. use App\Http\Business\CameraTypesBusiness;
  4. use Luticate\Auth\DBO\LuticateUsersDbo;
  5. use Luticate\Utils\LuController;
  6. use App\Http\Business\CamerasBusiness;
  7. use App\Http\DBO\CamerasDbo;
  8. use Luticate\Utils\LuMultipleDbo;
  9. class CamerasController extends LuController {
  10. protected function getBusiness()
  11. {
  12. return new CamerasBusiness();
  13. }
  14. /**
  15. * Get all camera types
  16. * @param int $page The page number, 0 based
  17. * @param int $perPage The number of items per page
  18. * @param string $query The filter query
  19. * @return LuMultipleDbo
  20. */
  21. public function getAllTypes($page = 0, $perPage = PHP_INT_MAX, $query = "")
  22. {
  23. return CameraTypesBusiness::getAll($page, $perPage, $query);
  24. }
  25. /**
  26. * Get all cameras, sorted by name
  27. * @param int $page The page number, 0 based
  28. * @param int $perPage The number of items per page
  29. * @param string $query The filter query
  30. * @param $_user LuticateUsersDbo Injected parameter
  31. * @return LuMultipleDbo
  32. */
  33. public function getAll($_user, $page = 0, $perPage = PHP_INT_MAX, $query = "")
  34. {
  35. return CamerasBusiness::getAllLight($_user, $page, $perPage, $query);
  36. }
  37. /**
  38. * Get a camera
  39. * @param $camera_id int The camera id
  40. * @param $_user LuticateUsersDbo Injected parameter
  41. * @return CamerasDbo
  42. */
  43. public function get($_user, $camera_id)
  44. {
  45. return CamerasBusiness::getLight($_user, $camera_id);
  46. }
  47. /**
  48. * Add a new camera
  49. * @param CamerasDbo $camera The camera
  50. * @return int
  51. */
  52. public function add(CamerasDbo $camera)
  53. {
  54. return CamerasBusiness::add($camera);
  55. }
  56. /**
  57. * Edit an existing camera
  58. * @param CamerasDbo $camera The camera
  59. * @param $camera_id int The camera id
  60. * @return bool
  61. */
  62. public function edit(CamerasDbo $camera, $camera_id)
  63. {
  64. return CamerasBusiness::edit($camera, $camera_id);
  65. }
  66. /**
  67. * Delete an existing camera
  68. * @param $camera_id int The camera id
  69. * @return bool
  70. */
  71. public function del($camera_id)
  72. {
  73. return CamerasBusiness::deleteById($camera_id);
  74. }
  75. /**
  76. * Get an image from the camera
  77. * @param $camera_id int The camera id
  78. * @return mixed
  79. */
  80. public function getImage($camera_id)
  81. {
  82. return CamerasBusiness::getImage($camera_id);
  83. }
  84. }