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 1.8KB

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