Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Dec 20, 2024
1 parent c06d2a9 commit 8353568
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
1 change: 0 additions & 1 deletion lizmap/modules/dataviz/classes/datavizPlot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*
* @license Mozilla Public License
*/

class datavizPlot
{
/**
Expand Down
35 changes: 16 additions & 19 deletions lizmap/modules/lizmap/classes/qgisVectorLayer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*
* @license Mozilla Public License : http://www.mozilla.org/MPL/
*/

use GuzzleHttp\Psr7;

class qgisVectorLayer extends qgisMapLayer
{
// layer type
Expand Down Expand Up @@ -1117,7 +1114,7 @@ public function isFeatureEditable($feature)
'PROPERTYNAME' => implode(',', $properties),
'OUTPUTFORMAT' => 'GeoJSON',
'GEOMETRYNAME' => 'none',
'EXP_FILTER' => implode(' AND ', $exp_filters)
'EXP_FILTER' => implode(' AND ', $exp_filters),
);

// Perform the request to get the editable features
Expand All @@ -1137,29 +1134,29 @@ public function isFeatureEditable($feature)
}

$featureStream = \Psr7\StreamWrapper::getResource($result->getBodyAsStream());
$features = \JsonMachine\Items::fromStream($featureStream, ['pointer' => "/features"]);
$features = \JsonMachine\Items::fromStream($featureStream, array('pointer' => '/features'));
if (iterator_count($features) !== 1) {
return false;
}

return true;
/*
// Get data
$wfsData = $result->getBodyAsString();
/*
// Get data
$wfsData = $result->getBodyAsString();
// Check data: if there is no data returned by WFS, the user has not access to it
if (!$wfsData) {
return true;
}
// Check data: if there is no data returned by WFS, the user has not access to it
if (!$wfsData) {
return true;
}
// Get data from layer
$wfsData = json_decode($wfsData);
if (count($wfsData->features) !== 1) {
return false;
}
// Get data from layer
$wfsData = json_decode($wfsData);
if (count($wfsData->features) !== 1) {
return false;
}
return true;
*/
return true;
*/
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ public function getData($form)
// Process request
$wfsResult = $wfsRequest->process();

//$data = $wfsResult->getBodyAsString();
// $data = $wfsResult->getBodyAsString();
$mime = $wfsResult->getMime();

if ($data && (strpos($mime, 'text/json') === 0
|| strpos($mime, 'application/json') === 0
|| strpos($mime, 'application/vnd.geo+json') === 0)) {
if (strpos($mime, 'text/json') === 0
|| strpos($mime, 'application/json') === 0
|| strpos($mime, 'application/vnd.geo+json') === 0) {
/*$json = json_decode($data);
// Get result from json
$features = $json->features;*/

$featureStream = \Psr7\StreamWrapper::getResource($wfsResult->getBodyAsStream());
$features = \JsonMachine\Items::fromStream($featureStream, ['pointer' => "/features"]);
$features = \JsonMachine\Items::fromStream($featureStream, array('pointer' => '/features'));
foreach ($features as $feat) {
if (property_exists($feat, 'properties')
and property_exists($feat->properties, $keyColumn)
Expand Down

0 comments on commit 8353568

Please sign in to comment.