Example #1
0
 public static function getResidents()
 {
     $dados = Database::ReadAll("resident m, person p", "m.*, p.*", "WHERE p.id_person = m.id_person");
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $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);
         $residents[] = $resident;
     }
     return $residents;
 }
Example #2
0
 public static function getReligions()
 {
     $dados = Database::ReadAll("religion", "*");
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $religion = new Religion();
         $religion->setId($dado['ID_RELIGION']);
         $religion->setName($dado['NAME_RELIGION']);
         $religions[] = $religion;
     }
     return $religions;
 }
Example #3
0
 public static function getChurches()
 {
     $dados = Database::ReadAll("church", "*");
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $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);
         $churches[] = $church;
     }
     return $churches;
 }
Example #4
0
                                 <tr>
                                     <th>ID</th>
                                     <th>Nome</th>
                                     <th>Ação</th>
                                 </tr>
                                 </thead>
                                 <tbody>
                                 <?php 
 if (Religion::getReligions() != '') {
     foreach (Religion::getReligions() as $rel) {
         echo '<tr>';
         echo '<td>' . $rel->getId() . '</td>';
         echo '<td>' . '<a class="modalReligion" data-id="' . $rel->getId() . '" >' . $rel->getName() . '</a>' . '</td>';
         if ($rel->getId() != 1) {
             echo '<td>' . '<a href="forms.php?p=altReligiao&cod=' . $rel->getId() . '">' . '<i class="icon icon-pencil"></i> Editar' . '</a>';
             if (!Database::ReadAll('person', '*', "WHERE ID_RELIGION = " . $rel->getId())) {
                 echo ' | ' . '<a data-table="religion" data-id="' . $rel->getId() . '" class="del">' . '<i class="icon icon-remove"></i> Exluir' . '</a>';
             }
             echo '</td>';
             echo '</tr>';
         } else {
             echo '<td></td>';
         }
     }
 }
 ?>
                                 </tbody>
                             </table>
                         </div>
                     </div>
                 </div>
Example #5
0
 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;
 }
Example #6
0
 public static function getHistorys($where = null)
 {
     $dados = Database::ReadAll('history', '*', $where);
     if (!$dados) {
         return false;
     }
     foreach ($dados as $dado) {
         $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']);
         $historys[] = $history;
     }
     return $historys;
 }
Example #7
0
 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;
 }
Example #8
0
 public static function getAddresses($where = null)
 {
     $dados = Database::ReadAll("address a, city c, state s", "a.*, c.*, s.*", "WHERE a.id_city = c.id_city AND s.id_state = c.id_state " . $where);
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $address = new Address();
         $address->setId($dado['ID_ADDRESS']);
         $address->setStreet($dado['NAME_ADDRESS']);
         $address->setNumber($dado['NUMBER']);
         $address->setComplement($dado['COMPLEMENT']);
         $address->setDistrict($dado['DISTRICT']);
         $address->setLatitude($dados['LATITUDE']);
         $address->setLongitude($dados['LONGITUDE']);
         $address->setCity($dado['NAME_CITY']);
         $address->setState($dado['INITIALS']);
         $address->setPs($dado['PS']);
         $addresses[] = $address;
     }
     return $addresses;
 }
Example #9
0
 public static function getMissions($where = null)
 {
     $dados = Database::ReadAll("mission", "*", $where);
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $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);
         }
         $missions[] = $mission;
     }
     return $missions;
 }
Example #10
0
 public static function getCity($where)
 {
     return Database::ReadAll('city', '*', "WHERE {$where}");
 }
Example #11
0
        </div>

        <script>
            $(document).ready(function () {
                $('#dataTables').dataTable();
            })
        </script>

        <?php 
        break;
    case 'opnionPerson':
        $get = $_POST['type'];
        $typeGood = array('Honesto', 'Comprometido', 'Persistente', 'Companheiro', 'NDA');
        $typeBad = array('Pontualidade', 'Hipocrita', 'Falso', 'Interesseiro', 'NDA');
        $typeAll = array('Honesto', 'Comprometido', 'Persistente', 'Companheiro', 'Pontualidade', 'Hipocrita', 'Falso', 'Interesseiro', 'NDA');
        $opnions = Database::ReadAll('research', 'OPNION_ADVENTISTA');
        if ($get == 'good') {
            $type = $typeGood;
        }
        if ($get == 'bad') {
            $type = $typeBad;
        }
        if ($get == 'all') {
            $type = $typeAll;
        }
        for ($i = 0; $i < count($type); $i++) {
            $typeCount[$i] = 0;
            foreach ($opnions as $opnion) {
                $opnion = explode(';', $opnion['OPNION_ADVENTISTA']);
                if ($opnion[0] == $type[$i]) {
                    $typeCount[$i]++;
Example #12
0
 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;
 }