app/control/admin/SystemProgramForm.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
public function onSave()
    {
        try
        {
            TTransaction::open($this->database);
            $data = $this->form->getData();
            $object = new SystemProgram;
            $object->id = $data->id;
            $object->name = $data->name;
            $object->controller = $data->controller;
            $this->form->validate();
            $object->store();
            $data->id = $object->id;
            $this->form->setData($data);
            $object->clearParts();
            if( !empty($data->groups) )
            {
                foreach( $data->groups as $group_id )
                {
                    $object->addSystemGroup( new SystemGroup($group_id) );
                }
            }
            TTransaction::close();
            new TMessage('info', AdiantiCoreTranslator::translate('Record saved'));
            return $object;
        }
        catch (Exception $e) 
        {
            $object = $this->form->getData($this->activeRecord);
            $this->form->setData($object);
            new TMessage('error', $e->getMessage());
            TTransaction::rollback();
        }
    }
public function onSave ( ) { try { TTransaction :: open ( $ this -> database ) ; $ data = $ this -> form -> getData ( ) ; $ object = new SystemProgram ; $ object -> id = $ data -> id ; $ object -> name = $ data -> name ; $ object -> controller = $ data -> controller ; $ this -> form -> validate ( ) ; $ object -> store ( ) ; $ data -> id = $ object -> id ; $ this -> form -> setData ( $ data ) ; $ object -> clearParts ( ) ; if ( ! empty ( $ data -> groups ) ) { foreach ( $ data -> groups as $ group_id ) { $ object -> addSystemGroup ( new SystemGroup ( $ group_id ) ) ; } } TTransaction :: close ( ) ; new TMessage ( 'info' , AdiantiCoreTranslator :: translate ( 'Record saved' ) ) ; return $ object ; } 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
// in case of exception // get the form data