/** * 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('lacenrh'); // instantiates object Servidor $object = new Servidor($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', "Registro atualizado"); } catch (Exception $e) { if ($e->getCode() == 23000) { new TMessage('error', '<b>Erro:</b> ' . 'Servidor já cadastrado.'); } else { new TMessage('error', '<b>Erro:</b> ' . $e->getMessage()); } TTransaction::rollback(); } }