app/control/admin/SystemPreferenceForm.class.php
/**
     * method onSave()
     * Executed whenever the user clicks at the save button
     */
method onSave()
Executed whenever the user clicks at the save button
method onSave () Executed whenever the user clicks at the save button
function onSave()
    {
        try
        {
            TTransaction::open($this->database);
            $data = $this->form->getData();
            $data_array = (array) $data;
            foreach ($data_array as $property => $value)
            {
                $object = new SystemPreference;
                $object->{'id'}    = $property;
                $object->{'value'} = $value;
                $object->store();
            }
            $this->form->setData($data);
            TTransaction::close();
            new TMessage('info', AdiantiCoreTranslator::translate('Record saved'));
        }
        catch (Exception $e) 
        {
            $object = $this->form->getData($this->activeRecord);
            $this->form->setData($object);
            new TMessage('error', $e->getMessage());
            TTransaction::rollback();
        }
    }
function onSave ( ) { try { TTransaction :: open ( $ this -> database ) ; $ data = $ this -> form -> getData ( ) ; $ data_array = ( array ) $ data ; foreach ( $ data_array as $ property => $ value ) { $ object = new SystemPreference ; $ object -> { 'id' } = $ property ; $ object -> { 'value' } = $ value ; $ object -> store ( ) ; } $ this -> form -> setData ( $ data ) ; TTransaction :: close ( ) ; new TMessage ( 'info' , AdiantiCoreTranslator :: translate ( 'Record saved' ) ) ; } catch ( Exception $ e ) { $ object = $ this -> form -> getData ( $ this -> activeRecord ) ; $ this -> form -> setData ( $ object ) ; new TMessage ( 'error' , $ e -> getMessage ( ) ) ; TTransaction :: rollback ( ) ; } }
method onSave()
 Executed whenever the user clicks at the save button
method onSave () Executed whenever the user clicks at the save button
// open a transaction with database // get the form data // fill the form with the active record data // close the transaction // shows the success message // reload the listing // in case of exception // get the form data // fill the form with the active record data // shows the exception error message // undo all pending operations