AS
PTimer
componente que efetua busca no banco , de acordo com tempo deterinado
caso não tenha nem um resultado com o criterio passado , o timer fica buscando ate ter um resultado a retornar
achando o resultado ele para
caso não tenha nem um resultado com o criterio passado , o timer fica buscando ate ter um resultado a retornar
achando o resultado ele para
- <?php
- class PTimerView extends TPage{
- private $datagrid;
- function __construct(){
- parent::__construct();
- // cria a crid
- $this->datagrid = new TQuickGrid();
- $this->datagrid->addQuickColumn('id','id','left',70);
- $this->datagrid->addQuickColumn('nome','nome','left',70);
- $this->datagrid->addQuickColumn('telefone','telefone','left',70);
- $this->datagrid->addQuickColumn('email','email','left',70);
- $this->datagrid->createModel();
- $form = new TQuickForm();
- $form->addQuickAction('Start',new TAction(array($this,'start')));
- $box = new TVBox();
- $box->add($this->datagrid);
- $box->add($form);
- parent::add($box);
- }
- public function start(){
- $criteria = new TCriteria();
- $criteria->add(new TFilter('novo','=',true));
- $timer = new PTimer('sample','Contatos',$criteria,20);
- $obj = $timer->start();
- foreach($obj as $item):
- $this->datagrid->addItem($item);
- endforeach;
- }
- }
- link do codigo
- https://github.com/ale-php/PComponetes/blob/master/PTimer/PTimer.php