123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
-
- namespace App\Http\Controller;
-
- use App\Http\Business\SensorTypesBusiness;
- use Luticate\Utils\LuController;
- use App\Http\Business\SensorsBusiness;
- use App\Http\DBO\SensorsDbo;
- use Luticate\Utils\LuMultipleDbo;
-
- class SensorsController extends LuController {
- protected function getBusiness()
- {
- return new SensorsBusiness();
- }
-
- /**
- * Get all sensor types
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return LuMultipleDbo
- */
- public function getAllTypes($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return SensorTypesBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get all sensors, sorted by name
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return \Luticate\Utils\LuMultipleDbo
- */
- public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return SensorsBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get a sensor
- * @param $sensor_id int The sensor id
- * @return SensorsDbo
- */
- public function get($sensor_id)
- {
- return SensorsBusiness::getById($sensor_id);
- }
-
- /**
- * Add a new sensor
- * @param SensorsDbo $sensor The sensor
- * @return int
- */
- public function add(SensorsDbo $sensor)
- {
- return SensorsBusiness::add($sensor);
- }
-
- /**
- * Edit an existing sensor
- * @param SensorsDbo $sensor The sensor
- * @param $sensor_id int The sensor id
- * @return bool
- */
- public function edit(SensorsDbo $sensor, $sensor_id)
- {
- return SensorsBusiness::edit($sensor, $sensor_id);
- }
-
- /**
- * Delete an existing sensor
- * @param $sensor_id int The sensor id
- * @return bool
- */
- public function del($sensor_id)
- {
- return SensorsBusiness::deleteById($sensor_id);
- }
- }
|