Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

SensorsController.php 2.0KB

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