SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class WelcomeController

Forms used for setting up SproutCMS for the first time

Variables

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

Functions

NameVisibilityDescription
__callpublicHandles methods that do not exist.
__constructpublic 
_runpublicThe router/kohana will invoke this method to invoke an action.
addSampleActionpublicAdd sample content
addSampleFilesprivateAdd sample files from sample_content/files.xml
addSampleHomePageprivateUpdates to home page - hardcoded rather than an xml file
addSamplePagesprivateAdd sample files from sample_content/pages.xml
autoSetEmptyParamprotectedAuto-set the "empty" param for fields with foreign keys to be NULL
checklistpublicDisplay the welcome checklist
dbConfDatabasepublic (static)Generate and download a database config file
dbConfFormpublicShow a UI for generating a database config
dbConfHostspublic (static)Generate and download a dev hosts config file
dbConfPasswordpublic (static)Generate and download a password config file
dbConfResultpublicDisplay the generated database config
dbConfTestpublicAjax method to test the db connection for a given set of params
deleteRecordprotectedDeletes a record, and logs the deletion
genDbConfigprivate (static)Generate a database config from given parameters
genDevHostsConfigprivate (static)Generate a dev hosts config, which contains the existing config and the current hostname
genPassConfigprivate (static)Generate a database password file from given parameters
generateFormViewprotectedGenerates a form view from a JSON config file
getCssClassNamepublicReturn the class name for this controller, expressed in CSS style, i.e. with dashes
getModulePathpublicGets the relative path to the module the controller lives in, or sprout itself
jsonExtraValidateprotectedDo any additional validation prior to saving the record
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
passwordComplexityprivate (static)Ensure password has enough complexity
phpInfopublicShow a phpinfo() view along with some extra information
redirectpublicRedirect home page traffic to the welcome checklist
replaceSetprotectedInserts records which are in $new_records, but are not in the specified table
saveJsonDataprotectedAutomatically saves the data associated with a submission on a JSON-generated form
superOperatorActionpublicCreate a super operator
superOperatorConfpublicGenerate and download super operator config file
superOperatorFormpublicShow a UI to create a super-operator
superOperatorResultpublicShow the generated super operator details
syncpublicRun a database sync
testDbconfprivateTest the database config is correct
testDbsyncprivateTest that tables are available
testSampleContentprivateTest that sample content has been added
testSuperOpprivateTest whether one or more super operators have been created
testWelcomeprivateTest that the welcome module isn't installed
wipeTablesprivateWipe the tables used by the sample code system (dev only code)

public __call (from BaseController)

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

Handles methods that do not exist.

public __construct

void $WelcomeController->__construct ( );

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 addSampleAction

void $WelcomeController->addSampleAction ( );

Add sample content

private addSampleFiles

void $WelcomeController->addSampleFiles ( );

Add sample files from sample_content/files.xml

private addSampleHomePage

void $WelcomeController->addSampleHomePage ( );

Updates to home page - hardcoded rather than an xml file

private addSamplePages

void $WelcomeController->addSamplePages ( );

Add sample files from sample_content/pages.xml

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.

public checklist

void $WelcomeController->checklist ( );

Display the welcome checklist

public dbConfDatabase

void WelcomeController::dbConfDatabase ( );

Generate and download a database config file

public dbConfForm

void $WelcomeController->dbConfForm ( );

Show a UI for generating a database config

public dbConfHosts

void WelcomeController::dbConfHosts ( );

Generate and download a dev hosts config file

public dbConfPassword

void WelcomeController::dbConfPassword ( );

Generate and download a password config file

public dbConfResult

void $WelcomeController->dbConfResult ( );

Display the generated database config

public dbConfTest

void $WelcomeController->dbConfTest ( );

Ajax method to test the db connection for a given set of params

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

private genDbConfig

string WelcomeController::genDbConfig ( array $data );

Generate a database config from given parameters

private genDevHostsConfig

string WelcomeController::genDevHostsConfig ( );

Generate a dev hosts config, which contains the existing config and the current hostname

private genPassConfig

string WelcomeController::genPassConfig ( array $data );

Generate a database password file from given parameters

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 getModulePath (from BaseController)

string $BaseController->getModulePath ( );

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

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

private passwordComplexity

unknown WelcomeController::passwordComplexity ( mixed $str );

Ensure password has enough complexity

public phpInfo

void $WelcomeController->phpInfo ( );

Show a phpinfo() view along with some extra information

public redirect

void $WelcomeController->redirect ( );

Redirect home page traffic to the welcome checklist

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

public superOperatorAction

void $WelcomeController->superOperatorAction ( );

Create a super operator

public superOperatorConf

void $WelcomeController->superOperatorConf ( );

Generate and download super operator config file

public superOperatorForm

void $WelcomeController->superOperatorForm ( );

Show a UI to create a super-operator

public superOperatorResult

void $WelcomeController->superOperatorResult ( );

Show the generated super operator details

public sync

void $WelcomeController->sync ( );

Run a database sync

private testDbconf

array $WelcomeController->testDbconf ( );

Test the database config is correct

private testDbsync

array $WelcomeController->testDbsync ( );

Test that tables are available

private testSampleContent

array $WelcomeController->testSampleContent ( );

Test that sample content has been added

private testSuperOp

array $WelcomeController->testSuperOp ( );

Test whether one or more super operators have been created

private testWelcome

array $WelcomeController->testWelcome ( );

Test that the welcome module isn't installed

private wipeTables

void $WelcomeController->wipeTables ( );

Wipe the tables used by the sample code system (dev only code)