Current Path : /data/web/virtuals/51568/virtual/www/subdom/agenda/php/zapisy/ |
Current File : /data/web/virtuals/51568/virtual/www/subdom/agenda/php/zapisy/Jednani.php |
<?php //session_start(); if (!$_SESSION["account"]){ header("location:../../login.php"); } require_once ("../DB.php"); require_once ("../Mailer.php"); class Jednani { private $db; private $ucitelId; public function __construct($id){ $this->db = new DB(); $this->ucitelId = $id; } public function mojeJednani(){ $vrsek = <<<HTML <div id="divProModal"></div> <h4 class="border border-secondary mt-2 p-2">Deník pedagoga</h4> <div id="jednani-top" class="mt-2 d-flex"> <button class="btn btn-outline-primary rounded-0 ms-auto" id="button-jednani-nove" onclick="jednaniNove()">Nová položka deníku</button> </div> <div class="cara w-100 mt-2"></div> HTML; $jednani = $this->db->fetchOne("SELECT count(`id`) as pocet FROM `jednani` WHERE `zapsalid` = :id", $this->ucitelId); if ($jednani->pocet == 0){ $html = <<<HTML $vrsek <div class="alert alert-info h5 border-0 mt-3"> Nemáš žádný zápis v deníku. </div> HTML; return $html; } $sql = "SELECT `id`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `datum` FROM `jednani` WHERE `zapsalid` = :zapsalid order by `datum` desc"; $mojeJednani = $this->db->fetchAll($sql, $this->ucitelId); $html = <<<HTML $vrsek <div class="scroll-container-vysoky"> <table class="table mt-3"> <thead> <tr class="fw-bold"> <td>žák</td> <td class="text-center">datum</td> <td class="width50">detail</td> </tr> </thead> HTML; forEach($mojeJednani as $jednani){ $zak = $jednani->zak_prijmeni.' '.$jednani->zak_jmeno.' ('.$jednani->zak_trida.')'; $datum = date( 'd.m.Y H:i', strtotime($jednani->datum)); $html .= <<<HTML <tr id="jednaniRadek{$jednani->id}"> <td>$zak</td> <td class="text-center">$datum</td> <td class="text-center pointer" onclick="jednaniEdituj($jednani->id)"><i class="fas fa-edit text-primary"></i></td> </tr> HTML; } $html .= <<<HTML </table> </div> HTML; return $html; } private function jednaniDuvody($idjednani){ $html = <<<HTML <div style="position: relative; top: -18px;"> HTML; $duvody = $this->db->fetchAll("select `jednani_duvody`.`id` as idduvod, `jednani_duvody`.`duvod`, `jednani_dovody_zapisy`.`popis`, `jednani_dovody_zapisy`.`id` as idzapis from `jednani_duvody` left join `jednani_dovody_zapisy` on `jednani_dovody_zapisy`.`idduvod` =`jednani_duvody`.`id` and `jednani_dovody_zapisy`.`idjednani`= :idjednani where `jednani_duvody`.`aktivni` = '1' order by `jednani_duvody`.`duvod`", $idjednani); $poradi = 0; forEach($duvody as $duvod){ $poradi++; $margin = ($poradi > 1) ? 'style="margin-top: 6px;"' : ''; $html .= <<<HTML <label for="idDuvod{$duvod->idduvod}" $margin>{$duvod->duvod}</label> <textarea class="form-control rounded-0" rows="2" name="duvod" id="idDuvod{$duvod->idduvod}">{$duvod->popis}</textarea> HTML; } $html .= <<<HTML </div> HTML; return $html; } private function tableDalsiUcastnici($idjednani){ $ucastnici = $this->db->fetchAll("SELECT `id`, `osoba` FROM `jednani_osoby` WHERE `idjednani` = :idjednani ORDER BY `osoba`", $idjednani); if ($ucastnici){ $html = <<<HTML <table class="table table-sm mt-2"> <thead> <tr class="fw-bold border-top border-dark"> <td>účastník</td> <td class="width50">smazat</td> <td class="width50">edit</td> </tr> </thead> HTML; forEach($ucastnici as $ucastnik){ $html .= <<<HTML <tr id="dalsi-ucastnik{$ucastnik->id}"> <td id="jednani-osoba{$ucastnik->id}">$ucastnik->osoba</td> <td class="text-center pointer" onclick="smazatUcastnikaJednani($ucastnik->id)"><i class="far fa-trash-alt text-danger"></i></td> <td class="text-center pointer" onclick="editovatUcastnikaJednani('$idjednani', '$ucastnik->id', '$ucastnik->osoba')"><i class="fas fa-edit text-primary"></i></td> </tr> <tr id="dotaz-smazat-dalsiho-ucastnika{$ucastnik->id}" class="d-none"> <td colspan="3"> <div class="d-flex alert alert-danger py-1 rounded-0"> <div class="flex-grow-1 me-1 pt-2">Chceš smazat ?</div> <button class="btn btn-primary rounded-0 me-1" onclick="smazatUcastnikaJednaniCancel($ucastnik->id)">Nemazat</button> <button class="btn btn-danger rounded-0 " onclick="smazatUcastnikaJednaniSmazat('$ucastnik->id', '$idjednani')">Smazat</button> </div> </td> </tr> HTML; } $html .= <<<HTML </table> HTML; } else { $html = <<<HTML <div class="h5 mt-3">Žádný další účastník.</div> HTML; } return $html; } public function dalsiUcastnici($idjednani){ $pocet = $this->db->fetchOne("select count(*) as pocet from jednani_osoby where idjednani = :idjednani", $idjednani)->pocet; if ($pocet){ $novyDisplay = "d-none"; $btnNovyUcastnikDisplay = ""; } else { $novyDisplay = ''; $btnNovyUcastnikDisplay = 'd-none'; } $novy = <<<HTML <div id="ucastnik-novy" class="shadow border border-secondary p-2 my-2 $novyDisplay"> <label class="mb-1">Nový další účastník jednání</label> <div class="d-flex"> <input type="text" id="ucastnik-novy-jmeno" value="" class="flex-grow-1 me-1" placeholder="sem zapiš jméno dalšího účastníka případně i s určením, o koho se jedná"> <button class="btn btn-outline-warning rounded-0 me-1" onclick="ucastnikJednaniNovyCancel()"><i class="fas fa-undo"></i></button> <button class="btn btn-outline-success rounded-0" onclick="ucastnikJednaniNovyUloz($idjednani)"><i class="far fa-save"></i></button> </div> </div> <div id="ucastnik-novy-error" class="my-2 w-100 alert alert-danger d-none py-1 rounded-0">chybí jméno dalšího účastníka</div> HTML; $tblDalsi = $this->tableDalsiUcastnici($idjednani); $html = <<<HTML <div class="d-flex mt-1"> <button id="btn-novy-ucastnik-jednani" class="btn btn-outline-primary ms-auto rounded-0 $btnNovyUcastnikDisplay" onclick="jednaniNovyUcastnik()">Přidat dalšího účastníka jednání</button> </div> $novy <div id="tbl-dalsi-ucastnici-seznam"> $tblDalsi </div> HTML; return $html; } public function dalsiUcastnikUloz($data){ $this->db->query("INSERT INTO `jednani_osoby`(`idjednani`, `osoba`) VALUES (:idjednani, :osoba)", $data->idjednani, $data->osoba); return $this->dalsiUcastnici($data->idjednani); } public function editovatUcastnikaUloz($data){ $this->db->query("UPDATE `jednani_osoby` SET `osoba` = :osoba WHERE id = :id", $data->osoba, $data->iducastnik); } public function smazatUcastnikaJednaniSmazat($data){ $this->db->query("DELETE FROM `jednani_osoby` WHERE `jednani_osoby`.`id`=:id", $data->iducastnik); return $this->tableDalsiUcastnici($data->idjednani); } public function jednaniNoveDialog(){ $html = <<<HTML <div id="dlgJednaniNove" class="modal fade" data-backdrop="static" tabindex="-1"> <div class="modal-dialog modal-lg modal-dialog-centered"> <div class="modal-content "> <div class="modal-header bg-success text-white"> <h5 class="modal-title">Nové jednání</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="form-group row align-items-top"> <label class="col-sm-3 col-form-label pt-0"><strong>Žák</strong></label> <div class="col-sm-9"> <div class="row "> <div class="col-md-5 mb-3"> <label for="idPrijmeni">Příjmení</label> <input type="text" class="form-control" name="prijmeni" id="idPrijmeni" required value=""> </div> <div class="col-md-5 mb-3"> <label for="idJmeno">Jméno</label> <input type="text" class="form-control" name="jmeno" id="idJmeno" required value=""> </div> <div class="col-md-2 mb-3"> <label for="idTrida">Třída</label> <input type="text" class="form-control" name="trida" id="idTrida" required value=""> </div> </div> </div> </div> <div class="form-group row mt-4"> <label class="col-sm-3 col-form-label ">Datum a čas jednání</label> <div class="col-sm-9" style="max-width: 250px"> <input type="datetime-local" class="form-control rounded-0" name="datum" id="idDatum" value="$jednani->datum"> </div> </div> </div> <div class="modal-footer d-flex"> <div id="jednaniMsg" class="flex-grow-1 me-2"></div> <button id="btnZalozit" class="btn btn-success ml-auto" onclick="jednaniZalozit()" name="btnZalozit">Založit <i class="far fa-file-alt"></i> </button> </div> </div> </div> </div> HTML; return $html; } public function jednaniDetail($idjednani){ if ($idjednani < 1){ $nadpis = "Nová položka deníku"; $bgcolor = "bg-success"; $jednani = new stdClass(); $jednani->typjednani = '000'; $jednani->zz_jmeno = ''; $jednani->zz_prijmeni = ''; $jednani->zak_jmeno = ''; $jednani->zak_prijmeni = ''; $jednani->zak_trida = ''; $jednani->typjednani_jinak = ''; $jednani->datum = ''; $jednani->forma = 0; $jednani->forma_jinak = ''; $jednani->reseni = ''; $script = ""; $dNoneDalsiUcastnici = "d-none"; $dNoneTblDalsiUcastnici = "d-none"; } else { $nadpis = "Detail položky deníku"; $bgcolor = "bg-primary"; $sql = "SELECT `typjednani`, `zz_jmeno`, `zz_prijmeni`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `typjednani_jinak`, `datum`, `forma`, `forma_jinak`, `reseni` FROM `jednani` WHERE `id` = :idjednani"; $jednani = $this->db->fetchOne($sql, $idjednani); $script = '<script> $(":input").on("keyup", function () { $("#zmena").removeClass("d-none");}); $(":input").on("change", function () { $("#zmena").removeClass("d-none");}); </script>'; $pocetDalsiUcastnici = $this->db->fetchOne("select count(*) as pocet from jednani_osoby where idjednani = :idjednani", $idjednani)->pocet; $dNoneDalsiUcastnici = ($pocetDalsiUcastnici > 0) ? "d-none" : ""; $dNoneTblDalsiUcastnici = ($pocetDalsiUcastnici > 0) ? "" : "d-none"; $dalsiUcastnici = $this->dalsiUcastnici($idjednani); } $skym0 = ($jednani->typjednani[0] == '1') ? "checked" : ""; if ($jednani->typjednani[1] == '1') { $skym1 = "checked" ; $skym1DNone = ""; } else { $skym1 = ""; $skym1DNone = "d-none"; } if ($jednani->typjednani[2] == '1') { $skym2 = "checked" ; $skym2DNone = ""; } else { $skym2 = ""; $skym2DNone = "d-none"; } $forma0 = ($jednani->forma == 0) ? "checked" : ""; $forma1 = ($jednani->forma == 1) ? "checked" : ""; $forma2 = ($jednani->forma == 2) ? "checked" : ""; $forma3 = ($jednani->forma == 3) ? "checked" : ""; $duvody = $this->jednaniDuvody($idjednani); $html = <<<HTML <div class="card shadow"> <div class="card-header $bgcolor text-white rounded-0 "> <div class="d-flex"> <div class="h4 mt-1"> $nadpis</div> <div id="zmena" class="alert alert-danger my-0 font-weight-bold text-danger d-none ms-auto rounded-0" style="padding: 6px 12px">ZMĚNA</div> </div> </div> <div class="card-body rounded-0 "> <div class="form-group row align-items-top"> <label class="col-sm-3 col-form-label pt-0"><strong>Žák</strong></label> <div class="col-sm-9"> <div class="row "> <div class="col-md-5 mb-3"> <label for="idPrijmeni">Příjmení</label> <input type="text" class="form-control" name="prijmeni" id="idPrijmeni" required value="$jednani->zak_prijmeni"> </div> <div class="col-md-5 mb-3"> <label for="idJmeno">Jméno</label> <input type="text" class="form-control" name="jmeno" id="idJmeno" required value="$jednani->zak_jmeno "> </div> <div class="col-md-2 mb-3"> <label for="idTrida">Třída</label> <input type="text" class="form-control" name="trida" id="idTrida" required value="$jednani->zak_trida"> </div> </div> </div> </div> <div class="border border-dark mt-3 p-2"> <div class="form-group row"> <label class="col-sm-3 col-form-label pt-0 fw-bold">Přítomni u jednání</label> <div class="col-sm-9 d-flex justify-content-between"> <div class=""> <input class="form-check-input" type="checkbox" name="rgskym" id="skym0" value="0" onclick="rgSkymChange()" $skym0> <label class="custom-control-label" for="skym0">žák</label> </div> <div class=""> <input class="form-check-input" type="checkbox" name="rgskym" id="skym1" value="1" onclick="rgSkymChange()" $skym1> <label class="custom-control-label" for="skym1">zákonný zástupce</label> </div> <div class=""> <input class="form-check-input" type="checkbox" name="rgskym" id="skym2" value="2" onclick="rgSkymChange()" $skym2> <label class="custom-control-label" for="skym2">jiný subjekt</label> </div> </div> </div> <div class="form-group row align-items-top mt-2 $skym1DNone" id="kdoPopis1"> <label class="col-sm-3 col-form-label pt-0">Zákonný zástupce</label> <div class="col-sm-9"> <div class="row "> <div class="col-md-6 mb-3"> <label for="idPrijmeniZZ">Příjmení</label> <input type="text" class="form-control" name="prijmeniZZ" id="idPrijmeniZZ" value="$jednani->zz_prijmeni"> </div> <div class="col-md-6 mb-3"> <label for="idJmenoZZ">Jméno</label> <input type="text" class="form-control" name="jmenoZZ" id="idJmenoZZ" value="$jednani->zz_jmeno"> </div> </div> </div> </div> <div class="form-group row mt-2 $skym2DNone" id="kdoPopis2"> <label class="col-sm-3 col-form-label ">Jiný subjekt</label> <div class="col-sm-9"> <input type="text" class="form-control" name="jinaIdentifikace" id="idJinaIdentifikace" placeholder="jméno firmy nebo jiná identifikace" value="$jednani->typjednani_jinak"> </div> </div> </div> <div id="btn-dalsi-ucastnici" class="d-flex {$dNoneDalsiUcastnici}"> <button class="btn btn-success ms-auto mt-1 rounded-0" onclick="jednaniDalsiUcastnici($idjednani)">Další účastníci</button> </div> <div id="tbl-dalsi-ucastnici" class="$dNoneTblDalsiUcastnici border border-dark mt-1 p-2 rounded-0"> $dalsiUcastnici </div> <div class="form-group row mt-4"> <label class="col-sm-3 col-form-label pt-0">Forma jednání</label> <div class="col-sm-9 d-flex justify-content-between"> <div class=""> <input class="form-check-input" type="radio" name="rgforma" id="forma0" value="0" checked onclick="rgFormaChange(0)" $forma0> <label class="form-check-label" for="forma0">osobně</label> </div> <div class=""> <input class="form-check-input" type="radio" name="rgforma" id="forma1" value="1" onclick="rgFormaChange(1)" $forma1> <label class="form-check-label" for="forma1">telefonicky</label> </div> <div class=""> <input class="form-check-input" type="radio" name="rgforma" id="forma2" value="2" onclick="rgFormaChange(2)" $forma2> <label class="form-check-label" for="forma2">e-mailem</label> </div> <div class=""> <input class="form-check-input" type="radio" name="rgforma" id="forma3" value="3" onclick="rgFormaChange(3)" $forma3> <label class="form-check-label" for="forma3">jiná forma</label> </div> </div> <div class="form-group row d-none" id="jinakForma3"> <label class="col-sm-3 col-form-label ">Jiná forma jednání</label> <div class="col-sm-9"> <input type="text" class="form-control" name="jinakForma" id="idJinakForma" placeholder="uveď formu jednání" value="$jednani->forma_jinak"> </div> </div> </div> <div class="form-group row mt-4"> <label class="col-sm-3 col-form-label ">Datum a čas jednání</label> <div class="col-sm-9" style="max-width: 250px"> <input type="datetime-local" class="form-control rounded-0" name="datum" id="idDatum" value="$jednani->datum"> </div> </div> <div class="border border-secondary p-2 pb-0 mt-5"> <span style="position: relative; top: -22px; background-color: white; padding-left: 10px; padding-right: 10px; "><strong>Obsah jednání</strong></span> $duvody </div> <div style="padding-left: 5px; "> <label for="idreseni" class="pt-0 mt-4"><strong>Řešení (závěr) </strong></label> </div> <textarea class="form-control border border-secondary rounded-0" rows="2" name="reseni" id="idReseni">$jednani->reseni</textarea> </div> <div class="card-footer rounded-0 d-flex"> <button class="btn btn-outline-primary me-2 rounded-0" style="max-height: 38px" onclick="jednaniTisk($idjednani)">Tisk zápisu z jednání</button> <div id="jednaniMsg" class="flex-grow-1 me-2"></div> <button class="btn btn-success ms-auto rounded-0" style="max-height: 38px" onclick="jednaniUlozit($idjednani)">Uložit</button> </div> </div> $script HTML; return $html; } private function formatujDatum($datum){ list($datumR, $casR) = explode('T', $datum); return $datumR.' '.$casR; } public function jednaniZalozitUloz($data){ $datumCas = $this->formatujDatum($data->datum); $sql = "INSERT INTO `jednani`(`zapsalid`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `datum`) VALUES (:ucitelId, :jmeno, :prijmeni, :trida, :datumCas)"; $this->db->query($sql, $this->ucitelId, htmlspecialchars($data->jmeno), htmlspecialchars($data->prijmeni), htmlspecialchars($data->trida), htmlspecialchars($datumCas)); $data->idjednani = $this->db->lastInsertId(); $this->poslatEmail($data->idjednani); $return = new stdClass(); $return->seznam = $this->mojeJednani(); $return->detail = $this->jednaniDetail($data->idjednani); $return->idjednani = $data->idjednani; return json_encode($return); } public function ulozJednani($data){ $datumCas = $this->formatujDatum($data->datum); if ($data->idjednani > 0){ $sql = "UPDATE `jednani` SET `typjednani`=:typjednani, `zz_jmeno`= :zz_jmeno, `zz_prijmeni`=:zz_prijmeni, `zak_jmeno`=:jmeno, `zak_prijmeni`=:prijmeni, `zak_trida`=:trida, `typjednani_jinak`=:typjednani_jinak, `datum`=:datum, `forma`=:forma, `forma_jinak`=:forma_jinak, `reseni`=:reseni WHERE `id` = :idjednani"; $this->db->query($sql, $data->typjednani, htmlspecialchars($data->zz_jmeno), htmlspecialchars($data->zz_prijmeni), htmlspecialchars($data->jmeno), htmlspecialchars($data->prijmeni), htmlspecialchars($data->trida), htmlspecialchars($data->typjednani_jinak), htmlspecialchars($datumCas), $data->forma, htmlspecialchars($data->forma_jinak), htmlspecialchars($data->reseni), htmlspecialchars($data->idjednani)); } else { $sql = "INSERT INTO `jednani`( `zapsalid`, `typjednani`, `zz_jmeno`, `zz_prijmeni`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `typjednani_jinak`, `datum`, `forma`, `forma_jinak`, `reseni`) VALUES (:ucitelId, :typjednani, :zz_jmeno, :zz_prijmeni, :jmeno, :prijmeni, :trida, :typjednani_jinak, :datumCas, :forma, :forma_jinak, :reseni)"; $this->db->query($sql, $this->ucitelId, $data->typjednani, htmlspecialchars($data->zz_jmeno), htmlspecialchars($data->zz_prijmeni), htmlspecialchars($data->jmeno), htmlspecialchars($data->prijmeni), htmlspecialchars($data->trida), htmlspecialchars($data->typjednani_jinak), htmlspecialchars($datumCas), $data->forma, htmlspecialchars($data->forma_jinak), htmlspecialchars($data->reseni)); $data->idjednani = $this->db->lastInsertId(); $this->poslatEmail($data->idjednani); } $sql = "DELETE from `jednani_dovody_zapisy` WHERE `idjednani` = :idjednani"; $this->db->query($sql, $data->idjednani); $sql = "INSERT INTO `jednani_dovody_zapisy`(`idjednani`, `idduvod`, `popis`) VALUES (:idjednani, :idduvod, :popis)"; forEach ($data->duvod as $zapis){ $this->db->query($sql, $data->idjednani, $zapis->id, $zapis->popis); } $return = new stdClass(); $return->seznam = $this->mojeJednani(); $return->detail = $this->jednaniDetail($data->idjednani); $return->idjednani = $data->idjednani; return json_encode($return); } private function emailBody($idjednani){ $sql = "SELECT `zalozeno`, `editovano`, `typjednani`, `zz_jmeno`, `zz_prijmeni`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `jednani`.`typjednani`, `typjednani_jinak`, `forma`, `forma_jinak`, `reseni`, `jednani`.`datum`, `users`.`prijmeni` as ucprijmeni, `users`.`jmeno` as ucjmeno FROM `jednani` left join `users` on `users`.`id`=`jednani`.`zapsalid` WHERE `jednani`.`id` = :idjednani"; $zaznam = $this->db->fetchOne($sql, $idjednani); $zak = $zaznam->zak_prijmeni.' '.$zaznam->zak_jmeno.' ('.$zaznam->zak_trida.')'; $datum = date( 'd.m.Y H:i', strtotime($zaznam->datum)); $zapsal = $zaznam->ucprijmeni.' '.$zaznam->ucjmeno; $html = <<<HTML <div style=" max-width: 600px; margin-left: auto; margin-right: auto;"> <div style="font-size: 24px;">Nový zápis o jednání</div> <table style="border: 1px solid black; border-collapse: collapse; width: 100%"> <tr> <td style="border: 1px solid black; padding: 3px 5px; width: 25%">Žák</td> <td style="border: 1px solid black; padding: 3px 5px;">$zak</td> </tr> <tr> <td style="border: 1px solid black; padding: 3px 5px;">Zapsal</td> <td style="border: 1px solid black; padding: 3px 5px;">$zapsal</td> </tr> <tr> <td style="border: 1px solid black; padding: 3px 5px;">Datum jednání</td> <td style="border: 1px solid black; padding: 3px 5px;">$datum</td> </tr> </table> Více: <a href="http://agenda.zsrepubliky.cz" target="agenda">agenda.zsrepubliky.cz</a> </div> HTML; return $html; } private function poslatEmail($idjednani){ $poslat = new Mailer(); $poslat->mail->Subject = 'Nový zápis o jednaní'; $poslat->mail->Body = $this->emailBody($idjednani); $sql = "SELECT `usersid`, `pravaid`, `users`.`email` FROM `users_prava` left join `users` on `users`.`id`=`users_prava`.`usersid` WHERE `pravaid` = 1"; $prijemci = $this->db->fetchAll($sql); forEach($prijemci as $prijemce){ $poslat->mail->clearAllRecipients(); $poslat->mail->addAddress($prijemce->email); // $poslat->mail->addAddress('dvorak@gymzn.cz'); $poslat->mail->send(); } } public function tisk($idjednani){ $sql = "SELECT `zz_jmeno`, `zz_prijmeni`, `zak_jmeno`, `zak_prijmeni`, `zak_trida`, `jednani`.`typjednani`, `typjednani_jinak`, `forma`, `forma_jinak`, `reseni`, `jednani`.`datum`, `users`.`prijmeni` as ucprijmeni, `users`.`jmeno` as ucjmeno FROM `jednani` left join `users` on `users`.`id`=`jednani`.`zapsalid` WHERE `jednani`.`id` = :idjednani"; $zaznam = $this->db->fetchOne($sql, $idjednani); if (!$zaznam){ return '<div class="m-4 h4">Chybná kombinace parametrů.</div>'; } $obsahy = $this->db->fetchAll("SELECT `id`, `popis` FROM `jednani_dovody_zapisy` WHERE `idjednani` = :idjednani", $idjednani); $text = ""; forEach($obsahy as $obsah){ $text .= nl2br($obsah->popis)."<br>"; } $reseni = nl2br($zaznam->reseni); $zak = $zaznam->zak_jmeno.' '.$zaznam->zak_prijmeni.', '.$zaznam->zak_trida; list($datum, $cas) = explode(' ', $zaznam->datum); list($rok, $mesic, $den) = explode('-', $datum); $datum = $den.'.'.$mesic.'.'.$rok; $ucastnici = '<table class="table table-bordered w-100 mb-0" style="border-right: 0px solid white;border-left: 0px solid white;"> <tr><td style="min-width: 50%; border-right: 1px solid rgba(0, 0, 0, 0.1);">'.$zaznam->ucjmeno.' '.$zaznam->ucprijmeni.'</td><td></td></tr>'; if (substr($zaznam->typjednani, 1, 1) == '1'){ $zz = $zaznam->zz_prijmeni.' '.$zaznam->zz_jmeno; $ucastnici .= '<tr><td style="border-right: 1px solid rgba(0, 0, 0, 0.1);">'.$zz.'</td><td></td></tr>'; } if (substr($zaznam->typjednani, 2, 1) == '1'){ $ucastnici .= '<tr><td style="border-right: 1px solid rgba(0, 0, 0, 0.1);">'.$zaznam->typjednani_jinak.'</td><td></td></tr>'; } $osoby = $this->db->fetchAll("SELECT `osoba` FROM `jednani_osoby` WHERE `idjednani` = :idjednani ORDER BY `osoba`", $idjednani); forEach($osoby as $jeden){ $ucastnici .= '<tr><td style="border-right: 1px solid rgba(0, 0, 0, 0.1);">'.$jeden->osoba.'</td><td></td></tr>'; } $ucastnici .= "</table>"; $html = <<<HTML <div class="text-center ms-1" style="max-width: 800px;"> <div class="h4 mb-4">Základní škola, Znojmo, náměstí Republiky 9</div> <table class="table table-bordered text-start"> <tr> <td colspan="2" class="h5 text-center fw-bold">Zápis o jednání</td> </tr> <tr> <td style="width: 33%">Jméno a příjmení žáka, třída</td> <td>$zak</td> </tr> <tr> <td>Datum</td> <td>$datum</td> </tr> <tr> <td colspan="2"> <div class="fw-bold">Obsah jednání:</div> $text </td> </tr> <tr> <td colspan="2"> <div class="fw-bold">Závěr - navržené opatření:</div> $reseni </td> </tr> <tr> <td colspan="2" style="padding-left: 0px; padding-right: 0px; padding-bottom:0px"> <div class="fw-bold p-2">Účastníci jednání (+podpis):</div> $ucastnici </td> </tr> </table> <div class="text-start">Zákonný zástupce obdržel kopii tohoto zápisu.</div> </div> HTML; return $html; } }