Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/doeditscheduletemplate.php b/src/doeditscheduletemplate.php
new file mode 100644
index 0000000..a08077a
--- /dev/null
+++ b/src/doeditscheduletemplate.php
@@ -0,0 +1,31 @@
+<?php
+require_once("core.php");
+security::checkType(security::ADMIN);
+
+if (!security::checkParams("POST", [
+  ["id", security::PARAM_ISINT],
+  ["name", security::PARAM_NEMPTY],
+  ["begins", security::PARAM_ISDATE],
+  ["ends", security::PARAM_ISDATE]
+])) {
+  security::go((isset($_POST["id"]) ? "scheduletemplate.php?id=".(int)$_POST["id"]."msg=empty" : "scheduletemplates.php?msg=empty"));
+}
+
+$id = $_POST["id"];
+$name = $_POST["name"];
+$begins = $_POST["begins"];
+$ends = $_POST["ends"];
+
+$status = schedules::editTemplate($id, $name, $begins, $ends);
+switch ($status) {
+  case 0:
+  security::go("scheduletemplate.php?id=".(int)$id."&msg=modified");
+  break;
+
+  case 2:
+  security::go("scheduletemplate.php?id=".(int)$id."&msg=order");
+  break;
+
+  default:
+  security::go("scheduletemplate.php?id=".(int)$id."&msg=unexpected");
+}