Property | Type | Description | |
---|---|---|---|
$add_button | Button | This points to a Button object, which you can change if you want a different label or anything else on it. | |
$allow_add | boolean | $this->add('CRUD', array('allow_add'=>false')); // to disable | |
$allow_del | boolean | $this->add('CRUD', array('allow_del'=>false')); // to disable | |
$allow_edit | boolean | $this->add('CRUD', array('allow_edit'=>false')); // to disable | |
$app | App_Web | ||
$entity_name | string | If you set this to 'false' then CRUD will not attempt to change default label ("Add") | |
$form | Form | IMPORTANT: check isEditing() method | |
$form_class | string | $this->add('CRUD', array('form_class'=>'MyForm')); | |
$form_options | array | $this->add('CRUD', array('form_options'=>array('js_widget'=>'ui.atk4_form'))); | |
$frame_options | array | When clicking on EDIT or ADD the frameURL is used. If you want to pass some arguments to it, put your hash here. | |
$grid | Grid | IMPORTANT: check isEditing() method | |
$grid_class | string | $this->add('CRUD', array('grid_class'=>'MyGrid')); | |
$grid_options | array | $this->add('CRUD', array('grid_options'=>array('show_header'=>false))); | |
$id | mixed | This is set to ID of the model when are in editing mode. In theory this can also be 0, so use is_null(). | |
$js_reload | jQuery_Chain | Contains reload javascript, used occassionally throughout the object. | |
$owner | View | ||
$virtual_page | VirtualPage | If isEditing() then you can add more stuff on this page, by calling virtual_page->getPage()->add('Hello!'); |
Method | Description | |
---|---|---|
addAction ( string $method_name, array $options = [] ) | Assuming that your model contains a certain method, this allows you to create a frame which will pop you a new frame with a form representing model method arguments. Once the form is submitted, the action will be evaluated. | |
addButton ( string | array $label, string $class = 'Button' ) : Button | Transparent method for adding buttons to a crud. | |
addFrame ( string $name, array $options = [] ) : Page | boolean | Adds button to the crud, which opens a new frame and returns page to you. Add anything into the page as you see fit. The ID of the record will be inside $crud->id. | |
addRef ( string $name, array $options = [] ) : View_CRUD | null | Assuming that your model has a $relation defined, this method will add a button into a separate column. When clicking, it will expand the grid and will present either another CRUD with related model contents (one to many) or a form preloaded with related model data (many to one). | |
formSubmitSuccess ( ) : jQuery_Chain | Returns JavaScript action which should be executed on form successfull submission. | |
init ( ) | ||
isEditing ( string $mode = null ) : boolean | Returns if CRUD is in editing mode or not. It's preferable over checking if($grid->form). | |
setModel ( string | Model $model, array $fields = null, array $grid_fields = null ) : AbstractModel | Assign model to your CRUD and specify list of fields to use from model. |
Method | Description | |
---|---|---|
configureAdd ( array $fields = null ) : void | Model | Configures necessary components when CRUD is in the adding mode. | |
configureDel ( ) | Configures deleting functionality for grid. | |
configureEdit ( array $fields = null ) : void | Model | Configures necessary components when CRUD is in the editing mode. | |
configureGrid ( array $fields ) | Configures grid's model itself. | |
formSubmit ( Form $form ) | Called after on post-init hook when form is submitted. |
protected configureAdd ( array $fields = null ) : void | Model | ||
$fields | array | List of fields for add form |
return | void | Model | If model, then bail out, no greed needed |
protected configureDel ( ) |
protected configureEdit ( array $fields = null ) : void | Model | ||
$fields | array | List of fields for add form |
return | void | Model | If model, then bail out, no greed needed |
protected configureGrid ( array $fields ) | ||
$fields | array | List of fields for grid |
protected formSubmit ( Form $form ) | ||
$form | Form | Form which was submitted |
public formSubmitSuccess ( ) : jQuery_Chain | ||
return | jQuery_Chain | to be executed on successful submit |
public init ( ) |
public Button $add_button | ||
return | Button |
public bool $allow_add | ||
return | boolean |
public bool $allow_del | ||
return | boolean |
public bool $allow_edit | ||
return | boolean |
public string $entity_name | ||
return | string |
public string $form_class | ||
return | string |
public array $form_options | ||
return | array |
public array $frame_options | ||
return | array |
public string $grid_class | ||
return | string |
public array $grid_options | ||
return | array |
public mixed $id | ||
return | mixed |
public jQuery_Chain $js_reload | ||
return | jQuery_Chain |