SproutCMS

This is the code documentation for the SproutCMS project

class Admin

Useful functions for the admin

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-03
**/
class NewClassName extends Admin {
    
    /**
    * For a given URL, ensure it's absolute.
    * If it's not absolute, the current admin abs-root is prepended
    **/
    public function ensureUrlAbsolute (string $url) {
        // Method code goes here
    }
    
    /**
    * Gets an instance of a managed admin controller
    **/
    public function getController (string $class_name) {
        // Method code goes here
    }
    
    /**
    * Return a unique key for identifying a session.
    * This will be constant even if the session id changes, although it's nuked if you log out.
    **/
    public function createLockKey () {
        // Method code goes here
    }
    
    /**
    * Remove all locks which are older than the allowed lock time.
    **/
    public function clearOldLocks () {
        // Method code goes here
    }
    
    /**
    * Removes locks for the current user
    **/
    public function unlock (string $ctlr, int $record_id) {
        // Method code goes here
    }
    
    public function setCategoryTablename ($name) {
        // Method code goes here
    }
    
    public function setCategorySinglecat ($value) {
        // Method code goes here
    }
    
    /**
    * Outputs an interface for selecting multiple categories
    **/
    public function categorySelection (The $field, An $data, An $selected) {
        // Method code goes here
    }
    
    /**
    * Nuke a lock
    **/
    public function forceUnlock ($lock_id) {
        // Method code goes here
    }
    
    /**
    * Updates the timestamp for a given lock record to prevent it from timing out
    **/
    public function pingLock (int $lock_id) {
        // Method code goes here
    }
    
    /**
    * Locks the given record for the current user
    **/
    public function lock (string $ctlr, int $record_id) {
        // Method code goes here
    }
    
    /**
    * Gets the lock details for a given record
    **/
    public function getLock (string $ctlr, int $record_id) {
        // Method code goes here
    }
    
    /**
    * Has a given JavaScript tour been completed?
    **/
    public function isTourCompleted (string $tour_name) {
        // Method code goes here
    }
    
    /**
    * Set a given JavaScript tour as being &quot;completed&quot;, preventing it from being shown again.
    **/
    public function setTourCompleted (string $tour_name) {
        // Method code goes here
    }
    
    /**
    * Is admin locks enabled?
    **/
    public function locksEnabled () {
        // Method code goes here
    }
    
    /**
    * When in the admin, return the slug of the controller being used, e.g. 'page' or 'blog_post'
    **/
    public function getControllerSlug () {
        // Method code goes here
    }
    
    /**
    * When in the admin, return the record id being added or edited.
    * If it's not an add or an edit, returns null.
    * If used outside of the admin, behaviour is undefined
    **/
    public function getRecordId () {
        // Method code goes here
    }
    
    /**
    * Return HTML for the top nav tabs
    **/
    public function topNav (string $selected_controller) {
        // Method code goes here
    }
    
    /**
    * Renders an interface for editing attributes
    * Uses a multiedit
    **/
    public function attrEditor ($current_attrs) {
        // Method code goes here
    }
    
    /**
    * Outputs a list of radiobuttons, which will all use the same field name
    **/
    public function radioList (string $field, array $data, array $selected) {
        // Method code goes here
    }
    
    /**
    * Outputs a list of checkboxes.
    * 
    * If the $field parameter is provided, multiple checkboxes with the same field name will be rendered.
    *    $data should be a key-value pair, with the keys being the value of the checkbox, and the value being the label.
    *    $selected should be an array of selected checkbox ids.
    * 
    * If the $field parameter is omitted (null), multiple checkboxes widh different field names will be rendered.
    * The checkboxes will be binary checkboxes with a value of 1.
    *    $data should be a key-value pair, with the keys being the field name, and the value being the label.
    *    $selected should be a key-value pair, with the keys being the field name, and the value being 1 or 0.
    **/
    public function checkboxList ($field, $data, $selected) {
        // Method code goes here
    }
    
    /**
    * Deprecated wrapper around {@see Fb::pageDropdown}
    **/
    public function pageDropdown (string $field_name, int $selected, int $exclude, int $subsite_id, string $top_text) {
        // Method code goes here
    }
    
    /**
    * Render a tree of nodes for the navigation area of the admin
    * Used by the pages module
    **/
    public function navigationTreeNode (Treenode $node, array $actions, int $depth) {
        // Method code goes here
    }
    
    /**
    * For a set of multi-edit fields, loads the data into a much more usable array
    * 
    * Input:
    *   [phone] = ('1234 1234', '4321 4321')
    *   [type] = ('Mobile', 'Home')
    * 
    * Output:
    *   [1] = ('phone' =&gt; '1234 1234', 'type' =&gt; 'Mobile')
    *   [2] = ('phone' =&gt; '4321 4321', 'type' =&gt; 'Home')
    **/
    public function multieditBuild (array $dataset, array $field_names) {
        // Method code goes here
    }
    
    /**
    * Shows a UI for the list of widgets, for editing
    **/
    public function widgetList (string $field_name, WidgetArea $area, array $curr_widgets, boolean $enable_all) {
        // Method code goes here
    }
    
    /**
    * Finds an appropriate error message for the specified error code
    **/
    public function lookupErrMsg ($err) {
        // Method code goes here
    }
    
    /**
    * Shows a per-field error message
    **/
    public function fieldError (string $field_name, $scope) {
        // Method code goes here
    }
    
    /**
    * Clears all pre-field error messages
    **/
    public function clearFieldErrors ($scope) {
        // Method code goes here
    }
    
}
?>