SproutCMS

This is the code documentation for the SproutCMS project

class AdminController

Main class to handle admin processing.
This delegates processing to controllers registered with Register::adminControllers

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-15
**/
class NewClassName extends AdminController {
    
    /**
    * Browser information
    **/
    public function userAgent () {
        // Method code goes here
    }
    
    /**
    * Activates AutoLaunch revisions
    **/
    public function cronGenericActivate () {
        // Method code goes here
    }
    
    public function heartbeat () {
        // Method code goes here
    }
    
    /**
    * Unlock a record.
    * Called via ajax in the beforeunload javascript event
    **/
    public function ajaxUnlock () {
        // Method code goes here
    }
    
    /**
    * Restore a deleted record from log data
    **/
    public function restore (int $log_id) {
        // Method code goes here
    }
    
    /**
    * Unlocks lock for a given record/controller, all records for a controller, or all locks
    **/
    private function unlock ($type, $id) {
        // Method code goes here
    }
    
    /**
    * Sets the a bunch of parameters for a the main view.
    **/
    private function setDefaultMainviewParams (View $view) {
        // Method code goes here
    }
    
    /**
    * Returns an instance of a controller class for a given type
    **/
    private function getController (string $type) {
        // Method code goes here
    }
    
    /**
    * Does lock checking, locking, or lock messages.
    **/
    private function lock (string $type, int $id, View $view) {
        // Method code goes here
    }
    
    /**
    * Sets up the sidebar navigation for a view to show the navigation for a specific controller.
    **/
    private function setNavigation (View $view, Controller $ctlr) {
        // Method code goes here
    }
    
    /**
    * Directly calls a method provided by an admin controller
    * Suports varargs - additional args are passed to the underlying function
    **/
    public function call (string $class, string $method) {
        // Method code goes here
    }
    
    /**
    * Processes the moderation form
    **/
    public function moderateAction () {
        // Method code goes here
    }
    
    /**
    * Calls any 'extra' commands that might be provided by the controller
    * 
    * Method names will be prefixed with '_extra' and must be public
    * Names which are lower_cased will be converted to camelCase
    * 
    * Supports varargs - additional args are passed to the underlying function
    * Called method should return an array, with two keys:
    *     title     string    Main title
    *     content   string    HTML for the main content area
    **/
    public function extra (string $class, string $method) {
        // Method code goes here
    }
    
    /**
    * Sets the active subsite, and then redirects back to the admin area.
    * Uses the post variable &quot;subsite&quot;.
    **/
    public function setActiveSubsite () {
        // Method code goes here
    }
    
    /**
    * Generates HTML for fields relating to per-record permissions in the 'save changes' box
    **/
    protected function perRecordPermissionsFields (ManagedAdminController $ctlr, int $item_id) {
        // Method code goes here
    }
    
    /**
    * Shows an add form for the specified item
    **/
    public function add (string $type) {
        // Method code goes here
    }
    
    /**
    * Executes the save action for a specific item
    **/
    public function addSave (string $type) {
        // Method code goes here
    }
    
    /**
    * Shows an edit form for the specified item
    **/
    public function edit (string $type, int $id) {
        // Method code goes here
    }
    
    /**
    * Executes the save action for a specific item
    **/
    public function editSave (string $type, int $id) {
        // Method code goes here
    }
    
    /**
    * Shows a delete form for the specified item
    **/
    public function delete (string $type, int $id) {
        // Method code goes here
    }
    
    /**
    * Executes the delete action for a specific item
    **/
    public function deleteSave (string $type, int $id) {
        // Method code goes here
    }
    
    /**
    * Shows a duplication form for the specified item
    * This uses the edit form with some string replacements
    **/
    public function duplicate (string $type, int $id) {
        // Method code goes here
    }
    
    /**
    * Executes the save action for a record duplication
    **/
    public function duplicateSave (string $type, int $orig_id) {
        // Method code goes here
    }
    
