Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Fomulario com Imagem Será que alguem poderia me dar um exemplo de um formulario com imagem que o caminho desta imagem venha da base de dados....
LJ
Fomulario com Imagem  
Fechado
Será que alguem poderia me dar um exemplo de um formulario com imagem que o caminho desta imagem venha da base de dados.

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 (12)


LJ

Fiz um formulário simples porem esta dando o seguinte erro:

Erro: Argument 1 passed to TForm::addField must implement interface
IWidget, instance of TImage given, called in
C:siterenomearlibadiantiwidgetwebformTForm.class.php
on line 196

  1. <?php
  2. /**
  3.  * ProductForm Registration
  4.  *
  5.  * @version    1.0
  6.  * @package    samples
  7.  * @subpackage library
  8.  * @author     Pablo DallOglio
  9.  * @copyright  Copyright (c) 2006-2011 Adianti Solutions Ltd. (http://www.adianti.com.br)
  10.  * @license    http://www.adianti.com.br/framework-license
  11.  */
  12. class ProductForm extends TPage
  13. {
  14.     private $form// form
  15.     /**
  16.      * Class constructor
  17.      * Creates the page and the registration form
  18.      */
  19.     function __construct()
  20.     {
  21.         parent::__construct();
  22.         
  23.         // creates the form
  24.         $this->form = new TForm('form_Product');
  25.         // creates a table
  26.         $table = new TTable;
  27.         $table_buttons = new TTable;
  28.         
  29.          // add the table inside the form
  30.         $this->form->add($table);       
  31.    
  32.         // create the form fields
  33.         $id                     = new TEntry('id');
  34.         $name                   = new TEntry('name');
  35.         $image            = new TImage('image');
  36.         
  37.      
  38.         $name->setSize(200);
  39.         $row=$table->addRow();
  40.         $row->addCell(new TLabel('Id:'));
  41.         $cell=$row->addCell($id);
  42.         $cell->colspan=2;
  43.         // add a row for the field nome
  44.         $row=$table->addRow();
  45.         $row->addCell(new TLabel('Nome:'));
  46.         $cell=$row->addCell($name);
  47.         $cell->colspan=2;
  48.        
  49.         // add a row for the field imagem
  50.         $row=$table->addRow();
  51.         $row->addCell(new TLabel('Imagem:'));
  52.         $cell=$row->addCell($image);
  53.     $cell->colspan=2;
  54.         
  55.     
  56.         // create an action button (go to list)
  57.         $goto_button=new TButton('list');
  58.         // define the button action
  59.         $goto_button->setAction(new TAction(array('ProductDataGridView''onReload')), 'Listagem');
  60.         $goto_button->setImage('ico_datagrid.gif');
  61.         
  62.         // add a row for the form action
  63.         $row=$table_buttons->addRow();
  64.         $row->addCell($goto_button);
  65.         
  66.         // add a row for the form action
  67.         $row=$table->addRow();
  68.         $cell=$row->addCell($table_buttons);
  69.         $cell->colspan=3;
  70.         // define wich are the form fields
  71.         $this->form->setFields(array($id,$name,$image,$goto_button));
  72.         // add the form to the page
  73.         parent::add($this->form);
  74.     }
  75.  
  76.     /**
  77.      * method onEdit()
  78.      * Executed whenever the user clicks at the edit button da datagrid
  79.      */
  80.     function onEdit($param)
  81.     {
  82.         try
  83.         {
  84.             if (isset($param['key']))
  85.             {
  86.                 // get the parameter $key
  87.                 $key=$param['key'];
  88.                 // open a transaction with database 'fotos'
  89.                 TTransaction::open('fotos');
  90.                 // instantiates object Book
  91.                 $object = new Product($key);
  92.                 // fill the form with the active record data
  93.                 $this->form->setData($object);
  94.                 TTransaction::close();
  95.             }
  96.             else
  97.             {
  98.                 $this->form->clear();
  99.             }
  100.         }
  101.         catch (Exception $e// in case of exception
  102.         {
  103.             // shows the exception error message
  104.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  105.             // undo all pending operations
  106.             TTransaction::rollback();
  107.         }
  108.     }
  109. }
  110. ?>

AS

opa, pelo que entendi você quer fazer um formulario com upload de imagem?, é isso?
MS

O $image não deve estar no array do addFields(), por isso está ocorrendo este erro.
LJ

Alexandre, o que eu preciso é apenas ver a foto, dentro de um célula da tabela, terão outros campos no formulário, onde vou descrever o que vejo na foto, mas removi os outros campos pois a única coisa que não esta funcionando é ver a foto.
LJ

Mailson, removendo o $image do addFields(), realmente não dá o erro, mas mesmo assim, não aparece a foto.
no meu BD no campo image tem o caminho e nome da foto:, tipo : app/images/tf2/LJ13TF2VL0001.jpg
MS

Eu também estou com a mesma situação que você, carregando no construtor a foto aparece mas no onEdit() ela não é exibida. Vou continuar tentando se eu encontrar uma solução eu posto aqui.
Abraço.
MS

Consegui resolver o problema, o que eu precisei fazer foi adicionar a imagem a um div e então adicionar o div a table e não a imagem direto. Funcionou perfeitamente para mim.

No método construtor fica assim
$this->divFoto = new TElement('div'); $this->divFoto->id = 'divFoto'; $this->divFoto->style = "width:100px;height:100px"; $this->imgFoto = new TElement('img'); $this->imgFoto->src = ""; $this->imgFoto->style = "width:100px;height:100px"; $this->divFoto->add($this->imgFoto);


No método "onEdit()", após o "setData()":
$this->imgFoto->src = "app/images/{$empresa}/{$nomeImg}.png";
MS

Lembrando que apenas o $this->divFoto deve ser adicionado a table que será exibida no formulário.
LJ

Mailson, muito obrigado, funcionou !!!

a unica coisa que tive que mudar e não sei porque foi no metodo edit:
No método "onEdit()", após o "setData()":

$this->imgFoto->src = "app/images/{$empresa}/{$nomeImg}.png";

alterei para :

$object = new Product($key) // fill the form with the active record data $this->form->setData($object);
$this->imgFoto->src = "app/images/".$object->corrida."/".$object->name.".jpg";
FS

Amigos gostaria de saber como posso implementar no meu código essa solução que foi dita pelo Mailson da Silva.
Não consigo fazer a imagem aparecer na página.

  1. <?php
  2. class ExameFisicoVisaoForm extends TPage
  3. {
  4.     
  5.     private $form;
  6.     function __construct()
  7.     {
  8.         
  9.         parent::__construct();
  10.         
  11.         $this->notebook = new TNotebook;
  12.         $this->notebook->setSize(950420);
  13.         
  14.         $this->form = new TForm('Examefisico');
  15.         $table     = new TTable;
  16.              
  17.         $this->form->add($this->notebook);
  18.         
  19.         $id                             = new TEntry('id');
  20.         $imagem                         = new TImage('imagem');
  21.         
  22.         
  23.         
  24.         
  25.         $table->addRowSet('Imagem'$imagem);
  26.         
  27.         
  28.        
  29.         $salvar_button = new TButton('salvar');
  30.         $salvar_button->setAction(new TAction(array($this'onSave')), 'Salvar');
  31.         $salvar_button->setImage('ico_save.png');
  32.         
  33.         $novo_button=new TButton('novo');
  34.         $novo_button->setAction(new TAction(array($this'onEdit')), 'Novo');
  35.         $novo_button->setImage('ico_new.png');
  36.         
  37.         $listar_button=new TButton('listar');
  38.         $listar_button->setAction(new TAction(array('ExameFisicoVisaoGrade''onReload')), 'Listagem');
  39.         $listar_button->setImage('ico_datagrid.png');
  40.              
  41.         
  42.         $this->form->setFields(array($id$salvar_button$novo_button$listar_button));
  43.         
  44.         
  45.         $this->notebook->appendPage(('Exame Fisico'), $table);
  46.         
  47.         
  48.         
  49.         $table_buttons = new TTable;
  50.         $row_buttons $table_buttons->addRow();
  51.         $row_buttons->addCell($salvar_button);
  52.         $row_buttons->addCell($novo_button);
  53.         $row_buttons->addCell($listar_button);
  54.         
  55.         
  56.         $container = new TTable;
  57.         $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml''ExameFisicoVisaoForm'));
  58.         $container->addRow()->addCell($this->form);
  59.         $container->addRow()->addCell($table_buttons);
  60.         
  61.         
  62.         parent::add($container);
  63.     }
  64.     
  65.   
  66.     function onSave()
  67.     {
  68.         try
  69.         {
  70.             
  71.             TTransaction::open('conexao');
  72.             $object $this->form->getData('Examefisico');
  73.             $this->form->validate(); 
  74.             $object->store(); 
  75.             $this->form->setData($object);
  76.             
  77.             TTransaction::close();
  78.             
  79.             
  80.             new TMessage('info'TAdiantiCoreTranslator::translate('Record saved'));
  81.         }
  82.         catch (Exception $e
  83.         {
  84.             
  85.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  86.             
  87.             $this->form->setData$this->form->getData() ); 
  88.             
  89.             
  90.             TTransaction::rollback();
  91.         }
  92.     }
  93.     
  94.    
  95.     function onEdit($param)
  96.     {
  97.         try
  98.         {
  99.             if (isset($param['key']))
  100.             {
  101.                 $key=$param['key'];                
  102.                 TTransaction::open('conexao');
  103.                 $object = new Examefisico($key); 
  104.                 $this->form->setData($object);
  105.                 TTransaction::close();
  106.              
  107.             }
  108.             else
  109.             {
  110.                 $this->form->clear();
  111.             }
  112.         }
  113.         catch (Exception $e
  114.         {
  115.             new TMessage('error''<b>Error</b> ' $e->getMessage());            
  116.             TTransaction::rollback();
  117.         }
  118.     }
  119. }
  120. ?>
LJ

este é meu codigo que esta funcionando:

  1. <?php
  2. /**
  3.  * ProductForm Registration
  4.  *
  5.  */
  6. class ProductForm extends TPage
  7. {
  8.     private $form// form
  9.     /**
  10.      * Class constructor
  11.      * Creates the page and the registration form
  12.      */
  13.     function __construct()
  14.     {
  15.         parent::__construct();
  16.         
  17.         //loads easyzoom
  18.         TPage::include_css('app/lib/jquery/easyzoom/css/example.css');
  19.         TPage::include_css('app/lib/jquery/easyzoom/css/pygments.css');
  20.         TPage::include_css('app/lib/jquery/easyzoom/css/easyzoom.css');
  21.         
  22.         TPage::include_js('app/lib/jquery/easyzoom/js/easyzoom.js');
  23.         
  24.         
  25.         // creates the form
  26.         $this->form = new TForm('form_Product');
  27.         // creates a table
  28.         $table = new TTable;
  29.         $table_buttons = new TTable;
  30.         $table_numbers = new TTable;
  31.         
  32.          // add the table inside the form
  33.         $this->form->add($table);       
  34.    
  35.         // create the form fields
  36.         $id                     = new TEntry('id');
  37.         $name                   = new TEntry('name');
  38.         $n1            = new TEntry('n1');
  39.         $n2            = new TEntry('n2');
  40.         $n3            = new TEntry('n3');
  41.         $n4            = new TEntry('n4');
  42.         $outros               = new TCombo('outros');
  43.         
  44.        
  45.         $items      = array();
  46.         $items['ni'] = 'Nao identificado';
  47.         $items['cadeirante'] = 'Cadeirante';
  48.         $items['bike'] = 'Bike';
  49.         $items['po'] = 'Podium';
  50.         $outros->addItems($items);       
  51.         
  52.         $name->setSize(150);
  53.         $name->setProperty("tabindex","-1");
  54.         $id->setProperty("tabindex","-1");
  55.         $n1->setSize(40);
  56.         $n2->setSize(40);
  57.         $n3->setSize(40);
  58.         $n4->setSize(40);
  59.         $id->setSize(40);
  60.         $n1->setProperty("tabindex","1");
  61.         $n2->setProperty("tabindex","2");
  62.         $n3->setProperty("tabindex","3");
  63.         $n4->setProperty("tabindex","4");
  64.         $outros->setProperty("tabindex","5");
  65.         $id->setEditable(FALSE);
  66.     $name->setEditable(FALSE);
  67.     $n1->setMask('99999'); // define numeric input
  68.     $n2->setMask('99999'); // define numeric input
  69.     $n3->setMask('99999'); // define numeric input
  70.     $n4->setMask('99999');
  71.         $table->border=1;
  72.         $table->bgcolor='#f2f2f2';
  73.   
  74.       
  75.     $easydiv = new TElement('div');
  76.     $easydiv->id "easyzoom easyzoom--overlay";
  77.     $easydiv->class "easyzoom easyzoom--overlay";        
  78.         $this->imgFoto = new TElement('img');
  79.         $this->imgFoto->src "";
  80.         $this->imgFoto->style "width:300px;height:450px";
  81.         
  82.         
  83.         $this->linka = new TElement('a');
  84.         $this->linka->href "";
  85.         $this->linka->add($this->imgFoto);
  86.         
  87.         
  88.         $easydiv->add($this->linka);
  89.         
  90.         $script =new TElement('script');
  91.     $script->type 'text/javascript';
  92.     $script->add('
  93.         // Instantiate EasyZoom plugin
  94.         var $easyzoom = $(".easyzoom").easyZoom();
  95.         // Get the instance API
  96.         var api = $easyzoom.data("easyZoom");
  97.         ');
  98.         // add the script to the table
  99.         //$table->addRow()->addCell($script);
  100.         $easydiv->add($script);
  101.     //$this->form->add($script);        
  102.         
  103.     
  104.         
  105.     // tabelas com numeros
  106.     $row=$table_numbers->addRow();
  107.     $row->addCell(new TLabel('Id:'));
  108.         $cell=$row->addCell($id);
  109.         
  110.         $row=$table_numbers->addRow();
  111.     $row->addCell(new TLabel('Nome:'));
  112.     $cell=$row->addCell($name);
  113.         $row=$table_numbers->addRow();        
  114.     $cell=$row->addCell('Numeros:');
  115.         $cell->colspan=4;    
  116.     $row=$table_numbers->addRow();
  117.     $cell=$row->addCell($n1);
  118.         $cell->colspan=4;    
  119.     $row=$table_numbers->addRow();
  120.     $cell=$row->addCell($n2);
  121.         $cell->colspan=4;    
  122.     $row=$table_numbers->addRow();
  123.     $cell=$row->addCell($n3);
  124.         $cell->colspan=4;    
  125.     $row=$table_numbers->addRow();
  126.     $cell=$row->addCell($n4);
  127.         $cell->colspan=4;    
  128.     $row=$table_numbers->addRow();
  129.     $cell=$row->addCell($outros);
  130.         $cell->colspan=4;    
  131.     $row=$table_numbers->addRow();
  132.     $cell=$row->addCell($table_buttons);
  133.         $cell->colspan=4;    
  134.         // create an action button (save)
  135.         $save_button=new TButton('save');
  136.         // define the button action
  137.         $save_button->setAction(new TAction(array($this'onSave')), 'Salvar e Mantem');
  138.         $save_button->setImage('ico_save.png');
  139.     $save_button->setProperty("tabindex","6");
  140.         
  141.         
  142.          // create an action button (proximo)
  143.         $proximo_button=new TButton('proximo');
  144.         // define the button action
  145.         $proximo_button->setAction(new TAction(array($this'onProximo')), 'Salva e Proximo');
  146.         $proximo_button->setImage('ico_save.png'); 
  147.         $proximo_button->setProperty("tabindex","7");
  148.         
  149.         // create an action button (go to list)
  150.         $goto_button=new TButton('list');
  151.         // define the button action
  152.         $goto_button->setAction(new TAction(array('ProductDataGridView''onReload')), 'Listagem');
  153.         $goto_button->setImage('ico_datagrid.png');
  154.         $goto_button->setProperty("tabindex","-1");
  155.         
  156.         // create an action button (go to list)
  157.         $anterior_button=new TButton('anterior');
  158.         // define the button action
  159.         $anterior_button->setAction(new TAction(array($this'onAnterior')), 'Anterior');
  160.         $anterior_button->setImage('ico_anterior.png');  
  161.         $anterior_button->setProperty("tabindex","-1");
  162.         // create an action button (go to list)
  163.         $limpar_button=new TButton('limpar');
  164.         // define the button action
  165.         $limpar_button->setAction(new TAction(array($this'onLimpar')), 'Limpar');
  166.         $limpar_button->setImage('ico_delete.png');  
  167.         $limpar_button->setProperty("tabindex","-1");
  168.    
  169.         // create an action button (go to list)
  170.         $deletar_button=new TButton('excluir');
  171.         // define the button action
  172.         $deletar_button->setAction(new TAction(array($this'onDelete')), 'EXCLUIR');
  173.         $deletar_button->setImage('ico_delete.png');  
  174.         $deletar_button->setProperty("tabindex","-1");   
  175.         // add a row for the form action
  176.         $row=$table_buttons->addRow();
  177.         $row->addCell($save_button);
  178.         $row->addCell($proximo_button);
  179.         $row->addCell($limpar_button);
  180.         $row->addCell($anterior_button);
  181.         $row->addCell($deletar_button);
  182.         $row->addCell($goto_button);
  183.         
  184.         
  185.         // add a row for the form action
  186.         //$row=$table->addRow();
  187.         //$cell=$row->addCell($table_buttons);
  188.         //$cell->colspan=3;
  189.         $row=$table->addRow();        
  190.         //$row->addCell($this->divFoto);
  191.         $row->addCell($easydiv);
  192.         $row->addCell($table_numbers);
  193.         // define wich are the form fields
  194.         $this->form->setFields(array($id,$name,$n1,$n2,$n3,$n4,$outros,$save_button,$anterior_button,$proximo_button,$goto_button,$limpar_button,$deletar_button));
  195.         // add the form to the page
  196.         parent::add($this->form);
  197.     }
  198.     /**
  199.      * method onSave()
  200.      * Executed whenever the user clicks at the save button
  201.      */
  202.     function onSave()
  203.     {
  204.         try
  205.         {
  206.             // open a transaction with database 'library'
  207.             TTransaction::open('fotos');
  208.             // get the form data into an active record Book
  209.             $object $this->form->getData('Product');
  210.             // stores the object
  211.             $object->store();
  212.             // fill the form with the active record data
  213.             // mantem n1,n2,n3,n4
  214.             //$this->form->setData($object);
  215.             
  216.             //avança para proximo
  217.             
  218.             $objectproximo = new Product($object->proximo);
  219.             if ($objectproximo->n1 == "" and $objectproximo->outros == "") {
  220.                 $objectproximo->n1 $object->n1;
  221.                 $objectproximo->n2 $object->n2;
  222.                 $objectproximo->n3 $object->n3;
  223.                 $objectproximo->n4 $object->n4;
  224.                 
  225.                 }
  226.             $this->form->setData($objectproximo);
  227.          $this->imgFoto->src "app/images/".$objectproximo->corrida."/".$objectproximo->name.".jpg";      
  228.         $this->linka->href $this->imgFoto->src;
  229.         
  230.             // close the transaction
  231.             TTransaction::close();
  232.             // shows the success message
  233.             //new TMessage('info', 'Registro Salvo');
  234.             // reload the listing
  235.             
  236.             
  237.             
  238.             
  239.         }
  240.         catch (Exception $e// in case of exception
  241.         {
  242.             // shows the exception error message
  243.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  244.             // undo all pending operations
  245.             TTransaction::rollback();
  246.         }
  247.     }
  248.     
  249.     /**
  250.      * method onEdit()
  251.      * Executed whenever the user clicks at the edit button da datagrid
  252.      */
  253.     function onEdit($param)
  254.     {
  255.         try
  256.         {
  257.             if (isset($param['key']))
  258.             {
  259.                 // get the parameter $key
  260.                 $key=$param['key'];
  261.                 // open a transaction with database 'fotos'
  262.                 TTransaction::open('fotos');
  263.                 // instantiates object Book
  264.                 $object = new Product($key);
  265.                 // fill the form with the active record data
  266.                 $this->form->setData($object);
  267.         $this->imgFoto->src "app/images/".$object->corrida."/".$object->name.".jpg"
  268.         
  269.         $this->linka->href $this->imgFoto->src;
  270.         
  271.                 // close the transaction
  272.                 TTransaction::close();
  273.             }
  274.             else
  275.             {
  276.                 $this->form->clear();
  277.             }
  278.         }
  279.         catch (Exception $e// in case of exception
  280.         {
  281.             // shows the exception error message
  282.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  283.             // undo all pending operations
  284.             TTransaction::rollback();
  285.         }
  286.     }
  287.     function onAnterior()
  288.     {
  289.         try
  290.         {
  291.             // open a transaction with database 'library'
  292.             TTransaction::open('fotos');
  293.             // get the form data into an active record Book
  294.             $object $this->form->getData('Product');
  295.             // stores the object
  296.             //$object->store();
  297.             // fill the form with the active record data
  298.             //$this->form->setData($object);
  299.             
  300.             //avança para proximo
  301.             
  302.             $objectanterior = new Product($object->anterior);
  303.             $this->form->setData($objectanterior);
  304.          $this->imgFoto->src "app/images/".$objectanterior->corrida."/".$objectanterior->name.".jpg";                
  305.         $this->linka->href $this->imgFoto->src;
  306.                 
  307.             // close the transaction
  308.             TTransaction::close();
  309.             // shows the success message
  310.             //new TMessage('info', 'Registro Salvo');
  311.             // reload the listing
  312.         }        
  313.         catch (Exception $e// in case of exception
  314.         {
  315.             // shows the exception error message
  316.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  317.             // undo all pending operations
  318.             TTransaction::rollback();
  319.         }   
  320.     }    
  321.     function onProximo()
  322.     {
  323.         try
  324.         {
  325.             // open a transaction with database 'library'
  326.             TTransaction::open('fotos');
  327.             // get the form data into an active record Book
  328.             $object $this->form->getData('Product');
  329.             // stores the object
  330.             $object->store();
  331.             // fill the form with the active record data
  332.             //$this->form->setData($object);
  333.             
  334.             //avança para proximo
  335.             
  336.             $objectproximo = new Product($object->proximo);
  337.             $this->form->setData($objectproximo);
  338.          $this->imgFoto->src "app/images/".$objectproximo->corrida."/".$objectproximo->name.".jpg";      
  339.         $this->linka->href $this->imgFoto->src;           //avança para proximo
  340.             
  341.                 
  342.             // close the transaction
  343.             TTransaction::close();
  344.             // shows the success message
  345.             //new TMessage('info', 'Registro Salvo');
  346.             // reload the listing
  347.             
  348.             
  349.             
  350.             
  351.         }        
  352.         catch (Exception $e// in case of exception
  353.         {
  354.             // shows the exception error message
  355.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  356.             // undo all pending operations
  357.             TTransaction::rollback();
  358.         }
  359.     }
  360.  /**
  361.      * method onEdit()
  362.      * Executed whenever the user clicks at the edit button da datagrid
  363.      */
  364.     function onLimpar()
  365.     {
  366.         try
  367.         {
  368.                 // instantiates object Book
  369.             $object $this->form->getData('Product');
  370.         $object->n1="";
  371.         $object->n2="";
  372.         $object->n3="";
  373.         $object->n4="";
  374.         $object->outros="";
  375.         
  376.             // fill the form with the active record data
  377.             $this->form->setData($object);
  378.         $this->imgFoto->src "app/images/".$object->corrida."/".$object->name.".jpg"
  379.         
  380.         $this->linka->href $this->imgFoto->src;
  381.         }
  382.         catch (Exception $e// in case of exception
  383.         {
  384.             // shows the exception error message
  385.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  386.             // undo all pending operations
  387.             TTransaction::rollback();
  388.         }
  389.     } 
  390.     /**
  391.      * method onDelete()
  392.      * executed whenever the user clicks at the delete button
  393.      * Ask if the user really wants to delete the record
  394.      */
  395.     function onDelete()
  396.     {
  397.         // get the parameter $key
  398.         $object $this->form->getData('Product');
  399.         
  400.         $key=$object->id;
  401.         
  402.         // define two actions
  403.         $action = new TAction(array($this'Delete'));
  404.         
  405.         // define the action parameters
  406.         $action->setParameter('key'$key);
  407.         
  408.         // shows a dialog to the user
  409.         new TQuestion(TAdiantiCoreTranslator::translate('Do you really want to delete ?'), $action);
  410.     }
  411.     
  412.     /**
  413.      * method Delete()
  414.      * Delete a record
  415.      */
  416.     function Delete($param)
  417.     {
  418.         try
  419.         {
  420.             // get the parameter $key
  421.             $key=$param['key'];
  422.             // open a transaction with database 'changeman'
  423.             TTransaction::open('fotos');
  424.             
  425.             // instantiates object Document
  426.             $object = new Product($key);
  427.             
  428.             $objectproximo = new Product($object->proximo);
  429.             
  430.             //exclui a imagem
  431.             unlink("app/images/".$object->corrida."/".$object->name.".jpg");
  432.             // deletes the object from the database
  433.             $object->delete();
  434.             
  435.             
  436.             // reload the listing
  437.             //$this->onReload();
  438.             // shows the success message
  439.   
  440.             
  441.             new TMessage('info'TAdiantiCoreTranslator::translate('Record deleted'));
  442.             
  443.             
  444.             $this->form->setData($objectproximo);
  445.          $this->imgFoto->src "app/images/".$objectproximo->corrida."/".$objectproximo->name.".jpg";      
  446.         $this->linka->href $this->imgFoto->src;           //avança para proximo    
  447.         
  448.             // close the transaction
  449.             TTransaction::close();        
  450.             
  451.         }
  452.         catch (Exception $e// in case of exception
  453.         {
  454.             // shows the exception error message
  455.             new TMessage('error''<b>Error</b> ' $e->getMessage());
  456.             
  457.             // undo all pending operations
  458.             TTransaction::rollback();
  459.         }
  460.     } 
  461. }
  462. ?>
FS

Show, deu certo aqui brother!