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 12, 2023
1 parent 828b6b8 commit d7b42f4
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 74 deletions.
35 changes: 16 additions & 19 deletions cadastre/classes/listGeoCommuneDatasource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,26 @@ 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 = array();
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);
}

$searchConditions = jDao::createConditions();
foreach ((array) $this->labelProperty as $property) {
$searchConditions->addItemOrder($property, 'asc');
}
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 @@ -42,26 +42,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 = array();
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 @@ -42,26 +42,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 = array();
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 @@ -57,26 +57,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 = array();
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 d7b42f4

Please sign in to comment.