The administrative part of the site

Initialization of the administrative part is similar to the initialization of the public part of the site. But it has its own characteristics due to the difference of the module structure and data access.

If the file index.php determined that requested the administrative part, then the file adm/index.php is connected. The file has the following functions:

  1. the connection of all the "vital" file;
  2. the initiation of the main object system.

The main system object – an instance of Init_admin described in the the file adm/includes/init.php.

When initiating a main object of the system takes place:

  1. start session;
  2. user identification and verification of access to the administrative part;
  3. language version definition for data editing;
  4. module definition;
  5. connection module administration;
  6. connect the administrative part template.

An instance Init_admin transmitted to all other facilities and is accessible from any location in the variable $this->diafan.

Thus, the global data can be obtained anywhere in the system:

  1. general data;
  2. general functions;
  3. objects classes-connections.

Now more about the data:

General data

  • $this->diafan->installed_modules – data array with installed modules;

    Example:

    if(in_array('search', $this->diafan->installed_modules))
    {
        
    // module "Search" is installed and can be set to handle it
    }
  • $this->diafan->rewrite_variable_names – list of all variables available for use in the URL;
  • $this->diafan->current_module – module of the current executable.

General functions

Class Init_admin inherits an abstract class Core](/dokument/full-manual/developers/api/core/) (includes/core.php). All functions of this class can be called up in the form of:

$this->diafan->function_name();

Example:

// cut the text up to 50 characters, while maintaining complete words at the end
$short_text = $this->diafan->short_text($text, 50);

Objects classes-connections

Basically, the object classes are initiated:

  • caching (class Cache, file includes/cache.php, called $this->diafan->_cache) – all the work with the cache;
  • router (class Route, file includes/route.php, called $this->diafan->_route) – access to the variables inherent in the link and the generation, storage, reception semantic URL;
  • modules templates (class Template, file includes/template.php, called $this->diafan->_tpl) – connection module templates, processing of text from visual editor;
  • parser template tags (class Parser_theme, file includes/parser_theme.php, called $this->diafan->_parser_theme) – connects the template tags, prescribed in the form of tags in the site templates directly in the text of the visual editor.

In addition, through the main object can refer to any module-connection. If the module is file modules/module_name/module_name.inc.php where the class described Module_name_inc, then at the first reference to a variable $this->diafan->_модуль, an instance is created.

Allocate a separate plug-ins related to the system kernel:

Per page admin - used to retrieve data about the current page in the administrative part.
  • admin pages – used to retrieve data about the current page in the administrative part.

    Example:

    • $this->diafan->_admin->rewrite – semantic URL of current page;
    • $this->diafan->_admin->module – module attached to current page.
  • users – used to get information about the current user.

    Example:

    • $this->diafan->_users->id – current user ID;
    • $this->diafan->_users->name – current user login;
    • $this->diafan->_users->fio – current user full name.
  • languages – used to get information about site languages, the main language of the administrative and public parts of the site and getting the translation interface.

    Example:

    • $this->diafan->_languages->all – array of data about all the languages ​​used on the site;
    • $this->diafan->_languages->site – ID of language used as the basic on the site;
    • $this->diafan->_languages->admin – language number, which is used as the basic admin part.