Example #1
0
 public static function getCalebe($where = null)
 {
     $dado = Database::ReadOne("calebe c, person p", "c.*, p.*", "WHERE p.id_person = c.id_person " . $where);
     if (!$dado) {
         return '';
     }
     $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->setDateInsert($dado['INSERT_DATE']);
     $calebe->setLeader($dado['LEADER']);
     $calebe->setTimeStudy($dado['TIME_STUDY']);
     $calebe->setBaptism($dado['BAPTISM']);
     $calebe->setStatus($dado['STATUS']);
     $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);
     return $calebe;
 }
Example #2
0
 public static function getReligion($where = null)
 {
     $dado = Database::ReadOne("religion", "*", $where);
     if (!$dado) {
         return '';
     }
     $religion = new Religion();
     $religion->setId($dado['ID_RELIGION']);
     $religion->setName($dado['NAME_RELIGION']);
     return $religion;
 }
Example #3
0
 public static function getLogin($person)
 {
     $dado = Database::ReadOne("login", "*", "WHERE id_person = {$person}");
     if (!$dado) {
         return '';
     }
     $log = new Login();
     $log->setId($dado['ID_LOGIN']);
     $log->setUser($dado['USER_NAME']);
     $log->setPass($dado['USER_PASS']);
     $log->setRole($dado['ROLE']);
     return $log;
 }
Example #4
0
 public static function getChurch($where = null)
 {
     $dado = Database::ReadOne("church", " *", $where);
     if (!$dado) {
         return '';
     }
     $church = new Church();
     $church->setId($dado['ID_CHURCH']);
     $church->setName($dado['NAME_CHURCH']);
     $church->setPastor($dado['NAME_PASTOR']);
     $church->setStatus($dado['STATUS']);
     $address = Address::getAddress('AND a.id_address = ' . $dado['ID_ADDRESS']);
     $church->setAddress($address);
     return $church;
 }
Example #5
0
 public static function getTeam($where = null)
 {
     $dado = Database::ReadOne("team t", "t.*", $where);
     if (!$dado) {
         return '';
     }
     $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()));
     return $team;
 }
Example #6
0
 public static function getHistory($where)
 {
     $dado = Database::ReadOne('history', '*', $where);
     if (!$dado) {
         return false;
     }
     $history = new HistoryChurch();
     $history->setId($dado['ID_HISTORY']);
     $history->setNamePastor($dado['NAME_PASTOR']);
     $church = Church::getChurch("WHERE id_church = " . $dado['ID_CHURCH']);
     $history->setChurch($church);
     $history->setDateInicial($dado['DATE_INICIAL']);
     $history->setDateFinal($dado['DATE_FINAL']);
 }
Example #7
0
 public static function getPerson($where)
 {
     $dado = Database::ReadOne("person", "*", $where);
     if (!$dado) {
         return '';
     }
     $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']);
     $person->setDateInsert($dado['INSERT_DATE']);
     $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);
     return $person;
 }
Example #8
0
<?php

include_once 'class/Database.php';
$id = filter_input(INPUT_GET, 'cod', FILTER_VALIDATE_INT);
$morador = Database::ReadOne('person', 'id_person, name_person', "where id_person = " . $id);
?>

<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">Pesquisa</h1>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="col-md-8 col-md-offset-4">
            <ul class="nav nav-wizard">
                <li class="active" id="1"><a href="#">Pesquisa</a></li>
                <li class="disabled" id="2"><a href="#">Confirmar</a></li>
                <li class="disabled" id="3"><a href="#">Finalizar Pesquisa</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="box dark">
            <div id="div-1" class="accordion-body collapse in body">
                <div class="message"></div>

                <div class="step1">
                    <form id="formPesquisa" class="form-horizontal">
Example #9
0
$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>

        <h4>Dados Pessoais</h4>
        <p><label>Nome</label>: <?php 
        echo $per->getName();
        ?>
Example #10
0
 public static function existResearch($id)
 {
     $one = Database::ReadOne('research', '*', 'WHERE id_resident = ' . $id);
     if ($one) {
         return true;
     } else {
         return false;
     }
 }
Example #11
0
 public static function getAddress($where = null)
 {
     $dados = Database::ReadOne("address a, city c, states s", "a.*, c.*, s.*", "WHERE a.id_city = c.id_city AND c.id_state = s.id_state " . $where);
     if (!$dados) {
         return '';
     }
     $address = new Address();
     $address->setId($dados['ID_ADDRESS']);
     $address->setZipcode($dados['ZIPCODE']);
     $address->setStreet($dados['NAME_ADDRESS']);
     $address->setNumber($dados['NUMBER']);
     $address->setComplement($dados['COMPLEMENT']);
     $address->setDistrict($dados['DISTRICT']);
     $address->setLatitude($dados['LATITUDE']);
     $address->setLongitude($dados['LONGITUDE']);
     $address->setCity($dados['NAME_CITY']);
     $address->setState($dados['INITIALS']);
     $address->setPs($dados['PS']);
     return $address;
 }
Example #12
0
     break;
 case 'alterPerfilLog':
     $login['ID_LOGIN'] = $_POST['ID_LOGIN'];
     $login['USER_PASS'] = $_POST['USER_PASS'];
     Database::Update('login', 'user_pass = "******"', "WHERE ID_LOGIN = "******"WHERE id_person = {$id_person}");
     echo 'success';
     break;
 case 'removeAdmin':
     $id_person = $_POST['id'];
     Database::Update('login', 'role = 2', "WHERE id_person = {$id_person}");
     if (!Database::ReadOne('calebe', '*', "WHERE id_person = {$id_person}")) {
         Database::Insert('calebe', 'ID_PERSON, TIME_STUDY, BAPTISM, LEADER, STATUS', "{$id_person}, '', 0, 2, 'Ativo'");
     }
     echo 'success';
     break;
 case 'makeLeader':
     $id_person = $_POST['id'];
     Database::Update('calebe', 'leader = 2', "WHERE id_person = {$id_person}");
     Database::Update('login', 'role = 2', "WHERE id_person = {$id_person}");
     echo 'success';
     break;
 case 'removeLeader':
     $id_person = $_POST['id'];
     Database::Update('calebe', 'leader = 1', "WHERE id_person = {$id_person}");
     Database::Update('login', 'role = 1', "WHERE id_person = {$id_person}");
     echo 'success';
Example #13
0
 public static function getMission($where)
 {
     $dado = Database::ReadOne("mission", "*", $where);
     if (!$dado) {
         return '';
     }
     $mission = new Mission();
     $mission->setId($dado['ID_MISSION']);
     $mission->setName($dado['NAME_MISSION']);
     $mission->setDateBegin($dado['DATE_INICIAL']);
     $mission->setDateEnd($dado['DATE_END']);
     $mission->setStatus($dado['STATUS']);
     $team = Team::getTeam("WHERE id_team = " . $dado['ID_TEAM']);
     $mission->setTeam($team);
     if (!empty($dado['ID_ADDRESS'])) {
         $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']);
         $mission->setAddress($address);
     }
     if (!empty($dado['ID_CHURCH'])) {
         $church = Church::getChurch("WHERE id_church = " . $dado['ID_CHURCH']);
         $mission->setChurch($church);
     }
     return $mission;
 }
Example #14
0
                 echo "erro";
             }
         }
     }
     break;
 case 'forgot':
     $email = $_POST['email'];
     if (empty($email)) {
         echo 'emailinvalido';
         break;
     }
     $valid = Database::ReadOne('person', '*', "WHERE EMAIL = '{$email}'");
     if (!$valid) {
         echo 'naoencontrado';
     } else {
         $pass = Database::ReadOne('login', 'user_pass', "WHERE ID_PERSON = " . $valid["ID_PERSON"]);
         if (Functions::sendEmailRecoverPass($email, $valid["NAME_PERSON"], $pass[0])) {
             echo 'enviado';
         } else {
             echo 'falha';
         }
     }
     break;
 case 'zipcode':
     $cep = $_POST['zipcode'];
     $reg = simplexml_load_file("http://cep.republicavirtual.com.br/web_cep.php?formato=xml&cep=" . $cep);
     $dados['sucesso'] = (string) $reg->resultado;
     $dados['rua'] = (string) $reg->tipo_logradouro . ' ' . $reg->logradouro;
     $dados['bairro'] = (string) $reg->bairro;
     $dados['cidade'] = (string) $reg->cidade;
     $dados['estado'] = (string) $reg->uf;
Example #15
0
 public static function selectLogin($login)
 {
     return Database::ReadOne('login', '*', "WHERE user_name = '{$login}'");
 }
Example #16
0
 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;
 }