From: Greg Burri Date: Mon, 18 May 2009 20:15:22 +0000 (+0200) Subject: First commit X-Git-Url: http://git.euphorik.ch/?p=appart.git;a=commitdiff_plain;h=3ea368615562fe13493f07cbfd12bd6566c79fa6 First commit --- 3ea368615562fe13493f07cbfd12bd6566c79fa6 diff --git a/DB/create.sql b/DB/create.sql new file mode 100755 index 0000000..56db805 --- /dev/null +++ b/DB/create.sql @@ -0,0 +1,77 @@ +SET client_encoding = 'UTF-8'; +SET check_function_bodies = false; +SET client_min_messages = warning; +SET escape_string_warning = off; + + +SET search_path = public, pg_catalog; + + +CREATE SEQUENCE appart_id_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + +ALTER TABLE public.appart_id_seq OWNER TO appart; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + + +/** Version 1 **/ + + +CREATE TABLE appart ( + id integer DEFAULT nextval('appart_id_seq'::regclass) NOT NULL, + prix numeric(28,0), + prixcharges numeric(10,0), + rue text DEFAULT ''::text NOT NULL, + nbpiece character varying(28), + surface numeric(28,0), + description text DEFAULT ''::text NOT NULL, + contact text DEFAULT ''::text NOT NULL, + url character varying(200) DEFAULT ''::character varying NOT NULL, + etage numeric(5,0), + annee_construction numeric(28,0), + points_positifs text DEFAULT ''::text NOT NULL, + points_negatifs text DEFAULT ''::text NOT NULL, + date_visite date, + visite_indications text DEFAULT ''::text NOT NULL, + statut smallint DEFAULT 0 NOT NULL, + localite character varying(100) DEFAULT ''::character varying +); + + +ALTER TABLE public.appart OWNER TO appart; + +COMMENT ON COLUMN appart.statut IS 'statut : 0 = pas visité 1 = on a rendez-vous, 2 = visité, 3 = déjà pris :('; + +ALTER TABLE ONLY appart ADD CONSTRAINT appart_pkey PRIMARY KEY (id); + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + +REVOKE ALL ON TABLE appart FROM PUBLIC; +REVOKE ALL ON TABLE appart FROM appart; +GRANT ALL ON TABLE appart TO appart; +GRANT ALL ON TABLE appart TO appart_group; + +REVOKE ALL ON TABLE site FROM PUBLIC; +REVOKE ALL ON TABLE site FROM appart; +GRANT ALL ON TABLE site TO appart; +GRANT ALL ON TABLE site TO appart_group; + + +/** Version 2 **/ + +ALTER TABLE public.appart ALTER date_visite TYPE timestamp without time zone; +ALTER TABLE public.appart ADD COLUMN date_libre date; + +ALTER TABLE public.appart ADD COLUMN url_map text; +ALTER TABLE public.appart ALTER COLUMN url_map SET DEFAULT ''; + diff --git a/DB/empty_db.sql b/DB/empty_db.sql new file mode 100644 index 0000000..54bf5f8 --- /dev/null +++ b/DB/empty_db.sql @@ -0,0 +1,147 @@ +-- +-- PostgreSQL database dump +-- + +-- Started on 2009-05-18 22:01:44 CEST + +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = off; +SET check_function_bodies = false; +SET client_min_messages = warning; +SET escape_string_warning = off; + +-- +-- TOC entry 1750 (class 1262 OID 16394) +-- Name: appart; Type: DATABASE; Schema: -; Owner: - +-- + +CREATE DATABASE appart WITH TEMPLATE = template0 ENCODING = 'UTF8'; + + +\connect appart + +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = off; +SET check_function_bodies = false; +SET client_min_messages = warning; +SET escape_string_warning = off; + +-- +-- TOC entry 294 (class 2612 OID 16506) +-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: - +-- + +CREATE PROCEDURAL LANGUAGE plpgsql; + + +SET search_path = public, pg_catalog; + +-- +-- TOC entry 1466 (class 1259 OID 16507) +-- Dependencies: 3 +-- Name: appart_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE appart_id_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- TOC entry 1467 (class 1259 OID 16509) +-- Dependencies: 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 3 +-- Name: appart; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE appart ( + id integer DEFAULT nextval('appart_id_seq'::regclass) NOT NULL, + prix numeric(28,0), + prixcharges numeric(10,0), + rue text DEFAULT ''::text NOT NULL, + nbpiece character varying(28), + surface numeric(28,0), + description text DEFAULT ''::text NOT NULL, + contact text DEFAULT ''::text NOT NULL, + url character varying(200) DEFAULT ''::character varying NOT NULL, + etage numeric(5,0), + annee_construction numeric(28,0), + points_positifs text DEFAULT ''::text NOT NULL, + points_negatifs text DEFAULT ''::text NOT NULL, + visite_indications text DEFAULT ''::text NOT NULL, + statut smallint DEFAULT 0 NOT NULL, + localite character varying(100) DEFAULT ''::character varying, + date_visite timestamp without time zone, + date_libre date, + url_map text DEFAULT ''::text +); + + +-- +-- TOC entry 1753 (class 0 OID 0) +-- Dependencies: 1467 +-- Name: COLUMN appart.statut; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN appart.statut IS 'statut : 0 = pas visité, 1 = visité, 2 = déjà pris, 3 = rdv pris'; + + +-- +-- TOC entry 1468 (class 1259 OID 16526) +-- Dependencies: 3 +-- Name: site_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE site_id_seq + START WITH 1 + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + + +-- +-- TOC entry 1747 (class 2606 OID 16536) +-- Dependencies: 1467 1467 +-- Name: appart_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY appart + ADD CONSTRAINT appart_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 1752 (class 0 OID 0) +-- Dependencies: 3 +-- Name: public; Type: ACL; Schema: -; Owner: - +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- TOC entry 1754 (class 0 OID 0) +-- Dependencies: 1467 +-- Name: appart; Type: ACL; Schema: public; Owner: - +-- + +REVOKE ALL ON TABLE appart FROM PUBLIC; +REVOKE ALL ON TABLE appart FROM appart; +GRANT ALL ON TABLE appart TO appart; +GRANT ALL ON TABLE appart TO appart_group; + + +-- Completed on 2009-05-18 22:01:46 CEST + +-- +-- PostgreSQL database dump complete +-- + diff --git a/constantes.php b/constantes.php new file mode 100755 index 0000000..2dbdea9 --- /dev/null +++ b/constantes.php @@ -0,0 +1,52 @@ + 'http://www.etudiant.ch/etudiant.sa.annonces.surf.ModuleLogement?categorie=5&nPage=1&entete=les%20offres%20de%20logements&affich=0&type=0', + 'students.ch' => 'http://www.students.ch/wohnungen/page_wohnungen.php?suchen=1&art=wo&plz=2000', + 'homegate.ch' => 'http://www.homegate.ch/homegate/objectlist;HGSESSIONID=BnS5Gf8TMmx3ZQDMr7LVB0jN0fLvJMkyphlyXJyQ1hGLJhyWd2wd!1228891005?MY_BUTTON=SEARCH&CURRENT_PAGE=1&SORT_ORDER=&z_von=2&z_bis=3.5&p_von=unlim.&p_bis=1300&s_type=egal&s_location=Neuch%C3%A2tel&m2_von=&m2_bis=&v_ab=egal', +'anibis.ch' => 'http://www.anibis.ch/search.do?rt=1&re=1&of=2&ot=13&cf=500&ct=1500&sf=&st=&ci=2000&v=m&c=150113&as=1&v=m', +'petites-annonces.ch' => 'http://www.petites-annonces.ch/recherche/?query=&tid=270113', +'immostreet.ch' => 'http://neuch.immostreet.ch/asp/base.asp?LAN_CODE=FRE&ETAT=100400&STA_NUM=2&GDTYPE=1&RESE_ECHELLE=450&RESE_NUM=454&TYOBSE_NUM=2&OBJ_PRIX_MAX=2000&PCE_NUM=2&SKIN=is', +'fidimmobil.ch centre' => 'http://www.sai-informatique.ch/cgi-bin-sai/REGCR.exe?LANGUE=FR&typobj=AP%3BCH%3BMA%3BVI%3BST&nbpiec=Indiff%E9rent&coregi=CVN&domimm=2000+Neuch%E2tel&loymin=0000&loymax=1200&datinj=--&datinm=----&datina=-----&Submit=Rechercher', +'fidimmobil.ch haut' => 'http://www.sai-informatique.ch/cgi-bin-sai/REGCR.exe?LANGUE=FR&typobj=AP%3BCH%3BMA%3BVI%3BST&nbpiec=Indiff%E9rent&coregi=HVN&domimm=2000+Neuch%E2tel&loymin=0000&loymax=1200&datinj=--&datinm=----&datina=-----&Submit=Rechercher', +'wincasa.ch' => 'http://www.homegate.ch/homegate/objectlist?description=Neuch%C3%A2tel&x=47&y=9&description=®iontype=PLACE&placelist_regiontype=NE', +'littoral-gerance.ch' => 'http://www.littoral-gerance.ch/alouer.php', +'pilote.ch' => 'http://www.pilote.ch/pilote/search/estate/search.htm?classMethod=doNewSearch&wasRedirected=true&searchParams=eNqFkV9rwjAUxb9KybtpKjonpBWcGxMmg83B3sY1vWhcmpQkVbtPv9R/6xDxKUnv/Z1zey4f7QoVbdA6aXRKEspIhFqYXOplSj7mT517Msr4GjbQ7upT9pUkJBIKnEtJU6YLBO3o5+xlgoFHS7KIm8UahT+1CVNQDYUUjpbVQklhtA5lulWCbnFBi4Ap6hCsWNFH58Hj+/4xA/c9DvIk4xsj86i0pkTr65SARTj0zOsSG0vnbZg9+5Elj493HjfUBStMpb2tp3kLe3i+RVnUfm48qBnsLn9xn0QBfkXHchmCkAWoMPVRMukxdtaPeHxgrzk5VKGK+atWUuOksuBD/I2n1D7r8bg5brBvuAzMNHcNBtZCfZo0wCRSqJd+FTZ6SlbqHHcpYSeXTvLPJsy8F7lmW5V5WFr+LrXASbhdCajyUtFDnSvTBJMM2aA/uGMs6Q55vP92M5+w4tbmuqyV7d+4Z4nGOPsFZX4DqQ==', +'romandie.com' => 'http://annonces.romandie.com/search.html?q=&rub=4&cat=60&ccp=2&ccr=37&l=Neuch%E2tel&amm=0&cyl=0&bat=0&kmin=min&kmax=max&act=Rechercher&p=search&tri=date_parution&odr=1', +'ne.ch' => 'http://www.ne.ch/neat/site/jsp/rubrique/rubrique.jsp?StyleType=marron&DocId=10432', +'jouval.ch' => 'http://www.jouval.ch/01-1-location.html#Anchor-47857', +'naef.ch' => 'http://www.naef.ch/index.php?mode=location&26510102=0-2000&26510105=NE&&26510101=26250', +'optiGestionSA.ch' => 'http://www.optigestionsa.ch/liste_loca_objet_appart_villa.php', + +); + +$champs = array( + 'id' => 'serial', + 'prix' => 'int', + 'prixcharges' => 'int', + 'rue' => 'text', + 'localite' => 'text', + 'nbpiece' => 'text', + 'surface' => 'int', + 'description' => 'text', + 'contact' => 'text', + 'url' => 'text', + 'etage' => 'int', + 'annee_construction' => 'int', + 'points_positifs' => 'text', + 'points_negatifs' => 'text', + 'date_visite' => 'date', + 'visite_indications' => 'text', + 'statut' => 'int', + 'date_libre' => 'date', + 'points_positifs' => 'text', + 'points_negatifs' => 'text', + 'date_visite' => 'timestamp', + 'visite_indications' => 'text', + 'url_map' => 'text' + ); + +$BD = 'appartement_olivier'; +$statuts = array('-1' => 'Gagné ! :-)', '5' => 'Inscrit', '0' => 'Pas visité', '1' => 'Rendez-vous', '2' => 'Visité', '3' => 'Déjà pris', '4' => 'Abandonné'); + + +?> diff --git a/debug.inc b/debug.inc new file mode 100755 index 0000000..99e844b --- /dev/null +++ b/debug.inc @@ -0,0 +1,29 @@ +'; + foreach ($arr as $key1 => $elem1) { + echo ''; + echo ''.$key1.' '; + + echo ''; + viewArray($elem1); + echo ' '; + + echo ''; + } + echo ''; +} + +function v($x){ viewarray($x);} + +?> diff --git a/index.php b/index.php new file mode 100755 index 0000000..a9a57c9 --- /dev/null +++ b/index.php @@ -0,0 +1,199 @@ +'; + + require ('constantes.php'); + + $dbconn = pg_connect("host=localhost port=5432 dbname=".$BD." user=appart password=soleil") or die('Connexion impossible : ' . pg_last_error()); + pg_query("SET datestyle = 'SQL, DMY';"); + + $inputs; + $erreur; + $action; + require ('traitement_inputs.php'); + +?> + + + + Appart + + + + + Google Maps JavaScript API Example + + + +' . utf8_encode($erreur) . ''; + } +?> + + + +
+ $type) + $appartData[$champ] = $inputs[$champ]; + } + else + { + $result = pg_query("SELECT * FROM appart WHERE id = $id"); + $appartData = pg_fetch_array($result, null, PGSQL_ASSOC); + } +?> +
+ +

Appartement N°

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Statut + + + + Lien internet
Prix + charges + = Contact
Libre à partir du (ex: "1/08/2007")
Rue
LocalitéDescription
Nombre de pièce
Surface
Étage
Dernière rénovation (année)
Points PositifsPoints négatifs
+

Visite

+
Date et heure de la visite (ex: "23/07/2007 14:23")
Indications
+

Map

+
+
+
+
+
+ +
+ + + + + diff --git a/list.php b/list.php new file mode 100755 index 0000000..11eae6b --- /dev/null +++ b/list.php @@ -0,0 +1,86 @@ +'; + require('debug.inc'); + require ('constantes.php'); + + $dbconn = pg_connect("host=localhost dbname=".$BD." user=appart password=soleil") or die('Connexion impossible : ' . pg_last_error()); + pg_query("SET datestyle = 'SQL, DMY';"); + + $inputs; + $erreur; + $action; + require ('traitement_inputs.php'); + +?> + + + + Appart + + + + + Google Maps JavaScript API Example + + + +' . utf8_encode($erreur) . ''; + } +?> + + +