diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-03-02 13:52:58 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-05-19 18:15:30 +0200 |
commit | 319ce41906376b9ef811101eba559a9934674aae (patch) | |
tree | 550813c35cdfebada1d0729c97388251f9dedcd8 | |
parent | 4f16ab67d2742acf41d3793e4b47bf9ee322775e (diff) |
#942 Implement update schedule (web)
-rw-r--r-- | admin/WebConsole/gestores/gestor_programaciones.php | 11 | ||||
-rw-r--r-- | admin/WebConsole/includes/restfunctions.php | 21 |
2 files changed, 28 insertions, 4 deletions
diff --git a/admin/WebConsole/gestores/gestor_programaciones.php b/admin/WebConsole/gestores/gestor_programaciones.php index 4df4d2ce..2edbe373 100644 --- a/admin/WebConsole/gestores/gestor_programaciones.php +++ b/admin/WebConsole/gestores/gestor_programaciones.php @@ -81,19 +81,22 @@ if($pswop!=$op_suspension){ $result; $idr=$pidprogramacion; switch($pswop){ - case $op_modificacion : - $swop=$op_modificacion; - break; case $op_alta: $result = create_schedule($pidentificador, $pnombrebloque, $pannos, $pmeses, $pdiario, $phoras, $pampm, $pminutos); $swop=$op_alta; break; - case $op_eliminacion : + case $op_eliminacion: $result = delete_schedule($pidprogramacion); $swop=$op_eliminacion; break; + case $op_modificacion: + $result = update_schedule($pidprogramacion, + $pidentificador, $pnombrebloque, $pannos, + $pmeses, $pdiario, $phoras, $pampm, $pminutos); + $swop = $op_modificacion; + break; default: break; } diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index adf09b2e..b6729345 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -29,6 +29,7 @@ define('OG_REST_CMD_RUN_SCHEDULE', 'run/schedule'); define('OG_REST_CMD_RUN_TASK', 'task/run'); define('OG_REST_CMD_CREATE_SCHEDULE', 'schedule/create'); define('OG_REST_CMD_DELETE_SCHEDULE', 'schedule/delete'); +define('OG_REST_CMD_UPDATE_SCHEDULE', 'schedule/update'); define('OG_REST_PARAM_CLIENTS', 'clients'); define('OG_REST_PARAM_ADDR', 'addr'); @@ -597,6 +598,26 @@ function delete_schedule($schedule_id) { return common_request(OG_REST_CMD_DELETE_SCHEDULE, POST, $data); } +function update_schedule($schedule_id, $task_id, $name, $years, $months, $days, + $hours, $am_pm, $minutes) { + + $data = array ( + OG_REST_PARAM_ID => $schedule_id, + OG_REST_PARAM_TASK => $task_id, + OG_REST_PARAM_NAME => $name, + OG_REST_PARAM_TIME_PARAMS => array ( + OG_REST_PARAM_YEARS => intval($years), + OG_REST_PARAM_MONTHS => intval($months), + OG_REST_PARAM_DAYS => intval($days), + OG_REST_PARAM_HOURS => intval($hours), + OG_REST_PARAM_AM_PM => intval($am_pm), + OG_REST_PARAM_MINUTES => intval($minutes) + ) + ); + + return common_request(OG_REST_CMD_UPDATE_SCHEDULE, POST, $data); +} + /* * @function multiRequest. * @param URLs array (may include header and POST data), cURL options array. |