[Cartoweb-users] Filter
Alexandre Saunier
alexandre.saunier at camptocamp.com
Wed Oct 4 09:41:20 EDT 2006
Hello,
you have to write a new plugin that will:
- cartoclient side : retrieve the filter criteria from your web form and
send a matching request to the cartoserver
- cartoserver side : retrieve the request sent by the cartoclient and
build the matching MapScript filters.
Briefly (classes names are examples):
* plugin client part :
class ClientFilters extends ClientPlugin
implements ServerCaller, GuiProvider {
public function handleHttpPostRequest($request) {
// retrieves the criteria from the webform
}
public function renderForm($smarty) {
// builds your web form
}
public function buildRequest() {
// sends request to cartoserver
$filterRequest = new FilterRequest;
$filterRequest->month = 'January';
$filterRequest->layer = 'FIRES';
return $filterRequest
}
}
* plugin server part
class ServerRequest extends ServerPlugin
implements ClientResponder {
public function initializeRequest($requ) {
$msMapObj = $this->serverContext->getMapObj();
for ($i = 0; $i < $msMapObj->numlayers; $i++) {
$msLayer = $msMapObj->getLayer($i);
if ($msLayer->name == $requ->layer) {
$filter = sprintf("month = '%s'",
$requ->month);
$msLayer->setFilter($filter);
}
}
}
}
* in the common part you have to define the FilterRequest and
FilterResult objects. FilterResult is probably a void class (nothing to
return).
AS
Adriano Hantequeste Gomes wrote:
> Hello,
>
> Sorry but my english is not very well. But i try explan:
>
> For exemple I can select on combox "Mouth", January, after click on
> "OK". In shape "FIRES" exists a field "Mouth". After I can display
> only "FIRES" of the January.
>
> OK?
More information about the Cartoweb-users
mailing list