public static function getTeams() { $dados = Database::ReadAll("team t", "t.*"); if (!$dados) { return ''; } foreach ($dados as $dado) { $team = new Team(); $team->setId($dado['ID_TEAM']); $team->setName($dado['NAME_TEAM']); $team->setStatus($dado['STATUS']); $calebe = Calebe::getCalebe("AND c.id_person = " . $dado['ID_LEADER']); $team->setLeader($calebe); $team->setMembers(Team::getMembersTeam($team->getId())); $teams[] = $team; } return $teams; }
<?php if ($_SESSION['login']['role'] != 3) { echo '<h2 style="text-align: center; vertical-align: middle">Página Restrita</h2>'; } else { include_once 'class/Calebe.php'; $id = filter_input(INPUT_GET, 'cod', FILTER_SANITIZE_NUMBER_INT); if (Calebe::getCalebe("AND p.id_person = {$id}")) { $cal = Calebe::getCalebe("AND p.id_person = {$id}"); } else { echo '<script>window.location = "index.php";</script>'; } ?> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Alterar Calebe</h1> </div> </div> <div class="row"> <div class="col-lg-12"> <div class="col-md-6 col-md-offset-3"> <ul class="nav nav-wizard"> <li class="active" id="1"><a href="#">Dados Pessoais</a></li> <li class="disabled" id="2"><a href="#">Endereço</a></li> <li class="disabled" id="3"><a href="#">Login</a></li> <li class="disabled" id="4"><a href="#">Finalizar</a></li> </ul> </div> </div> </div> <div class="row">
alert("Para cadastrar uma Equipe é necessário ter ao menos um Líder!"); window.location = "consulta.php?p=lider"; </script>'; } ?> </select> </div> </div> <div class="form-group"> <label class="control-label col-lg-4">Integrantes Equipe</label> <div class="col-lg-5"> <select id="CALEBES_MISSAO" name="CALEBES_MISSAO[]" multiple="multiple" class="form-control chzn-select" required data-placeholder="Escolha os Calebes para a Equipe"> <?php if (Calebe::getCalebes() != '') { foreach (Calebe::getCalebes() as $cal) { echo '<option value="' . $cal->getId() . '">' . $cal->getName() . '</option>'; } } else { echo '<script> alert("Para cadastrar uma Equipe é necessário ter ao menos um Calebe!"); window.location = "consulta.php?p=calebe"; </script>'; } ?> </select> </div> </div> <div class="form-group"> <label class="control-label col-lg-4">Status</label>
<table class="table table-striped table-bordered table-hover dataTables-example"> <thead> <tr> <th>ID</th> <th>Nome</th> <th>Email</th> <th>Religião</th> <th>Idade</th> <th>Status</th> <th>Ação</th> </tr> </thead> <tbody> <?php if (Calebe::getLeaders() != '') { foreach (Calebe::getLeaders() as $cal) { echo '<tr>'; echo '<td>' . $cal->getId() . '</td>'; echo '<td>' . '<a class="modalCalebe" data-id="' . $cal->getId() . '" >' . $cal->getName() . '</a>' . '</td>'; echo '<td>' . $cal->getEmail() . '</td>'; echo '<td>' . $cal->getReligion()->getName() . '</td>'; echo '<td>' . $cal->getAge() . '</td>'; echo '<td>' . $cal->getStatus() . '</td>'; if ($cal->getStatus() != 'Banido') { echo '<td>' . '<a href="forms.php?p=altCalebe&cod=' . $cal->getId() . '">' . '<i class="icon icon-pencil"></i> Editar' . '</a>' . ' | ' . '<a class="removeLeader" data-id="' . $cal->getId() . '" data-name="' . $cal->getName() . '" title="Retirar Líder">' . '<i class="icon icon-star-half"></i> Retirar' . '</a>'; if ($cal->getLogin()->getRole() != 3) { echo ' | ' . '<a class="makeAdmin" data-id="' . $cal->getId() . '" data-name="' . $cal->getName() . '" title="Tornar Admin">' . '<i class="icon icon-key"></i> Admin' . '</a>'; } echo '</td>'; echo '</tr>'; }
- <?php echo $per->getAddress()->getCity(); ?> / <?php echo $per->getAddress()->getState(); ?> </p> <p><label>Observações</label>: <?php echo $per->getAddress()->getPs(); ?> </p> <?php break; case 'calebe': $cod = filter_input(INPUT_POST, 'cod', FILTER_SANITIZE_NUMBER_INT); $per = Calebe::getCalebe('AND p.id_person = ' . $cod); ?> <p><label>No sistema desde</label>: <?php echo $per->getDateInsert(); ?> </p> <h4>Dados Pessoais</h4> <p><label>Nome</label>: <?php echo $per->getName(); ?> </p> <p><label>Idade</label>: <?php echo $per->getAge(); ?> | <label>Sexo</label>: <?php
} for ($i = 0; $i < count($religions); $i++) { $data[$i] = array('label' => $religions[$i]['name_religion'], 'data' => $reliCount[$i]); } echo json_encode($data); break; case 'detalReligions': $type = $_POST['type']; $data = []; $reliCount[] = 0; $religions = Database::ReadAll('religion', 'id_religion, name_religion'); if ($type == 'person') { $persons = Person::getPersons(); } else { if ($type == 'calebe') { $persons = Calebe::getCalebes(); } else { $persons = Resident::getResidents(); } } for ($i = 0; $i < count($religions); $i++) { $reliCount[$i] = 0; for ($j = 0; $j < count($persons); $j++) { if ($religions[$i]['id_religion'] == $persons[$j]->getReligion()->getId()) { $reliCount[$i]++; } } } ?> <div class="row"> <div class="col-lg-12">
public static function getLeaders() { $dados = Database::ReadAll("calebe c, person p", "c.*, p.*", "WHERE p.id_person = c.id_person AND c.leader = 2"); if (!$dados) { return ''; } foreach ($dados as $dado) { $calebe = new Calebe(); $calebe->setId($dado['ID_PERSON']); $calebe->setName($dado['NAME_PERSON']); $calebe->setEmail($dado['EMAIL']); $calebe->setAge($dado['AGE']); $calebe->setSex($dado['SEX']); $calebe->setPhone($dado['PHONE']); $calebe->setOperator($dado['OPERATOR']); $calebe->setMaritalStatus($dado['MARITAL_STATUS']); $calebe->setChildren($dado['CHILDREN']); $calebe->setBaptism($dado['BAPTISM']); $calebe->setLeader($dado['LEADER']); $calebe->setTimeStudy($dado['TIME_STUDY']); $calebe->setStatus($dado['STATUS']); $calebe->setDateInsert($dado['INSERT_DATE']); $religion = Religion::getReligion("WHERE id_religion = " . $dado['ID_RELIGION']); $calebe->setReligion($religion); $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']); $calebe->setAddress($address); $login = Login::getLogin($dado['ID_PERSON']); $calebe->setLogin($login); $calebes[] = $calebe; } return $calebes; }