<?php require_once '../../includes/initialize.php'; if (!$session->is_logged_in()) { redirect_to("login.php"); } include_layout_template('admin_header.php'); include_layout_template('sidebar.php'); $zadatak = ZadatakKorisnik::find_by_id($_GET['id']); ?> <div class="span12"> <table class="table"> <th>Naziv Zadatka</th> <th>Datum kreiranja</th> <th>Datum zadnje promjene</th> <th>Datum kad istièe</th> <th>Osobe na zadatku</th> <?php echo "<tr><td>{$zadatak->naziv}</td>"; echo "<td>{$zadatak->created_at}</td>"; echo "<td>{$zadatak->updated_at}</td>"; echo "<td>{$zadatak->expire_at}</td>"; echo "<td>{$zadatak->ime} {$zadatak->prezime}</td>"; echo "<td>{$zadatak->expire_at}</td>"; ?> </table> </div>
<th>Rok za završetak</th> <th>Riješen</th> <th>Akcije</th> </tr> </thead> <tbody> <?php } echo "<tr id={$zadatak->id}><td>{$zadatak->ime} {$zadatak->prezime}</td>"; echo "<td>{$zadatak->created_at}</td>"; echo "<td>{$zadatak->updated_at}</td>"; echo "<td>{$zadatak->expire_at}</td>"; echo "<td><input type='checkbox' value='{$zadatak->expire_at}' disabled></td>"; echo "<td><a href=edit.php?id={$zadatak->id}>E</a>"; echo "<a id='delete' href=delete={$zadatak->id}>D</a></td></tr>"; $komentari = ZadatakKorisnik::komentari($zadatak->id); if ($komentari) { echo "<tr><td>Komentari</td></tr>"; foreach ($komentari as $komentar) { echo "<tr><td>{$komentar->tekst}</td><td>{$komentar->ime} {$komentar->prezime}</td></tr>"; } } $i++; } } ?> </tbody> </table> </div> <script>
<?php require_once '../../includes/initialize.php'; if (!$session->is_logged_in()) { redirect_to("login.php"); } include_layout_template('admin_header.php'); include_layout_template('sidebar.php'); $zadaci = ZadatakKorisnik::groupByZadatakId(); ?> <div class="span12"> <?php echo output_message($message); ?> <table class="table"> <thead> <tr> <th>Naziv Zadatka</th> <th>Broj zadataka</th> <th>Datum Kreiranja</th> <th>Rok za završetak</th> <th>Akcije</th> </tr> </thead> <tbody> <?php foreach ($zadaci as $zadatak) { echo "<tr><td><a href=show.php?id={$zadatak->id}>{$zadatak->naziv}</a></td>"; echo "<td>{$zadatak->brojzadataka}</td>"; echo "<td>{$zadatak->created_at}</td>"; echo "<td>{$zadatak->expire_at}</td>";
$zadatak->updated_at = date('YMd hms'); $zadatak->expire_at = date("YMd hms", strtotime($_POST['expire_at'])); $zadatak->created_by = $_SESSION['user_id']; $zadatak->save(); $form_data['posted'] = 'Podaci su uspješno upisani u bazu'; } //Return the data back to formE.php echo json_encode($form_data); } if (isset($_POST['member'])) { $errors = array(); //To store errors $form_data = array(); //Pass back the data to `formE.php` for ($i = 0; $i < count($_POST['member']['k_id']); $i++) { $zadatakKorisnik = new ZadatakKorisnik(); $zadatakKorisnik->korisnik_id = $_POST['member']['k_id'][$i]; $zadatakKorisnik->zadatak_id = $_SESSION['last_inserted_id']; $zadatakKorisnik->created_at = date('YMd hms'); $zadatakKorisnik->expire_at = date('YMd hms', strtotime($_POST['member']['expire_at'][$i])); $zadatakKorisnik->prioritet_id = $_POST['member']['prioritet_id'][$i]; $zadatakKorisnik->save(); $komentar = new Komentar(); $komentar->korisnici_id = $_SESSION['user_id']; $komentar->zadatak_id = $_SESSION['last_inserted_id_zk']; $komentar->tekst = $_POST['member']['tekst'][$i]; $komentar->created_at = date('YMd hms'); $komentar->save(); $form_data['posted'] = 'Podaci su uspješno upisani u bazu'; } //Return the data back to formE.php
<?php require_once '../../includes/initialize.php'; if (!$session->is_logged_in()) { redirect_to("login.php"); } include_layout_template('admin_header.php'); include_layout_template('sidebar.php'); $zadaci = ZadatakKorisnik::all(); ?> <div class="span12"> <?php echo output_message($message); ?> <table class="table"> <th>Naziv Zadatka</th> <th>Datum kreiranja</th> <th>Datum zadnje promjene</th> <th>Datum kad ističe</th> <th>Osobe na zadatku</th> <?php foreach ($zadaci as $zadatak) { echo "<tr><td><a href='show.php?id={$zadatak->id}'>{$zadatak->naziv}</a></td>"; echo "<td>{$zadatak->created_at}</td>"; echo "<td>{$zadatak->updated_at}</td>"; echo "<td>{$zadatak->expire_at}</td>"; echo "<td>{$zadatak->ime} {$zadatak->prezime}</td>"; echo "<td>{$zadatak->expire_at}</td>"; } ?> </table>
public static function delete($id) { $stmt = ZadatakKorisnik::getInstance()->prepare("DELETE FROM " . self::$table_name . " WHERE id = {$id}"); if ($stmt->execute()) { return true; } else { foreach (ZadatakKorisnik::getInstance()->errorInfo() as $error) { echo $error . '<br />'; } return false; } }