Geisa-CWBPJ 1 de fev. de 2007
Geisa-CWBPJ 2 de fev. de 2007
[color="red"]Só para vcs entenderem o que eu queria fazer...
estou postando o meu código :)
Qdo clico no botão NOVO, ele vai até ao banco e me retorna o último código de atendimento cadastrado + 1, e além disso, o slider começa a funcionar, informando ao usuário qtos minutos ele vai levar para responder ao atendimento que ele acabou de abrir (em segundos).
Valeu de novo pessoal!!! [/color]
[color="#444444"][/color]Laszlo:
& lt ; canvas height =& quot ; 500 & quot ; & gt ;
& lt ; class name =& quot ; mybutton & quot ; extends =& quot ; button & quot ; & gt ;
& lt ; attribute name =& quot ; myattr & quot ; type =& quot ; string & quot ; value =& quot ; & quot ; /& gt ;
& lt ; / class & gt ;
& lt ; dataset name =& quot ; menu & quot ; src =& quot ; http & #58;//10.96.168.4/novo_chamado.php" request="true"/>
& lt ; mybutton id =& quot ; b1 & quot ; name =& quot ; b & quot ; x =& quot ; 198 & quot ; y =& quot ; 72 & quot ; text =& quot ; Novo & quot ; datapath =& quot ; menu & #58;/tabela/novo_chamado"
myattr =& quot ; $ path & #123;'cod_chamado/text()'}" onclick="b1.novoChamado()">
& lt ; method name =& quot ; novoChamado & quot ; args =& quot ; & quot ; & gt ;
var valorbutton = this . getAttribute & #40;'myattr');
t . setAttribute & #40;'text', valorbutton);
slidergeid . acao & #40;);
& lt ; / method & gt ;
& lt ; / mybutton & gt ;
& lt ; edittext width =& quot ; 80 & quot ; x =& quot ; 111 & quot ; y =& quot ; 72 & quot ; bgcolor =& quot ; 0xa0a0a0 & quot ; id =& quot ; t & quot ; /& gt ;
& lt ; slider x =& quot ; 30 & quot ; y =& quot ; 250 & quot ; width =& quot ; 300 & quot ; value =& quot ; 0 & quot ; minvalue =& quot ; 0 & quot ; maxvalue =& quot ; 300 & quot ; id =& quot ; slidergeid & quot ; name =& quot ; sliderge & quot ; & gt ;
& lt ; attribute name =& quot ; sliderDelegate & quot ; /& gt ;
& lt ; attribute name =& quot ; timeWait & quot ; value =& quot ; 1000 & quot ; type =& quot ; number & quot ; /& gt ;
& lt ; method name =& quot ; acao & quot ; & gt ; & lt ; !& #91;CDATA[
this . sliderDelegate = new LzDelegate & #40; this, "verificaValor" );
this . verificaValor & #40;);
& #93;]></method>
& lt ; method name =& quot ; verificaValor & quot ; & gt ; & lt ; !& #91;CDATA[
if & #40; this.getAttribute('value') < this.getAttribute('maxvalue') ) {
var valorAtual = this . getAttribute & #40;'value');
this . setAttribute & #40;'value', valorAtual + 1 );
& #125;
LzTimer . addTimer & #40; this.sliderDelegate, this.timeWait );
& #93;]></method>
& lt ; / slider & gt ;
& lt ; / canvas & gt ;
[color="#444444"][/color]Conexão com o banco: (PostgreSQL)
<?php
$cod_empresa = 1 ;
$conex1 = pg_connect("dbname=postgres port=5432 host=localhost user=postgres password=postgres");
if ($conex1) {
//Caso queira Imprimir na Tela a mensagem, retirar o comentário
//echo "Conectado com: " . pg_host($conex1) . "<br/> ";
}
else {
echo pg_last_error($conex1);
exit;
}
$result = pg_exec ($conex1, "select max(seq_atendimento) + 1 as novo_atendimento from hdk_instituicao
where cod_empresa = $cod_empresa");
echo "<tabela>\n";
$novo_atendimento = pg_result ($result, 0, 0);
echo "<novo_chamado>\n";
echo "<cod_chamado>".$novo_atendimento."</cod_chamado>\n";
echo "</novo_chamado>\n";
echo "</tabela>\n";
pg_close ($conex1);
?>