Back to top

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
documentation:rack:reference:views [2018/05/26 16:37] Martijn Luinstradocumentation:rack:reference:views [2019/05/10 17:55] – Document ModelView->run_csv() behaviour Martijn Luinstra
Line 117: Line 117:
 <php>ModelView</php> inherits all properties from <php>FormView</php>. <php>ModelView</php> inherits all properties from <php>FormView</php>.
  
-  * <php>protected $views</php> List of implemented views. Defaults to <php>['create', 'read', 'update', 'delete', 'list']</php>.+  * <php>protected $views</php> List of implemented views. Defaults to <php>['create', 'read', 'update', 'delete', 'list']</php>. Additionally a view for export to CSV (<php>'csv'</php>) has been implemented, but is disabled by default.
   * <php>protected $default_view</php> The name of the view to run if the URL parameter <php>view</php> is not provided. Defaults to <php>"list"</php>.   * <php>protected $default_view</php> The name of the view to run if the URL parameter <php>view</php> is not provided. Defaults to <php>"list"</php>.
   * <php>protected $model</php> Contains the view's model object, but obsolete if you override <php>get_model()</php>.   * <php>protected $model</php> Contains the view's model object, but obsolete if you override <php>get_model()</php>.
Line 126: Line 126:
  
   * <php>public __construct($page_id, $title='', $model=null, $form=null)</php>   * <php>public __construct($page_id, $title='', $model=null, $form=null)</php>
-  * <php>protected run_page()</php> It is not recommended to override this function unless you want to create additional views. Override <php>run_create()</php>, <php>run_read()</php>, <php>run_update()</php>, <php>run_delete()</php> and <php>run_list()</php> instead.+  * <php>protected run_page()</php> It is not recommended to override this function unless you want to create additional views. Override <php>run_create()</php>, <php>run_read()</php>, <php>run_update()</php>, <php>run_delete()</php><php>run_list()</php> and <php>run_csv()</php> instead.
   * <php>protected run_create()</php>   * <php>protected run_create()</php>
   * <php>protected run_read()</php>   * <php>protected run_read()</php>
Line 132: Line 132:
   * <php>protected run_delete()</php>   * <php>protected run_delete()</php>
   * <php>protected run_list()</php>   * <php>protected run_list()</php>
 +  * <php>protected run_csv()</php> Disabled by default. Enable by overriding <php>$views</php> (add <php>'csv'</php>).
 +  * <php>protected get_csv_data()</php> Provides dataset for <php>run_csv()</php> as associative array.
   * <php>protected process_form_data($data)</php> Creates or updates object in database.   * <php>protected process_form_data($data)</php> Creates or updates object in database.
   * <php>protected get_model()</php>   * <php>protected get_model()</php>

documentation/rack/reference/views.txt · Last modified: 2023/08/31 23:22 by Martijn Luinstra