SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class AdminAjaxController

Handles processing of various admin AJAX methods including: widget settings; links; and categories.

Variables

NameVisibilityDescription
$action_log
Should this controller log add/edit/delete actions?

Functions

NameVisibilityDescription
__callpublicHandles methods that do not exist.
__constructpublicConstructor
_runpublicThe router/kohana will invoke this method to invoke an action.
addAddonpublicPopup for adding an addon
addCategorypublicAdds a category
attrEditorpublicLoad an attribute editor for a given field
autoSetEmptyParamprotectedAuto-set the "empty" param for fields with foreign keys to be NULL
deleteRecordprotectedDeletes a record, and logs the deletion
footerCompatpublic 
generateFormViewprotectedGenerates a form view from a JSON config file
getCssClassNamepublicReturn the class name for this controller, expressed in CSS style, i.e. with dashes
getEntranceArgumentspublic 
getModulePathpublicGets the relative path to the module the controller lives in, or sprout itself
getTagSuggestionspublic 
jsonExtraValidateprotectedDo any additional validation prior to saving the record
lnkEditorpublicLoad an attribute editor for a given field
loadEditJsonprotectedLoads a JSON config file for an automated edit-type form for this controller
loadFormJsonprotectedLoads a config file for a JsonForm associated with this controller
loadRecordprotectedFetches the pre-update record from the database.
logActionprotectedStores a history item in the database, recording an add (i.e. insert), edit, or delete.
logAddprotectedLogs an add action. This is a wrapper for Controller::logAction
logAddCategoryprotectedLogs the adding of a record to a category. This is a wrapper for Controller::logAction
logDeleteprotectedLogs a delete action. This is a wrapper for Controller::logAction
logDeleteCategoryprotectedLogs the removal of a record from a category. This is a wrapper for Controller::logAction
logEditprotectedLogs an edit action. This is a wrapper for Controller::logAction
replaceSetprotectedInserts records which are in $new_records, but are not in the specified table
richtextImportpublicCalled by button handlers on the two RTEs and loaded in a facebox window
richtextImportIframepublicHandle an upload of a document. Echos DIV-warapped JSON with the result of the import.
saveJsonDataprotectedAutomatically saves the data associated with a submission on a JSON-generated form
setTourCompletedpublicSet a given JavaScript tour as complete, preventing it from showing again.
styleGuideDemoConditionspublicDemo AJAX JSON callback url for Fb::conditionsList
widgetDispCondParamspublicCallback url for Fb::conditionsList for the widget display conditions
widgetDispCondspublicAJAX-loaded popup content for UI to manage widget display conditions
widgetSettingspublicReturns the HTML for the settings for an individual widget.

public __call (from BaseController)

void $BaseController->__call ( string $method , array $args );

Handles methods that do not exist.

public __construct

void $AdminAjaxController->__construct ( );

Constructor

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 addAddon

void $AdminAjaxController->addAddon ( mixed $area_id , mixed $field_name );

Popup for adding an addon

public addCategory

void $AdminAjaxController->addCategory ( );

Adds a category

public attrEditor

void $AdminAjaxController->attrEditor ( );

Load an attribute editor for a given field

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

public footerCompat

void $AdminAjaxController->footerCompat ( );

This function does not have a description

protected generateFormView (from Controller)

array $Controller->generateFormView ( mixed $file_name );

Generates a form view from a JSON config file

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 getEntranceArguments

void $AdminAjaxController->getEntranceArguments ( mixed $class );

This function does not have a description

public getModulePath (from BaseController)

string $BaseController->getModulePath ( );

Gets the relative path to the module the controller lives in, or sprout itself

public getTagSuggestions

void $AdminAjaxController->getTagSuggestions ( [ mixed $table ] );

This function does not have a description

protected jsonExtraValidate (from Controller)

void $Controller->jsonExtraValidate ( int $id , Validator $validator );

Do any additional validation prior to saving the record

public lnkEditor

void $AdminAjaxController->lnkEditor ( );

Load an attribute editor for a given field

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

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.

public richtextImport

void $AdminAjaxController->richtextImport ( mixed $elemid );

Called by button handlers on the two RTEs and loaded in a facebox window
Shows an interface to load stuff into the editor
The editor id will br provided in $elemid

public richtextImportIframe

void $AdminAjaxController->richtextImportIframe ( );

Handle an upload of a document. Echos DIV-warapped JSON with the result of the import.

Keys include:
   'html'    The imported HTML of the document

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

public setTourCompleted

void $AdminAjaxController->setTourCompleted ( mixed $tour_name );

Set a given JavaScript tour as complete, preventing it from showing again.

public styleGuideDemoConditions

void $AdminAjaxController->styleGuideDemoConditions ( );

Demo AJAX JSON callback url for Fb::conditionsList

Input is GET params 'field', 'op', 'val'

Output is JSON with two keys, 'op' and 'val'. They are both
HTML strings containing Form fields for the operator
dropdown and the values dropdown/textbox

public widgetDispCondParams

void $AdminAjaxController->widgetDispCondParams ( );

Callback url for Fb::conditionsList for the widget display conditions

Input is GET params 'field', 'op', 'val'

Output is JSON with two keys, 'op' and 'val'. They are both
HTML strings containing Form fields for the operator
dropdown and the values dropdown/textbox

public widgetDispConds

void $AdminAjaxController->widgetDispConds ( );

AJAX-loaded popup content for UI to manage widget display conditions

public widgetSettings

void $AdminAjaxController->widgetSettings ( string $widget_name );

Returns the HTML for the settings for an individual widget.