<?php

$pacients = PacientData::getAll();
$medics = MedicData::getAll();
?>

<div class="row">
<div class="col-md-10">
<h1>Nueva Cita</h1>
<form class="form-horizontal" role="form" method="post" action="./?action=addreservation">
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Asunto</label>
    <div class="col-lg-10">
      <input type="text" name="title" required class="form-control" id="inputEmail1" placeholder="Asunto">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Paciente</label>
    <div class="col-lg-10">
<select name="pacient_id" class="form-control" required>
<option value="">-- SELECCIONE --</option>
  <?php 
foreach ($pacients as $p) {
    ?>
    <option value="<?php 
    echo $p->id;
    ?>
"><?php 
    echo $p->id . " - " . $p->name . " " . $p->lastname;
    ?>
</option>
<div class="btn-group pull-right">
	<a href="index.php?view=newpacient" class="btn btn-default"><i class='fa fa-male'></i> Nuevo Paciente</a>
<!--<div class="btn-group pull-right">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <i class="fa fa-download"></i> Descargar <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="report/clients-word.php">Word 2007 (.docx)</a></li>
  </ul>
</div>
-->
</div>
		<h1>Pacientes</h1>
<br>
		<?php 
$users = PacientData::getAll();
if (count($users) > 0) {
    // si hay usuarios
    ?>

			<table class="table table-bordered table-hover">
			<thead>
			<th>Nombre completo</th>
			<th>Direccion</th>
			<th>Email</th>
			<th>Telefono</th>
			<th></th>
			</thead>
			<?php 
    foreach ($users as $user) {
        ?>
Example #3
0
<?php

/**
* BookMedik
* @author evilnapsis
* @url http://evilnapsis.com/about/
**/
if (count($_POST) > 0) {
    $user = new PacientData();
    $user->name = $_POST["name"];
    $user->lastname = $_POST["lastname"];
    $user->gender = $_POST["gender"];
    $user->day_of_birth = $_POST["day_of_birth"];
    $user->sick = $_POST["sick"];
    $user->medicaments = $_POST["medicaments"];
    $user->alergy = $_POST["alergy"];
    $user->address = $_POST["address"];
    $user->email = $_POST["email"];
    $user->phone = $_POST["phone"];
    $user->add();
    print "<script>window.location='index.php?view=pacients';</script>";
}
<?php

$user = PacientData::getById($_GET["id"]);
?>
<div class="row">
	<div class="col-md-12">
	<h1>Editar Paciente</h1>
	<br>
		<form class="form-horizontal" method="post" id="addproduct" action="index.php?view=updatepacient" role="form">


  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Nombre*</label>
    <div class="col-md-6">
      <input type="text" name="name" value="<?php 
echo $user->name;
?>
" class="form-control" id="name" placeholder="Nombre">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Apellido*</label>
    <div class="col-md-6">
      <input type="text" name="lastname" value="<?php 
echo $user->lastname;
?>
" required class="form-control" id="lastname" placeholder="Apellido">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Genero*</label>
 public function getPacient()
 {
     return PacientData::getById($this->pacient_id);
 }
<?php

$pacient = PacientData::getById($_GET["id"]);
?>
<div class="row">
	<div class="col-md-12">
<div class="btn-group pull-right">
<!--<div class="btn-group pull-right">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <i class="fa fa-download"></i> Descargar <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="report/clients-word.php">Word 2007 (.docx)</a></li>
  </ul>
</div>
-->
</div>
<div class="card">
  <div class="card-header" data-background-color="blue">
      <h4 class="title">Historial de Citas del Paciente</h4>
<p>Paciente: <?php 
echo $pacient->name . " " . $pacient->lastname;
?>
</p>
  </div>
  <div class="card-content table-responsive">
		<?php 
$users = ReservationData::getAllByPacientId($_GET["id"]);
if (count($users) > 0) {
    // si hay usuarios
    ?>
<?php

if (count($_POST) > 0) {
    $user = PacientData::getById($_POST["user_id"]);
    $user->name = $_POST["name"];
    $user->lastname = $_POST["lastname"];
    $user->address = $_POST["address"];
    $user->email = $_POST["email"];
    $user->phone = $_POST["phone"];
    $user->update();
    print "<script>window.location='index.php?view=pacients';</script>";
}