This is a generic controller which all controllers which are managed in the admin area should extend. Required fields for a managed controller table: id
This is the code documentation for the SproutCMS project
Search documentation |
class ManagedAdminControllerThis is a generic controller which all controllers which are managed in the admin area should extend. Required fields for a managed controller table: id
Variables
Functions
public __call (from BaseController)void $BaseController->__call ( string $method , array $args ); Handles methods that do not exist. public __constructvoid $ManagedAdminController->__construct ( ); Constructor. This must be called in the extending class. public _actionLogunknown $ManagedAdminController->_actionLog ( ); This function does not have a description protected _addPreRendervoid $ManagedAdminController->_addPreRender ( mixed $view ); Hook called by _getAddForm() just before the view is rendered public _addSaveboolean $ManagedAdminController->_addSave ( int &$item_id ); Process the saving of an add. public _deletePostSavevoid $ManagedAdminController->_deletePostSave ( int $item_id ); Does custom actions after the _deleteSave method is called, e.g. clearing cache data public _deletePreSavevoid $ManagedAdminController->_deletePreSave ( int $item_id ); Does custom actions before _deleteSave method is called, e.g. extra security checks public _deleteSaveunknown $ManagedAdminController->_deleteSave ( int $item_id ); Deletes an item and logs the deleted data protected _duplicatePreRendervoid $ManagedAdminController->_duplicatePreRender ( mixed $view , mixed $item_id ); Hook called by _getDuplicateForm() just before the view is rendered public _duplicateSaveboolean $ManagedAdminController->_duplicateSave ( int $id ); Process the saving of a duplication. Basic version just calls _editSave protected _editPreRendervoid $ManagedAdminController->_editPreRender ( mixed $view , mixed $item_id ); Hook called by _getEditForm() just before the view is rendered public _editSaveboolean $ManagedAdminController->_editSave ( int $item_id ); Process the saving of a record. public _exportDataarray $ManagedAdminController->_exportData ( ); Does the actual export. Return false on error. public _extraMultiDeleteunknown $ManagedAdminController->_extraMultiDelete ( ); Form to delete multiple records public _getAddFormarray $ManagedAdminController->_getAddForm ( ); Returns a page title and HTML for a form to add a record public _getAddSubActionsarray $ManagedAdminController->_getAddSubActions ( ); Return the sub-actions for adding a record (e.g. preview) These are rendered into HTML using AdminController::renderSubActions public _getContentsunknown $ManagedAdminController->_getContents ( ); Return HTML which represents a list of records for this controller protected _getContentsQuerystring $ManagedAdminController->_getContentsQuery ( string $where , string $order , array &$params ); Returns the SQL query for use by the contents list. The query MUST NOT include a LIMIT clause. The query MUST include a SQL_CALC_FOUND_ROWS clause. The main table SHOULD be aliased to 'item'. public _getContentsViewunknown $ManagedAdminController->_getContentsView ( Traversable $items , string $mode , anything $unused ); Return HTML for a resultset of items The returned HTML will be sandwiched between the refinebar and the pagination bar. public _getContentsViewListunknown $ManagedAdminController->_getContentsViewList ( Traversable $items , anything $unused ); Formats a resultset of items into an Itemlist public _getCustomAddSaveHTMLunknown $ManagedAdminController->_getCustomAddSaveHTML ( ); Optional custom HTML for the save box Return NULL to use the default HTML public _getCustomDuplicateSaveHTMLunknown $ManagedAdminController->_getCustomDuplicateSaveHTML ( return $item_id ); Optional custom HTML for the save box Return NULL to use the default HTML public _getCustomEditSaveHTMLunknown $ManagedAdminController->_getCustomEditSaveHTML ( return $item_id ); Optional custom HTML for the save box Return NULL to use the default HTML public _getDeleteFormstring $ManagedAdminController->_getDeleteForm ( int $id ); Return HTML which represents the form for deleting a record public _getDeleteSubActionsarray $ManagedAdminController->_getDeleteSubActions ( mixed $item_id ); Return the sub-actions for deleting a record (e.g. cancel) These are rendered into HTML using AdminController::renderSubActions public _getDuplicateFormunknown $ManagedAdminController->_getDuplicateForm ( int $id ); Return HTML which represents the form for duplicating a record public _getDuplicateSubActionsarray $ManagedAdminController->_getDuplicateSubActions ( mixed $item_id ); Return the sub-actions for duplicating a record These are rendered into HTML using AdminController::renderSubActions public _getEditFormarray $ManagedAdminController->_getEditForm ( int $id ); Returns a page title and HTML for a form to edit a record public _getEditLiveUrlnull|string $ManagedAdminController->_getEditLiveUrl ( int $item_id ); Return the URL to use for the 'view live site' button, when editing a given record public _getEditSubActionsarray $ManagedAdminController->_getEditSubActions ( mixed $item_id ); Return the sub-actions for editing a record (e.g. deleting) These are rendered into HTML using AdminController::renderSubActions public _getExportunknown $ManagedAdminController->_getExport ( ); Returns form for doing exports protected _getExportQueryunknown $ManagedAdminController->_getExportQuery ( [ string $where ] ); Returns the SQL query for use by the export tools. The query does MUST NOT include a LIMIT clause. public _getImportunknown $ManagedAdminController->_getImport ( mixed $filename ); Returns a form which contains options for doing an export public _getNavigationvoid $ManagedAdminController->_getNavigation ( ); Return the navigation for this controller Should return HTML protected _getRecordarray $ManagedAdminController->_getRecord ( int $id ); Fetch the record with a given id protected _getRefineClausestring $ManagedAdminController->_getRefineClause ( string $key , string $val , array &$query_params ); Return the WHERE clause to use for a given key which is provided by the RefineBar This must be called in the extending class if no clause can be determined, i.e. return parent::_getRefineClause() Allows custom non-table clauses to be added. Is only called for key names which begin with an underscore. The base table is aliased to 'item'. public _getSearchFormunknown $ManagedAdminController->_getSearchForm ( ); Return HTML for a search form public _getToolsunknown $ManagedAdminController->_getTools ( ); Returns tools to show in the left hand navigation. Return an empty array if no tools. public _getVisibilityFieldsarray $ManagedAdminController->_getVisibilityFields ( ); Return the fields to show in the sidebar when adding or editing a record. These fields are shown under a heading of "Visibility" Key is the field name, value is the field label public _identifierstring $ManagedAdminController->_identifier ( array $item ); Creates the identifier used in the heading, and for reordering. protected _importColGuessstring $ManagedAdminController->_importColGuess ( string $csv_heading ); Try to guess the database name for a given CSV heading. If you can't figure it out, return NULL. If NULL is returned, the rudimentry almost-exact guesser will be run. public _importDataunknown $ManagedAdminController->_importData ( string $filename ); Does the actual import protected _importExtraOptionsunknown $ManagedAdminController->_importExtraOptions ( ); Called when the import form is being built. Returns HTML of extra options to display, or null if no extra options. protected _importPostunknown $ManagedAdminController->_importPost ( ); Called at the end of the the import process, after everything has been done. Is called from within a transaction. Return FALSE to abort the import. protected _importPostRecordboolean $ManagedAdminController->_importPostRecord ( int $record_id , array $new_data , array $existing_record , string $type , array $raw_data ); Called after a record has been inserted or updated. protected _importPreunknown $ManagedAdminController->_importPre ( ); Called at the beginning of the the import process. Is called from within a transaction. Return FALSE to abort the import. protected _importPreRecordunknown $ManagedAdminController->_importPreRecord ( array &$new_data , array $raw_data ); Called after the field data has been determined, but before the insert or update is run. Return FALSE to skip the record. public _introvoid $ManagedAdminController->_intro ( ); Returns the intro HTML for this controller. public _invalidateCachesvoid $ManagedAdminController->_invalidateCaches ( string $action [, int $item_id ] ); This is called after every add, edit and delete, as well as other (i.e. bulk) actions. Use it to clear any frontend caches. The default is an empty method. public _isAddSavedbool $ManagedAdminController->_isAddSaved ( ); Is the "add" action saved? These may be false if the UI provides its own save mechanism (e.g. multi-add) public _isDeleteSavedbool $ManagedAdminController->_isDeleteSaved ( int $item_id ); Check if deletion of a particular record is allowed This method may be overridden if ignoring the $main_delete property is desired public _isEditSavedbool $ManagedAdminController->_isEditSaved ( mixed $item_id ); Is the "edit" action saved? These may be false if the UI provides its own save mechanism protected _modeSelectorunknown $ManagedAdminController->_modeSelector ( mixed $current_mode ); Returns HTML for a ui component to update the current main view mode protected _paginationBarHTML $ManagedAdminController->_paginationBar ( The $current_page , The $total_row_count ); Builds the HTML for showing the navigation through pages in the admin. This method is FINAL to help keep the user interface consistent. protected _preSavevoid $ManagedAdminController->_preSave ( mixed $id , mixed &$data ); This function does not have a description public _run (from BaseController)void $BaseController->_run ( mixed $method , mixed $args ); The router/kohana will invoke this method to invoke an action. If you please, you may wrap this method to create before/after hooks. public ajaxLookupvoid $ManagedAdminController->ajaxLookup ( ); Return list of records for given search term Used for Fb::autocomplete public ajaxLookupListvoid $ManagedAdminController->ajaxLookupList ( ); Return list of records for given search term Used for Fb::autocompleteList protected applyRefineFilterarray $ManagedAdminController->applyRefineFilter ( [ array $source_data ] ); Applies filters defined in the query string using a LIKE contains Only fields which exist in the RefineBar will be filtered protected autoSetEmptyParam (from Controller)null $Controller->autoSetEmptyParam ( array &$conf ); Auto-set the "empty" param for fields with foreign keys to be NULL This greatly reduces the number of foreign-key constraints hit in day-to-day use, especially with file fields. protected deleteRecord (from Controller)int $Controller->deleteRecord ( string $table , int $record_id [, int $parent_log_id ] ); Deletes a record, and logs the deletion This should be used by all _deleteSave methods Starts a transaction and commits it if not already in a transaction when called protected generateFormView (from Controller)array $Controller->generateFormView ( mixed $file_name ); Generates a form view from a JSON config file public getControllerNameunknown $ManagedAdminController->getControllerName ( ); Returns the defined controller name. public getCssClassName (from BaseController)string $BaseController->getCssClassName ( ); Return the class name for this controller, expressed in CSS style, i.e. with dashes Example: When called from BlogPostController --> 'blog-post-controller' public getDuplicateEnabledunknown $ManagedAdminController->getDuplicateEnabled ( ); Returns the duplication enabling flag public getFriendlyNameunknown $ManagedAdminController->getFriendlyName ( ); Returns the defined controller friendly name public getModulePath (from BaseController)string $BaseController->getModulePath ( ); Gets the relative path to the module the controller lives in, or sprout itself public getNavigationNameunknown $ManagedAdminController->getNavigationName ( ); Returns the defined controller navigation name public getTableNameunknown $ManagedAdminController->getTableName ( ); Returns the defined table name public getTopnavNameunknown $ManagedAdminController->getTopnavName ( ); Gets the name of the controller to use for the top nav protected initRefineBarvoid $ManagedAdminController->initRefineBar ( ); Initialises the refine bar if it isn't already set, with a search widget for the 'name' field if it exists Most controllers which need a custom refine bar should call this before adding their own search widgets protected initTableNamevoid $ManagedAdminController->initTableName ( ); Initialises the table name if it isn't already set, using the plural of the shorthand controller name protected injectVisiblityFieldsvoid $ManagedAdminController->injectVisiblityFields ( array &$conf ); Inject the visiblity fields into a loaded json configuration, so they actually save public isPerSubsiteunknown $ManagedAdminController->isPerSubsite ( ); If true, then a UI for editing the "subsite_id" for a record should be shown protected jsonExtraValidate (from Controller)void $Controller->jsonExtraValidate ( int $id , Validator $validator ); Do any additional validation prior to saving the record protected loadEditJson (from Controller)array $Controller->loadEditJson ( ); Loads a JSON config file for an automated edit-type form for this controller protected loadFormJson (from Controller)array $Controller->loadFormJson ( string $file_name ); Loads a config file for a JsonForm associated with this controller protected loadRecord (from Controller)bool|array $Controller->loadRecord ( string $table , int $record_id ); Fetches the pre-update record from the database. Used by the action log system, and disabled if the action log system has been turned off protected logAction (from Controller)int $Controller->logAction ( string $table , int $record_id , int $type , array $data [, int $parent_log_id ] ); Stores a history item in the database, recording an add (i.e. insert), edit, or delete. Should be called AFTER the action has been made. N.B. This is a low-level method; the friendlier wrapper methods are preferred; e.g. Controller::logAdd, Controller::logEdit protected logAdd (from Controller)int $Controller->logAdd ( string $table , int $record_id ); Logs an add action. This is a wrapper for Controller::logAction protected logAddCategory (from Controller)int $Controller->logAddCategory ( string $table , int $record_id , int $cat_id ); Logs the adding of a record to a category. This is a wrapper for Controller::logAction protected logDelete (from Controller)int $Controller->logDelete ( string $table , int $record_id , array $data [, int $parent_log_id ] ); Logs a delete action. This is a wrapper for Controller::logAction protected logDeleteCategory (from Controller)int $Controller->logDeleteCategory ( string $table , int $record_id , int $cat_id ); Logs the removal of a record from a category. This is a wrapper for Controller::logAction protected logEdit (from Controller)int $Controller->logEdit ( string $table , int $record_id , array $data ); Logs an edit action. This is a wrapper for Controller::logAction public postJsonMultiTagvoid $ManagedAdminController->postJsonMultiTag ( ); Multi-tag some items. Uses AJAX. Returns JSON. public postMultiDeletevoid $ManagedAdminController->postMultiDelete ( ); Delete multiple records protected replaceSet (from Controller)void $Controller->replaceSet ( string $table , array $new_records , array $conditions ); Inserts records which are in $new_records, but are not in the specified table Deletes records which are in the specified table, but not in $new_records Updates records which are in both Matching is done on the 'id' field, as a result the $new_records arrays MUST contain an id field. protected saveJsonData (from Controller)bool $Controller->saveJsonData ( array $conf , int &$item_id [, string $mode ] ); Automatically saves the data associated with a submission on a JSON-generated form |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Friday, 5th August, 2022 at 05:25 pm |
![]() |