| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('P5');
- Lib::loadClass('Core_AclHelper');
- Lib::loadClass('ACL');
- class Route_WfsJsRequestPanel extends RouteBase {
- public function defaultAction() {
- UI::gora();
- try {
- $exampleWfsRequestBody = "<wfs:Query>
- <wfs:PropertyName>ID</wfs:PropertyName>
- <wfs:PropertyName>PARENT_ID</wfs:PropertyName>
- <wfs:PropertyName>TYPE</wfs:PropertyName>
- <wfs:PropertyName>DESC</wfs:PropertyName>
- <wfs:PropertyName>OPIS</wfs:PropertyName>
- <wfs:PropertyName>path</wfs:PropertyName>
- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES</wfs:PropertyName>
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_BENEFIT_INFO</wfs:PropertyName> -->
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_GROUP_1</wfs:PropertyName> -->
- <!-- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_GROUP_2</wfs:PropertyName> -->
- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/*</wfs:PropertyName>
- <wfs:PropertyName>default_db__x3A__CRM_PROCES:PROCES_INIT/**</wfs:PropertyName>
- <wfs:PropertyName>default_db__x3A__CRM_WSKAZNIK:CRM_WSKAZNIK/*</wfs:PropertyName>
- <ogc:Filter>
- <ogc:Or>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>ID</ogc:PropertyName>
- <ogc:Literal>1003</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>ID</ogc:PropertyName>
- <ogc:Literal>608</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Or>
- </ogc:Filter>
- </wfs:Query>";
- echo '...';
- UI::startContainer();
- echo UI::h('textarea', [ 'id' => 'wfsRequestBody', 'style' => "width:100%; height:300px" ], htmlspecialchars($exampleWfsRequestBody));
- echo UI::h('button', [ 'class' => "btn btn-primary", 'onClick' => "return sendWfsRequest(this)" ], "Wyslij");
- echo UI::h('pre', [ 'id' => 'wfsResponse' ], 'loading...');
- UI::endContainer();
- echo UI::h('script', [], "
- function sendWfsRequest() {
- document.getElementById('wfsResponse').innerHTML = 'loading...'
- var postBody = document.getElementById('wfsRequestBody').value.replace(/</g, '<').replace(/>/g, '>')
- console.log('wfsRequestBody:', postBody)
- p5WFS_GetFeature('default_db__x3A__CRM_PROCES:PROCES', {
- 'ogc:Filter': postBody,
- }).then(function (features) {
- console.log('features', features)
- document.getElementById('wfsResponse').innerHTML = JSON.stringify(features, null, 2)
- }).catch(function (e) {
- console.warn(e)
- document.getElementById('wfsResponse').innerHTML = JSON.stringify(e, null, 2)
- p5UI__notifyAjaxCallback({ type: 'error', msg: e })
- })
- return false
- }
- (function () {
- console.log('p5WFS_GetFeature(default_db__x3A__CRM_PROCES:PROCES, ...)')
- sendWfsRequest()
- })()
- ");
- } catch (Exception $e) {
- UI::alert('danger', $e);
- }
- UI::dol();
- }
- }
|