Dotclear 2.24
Loading...
Searching...
No Matches
adminModulesList Class Reference
Inheritance diagram for adminModulesList:
adminThemesList

Public Member Functions

 __construct (dcModules $modules, string $modules_root, string $xml_url, bool $force=false)
 
 setList (string $id)
 
 getList ()
 
Page methods
 setURL (string $url)
 
 getURL ($queries='', bool $with_tab=true)
 
 setTab (string $tab)
 
 getTab ()
 
 setRedir (string $default='')
 
 getRedir ()
 
Search methods
 getSearch ()
 
 displaySearch ()
 
Navigation menu methods
 setIndex (string $str)
 
 getIndex ()
 
 displayIndex ()
 
Sort methods
 setSort (string $field, bool $asc=true)
 
 getSort ()
 
 displaySort ()
 

Data Fields

 $modules
 
 $store
 

Static Public Attributes

static $allow_multi_install = false
 
static $distributed_modules = []
 
static $nav_indexes = 'abcdefghijklmnopqrstuvwxyz0123456789'
 

Protected Attributes

 $list_id = 'unknown'
 
 $data = []
 
 $config_module = []
 
 $config_file = ''
 
 $config_content = ''
 
 $path
 
 $path_writable = false
 
 $path_pattern = ''
 
 $page_url = ''
 
 $page_qs = '?'
 
 $page_tab = ''
 
 $page_redir = ''
 
 $nav_list = []
 
 $nav_special = 'other'
 
 $sort_field = 'sname'
 
 $sort_asc = true
 

Modules root directory methods

 getPath ()
 
 isWritablePath ()
 
 isDeletablePath (string $root)
 
 setPath (string $root)
 

Modules methods

 setModules (array $modules)
 
 getModules ()
 
 displayModules (array $cols=['name', 'version', 'desc'], array $actions=[], bool $nav_limit=false)
 
 doActions ()
 
 displayManualForm ()
 
 getActions (string $id, array $module, array $actions)
 
 getGlobalActions (array $actions, bool $with_selection=false)
 
static sanitizeModule (string $id, array $module)
 
static isDistributedModule (string $id)
 
static sortModules (array $modules, string $field, bool $asc=true)
 
static getSettingsUrls (string $id, bool $check=false, bool $self=true)
 

Module configuration methods

 setConfiguration (string $id=null)
 
 includeConfiguration ()
 
 getConfiguration ()
 
 displayConfiguration ()
 
static sanitizeString (string $str)
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( dcModules  $modules,
string  $modules_root,
string  $xml_url,
bool  $force = false 
)

Constructor.

Note that this creates dcStore instance.

Parameters
dcModules$modulesdcModules instance
string$modules_rootModules root directories
string$xml_urlURL of modules feed from repository
boolean$forceForce query repository

Reimplemented in adminThemesList.

References $modules, dcCore\app(), setIndex(), and setPath().

Member Function Documentation

◆ setList()

setList ( string  $id)

Begin a new list.

Parameters
string$idNew list ID
Returns
adminModulesList self instance

◆ getList()

getList ( )

Get list ID.

Returns
string

References $list_id.

◆ setPath()

setPath ( string  $root)
protected

Set path info.

Parameters
string$rootModules root directories
Returns
adminModulesList self instance

References $path, and $paths.

Referenced by __construct().

◆ getPath()

getPath ( )

Get modules root directories.

Returns
null|string directory to work on

References $path.

◆ isWritablePath()

isWritablePath ( )

Check if modules root directory is writable.

Returns
bool True if directory is writable

References $path_writable.

◆ isDeletablePath()

isDeletablePath ( string  $root)

Check if root directory of a module is deletable.

Parameters
string$rootModule root directory
Returns
bool True if directory is delatable

References dcCore\app().

◆ setURL()

setURL ( string  $url)

Set page base URL.

Parameters
string$urlPage base URL
Returns
adminModulesList self instance

◆ getURL()

getURL (   $queries = '',
bool  $with_tab = true 
)

Get page URL.

Parameters
string | array$queriesAdditionnal query string
bool$with_tabAdd current tab to URL end
Returns
string Clean page URL

Referenced by displayIndex(), displaySearch(), and getRedir().

◆ setTab()

setTab ( string  $tab)

Set page tab.

Parameters
string$tabPage tab
Returns
adminModulesList self instance

◆ getTab()

getTab ( )

Get page tab.

Returns
string Page tab

References $page_tab.

◆ setRedir()

setRedir ( string  $default = '')

Set page redirection.

Parameters
string$defaultDefault redirection
Returns
adminModulesList self instance

◆ getRedir()

getRedir ( )

Get page redirection.

Returns
string Page redirection

References $page_redir, and getURL().

◆ getSearch()

getSearch ( )

Get search query.

Returns
mixed Search query

Referenced by displayIndex(), and displaySearch().

◆ displaySearch()

displaySearch ( )

Display searh form.

Returns
adminModulesList self instance

References html\escapeHTML(), form\field(), getSearch(), and getURL().

◆ setIndex()

setIndex ( string  $str)

Set navigation special index.

Parameters
string$strIndex
Returns
adminModulesList self instance

Referenced by __construct().

◆ getIndex()

getIndex ( )

Get index from query.

Returns
string Query index or default one

Referenced by displayIndex().

◆ displayIndex()

displayIndex ( )

Display navigation by index menu.

Returns
adminModulesList self instance

References $nav_special, getIndex(), getSearch(), and getURL().

◆ setSort()

setSort ( string  $field,
bool  $asc = true 
)

Set default sort field.

Parameters
string$fieldThe field
bool$ascThe ascending
Returns
adminModulesList self instance

