blob: 0f127ba158734c7c02faa9a0b094bc453668f7bf [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once(__DIR__."/../core.php");
3security::checkType(security::ADMIN, security::METHOD_NOTFOUND);
4
5if (!security::checkParams("GET", [
6 ["workers", security::PARAM_ISARRAY]
7])) {
8 security::notFound();
9}
10?>
11
12<form action="docopytemplate.php" method="POST" autocomplete="off">
13 <h4 class="mdl-dialog__title">Copiar plantilla a trabajadores</h4>
14 <div class="mdl-dialog__content">
15 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
16 <select name="template" id="template" class="mdlext-selectfield__select" data-required>
17 <?php
18 $templates = schedules::getTemplates();
19 foreach ($templates as $t) {
20 echo '<option value="'.(int)$t["id"].'">'.security::htmlsafe($t["name"]).'</option>';
21 }
22 ?>
23 </select>
24 <label for="template" class="mdlext-selectfield__label">Plantilla</label>
25 </div>
26 <br>
27 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="active">
28 <input type="checkbox" id="active" name="active" value="1" class="mdl-switch__input">
29 <span class="mdl-switch__label">Activar horario</span>
30 </label>
31 <br><br>
32 <b>Copiar a:</b>
33 <div class="copyto">
34 <ul>
35 <?php
36 foreach ($_GET["workers"] as $workerid) {
37 $worker = workers::get($workerid);
38 if ($worker === false) {
39 die("Error: Uno de los trabajadores seleccionados ya no existe");
40 }
41
42 echo "<li><input type='hidden' name='workers[]' value='".(int)$worker["id"]."'> ".security::htmlsafe($worker["name"])." (".security::htmlsafe($worker["companyname"]).")</li>";
43 }
44 ?>
45 </ul>
46 </div>
47 </div>
48 <div class="mdl-dialog__actions">
49 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Copiar</button>
50 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
51 </div>
52</form>