    /**
    * Moderation
    **/
    public function moderate () {
        // Method code goes here
    }
    
    /**
    * Render a list of sub-actions into HTML as links
    * 
    * Each sub-action should be an array, with the following keys:
    *    url     Link URL
    *    name    Link text
    *    class   Optional class
    *    new_tab Optional bool to show in new window/tab
    * 
    * Use a special entry with a key of &quot;_preview&quot; and a value of the
    * preview URL to set up a preview button
    **/
    private function renderSubActions (array $list) {
        // Method code goes here
    }
    
    /**
    * Does some general admin loading
    **/
    public function __construct () {
        // Method code goes here
    }
    
    /**
    * Home page of admin area
    **/
    public function index () {
        // Method code goes here
    }
    
    /**
    * Shows a login form
    **/
    public function login () {
        // Method code goes here
    }
    
    /**
    * Processes a user login
    **/
    public function loginAction () {
        // Method code goes here
    }
    
    /**
    * Show the two-factor-auth ui for a half-logged-in operator
    **/
    public function loginTwoFactor () {
        // Method code goes here
    }
    
    /**
    * Process the result of a two-factor-auth for a half-logged-in operator
    **/
    public function loginTwoFactorAction () {
        // Method code goes here
    }
    
    /**
    * Set up various login params and redirect into admin
    * 
    * Called after a successful login (either one-factor or two-factor)
    **/
    private function loginComplete () {
        // Method code goes here
    }
    
    /**
    * Processes a user logout
    **/
    public function logout () {
        // Method code goes here
    }
    
    /**
    * View the various styles available in the admin area
    **/
    public function styleGuide ($section) {
        // Method code goes here
    }
    
    /**
    * Dashboard shown when a user first logs in to the admin
    **/
    public function dashboard () {
        // Method code goes here
    }
    
    /**
    * Closes the 'first run' box, which is shown on the admin dashboard
    **/
    public function closeFirstrun () {
        // Method code goes here
    }
    
    /**
    * Shows an introduction for a specified type.
    **/
    public function intro (string $type) {
        // Method code goes here
    }
    
    /**
    * Shows a search form for the specified item
    **/
    public function search (string $type) {
        // Method code goes here
    }
    
    /**
    * Shows an edit form for the specified item
    **/
    public function contents (string $type) {
        // Method code goes here
    }
    
    /**
    * Shows an edit form for the specified item
    **/
    public function export (string $type) {
        // Method code goes here
    }
    
    /**
    * Executes the save action for a specific item
    **/
    public function exportAction (string $type) {
        // Method code goes here
    }
    
    /**
    * File upload box for importing, options are the next step
    **/
    public function importUpload (string $type) {
        // Method code goes here
    }
    
    /**
    * Copies the file to a temporary directory
    **/
    public function importUploadAction ($type) {
        // Method code goes here
    }
    
    /**
    * Shows the import form for the specified item
    **/
    public function importOptions (string $type) {
        // Method code goes here
    }
    
    /**
    * Executes the import action
    **/
    public function importAction (string $type) {
        // Method code goes here
    }
    
    /**
    * Shows an error message in the admin skin
    **/
    private function error (string $message, ManagedAdminController $ctlr) {
        // Method code goes here
    }
    
    /**
    * Check access for a given controller/access flag combo
    * If this returns false, it will echo out an error message; the calling code should just return.
    **/
    private function checkAccess (ManagedAdminController $ctlr, string $access_flag, bool $action) {
        // Method code goes here
    }
    
    /**
    * Checks that an admin user has access to an individual record
    **/
    public function checkRecordAccess (ManagedAdminController $ctlr, int $item_id) {
        // Method code goes here
    }
    
    /**
    * Ensure 'active' flag and 'tags' POST fields have values set, if they are nonexistant
    **/
    private function cleanupCommonPostData (ManagedAdminController $ctlr) {
        // Method code goes here
    }
    
}
?>