◆ getSort()

getSort ( )

Get sort field from query.

Returns
string Query sort field or default one

References $sort_field.

◆ displaySort()

displaySort ( )

Display sort field form.

Todo:
This method is not implemented yet
Returns
adminModulesList self instance

◆ setModules()

setModules ( array  $modules)

Set modules and sanitize them.

Parameters
array$modules
Returns
adminModulesList self instance

References $modules, and sanitizeModule().

◆ getModules()

getModules ( )

Get modules currently set.

Returns
array Array of modules

References $data.

◆ sanitizeModule()

static sanitizeModule ( string  $id,
array  $module 
)
static

Sanitize a module.

This clean infos of a module by adding default keys and clean some of them, sanitize module can safely be used in lists.

Parameters
string$idThe identifier
array$moduleThe module
Returns
array Array of the module informations

References dcModules\DEFAULT_PRIORITY.

Referenced by dcRestMethods\getModuleById(), and setModules().

◆ isDistributedModule()

static isDistributedModule ( string  $id)
static

Check if a module is part of the distribution.

Parameters
string$idModule root directory
Returns
bool True if module is part of the distribution

Referenced by themeEditorBehaviors\adminCurrentThemeDetails(), and adminThemeEditor\render().

◆ sortModules()

static sortModules ( array  $modules,
string  $field,
bool  $asc = true 
)
static

Sort modules list by specific field.

Parameters
array$modulesArray of modules
string$fieldField to sort from
bool$ascSort asc if true, else decs
Returns
array Array of sorted modules

◆ displayModules()

displayModules ( array  $cols = ['name', 'version', 'desc'],
array  $actions = [],
bool  $nav_limit = false 
)

Display list of modules.

Parameters
array$colsList of colones (module field) to display
array$actionsList of predefined actions to show on form
bool$nav_limitLimit list to previously selected index
Returns
adminModulesList self instance

Reimplemented in adminThemesList.

◆ getSettingsUrls()

static getSettingsUrls ( string  $id,
bool  $check = false,
bool  $self = true 
)
static

Get settings URLs if any

Parameters
string$idModule ID
boolean$checkCheck permission
boolean$selfInclude self URL (→ plugin index.php URL)
Returns
array Array of settings URLs

Referenced by adminPlugin\render().

◆ getActions()

getActions ( string  $id,
array  $module,
array  $actions 
)
protected

Get action buttons to add to modules list.

Parameters
string$idModule ID
array$moduleModule info
array$actionsActions keys
Returns
array Array of actions buttons

Reimplemented in adminThemesList.

◆ getGlobalActions()

getGlobalActions ( array  $actions,
bool  $with_selection = false 
)
protected

Get global action buttons to add to modules list.

Parameters
array$actionsActions keys
bool$with_selectionLimit action to selected modules
Returns
array Array of actions buttons

Reimplemented in adminThemesList.

◆ doActions()

doActions ( )

Execute POST action.

Set a notice on success through dcPage::addSuccessNotice

Exceptions
ExceptionModule not find or command failed

Reimplemented in adminThemesList.

◆ displayManualForm()

displayManualForm ( )

Display tab for manual installation.

Returns
mixed self instance or null

◆ setConfiguration()

setConfiguration ( string  $id = null)

Prepare module configuration.

We need to get configuration content in three steps and out of this class to keep backward compatibility.

if ($xxx->setConfiguration()) { include $xxx->includeConfiguration(); } $xxx->getConfiguration(); ... [put here page headers and other stuff] $xxx->displayConfiguration();

Parameters
string$idModule to work on or it gather through REQUEST
Returns
bool True if config set

◆ includeConfiguration()

includeConfiguration ( )

Get path of module configuration file.

Note
Required previously set file info
Returns
mixed Full path of config file or null

◆ getConfiguration()

getConfiguration ( )

Gather module configuration file content.

Note
Required previously file inclusion
Returns
bool True if content has been captured

◆ displayConfiguration()

displayConfiguration ( )

Display module configuration form.

Note
Required previously gathered content
Returns
adminModulesList self instance

◆ sanitizeString()

static sanitizeString ( string  $str)
static

Helper to sanitize a string.

Used for search or id.

Parameters
string$strString to sanitize
Returns
string Sanitized string

Field Documentation

◆ $modules

$modules

Referenced by __construct(), and setModules().

◆ $store

$store

◆ $allow_multi_install

$allow_multi_install = false
static

Referenced by adminPlugins\init().

◆ $distributed_modules

$distributed_modules = []
static

◆ $list_id

$list_id = 'unknown'
protected

Referenced by getList().

◆ $data

$data = []
protected

Referenced by getModules().

◆ $config_module

$config_module = []
protected

◆ $config_file

$config_file = ''
protected

◆ $config_content

$config_content = ''
protected

◆ $path

$path
protected

Referenced by getPath(), and setPath().

◆ $path_writable

$path_writable = false
protected

Referenced by isWritablePath().

◆ $path_pattern

$path_pattern = ''
protected

◆ $page_url

$page_url = ''
protected

◆ $page_qs

$page_qs = '?'
protected

◆ $page_tab

$page_tab = ''
protected

Referenced by getTab().

◆ $page_redir

$page_redir = ''
protected

Referenced by getRedir().

◆ $nav_indexes

$nav_indexes = 'abcdefghijklmnopqrstuvwxyz0123456789'
static

◆ $nav_list

$nav_list = []
protected

◆ $nav_special

$nav_special = 'other'
protected

Referenced by displayIndex().

◆ $sort_field

$sort_field = 'sname'
protected

Referenced by getSort().

◆ $sort_asc

$sort_asc = true
protected

The documentation for this class was generated from the following file: