80 lines
3.1 KiB
PHP
80 lines
3.1 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_contours.inc
|
|
|
|
Description: CAD contour model. Dit bestand heeft niets met interfacing te maken
|
|
maar werkt uitsluitend op JSON-data
|
|
Parameters:
|
|
Context:
|
|
|
|
Notes: Dummy placeholder
|
|
*/
|
|
%>
|
|
<!-- #include file="../Shared/json2.js" -->
|
|
<!-- #include file="../ALG/alg.inc" -->
|
|
<%
|
|
|
|
model_cadcontours =
|
|
{
|
|
table: "cad_imp_contour",
|
|
primary: "cad_imp_contour_key",
|
|
aliasprefix: "CAD.",
|
|
records_name: "cadcontours",
|
|
record_name: "cadcontour",
|
|
fields: [{ name: "id", dbs: "cad_imp_contour_key", typ: "key", filter: "exact" },
|
|
{ name: "name", dbs: "cad_imp_contour_nr", typ: "varchar", filter: "like" },
|
|
{ name: "cadarea", dbs: "cad_imp_contour_opp", typ: "float" },
|
|
{ name: "cadalt1", dbs: "cad_imp_contour_opp_alt1", typ: "float" },
|
|
{ name: "cadalt2", dbs: "cad_imp_contour.cad_imp_contour_opp_alt2", typ: "float" },
|
|
{ name: "concept", dbs: "cad_imp_contour_concept", typ: "number" }
|
|
],
|
|
|
|
_check_authorization: function(params, method)
|
|
{
|
|
},
|
|
_analyze_fields: function (fields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
|
{
|
|
},
|
|
REST_GET: function _GET(params, jsondata)
|
|
{
|
|
var sqlSync = " (SELECT sync.alg_ruimte_key"
|
|
+ " , c.cad_imp_contour_nr"
|
|
+ " , c.cad_imp_contour_opp"
|
|
+ " , c.cad_imp_contour_opp_alt1"
|
|
+ " , c.cad_imp_contour_opp_alt2"
|
|
+ " , c.cad_imp_contour_concept"
|
|
+ " FROM " + S("fg_syncruimteview") + " sync"
|
|
+ " , cad_imp_contour c"
|
|
+ " , cad_tekening t"
|
|
+ " WHERE sync.cadlabel = c.cad_imp_contour_nr"
|
|
+ " AND t.cad_tekening_key = c.cad_tekening_key"
|
|
+ " AND t.alg_verdieping_key = sync.alg_verdieping_key"
|
|
+ " ) contour";
|
|
|
|
model_cadcontours._check_authorization(params, "GET");
|
|
var query = api2.sqlfields(params, model_cadcontours);
|
|
|
|
var wheres = api2.sqlfilter(params, model_cadcontours);
|
|
query.wheres = query.wheres.concat(wheres);
|
|
|
|
var sql = "SELECT " + query.selects.join(", ")
|
|
+ " FROM " + query.tables.join(", ")
|
|
+ (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "")
|
|
|
|
var json = api2.sql2json (params, sql, model_cadcontours);
|
|
|
|
return json;
|
|
},
|
|
REST_PUT: function (params, jsondata, the_key) /* update cad contour */
|
|
{
|
|
},
|
|
REST_POST: function (params, jsondata) /* new cad contour */
|
|
{
|
|
},
|
|
REST_DELETE: function (params, the_key) /* delete cad contour */
|
|
{
|
|
}
|
|
}
|
|
%> |