protected function _run_task()
    {
        if ($this->after && $this->after == $this->task)
        {
            return self::error('Task recursion!');
        }
        if (!$this->task)
        {
            $this->task = 'list';
        }
        switch ($this->task)
        {
            case 'create':
                $this->_set_field_types('create');
                //$this->_sort_defaults();
                return $this->_create();
                break;
            case 'edit':
                $this->_set_field_types('edit');
                return $this->_entry('edit');
                break;
            case 'save':
                if (!$this->before)
                {
                    return self::error('Restricted task!');
                }
                $this->_set_field_types($this->before);
                return $this->_save();

                /*$this->task = $this->after;
                $this->after = null;
                return $this->_run_task();*/
                break;
            case 'remove':
                $this->_set_field_types('list');
                $this->_remove();
                return $this->_list();
                break;
            case 'upload':
                return $this->_upload();
                break;
            case 'remove_upload':
                return $this->_remove_upload();
                break;
            case 'crop_image':
                return $this->manual_crop();
                break;
            case 'unique':
                $this->_set_field_types('edit');
                return $this->_check_unique_value();
                break;
            case 'clone':
                $this->_set_field_types('list');
                $this->_clone_row();
                return $this->_list();
                break;
            case 'print':
                if (!$this->is_print)
                {
                    return self::error('Restricted');
                }
                $this->_set_field_types('list', Fruit_config::$print_all_fields);
                $this->theme = 'printout';
                return $this->_list();
                break;
            case 'depend':
                return $this->create_relation($this->_post('name', false, 'base64'), $this->_post('value'), $this->get_field_attr($this->
                    _post('name', false, 'base64'), 'edit'), $this->_post('dependval'));
                break;
            case 'view':
                $this->_set_field_types('view');
                return $this->_entry('view');
                break;
            case 'query':

                break;
            case 'external':

                break;
            case 'action':
                return $this->_call_action();
                break;
            case 'file':
                $this->_set_field_types('list');
                return $this->_render_file();
                break;
            case 'csv':
                $this->_set_field_types('list', Fruit_config::$csv_all_fields);
                return $this->_csv();
                break;
            case 'list':
            default:
                $this->_set_field_types('list');
                return $this->_list();
                break;
        }
    }
protected function _run_task()
    {
        if ($this->after && $this->after == $this->task)
        {
            return self::error('Task recursion!');
        }
        if (!$this->task)
        {
            $this->task = 'list';
        }
        switch ($this->task)
        {
            case 'create':
                $this->_set_field_types('create');
                //$this->_sort_defaults();
                return $this->_create();
                break;
            case 'edit':
                $this->_set_field_types('edit');
                return $this->_entry('edit');
                break;
            case 'save':
                if (!$this->before)
                {
                    return self::error('Restricted task!');
                }
                $this->_set_field_types($this->before);
                return $this->_save();

                /*$this->task = $this->after;
                $this->after = null;
                return $this->_run_task();*/
                break;
            case 'remove':
                $this->_set_field_types('list');
                $this->_remove();
                return $this->_list();
                break;
            case 'upload':
                return $this->_upload();
                break;
            case 'remove_upload':
                return $this->_remove_upload();
                break;
            case 'crop_image':
                return $this->manual_crop();
                break;
            case 'unique':
                $this->_set_field_types('edit');
                return $this->_check_unique_value();
                break;
            case 'clone':
                $this->_set_field_types('list');
                $this->_clone_row();
                return $this->_list();
                break;
            case 'print':
                if (!$this->is_print)
                {
                    return self::error('Restricted');
                }
                $this->_set_field_types('list', Fruit_config::$print_all_fields);
                $this->theme = 'printout';
                return $this->_list();
                break;
            case 'depend':
                return $this->create_relation($this->_post('name', false, 'base64'), $this->_post('value'), $this->get_field_attr($this->
                    _post('name', false, 'base64'), 'edit'), $this->_post('dependval'));
                break;
            case 'view':
                $this->_set_field_types('view');
                return $this->_entry('view');
                break;
            case 'query':

                break;
            case 'external':

                break;
            case 'action':
                return $this->_call_action();
                break;
            case 'file':
                $this->_set_field_types('list');
                return $this->_render_file();
                break;
            case 'csv':
                $this->_set_field_types('list', Fruit_config::$csv_all_fields);
                return $this->_csv();
                break;
            case 'list':
            default:
                $this->_set_field_types('list');
                return $this->_list();
                break;
        }
    }
protected function _run_task ( ) { if ( $ this -> after && $ this -> after == $ this -> task ) { return self :: error ( 'Task recursion!' ) ; } if ( ! $ this -> task ) { $ this -> task = 'list' ; } switch ( $ this -> task ) { case 'create' : $ this -> _set_field_types ( 'create' ) ; //$this->_sort_defaults();
 return $ this -> _create ( ) ; break ; case 'edit' : $ this -> _set_field_types ( 'edit' ) ; return $ this -> _entry ( 'edit' ) ; break ; case 'save' : if ( ! $ this -> before ) { return self :: error ( 'Restricted task!' ) ; } $ this -> _set_field_types ( $ this -> before ) ; return $ this -> _save ( ) ; /*$this->task = $this->after;
                $this->after = null;
                return $this->_run_task();*/ break ; case 'remove' : $ this -> _set_field_types ( 'list' ) ; $ this -> _remove ( ) ; return $ this -> _list ( ) ; break ; case 'upload' : return $ this -> _upload ( ) ; break ; case 'remove_upload' : return $ this -> _remove_upload ( ) ; break ; case 'crop_image' : return $ this -> manual_crop ( ) ; break ; case 'unique' : $ this -> _set_field_types ( 'edit' ) ; return $ this -> _check_unique_value ( ) ; break ; case 'clone' : $ this -> _set_field_types ( 'list' ) ; $ this -> _clone_row ( ) ; return $ this -> _list ( ) ; break ; case 'print' : if ( ! $ this -> is_print ) { return self :: error ( 'Restricted' ) ; } $ this -> _set_field_types ( 'list' , Fruit_config :: $ print_all_fields ) ; $ this -> theme = 'printout' ; return $ this -> _list ( ) ; break ; case 'depend' : return $ this -> create_relation ( $ this -> _post ( 'name' , false , 'base64' ) , $ this -> _post ( 'value' ) , $ this -> get_field_attr ( $ this -> _post ( 'name' , false , 'base64' ) , 'edit' ) , $ this -> _post ( 'dependval' ) ) ; break ; case 'view' : $ this -> _set_field_types ( 'view' ) ; return $ this -> _entry ( 'view' ) ; break ; case 'query' : break ; case 'external' : break ; case 'action' : return $ this -> _call_action ( ) ; break ; case 'file' : $ this -> _set_field_types ( 'list' ) ; return $ this -> _render_file ( ) ; break ; case 'csv' : $ this -> _set_field_types ( 'list' , Fruit_config :: $ csv_all_fields ) ; return $ this -> _csv ( ) ; break ; case 'list' : default : $ this -> _set_field_types ( 'list' ) ; return $ this -> _list ( ) ; break ; } }
main task trigger
main task trigger