Ejemplo n.º 1
0
 /**
  * method onInlineEdit()
  * Inline record editing
  * @param $param Array containing:
  *              key: object ID value
  *              field name: object attribute to be updated
  *              value: new attribute content 
  */
 function onInlineEdit($param)
 {
     try {
         // get the parameter $key
         $field = $param['field'];
         $key = $param['key'];
         $value = $param['value'];
         // open a transaction with database 'permission'
         TTransaction::open('liger');
         // instantiates object SystemProgram
         $object = new Cidade($key);
         // deletes the object from the database
         $object->{$field} = $value;
         $object->store();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', "Alterado com Sucesso");
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }