Skip to content

Commit

Permalink
[PHP] Utilisation de la méthode de projet getLoginFilter suite
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Oct 6, 2023
1 parent 46a1c6f commit ea9a274
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 74 deletions.
34 changes: 15 additions & 19 deletions cadastre/classes/listGeoCommuneDatasource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,23 @@ public function getData($form)
$layerConditions = null;
$layerSql = cadastreConfig::getLayerSql($repository, $project, $config->commune->id);
$polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->commune->id);
if ($layerSql !== null && $polygonFilter !== null) {
$layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')';
} elseif ($layerSql !== null) {
$layerConditions = $layerSql;
} elseif ($polygonFilter !== null) {
$layerConditions = $polygonFilter;
$loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id);
$layerFilters = [];
if ($layerSql !== null) {
$layerFilters[] = $layerSql;
}
$fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->commune->id);

$searchConditions = jDao::createConditions();
if ($fblConfig !== null) {
$filterValues = array('all');
if (jAuth::isConnected()) {
if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') {
$user = jAuth::getUserSession();
$filterValues[] = $user->login;
} else {
$filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups());
}
if ($polygonFilter !== null) {
$layerFilters[] = $polygonFilter;
}
if ($loginFilter !== null) {
$layerFilters[] = $loginFilter;
}
if (count($layerFilters) != 0) {
if (count($layerFilters) == 1) {
$layerConditions = $layerFilters[0];
} else {
$layerConditions = '(' . implode(') AND (', $layerFilters) . ')';
}
$searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues);
}

foreach ((array) $this->labelProperty as $property) {
Expand Down
33 changes: 15 additions & 18 deletions cadastre/classes/listGeoSectionDatasource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,23 @@ public function getData($form)
$layerConditions = null;
$layerSql = cadastreConfig::getLayerSql($repository, $project, $config->section->id);
$polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->section->id);
if ($layerSql !== null && $polygonFilter !== null) {
$layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')';
} elseif ($layerSql !== null) {
$layerConditions = $layerSql;
} elseif ($polygonFilter !== null) {
$layerConditions = $polygonFilter;
$loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id);
$layerFilters = [];
if ($layerSql !== null) {
$layerFilters[] = $layerSql;
}
$fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->section->id);

if ($fblConfig !== null) {
$filterValues = array('all');
if (jAuth::isConnected()) {
if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') {
$user = jAuth::getUserSession();
$filterValues[] = $user->login;
} else {
$filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups());
}
if ($polygonFilter !== null) {
$layerFilters[] = $polygonFilter;
}
if ($loginFilter !== null) {
$layerFilters[] = $loginFilter;
}
if (count($layerFilters) != 0) {
if (count($layerFilters) == 1) {
$layerConditions = $layerFilters[0];
} else {
$layerConditions = '(' . implode(') AND (', $layerFilters) . ')';
}
$searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues);
}

foreach ((array) $this->labelProperty as $property) {
Expand Down
33 changes: 15 additions & 18 deletions cadastre/classes/listParcelleLieuNoMajicDatasource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,23 @@ public function getData($form)
$layerConditions = null;
$layerSql = cadastreConfig::getLayerSql($repository, $project, $config->parcelle->id);
$polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->parcelle->id);
if ($layerSql !== null && $polygonFilter !== null) {
$layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')';
} elseif ($layerSql !== null) {
$layerConditions = $layerSql;
} elseif ($polygonFilter !== null) {
$layerConditions = $polygonFilter;
$loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id);
$layerFilters = [];
if ($layerSql !== null) {
$layerFilters[] = $layerSql;
}
$fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->parcelle->id);

if ($fblConfig !== null) {
$filterValues = array('all');
if (jAuth::isConnected()) {
if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') {
$user = jAuth::getUserSession();
$filterValues[] = $user->login;
} else {
$filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups());
}
if ($polygonFilter !== null) {
$layerFilters[] = $polygonFilter;
}
if ($loginFilter !== null) {
$layerFilters[] = $loginFilter;
}
if (count($layerFilters) != 0) {
if (count($layerFilters) == 1) {
$layerConditions = $layerFilters[0];
} else {
$layerConditions = '(' . implode(') AND (', $layerFilters) . ')';
}
$searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues);
}

foreach ((array) $this->labelProperty as $property) {
Expand Down
35 changes: 16 additions & 19 deletions cadastre/classes/listParcellePropDatasource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,23 @@ public function getData($form)
$layerConditions = null;
$layerSql = cadastreConfig::getLayerSql($repository, $project, $config->parcelle->id);
$polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->parcelle->id);
if ($layerSql !== null && $polygonFilter !== null) {
$layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')';
} elseif ($layerSql !== null) {
$layerConditions = $layerSql;
} elseif ($polygonFilter !== null) {
$layerConditions = $polygonFilter;
}
$fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->parcelle->id);

if ($fblConfig !== null) {
$filterValues = array('all');
if (jAuth::isConnected()) {
if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') {
$user = jAuth::getUserSession();
$filterValues[] = $user->login;
} else {
$filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups());
}
$loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id);
$layerFilters = [];
if ($layerSql !== null) {
$layerFilters[] = $layerSql;
}
if ($polygonFilter !== null) {
$layerFilters[] = $polygonFilter;
}
if ($loginFilter !== null) {
$layerFilters[] = $loginFilter;
}
if (count($layerFilters) != 0) {
if (count($layerFilters) == 1) {
$layerConditions = $layerFilters[0];
} else {
$layerConditions = '(' . implode(') AND (', $layerFilters) . ')';
}
$searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues);
}

foreach ((array) $this->labelProperty as $property) {
Expand Down

0 comments on commit ea9a274

Please sign in to comment.