blob: a08077a22daa6bf896bb533bb699214ac39eed81 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::ADMIN);
4
5if (!security::checkParams("POST", [
6 ["id", security::PARAM_ISINT],
7 ["name", security::PARAM_NEMPTY],
8 ["begins", security::PARAM_ISDATE],
9 ["ends", security::PARAM_ISDATE]
10])) {
11 security::go((isset($_POST["id"]) ? "scheduletemplate.php?id=".(int)$_POST["id"]."msg=empty" : "scheduletemplates.php?msg=empty"));
12}
13
14$id = $_POST["id"];
15$name = $_POST["name"];
16$begins = $_POST["begins"];
17$ends = $_POST["ends"];
18
19$status = schedules::editTemplate($id, $name, $begins, $ends);
20switch ($status) {
21 case 0:
22 security::go("scheduletemplate.php?id=".(int)$id."&msg=modified");
23 break;
24
25 case 2:
26 security::go("scheduletemplate.php?id=".(int)$id."&msg=order");
27 break;
28
29 default:
30 security::go("scheduletemplate.php?id=".(int)$id."&msg=unexpected");
31}