[Cartoweb-users] Filter Error

Oliver Christen oliver.christen at camptocamp.com
Fri Oct 6 01:43:04 EDT 2006


$_POST["mes"]; does not exist
try $this->mes = isset($_POST["mes"]) ? $_POST["mes"] : '';
which means: "if $_POST["mes"] is set, use it, otherwise use an empty 
string"
do the same for the others !



----- Original Message ----- 
From: "Adriano Hantequeste Gomes" <adrianohg at gmail.com>
To: "Oliver Christen" <oliver.christen at camptocamp.com>
Cc: "CartoWeb Lista de Usuários" <cartoweb-users at lists.maptools.org>
Sent: Thursday, October 05, 2006 4:46 PM
Subject: Re: [Cartoweb-users] Filter Error


Hi,


When a try any function (zoom in, zoom out, pan, choose layer) on map
retry this errors:


###########################################################

Class : CartocommonExceptionMessage : Error [8, Undefined index:  mes,
C:\wamp\www\cartoweb3\plugins\filtro\client\ClientFiltro.php, 17]
Backtrace:

file: 17 - C:\wamp\www\cartoweb3\plugins\filtro\client\ClientFiltro.php
call: Common::cartowebErrorHandler(8, "Undefined index:  mes",
"C:\wamp\www\cartoweb3\plugins\filtro\client\ClientFiltro.php", 17,
Array(1))

file: UNKNOWN - UNKNOWN
call: ClientFiltro->handleHttpPostRequest(Array(25))

file: 270 - C:\wamp\www\cartoweb3\common\PluginManager.php
call: call_user_func_array(Array(2), Array(1))

file: 320 - C:\wamp\www\cartoweb3\common\PluginManager.php
call: PluginManager->callPluginImplementing(Object(ClientFiltro),
"GuiProvider", "handleHttpPostRequest", Array(1))

file: 685 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: PluginManager->callEnabledPluginsImplementing(1, "GuiProvider",
"handleHttpPostRequest", Array(1))

file: 995 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: Cartoclient->callEnabledPluginsImplementing(1, "GuiProvider",
"handleHttpPostRequest", Array(25))

file: 1220 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: Cartoclient->doMain()

file: 38 - C:\wamp\www\cartoweb3\htdocs\client.php
call: Cartoclient->main()

file: 10 - C:\wamp\www\cartoweb3\htdocs\geo.php
call: require_once("C:\wamp\www\cartoweb3\htdocs\client.php")

###########################################################


ClientFiltro.php code:

%%%%%%%%%%%%%%%%%%%%%%
<?php
class ClientFiltro extends ClientPlugin
                   implements ServerCaller, GuiProvider {

   private $classe;
   private $mes;
   private $incid;
   private $incidente;

  public function handleHttpGetRequest($request) {

  }


  public function handleHttpPostRequest($request) {

$this->mes       = $_POST["mes"];
$this->classe    = $_POST["classe"];
$this->incid     = $_POST["incidente"];
$this->incidente = strtoupper($incid);

  }

  public function renderForm(Smarty $template) {

echo '<!-- Inicio do Filtro -->';
echo '<div id="Layer1" style="position:absolute; left:358px;
top:66px; width:511px; height:27px; z-index:1">';
echo '  <form action="geo.php" method="post" name="filtra">';
echo '  <table border="0" cellspacing="0" cellpadding="0">';
echo '    <tr>';
echo '      <td>M&ecirc;s: ';
echo '        <select name="mes">';
echo '        <option value="">Escolha um M&ecirc;s</option>';
echo '        <option value="1">Janeiro</option>';
echo '        <option value="2">Fevereiro</option>';
echo '        <option value="3">Mar&ccedil;o</option>';
echo '        <option value="4">Abril</option>';
echo '        <option value="5">Maio</option>';
echo '        <option value="6">Junho</option>';
echo '        <option value="7">Julho</option>';
echo '        <option value="8">Agosto</option>';
echo '        <option value="9">Setembro</option>';
echo '        <option value="10">Outubro</option>';
echo '        <option value="11">Novembro</option>';
echo '        <option value="12">Dezembro</option>';
echo '      </select>&nbsp;</td>';
echo '      <td>Classe: <select name="classe">';
echo '       <option value="">Escolha uma Classe</option>';
echo '        <option value="A">Pessoa</option>';
echo '        <option value="B">Patrimonio</option>';
echo '        <option value="C">Costumes</option>';
echo '        <option value="D">Adm. Publica</option>';
echo '        <option value="E">Toxico</option>';
echo '        <option value="F">Armas e Municoes</option>';
echo '        <option value="G">Diversos</option>';
echo '        <option value="H">Contravencoes</option>';
echo '        <option value="I">Transito</option>';
echo '        <option value="J">Bombeiro</option>';
echo '      </select>&nbsp;</td>';
echo '      <td>Incidente: <input name="incidente" type="text"
size="4" maxlength="4" /></td>';
echo '      <td><input name="submit" type="submit" id="submit"
value="Ok" /></td>';
echo '    </tr>';
echo '  </table>';
echo '</form></div>';
echo '<!-- Fim do Filtro -->';

   }

  public function buildRequest() {

$filterRequest = new FilterRequest;
$filterRequest->classe = $this->classe;
$filterRequest->incidente = $this->incidente;
$filterRequest->mes = $this->mes;
$filterRequest->layer = 'COMPLETO2005';
$filterRequest->layer = 'COMPLETO2004';
return $filterRequest;
  }

   /**
    * @see ServerCaller::initializeResult()
    */
  public function initializeResult($imagesResult) {}

   /**
    * @see ServerCaller::handleResult()
    */
  public function handleResult($imagesResult) {}

}
?>

%%%%%%%%%%%%%%%%%%%%%%


ServerFiltro.php Code:

%%%%%%%%%%%%%%%%%%%%%%
<?php
class ServerFiltro extends ServerPlugin
                    implements ClientResponder {

public function initializeResult($request) {

}

public function handleResult($request) {

}

    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("classe = '%s'",
                                  $requ->classe);
                $msLayer->setFilter($filter);
            }
        }
    }
}
?>

%%%%%%%%%%%%%%%%%%%%%%


Filtro.php code:

%%%%%%%%%%%%%%%%%%%%%%
<?php
/**
 * Abstract serializable
 */
require_once(CARTOWEB_HOME . 'common/CwSerializable.php');

/**
 * An Image
 * @package CorePlugins
 */
class FilterRequest extends CwSerializable {

   /**
    * ?
    * @var string
    */
   public $classe;
   public $mes;
   public $incidente;

   /**
    * ?
    * @var string
    */
   public $layer;

   /**
    * @see CwSerializable::unserialize()
    */
   public function unserialize($struct) {
       $this->path = self::unserializeValue($struct, 'mes');
       $this->path = self::unserializeValue($struct, 'classe');
       $this->path = self::unserializeValue($struct, 'incidente');
       $this->path = self::unserializeValue($struct, 'layer');
   }
}

?>
%%%%%%%%%%%%%%%%%%%%%%




Very Thanks All
-- 
Atenciosamente,
Adriano Hantequeste Gomes
Departamento de Geoprocessamento - GEO
Gerência de Estatística e Analise Criminal - GEAC
Secretaria de Estado da Segurança Pública e Defesa Social - SESP
Av. Marechal Mascarenhas de Moraes, 2355
Bento Ferreira - Vitória - Espírito Santo
CEP: 29.052-121
Telefone: 55 27 3334-4736
Fax:       55 27 3334-4735
Celular:   55 27 9225-4852



More information about the Cartoweb-users mailing list