Ejemplo n.º 1
0
if($_POST){
    switch(strtolower($_POST['do'])){
        case 'update':
            if(!$sla){
                $errors['err']=sprintf(__('%s: Unknown or invalid'),
                    __('SLA plan'));
            }elseif($sla->update($_POST,$errors)){
                $msg=sprintf(__('Successfully updated %s'),
                    __('this SLA plan'));
            }elseif(!$errors['err']){
                $errors['err']=sprintf(__('Error updating %s. Try again!'),
                    __('this SLA plan'));
            }
            break;
        case 'add':
            if(($id=SLA::create($_POST,$errors))){
                $msg=sprintf(__('Successfully added %s'),
                    __('a SLA plan'));
                $_REQUEST['a']=null;
            }elseif(!$errors['err']){
                $errors['err']=sprintf(__('Unable to add %s. Correct error(s) below and try again.'),
                    __('this SLA plan'));
            }
            break;
        case 'mass_process':
            if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
                $errors['err'] = sprintf(__('You must select at least %s.'),
                    __('one SLA plan'));
            } else {
                $count=count($_POST['ids']);
                switch(strtolower($_POST['a'])) {