Ejemplo n.º 1
0
 /**
  * Returns a list of offers in given language, take into account the filtering and sorting.
  * @param RefreshEventArgs $args
  * @param int $idLng
  * @return Offer[]
  */
 public static function GetOffers(RefreshEventArgs $args, $idLng = 1045)
 {
     $db = DataBase::GetDbInstance();
     $args->Filters["IdLng"] = (int) $idLng;
     $filters = self::PrepareFilters($args->Filters);
     $query_start = "SELECT COUNT(o.id)";
     if (array_key_exists('properties', $args->Filters)) {
         $query_start = "SELECT COUNT(DISTINCT(o.id))";
     }
     $query = self::GetQuery($query_start, "", $args->Filters, false);
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     $row = $db->FetchArray($result);
     $args->SetRowsCount($row[0]);
     $query = "SELECT o.id_lng, o.id, o.object, o.rent, o.symbol, o.original, o.province, o.district, o.location, o.quarter, o.region,\r\n\t\t\to.street, o.floor, o.price, o.price_square, o.rooms_no, o.area, o.latitude, o.longitude, o.building_technology, o.status,\r\n\t\t\to.construction_material, o.construction_status, o.building_type, o.agents_id, o.creation_date, o.modification_date, o.investments_buildings_id, o.description_synonim, \r\n            o.country, o.floor_no, o.year_of_construction, o.house_type, o.first_page, o.object_type, o.contract_type, \r\n            o.visits_no, o.legal_status, o.ownership_status, o.furnishings, o.field_area, o.change_status, o.notices, o.notices_property, o.video_link, o.no_commission, o.expiration_date,\r\n            o.has_swfs, o.has_movs, o.has_photos, o.has_pans, o.has_maps, o.has_proj, o.loc_as_commune";
     $query = self::GetQuery($query, $args->Sorting, $args->Filters);
     $args->SetLimit($query);
     $list = array();
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     while ($row = $db->FetchArray($result)) {
         $list[count($list)] = self::BuildOffer($row);
     }
     return $list;
 }
Ejemplo n.º 2
0
 /**
  * Returns a list of osoba, take into account the filtering and sorting.
  * @param RefreshEventArgs $args
  * @return Osoba[]
  */
 public static function GetOsoby(RefreshEventArgs $args)
 {
     $db = DataBase::GetDbInstance();
     $filters = self::PrepareFilters($args->Filters);
     $query = self::GetQuery("SELECT COUNT(*)", "", $args->Filters);
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     $row = $db->FetchArray($result);
     $args->SetRowsCount($row[0]);
     $query = "SELECT o.id, o.name, o.last_name, o.email, o.phone, o.login, o.pwd, o.registration_date, o.user_id ";
     $query = self::GetQuery($query, $args->Sorting, $args->Filters);
     $args->SetLimit($query);
     $list = array();
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     while ($row = $db->FetchArray($result)) {
         $list[count($list)] = self::BuildOsoba($row);
     }
     return $list;
 }
Ejemplo n.º 3
0
 /**
  * Returns a list of investments in given language, take into account the filtering and sorting.
  * @param RefreshEventArgs $args
  * @param int $idLng
  * @return Investment[]
  */
 public static function GetInvestments(RefreshEventArgs $args, $idLng)
 {
     $db = DataBase::GetDbInstance();
     $args->Filters["IdLng"] = (int) $idLng;
     $filters = self::PrepareFilters($args->Filters);
     $query = self::GetQuery("SELECT COUNT(*)", "", $args->Filters);
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     $row = $db->FetchArray($result);
     $args->SetRowsCount($row[0]);
     $query = "SELECT *  ";
     $query = self::GetQuery($query, $args->Sorting, $args->Filters);
     $args->SetLimit($query);
     $list = array();
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     while ($row = $db->FetchArray($result)) {
         $list[count($list)] = self::BuildInvestment($row);
     }
     return $list;
 }
Ejemplo n.º 4
0
 /**
  * Returns a list of agents, take into account the filtering and sorting.
  * @param RefreshEventArgs $args
  * @return Agent[]
  */
 public static function GetAgents(RefreshEventArgs $args)
 {
     $db = DataBase::GetDbInstance();
     $filters = self::PrepareFilters($args->Filters);
     $query = self::GetQuery("SELECT COUNT(*)", "", $args->Filters);
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     $row = $db->FetchArray($result);
     $args->SetRowsCount($row[0]);
     $query = "SELECT a.id, a.name, a.phone, a.cell, a.email, a.departments_id, a.jabber_login, a.licence_no, a.responsible_name, a.responsible_licence_no, a.comunicators, a.photo_file, a.agents_code, a.section ";
     $query = self::GetQuery($query, $args->Sorting, $args->Filters);
     $args->SetLimit($query);
     $list = array();
     $result = $db->ExecuteQueryWithParams($query, array_values($filters));
     while ($row = $db->FetchArray($result)) {
         $list[count($list)] = self::BuildAgent($row);
     }
     return $list;
 }