public static function getPersons() { $dados = Database::ReadAll("person", "*"); if (!$dados) { return ''; } foreach ($dados as $dado) { $person = new Person(); $person->setId($dado['ID_PERSON']); $person->setName($dado['NAME_PERSON']); $person->setEmail($dado['EMAIL']); $person->setAge($dado['AGE']); $person->setSex($dado['SEX']); $person->setPhone($dado['PHONE']); $person->setOperator($dado['OPERATOR']); $person->setMaritalStatus($dado['MARITAL_STATUS']); $person->setChildren($dado['CHILDREN']); $religion = Religion::getReligion("WHERE id_religion = " . $dado['ID_RELIGION']); $person->setReligion($religion); $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']); $person->setAddress($address); $login = Login::getLogin($dado['ID_PERSON']); $person->setLogin($login); $persons[] = $person; } return $persons; }
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; }
<?php include_once '../class/Functions.php'; include_once '../class/Mission.php'; include_once '../class/Resident.php'; $acao = $_POST['acao']; switch ($acao) { case 'religion': $cod = filter_input(INPUT_POST, 'cod', FILTER_SANITIZE_NUMBER_INT); $rel = Religion::getReligion("WHERE id_religion = {$cod}"); ?> <p><label>Nome</label>: <?php echo $rel->getName(); ?> </p> <?php break; case 'admin': $cod = filter_input(INPUT_POST, 'cod', FILTER_SANITIZE_NUMBER_INT); $cal = false; if (!Database::ReadOne('calebe', '*', 'WHERE id_person =' . $cod)) { $per = Person::getPerson('WHERE id_person = ' . $cod); } else { $per = Calebe::getCalebe('AND p.id_person = ' . $cod); $cal = true; } ?> <p><label>No sistema desde</label>: <?php echo $per->getDateInsert(); ?> </p>
public static function getResident($where) { $dado = Database::ReadOne("resident r, person p", "r.*, p.*", "WHERE p.id_person = r.id_person {$where}"); if (!$dado) { return ''; } $resident = new Resident(); $resident->setId($dado['ID_PERSON']); $resident->setName($dado['NAME_PERSON']); $resident->setEmail($dado['EMAIL']); $resident->setAge($dado['AGE']); $resident->setSex($dado['SEX']); $resident->setPhone($dado['PHONE']); $resident->setOperator($dado['OPERATOR']); $resident->setMaritalStatus($dado['MARITAL_STATUS']); $resident->setChildren($dado['CHILDREN']); $resident->setDateInsert($dado['INSERT_DATE']); $resident->setNumberResident($dado['NUMBER_RESIDENT_HOUSE']); $resident->setHouseFather($dado['HOUSEFATHER']); $resident->setCognateAdventista($dado['COGNATE_ADVENTISTA']); $religion = Religion::getReligion("WHERE id_religion = " . $dado['ID_RELIGION']); $resident->setReligion($religion); $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']); $resident->setAddress($address); $research = Research::getResearch('WHERE id_resident = ' . $dado['ID_PERSON']); $resident->setResearch($research); return $resident; }