1 | <?php |
2 | |
3 | require_once __DIR__ . "/../lib/php/ejecutaServicio.php"; |
4 | require_once __DIR__ . "/../lib/php/select.php"; |
5 | require_once __DIR__ . "/../lib/php/devuelveJson.php"; |
6 | require_once __DIR__ . "/Bd.php"; |
7 | require_once __DIR__ . "/TABLA_ROL.php"; |
8 | |
9 | ejecutaServicio(function () { |
10 | |
11 | $lista = select(pdo: Bd::pdo(), from: ROL, orderBy: ROL_ID); |
12 | |
13 | $render = ""; |
14 | foreach ($lista as $modelo) { |
15 | $id = htmlentities($modelo[ROL_ID]); |
16 | $descripcion = htmlentities($modelo[ROL_DESCRIPCION]); |
17 | $render .= |
18 | "<p> |
19 | <label style='display: flex'> |
20 | <input type='checkbox' name='rolIds[]' value='$id'> |
21 | <span> |
22 | <strong>$id</strong> |
23 | <br>$descripcion |
24 | </span> |
25 | </label> |
26 | </p>"; |
27 | } |
28 | |
29 | devuelveJson(["roles" => ["innerHTML" => $render]]); |
30 | }); |
31 | |