Пример #1
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;
 }