app/control/admin/SystemGroupForm.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($param)
    {
        try
        {
            TTransaction::open('permission');
            $data = $this->form->getData();
            $this->form->setData($data);
            $object = new SystemGroup;
            $object->fromArray( (array) $data );
            $object->store();
            $object->clearParts();
            if (!empty($data->program_list))
            {
                foreach ($data->program_list as $program_id)
                {
                    $object->addSystemProgram( new SystemProgram( $program_id ) );
                }
            }
            if (!empty($data->user_list))
            {
                foreach ($data->user_list as $user_id)
                {
                    $object->addSystemUser( new SystemUser( $user_id ) );
                }
            }
            $data = new stdClass;
            $data->id = $object->id;
            TForm::sendData('form_System_group', $data);
            TTransaction::close(); 
            new TMessage('info', _t('Record saved')); 
        }
        catch (Exception $e) 
        {
            new TMessage('error', $e->getMessage());
            TTransaction::rollback();
        }
    }
public function onSave ( $ param ) { try { TTransaction :: open ( 'permission' ) ; $ data = $ this -> form -> getData ( ) ; $ this -> form -> setData ( $ data ) ; $ object = new SystemGroup ; $ object -> fromArray ( ( array ) $ data ) ; $ object -> store ( ) ; $ object -> clearParts ( ) ; if ( ! empty ( $ data -> program_list ) ) { foreach ( $ data -> program_list as $ program_id ) { $ object -> addSystemProgram ( new SystemProgram ( $ program_id ) ) ; } } if ( ! empty ( $ data -> user_list ) ) { foreach ( $ data -> user_list as $ user_id ) { $ object -> addSystemUser ( new SystemUser ( $ user_id ) ) ; } } $ data = new stdClass ; $ data -> id = $ object -> id ; TForm :: sendData ( 'form_System_group' , $ data ) ; TTransaction :: close ( ) ; new TMessage ( 'info' , _t ( 'Record saved' ) ) ; } catch ( Exception $ e ) { 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 'permission' // get the form data into an active record System_group // close the transaction // shows the success message // in case of exception