[Cartoweb-users] Filter Error

Oliver Christen oliver.christen at camptocamp.com
Thu Oct 5 02:16:23 EDT 2006


hi Adriano

you are missing the "common" part of the plugin

at the same place you have the "client" and "server" folder, create a new 
folder named "common"

there create a new file named Filtro.php and copy this into:

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

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

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

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

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

?>

also, in ServerFiltro.php, you must rename the class to "ServerFiltro"

and in ClientFiltro.php there was a few error when declaring, accessing and 
seting some variable. See below the corrected 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->layer = 'COMPLETO2004';
        return $filterRequest;
    }

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

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

}
?>

For the rest, I will let you see yourself.

Regards
Oliver







More information about the Cartoweb-users mailing list