SproutCMS

This is the code documentation for the SproutCMS project

class Controller

Kohana Controller class. The controller class must be extended to work
properly, so this class is defined as abstract.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-15
**/
class NewClassName extends Controller {
    
    /**
    * Logs an edit action. This is a wrapper for {@see Controller::logAction}
    **/
    protected function logEdit (string $table, int $record_id, array $data) {
        // Method code goes here
    }
    
    /**
    * Logs a delete action. This is a wrapper for {@see Controller::logAction}
    **/
    protected function logDelete (string $table, int $record_id, array $data, int $parent_log_id) {
        // Method code goes here
    }
    
    /**
    * Logs the removal of a record from a category. This is a wrapper for {@see Controller::logAction}
    **/
    protected function logDeleteCategory (string $table, int $record_id, int $cat_id) {
        // Method code goes here
    }
    
    /**
    * 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 function deleteRecord (string $table, int $record_id, int $parent_log_id) {
        // Method code goes here
    }
    
    /**
    * Automatically saves the data associated with a submission on a JSON-generated form
    **/
    protected function saveJsonData (array $conf, int $item_id, string $mode) {
        // Method code goes here
    }
    
    /**
    * 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 function replaceSet (string $table, array $new_records, array $conditions) {
        // Method code goes here
    }
    
    /**
    * Loads a config file for a JsonForm associated with this controller
    **/
    protected function loadFormJson (string $file_name) {
        // Method code goes here
    }
    
    /**
    * Loads a JSON config file for an automated edit-type form for this controller
    **/
    protected function loadEditJson () {
        // Method code goes here
    }
    
    /**
    * Generates a form view from a JSON config file
    **/
    protected function generateFormView ($file_name) {
        // Method code goes here
    }
    
    /**
    * Do any additional validation prior to saving the record
    **/
    protected function jsonExtraValidate (int $id, Validator $validator) {
        // Method code goes here
    }
    
    /**
    * Auto-set the &quot;empty&quot; 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 function autoSetEmptyParam (array $conf) {
        // Method code goes here
    }
    
    /**
    * Logs the adding of a record to a category. This is a wrapper for {@see Controller::logAction}
    **/
    protected function logAddCategory (string $table, int $record_id, int $cat_id) {
        // Method code goes here
    }
    
    /**
    * 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 function loadRecord (string $table, int $record_id) {
        // Method code goes here
    }
    
    /**
    * Logs an add action. This is a wrapper for {@see Controller::logAction}
    **/
    protected function logAdd (string $table, int $record_id) {
        // Method code goes here
    }
    
    /**
    * 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. {@see Controller::logAdd}, {@see Controller::logEdit}
    **/
    protected function logAction (string $table, int $record_id, int $type, array $data, int $parent_log_id) {
        // Method code goes here
    }
    
}
?>