Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Componente de Data Boa tarde! Criei uma pagina de cadastro de projetos e nela tenho 3 campos de data, porém quando abro o projeto no navegador apenas 2 campos aparecem com o componente de pesquisa de data e um deles não tem o botão. Verifiquei no código fonte e todos estão declarados como TDate. $Abertura = new TDate('Abertura'); $DtEntrega = new TDate('DtEntrega'); $DtEncerramento = new TDate('DtEnce...
RN
Componente de Data  
Fechado
Boa tarde!
Criei uma pagina de cadastro de projetos e nela tenho 3 campos de data, porém quando abro o projeto no navegador apenas 2 campos aparecem com o componente de pesquisa de data e um deles não tem o botão.
Verifiquei no código fonte e todos estão declarados como TDate.

$Abertura = new TDate('Abertura');
$DtEntrega = new TDate('DtEntrega');
$DtEncerramento = new TDate('DtEncerramento');

Gostaria de saber oque eu poderia fazer para resolver o problema tendo em vista que já atualizei o framework e não resolveu.

Utilizei o Adianti Studio Professional para criar o modelo e a pagina.

Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (8)


AS

1 mova o post para o forun
2 cole toda a class
PD

Oi Robson,

Sem o código é difícil de perceber possíveis erros...

abs,
Pablo
RN

Controle

  1. <?php
  2. /**
  3.  * ApontamentoFormList Registration
  4.  * @author  <your name here>
  5.  */
  6. class ApontamentoFormList extends TPage
  7. {
  8.     protected $form// form
  9.     protected $datagrid// datagrid
  10.     protected $pageNavigation;
  11.     protected $loaded;
  12.     
  13.     /**
  14.      * Class constructor
  15.      * Creates the page and the registration form
  16.      */
  17.     function __construct()
  18.     {
  19.         parent::__construct();
  20.         
  21.         // create the notebook
  22.         $notebook = new TNotebook(915600);
  23.         
  24.         // creates the form
  25.         $this->form = new TForm('form_Apontamento');
  26.         
  27.         // creates a table
  28.         $table = new TTable;
  29.         
  30.         // add the table inside the form
  31.         $this->form->add($table);
  32.         
  33.         // adds the notebook page
  34.         //$notebook->appendPage('Apontamentos', $this->form);
  35.         // create the form fields
  36.         $ApontamentoID                  = new TEntry('ApontamentoID');
  37.         $ProjetoID                      = new TSeekButton('ProjetoID');
  38.         $Projeto                        = new TEntry('Projeto');
  39.         $FuncionarioID                  = new TSeekButton('FuncionarioID');
  40.         $Funcionario                    = new TEntry('Funcionario');
  41.         $Inicio                         = new TDate('Inicio');
  42.         $Fim                            = new TDate('Fim');
  43.         $Descricao                      = new TText('Descricao');
  44.         $Obs                            = new TText('Obs');
  45.         $HIni                           = new TEntry('HIni');
  46.         $HFim                           = new TEntry('HFim'); 
  47.         // define the sizes
  48.         $ApontamentoID->setSize(100);
  49.         $ProjetoID->setSize(100);
  50.         $Projeto->setSize(200);
  51.         $FuncionarioID->setSize(100);
  52.         $Funcionario->setSize(200);
  53.         $Inicio->setSize(80);
  54.         $Fim->setSize(80);
  55.         $Descricao->setSize(200);
  56.         $Obs->setSize(200);
  57.         
  58.         $HIni->setSize(40);
  59.         $HFim->setSize(40);
  60.         
  61.         $Inicio->setMask('dd/mm/yyyy');
  62.         $HIni->setMask('99:99');
  63.         $Fim->setMask('dd/mm/yyyy');
  64.         $HFim->setMask('99:99');
  65.         
  66.         $ApontamentoID->setEditable(False);
  67.         $Projeto->setEditable(False);
  68.         $Funcionario->setEditable(False);
  69.         
  70.         $obj = new TStandardSeek;
  71.         $actionP = new TAction(array($obj'onSetup'));
  72.         $actionP->setParameter('database',      'db');
  73.         $actionP->setParameter('parent',        'form_Apontamento');
  74.         $actionP->setParameter('model',         'Projeto');
  75.         $actionP->setParameter('display_field''Descricao');
  76.         $actionP->setParameter('receive_key',   'ProjetoID');
  77.         $actionP->setParameter('receive_field''Projeto');
  78.         $ProjetoID->setAction($actionP);
  79.         $obj = new TStandardSeek;
  80.         $action = new TAction(array($obj'onSetup'));
  81.         $action->setParameter('database',      'db');
  82.         $action->setParameter('parent',        'form_Apontamento');
  83.         $action->setParameter('model',         'Funcionario');
  84.         $action->setParameter('display_field''Nome');
  85.         $action->setParameter('receive_key',   'FuncionarioID');
  86.         $action->setParameter('receive_field''Funcionario');
  87.         $FuncionarioID->setAction($action);
  88.         // validations
  89.         $ProjetoID->addValidation('ProjetoID', new TRequiredValidator);
  90.         $Projeto->addValidation('Nome Projeto', new TRequiredValidator);
  91.         $FuncionarioID->addValidation('FuncionarioID', new TRequiredValidator);
  92.         $Funcionario->addValidation('Nome Funcionario', new TRequiredValidator);
  93.         $Inicio->addValidation('Inicio', new TRequiredValidator);
  94.         $Fim->addValidation('Fim', new TRequiredValidator);
  95.         $Descricao->addValidation('Descrição', new TRequiredValidator);
  96.         // add a row for the field ApontamentoID
  97.         $row=$table->addRow();
  98.         $row->addCell(new TLabel('ApontamentoID:'));
  99.         $row->addCell($ApontamentoID)->colspan=2;
  100.         // add a row for the field ProjetoID
  101.         $row=$table->addRow();
  102.         $row->addCell(new TLabel('Projeto:'));
  103.         $row->addCell($ProjetoID);
  104.         $row->addCell($Projeto);
  105.         // add a row for the field FuncionarioID
  106.         $row=$table->addRow();
  107.         $row->addCell(new TLabel('Funcionario:'));
  108.         $row->addCell($FuncionarioID);
  109.         $row->addCell($Funcionario);
  110.         // add a row for the field Inicio
  111.         $row=$table->addRow();
  112.         $row->addCell(new TLabel('Inicio:'));
  113.         $row->addCell($Inicio);
  114.         $row->addCell($HIni);
  115.         // add a row for the field Fim
  116.         $row=$table->addRow();
  117.         $row->addCell(new TLabel('Fim:'));
  118.         $row->addCell($Fim);
  119.         $row->addCell($HFim);
  120.         // add a row for the field Descricao
  121.         $row=$table->addRow();
  122.         $row->addCell(new TLabel('Descricao:'));
  123.         $row->addCell($Descricao)->colspan=2;
  124.         // add a row for the field Obs
  125.         $row=$table->addRow();
  126.         $row->addCell(new TLabel('Obs:'));
  127.         $row->addCell($Obs)->colspan=2;
  128.         // create an action button (save)
  129.         $save_button=new TButton('save');
  130.         $save_button->setAction(new TAction(array($this'onSave')), _t('Save'));
  131.         $save_button->setImage('ico_save.png');
  132.  
  133.         // create an new button (edit with no parameters)
  134.         $new_button=new TButton('new');
  135.         $new_button->setAction(new TAction(array($this'onEdit')), _t('New'));
  136.         $new_button->setImage('ico_new.png');
  137.         $this->form->setFields(array($ApontamentoID,$ProjetoID,$Projeto,$FuncionarioID,$Funcionario,
  138.                                      $Inicio,$Fim,$Descricao,$Obs,$save_button,$new_button,
  139.                                      $HIni$HFim));
  140.         
  141.         // creates a DataGrid
  142.         $this->datagrid = new TDataGrid;
  143.         $this->datagrid->setHeight(320);
  144.         
  145.         // creates the datagrid columns
  146.         $ApontamentoID   = new TDataGridColumn('ApontamentoID''ApontamentoID''left'100);
  147.         $ProjetoID   = new TDataGridColumn('ProjetoID''ProjetoID''left'100);
  148.         $Projeto   = new TDataGridColumn('ProjetoNome''Nome Projeto''left'200);
  149.         $FuncionarioID   = new TDataGridColumn('FuncionarioID''FuncionarioID''left'100);
  150.         $Funcionario   = new TDataGridColumn('FuncionarioNome''Nome Funcionario''left'200);
  151.         $Inicio   = new TDataGridColumn('Inicio''Inicio''left'100);
  152.         $Fim   = new TDataGridColumn('Fim''Fim''left'100);
  153.         $TotalHora = new TDataGridColumn('TotalHoras''Total Horas''left'100);
  154.         $Descricao   = new TDataGridColumn('Descricao''Descricao''left'200);
  155.         $Obs   = new TDataGridColumn('Obs''Obs''left'200);
  156.         
  157.         // add the columns to the DataGrid
  158.         $this->datagrid->addColumn($ApontamentoID);
  159.         $this->datagrid->addColumn($ProjetoID);
  160.         $this->datagrid->addColumn($Projeto);
  161.         $this->datagrid->addColumn($FuncionarioID);
  162.         $this->datagrid->addColumn($Funcionario);
  163.         $this->datagrid->addColumn($Inicio);
  164.         $this->datagrid->addColumn($Fim);
  165.         $this->datagrid->addColumn($TotalHora);
  166.         $this->datagrid->addColumn($Descricao);
  167.         $this->datagrid->addColumn($Obs);
  168.         
  169.         // creates two datagrid actions
  170.         $action1 = new TDataGridAction(array($this'onEdit'));
  171.         $action1->setLabel(_t('Edit'));
  172.         $action1->setImage('ico_edit.png');
  173.         $action1->setField('ApontamentoID');
  174.         
  175.         $action2 = new TDataGridAction(array($this'onDelete'));
  176.         $action2->setLabel(_t('Delete'));
  177.         $action2->setImage('ico_delete.png');
  178.         $action2->setField('ApontamentoID');
  179.         
  180.         // add the actions to the datagrid
  181.         $this->datagrid->addAction($action1);
  182.         $this->datagrid->addAction($action2);
  183.         
  184.         // create the datagrid model
  185.         $this->datagrid->createModel();
  186.         
  187.         // creates the page navigation
  188.         $this->pageNavigation = new TPageNavigation;
  189.         $this->pageNavigation->setAction(new TAction(array($this'onReload')));
  190.         $this->pageNavigation->setWidth($this->datagrid->getWidth());
  191.         
  192.         $table_buttons = new TTable;
  193.         $row_buttons $table_buttons->addRow();
  194.         $row_buttons->addCell($save_button);
  195.         $row_buttons->addCell($new_button);
  196.         
  197.         // creates the page structure using a table
  198.         $table = new TTable;
  199.         $table->addRow()->addCell($this->form);
  200.         $table->addRow()->addCell($table_buttons);
  201.         $table->addRow()->addCell($this->datagrid);
  202.         $table->addRow()->addCell($this->pageNavigation);
  203.         
  204.         // add the table inside the page
  205.         parent::add($table);
  206.         //parent::add($notebook);
  207.     }
  208.     /**
  209.      * method onReload()
  210.      * Load the datagrid with the database objects
  211.      */
  212.     function onReload($param NULL)
  213.     {
  214.         try
  215.         {
  216.             // open a transaction with database 'db'
  217.             TTransaction::open('db');
  218.             
  219.             // creates a repository for Apontamento
  220.             $repository = new TRepository('Apontamento');
  221.             $limit 10;
  222.             // creates a criteria
  223.             $criteria = new TCriteria;
  224.             $criteria->setProperties($param); // order, offset
  225.             $criteria->setProperty('limit'$limit);
  226.             
  227.             if (TSession::getValue('Apontamento_filter'))
  228.             {
  229.                 // add the filter stored in the session to the criteria
  230.                 $criteria->add(TSession::getValue('Apontamento_filter'));
  231.             }
  232.             
  233.             // load the objects according to criteria
  234.             $objects $repository->load($criteria);
  235.             
  236.             $this->datagrid->clear();
  237.             if ($objects)
  238.             {
  239.                 // iterate the collection of active records
  240.                 foreach ($objects as $object)
  241.                 {
  242.                     // add the object inside the datagrid
  243.                     $this->datagrid->addItem($object);
  244.                 }
  245.             }
  246.             
  247.             // reset the criteria for record count
  248.             $criteria->resetProperties();
  249.             $count$repository->count($criteria);
  250.             
  251.             $this->pageNavigation->setCount($count); // count of records
  252.             $this->pageNavigation->setProperties($param); // order, page
  253.             $this->pageNavigation->setLimit($limit); // limit
  254.             
  255.             // close the transaction
  256.             TTransaction::close();
  257.             $this->loaded true;
  258.         }
  259.         catch (Exception $e// in case of exception
  260.         {
  261.             // shows the exception error message
  262.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  263.             
  264.             // undo all pending operations
  265.             TTransaction::rollback();
  266.         }
  267.     }
  268.     
  269.     /**
  270.      * method onDelete()
  271.      * executed whenever the user clicks at the delete button
  272.      * Ask if the user really wants to delete the record
  273.      */
  274.     function onDelete($param)
  275.     {
  276.         // define the delete action
  277.         $action = new TAction(array($this'Delete'));
  278.         $action->setParameters($param); // pass the key parameter ahead
  279.         
  280.         // shows a dialog to the user
  281.         new TQuestion(TAdiantiCoreTranslator::translate('Do you really want to delete ?'), $action);
  282.     }
  283.     
  284.     /**
  285.      * method Delete()
  286.      * Delete a record
  287.      */
  288.     function Delete($param)
  289.     {
  290.         try
  291.         {
  292.             // get the parameter $key
  293.             $key=$param['key'];
  294.             // open a transaction with database 'db'
  295.             TTransaction::open('db');
  296.             
  297.             // instantiates object Apontamento
  298.             $object = new Apontamento($key);
  299.             
  300.             // deletes the object from the database
  301.             $object->delete();
  302.             
  303.             // close the transaction
  304.             TTransaction::close();
  305.             
  306.             // reload the listing
  307.             $this->onReload$param );
  308.             // shows the success message
  309.             new TMessage('info'TAdiantiCoreTranslator::translate('Record deleted'));
  310.         }
  311.         catch (Exception $e// in case of exception
  312.         {
  313.             // shows the exception error message
  314.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  315.             
  316.             // undo all pending operations
  317.             TTransaction::rollback();
  318.         }
  319.     }
  320.     
  321.     /**
  322.      * method onSave()
  323.      * Executed whenever the user clicks at the save button
  324.      */
  325.     function onSave()
  326.     {
  327.         try
  328.         {
  329.             // open a transaction with database 'db'
  330.             TTransaction::open('db');
  331.             
  332.             // get the form data into an active record Apontamento
  333.             $data $this->form->getData();
  334.             
  335.             // form validation
  336.             $this->form->validate();
  337.             
  338.             $object = new Apontamento;
  339.             
  340.             $object->ApontamentoID $data->ApontamentoID;
  341.             $object->ProjetoID $data->ProjetoID;
  342.             $object->FuncionarioID $data->FuncionarioID;
  343.             $object->Inicio TDate::date2us($data->Inicio). ' ' .$data->HIni;
  344.             $object->Fim TDate::date2us($data->Fim). ' ' .$data->HFim;
  345.             $object->Descricao $data->Descricao;
  346.             $object->Obs $data->Obs;
  347.             
  348.             // stores the object
  349.             $object->store();
  350.             
  351.             $data->ApontamentoID $object->ApontamentoID;
  352.             
  353.             // fill the form with the active record data
  354.             $this->form->setData($data);
  355.             
  356.             // close the transaction
  357.             TTransaction::close();
  358.             
  359.             // shows the success message
  360.             new TMessage('info'TAdiantiCoreTranslator::translate('Record saved'));
  361.             // reload the listing
  362.             $this->onReload();
  363.         }
  364.         catch (Exception $e// in case of exception
  365.         {
  366.             // shows the exception error message
  367.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  368.             
  369.             // undo all pending operations
  370.             TTransaction::rollback();
  371.         }
  372.     }
  373.     
  374.     /**
  375.      * method onEdit()
  376.      * Executed whenever the user clicks at the edit button da datagrid
  377.      */
  378.     function onEdit($param)
  379.     {
  380.         try
  381.         {
  382.             if (isset($param['key']))
  383.             {
  384.                 // get the parameter $key
  385.                 $key=$param['key'];
  386.                 
  387.                 // open a transaction with database 'db'
  388.                 TTransaction::open('db');
  389.                 
  390.                 // instantiates object Apontamento
  391.                 $object = new Apontamento($key);
  392.                 
  393.                 $data = new stdClass;
  394.                 
  395.                 // Instancia o objeto DateTime com o formato recebido, dito, original
  396.                 $objDateIni DateTime::createFromFormat('Y-m-d H:i:s'$object->Inicio);
  397.                 $objDateFim DateTime::createFromFormat('Y-m-d H:i:s'$object->Fim);
  398.                 $data->ApontamentoID $object->ApontamentoID;
  399.                 $data->ProjetoID $object->ProjetoID;
  400.                 $data->Projeto $object->ProjetoNome;
  401.                 $data->FuncionarioID $object->FuncionarioID;
  402.                 $data->Funcionario $object->FuncionarioNome;
  403.                 $data->Inicio $objDateIni->format('d/m/Y');
  404.                 $data->Fim $objDateFim->format('d/m/Y');
  405.                 $data->HIni $objDateIni->format('H:i');
  406.                 $data->HFim $objDateFim->format('H:i');
  407.                 $data->Descricao $object->Descricao;
  408.                 $data->Obs $object->Obs;
  409.                     
  410.                 // fill the form with the active record data
  411.                 $this->form->setData($data);
  412.                 
  413.                 // close the transaction
  414.                 TTransaction::close();
  415.             }
  416.             else
  417.             {
  418.                 $this->form->clear();
  419.             }
  420.         }
  421.         catch (Exception $e// in case of exception
  422.         {
  423.             // shows the exception error message
  424.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  425.             
  426.             // undo all pending operations
  427.             TTransaction::rollback();
  428.         }
  429.     }
  430.     
  431.     /**
  432.      * method show()
  433.      * Shows the page e seu conteúdo
  434.      */
  435.     function show()
  436.     {
  437.         // check if the datagrid is already loaded
  438.         if (!$this->loaded)
  439.         {
  440.             $this->onReloadfunc_get_arg(0) );
  441.         }
  442.         parent::show();
  443.     }
  444. }
  445. ?>



Modelo

  1. <?php
  2. /**
  3.  * Apontamentos Active Record
  4.  * @author  <your-name-here>
  5.  */
  6. class Apontamento extends TRecord
  7. {
  8.     const TABLENAME 'apontamentos';
  9.     const PRIMARYKEY'ApontamentoID';
  10.     const IDPOLICY =  'max'// {max, serial}
  11.     
  12.     private $funcionario;
  13.     private $projeto;
  14.     /**
  15.      * Constructor method
  16.      */
  17.     public function __construct($id NULL)
  18.     {
  19.         parent::__construct($id);
  20.         parent::addAttribute('ProjetoID');
  21.         parent::addAttribute('FuncionarioID');
  22.         parent::addAttribute('Inicio');
  23.         parent::addAttribute('Fim');
  24.         parent::addAttribute('Descricao');
  25.         parent::addAttribute('Obs');
  26.     }
  27.     
  28.     /**
  29.      * Method set_funcionario
  30.      * Sample of usage: $apontamentos->funcionario = $object;
  31.      * @param $object Instance of Funcionario
  32.      */
  33.     public function set_funcionario(Funcionario $object)
  34.     {
  35.         $this->funcionario $object;
  36.         $this->funcionarioID $object->FuncionarioID;
  37.     }
  38.     
  39.     /**
  40.      * Method get_funcionario
  41.      * Sample of usage: $apontamentos->funcionario->attribute;
  42.      * @returns Funcionario instance
  43.      */
  44.     public function get_funcionario()
  45.     {
  46.         // loads the associated object
  47.         if (empty($this->funcionario))
  48.             $this->funcionario = new Funcionario($this->FuncionarioID);
  49.     
  50.         // returns the associated object
  51.         return $this->funcionario;
  52.     }
  53.     
  54.     public function get_FuncionarioNome()
  55.     {
  56.         // loads the associated object
  57.         if (empty($this->funcionario))
  58.             $this->funcionario = new Funcionario($this->FuncionarioID);
  59.     
  60.         // returns the associated object
  61.         return $this->funcionario->Nome;
  62.        
  63.     }
  64.     
  65.     /**
  66.      * Method set_projeto
  67.      * Sample of usage: $apontamentos->projeto = $object;
  68.      * @param $object Instance of Projeto
  69.      */
  70.     public function set_projeto(Projeto $object)
  71.     {
  72.         $this->projeto $object;
  73.         $this->projetoID $object->ProjetoID;
  74.     }
  75.     
  76.     /**
  77.      * Method get_projeto
  78.      * Sample of usage: $apontamentos->projeto->attribute;
  79.      * @returns Projeto instance
  80.      */
  81.     public function get_projeto()
  82.     {
  83.         // loads the associated object
  84.         if (empty($this->projeto))
  85.             $this->projeto = new Projeto($this->ProjetoID);
  86.     
  87.         // returns the associated object
  88.         return $this->projeto;
  89.     }
  90.     public function get_Nome()
  91.     {
  92.        if (empty($this->funcionario))
  93.             $this->funcionario = new Funcionario($this->FuncionarioID);
  94.             
  95.        return $this->funcionario->Nome;
  96.     }
  97.     
  98.     public function get_ProjetoNome()
  99.     {
  100.         // loads the associated object
  101.         if (empty($this->projeto))
  102.             $this->projeto = new Projeto($this->ProjetoID);
  103.     
  104.         // returns the associated object
  105.         return $this->projeto->Descricao;
  106.        
  107.     }
  108.     
  109.     public function get_TotalHoras()
  110.     {
  111.        $Ini DateTime::createFromFormat('Y-m-d H:i:s'$this->Inicio);
  112.        $Fim DateTime::createFromFormat('Y-m-d H:i:s'$this->Fim);
  113.        
  114.        $Total $Fim->diff($Ini);
  115.        //$datetime1 = strtotime($this->Inicio);
  116.        //$datetime2 = strtotime($this->Fim);
  117.        //$Total  = abs($datetime2 - $datetime1);
  118.        //$minutes   = (($Total / 60)/60);
  119.        
  120.        return $Total->format('%H:%I'); 
  121.     }
  122. }
  123. ?>
</your>
AS

cara so vi 2 campos

$this->datagrid->addColumn($Inicio);
$this->datagrid->addColumn($Fim);

você deve postado o contoler errado
PD

Robson,

Para mim aqui funcionou e os dois campos de data que tinha no código da controller foram exibidos. Eu só não rodei tudo pq não tenho o teu BD.

Mas cuide para um detalhe, você está reaproveitando variáveis. Você usou $Inicio para um TDate e depois para uma TDataGridColumn. Não é uma boa prática...

abraço,
Pablo
VV

Pessoal, o que vou dizer pode parecer estranho, mas acho que é algum bug do componente (TDate) relacionado à versão do PHP. Acontece que tenho um projeto, que, as páginas com mais de um componente data, funcionam perfeitamente na minha máquina (servidor Vertrigo, com PHP 5.5.28). Porém, quando mando a aplicação (fiz isso várias vezes) para o servidor da Redehost (PHP PHP 5.3 ou PHP 5.4), tais páginas ficam "bugadas". Exemplo: tenho uma tela com dois componentes TDate para seleção de um período. Pois bem, no Redehost, os dois aparecem em linhas diferentes (apesar de ter sido usado um AddRowSet, e quando seleciono a data com o ícone do segundo componente, ele seta a data no primeiro!
As páginas com mais de um componente TDate ficam "bugadas".
Chamo a atenção para o fato de que na minha máquina, funciona perfeitamente, o que me levou à suspeita da versão do PHP.
VV

Pesquisando um pouco mais, achei a resposta aqui no site mesmo...

www.adianti.com.br/forum/pt/view_1695?bugduvida-usando-dois-tdate-no

Porém, comigo só "matou" o problema quando usei:
$this->id = 'tdate_'.date("Hisu").rand(0,100);
no construtor de TDate

Ainda não entendo porque no minha máquina funcionou normalmente, mas...
PD

A função uniqid() tem problemas em algumas versões do PHP para Windows.
Na versão nova, que será lançada em breve, trocamos tudo para mt_rand().
Basta aguardar alguns dias, já está tudo resolvido nativamente.