Admin panel add-ons
Creating your own pages
To create your own page in the admin panel, you need to:
- In the customs/adminpanel/ folder, create a php file with a name that will then go into the URL (without the extension), for example, mypage.php.
- Now this page will be available at the link /adminpanel/custom?view=mypage.
- To go to this page, you usually need to add a button or link to the model page, for this you need to create a file, for example, pages-index-bottom.php, as described in the section Model settings inserting code into the administrative interface.
- Connect the upper and lower parts of the admin template in the mypage.php file, as in the example below. The structure of HTML tags inside may be different, for example, to split the page into columns, you can take the structure of tags from another page of the admin panel.
//File customs/adminpanel/mypage.php
<?
include Registry::get('IncludeAdminPath').'includes/header.php';
?>
<div id='columns-wrapper'>
<div id='model-form'>
<div class='column-inner'>
<h3 class='column-header'>Mypage</h3>
//Page contents
<input type='button' class='button-light' value='Button 1' />
<input type='button' class='button-dark' value='Button 2' onclick='...' />
</div>
</div>
</div>
<?
include Registry::get('IncludeAdminPath').'includes/footer.php';
?>
Model objects can be created through classes. All properties of the Registry object described in the section System settings are available, and additional properties may also be needed.
- AdminPanelPath - URL path from the server root to the project's administrative panel, on a production server usually /adminpanel/
- IncludeAdminPath - path from the file system root to the administrative panel folder to include files
//Calling objects of the required models
$products = new Products();
$catalogs = new Catalogs();
$producers = new Producers();
//Checking user rights to this model
//Parameters: 'create', 'read', 'update', 'delete'
$system -> user -> extraCheckModelRights('products', 'update');
Previous section
Security