Additional Notes to Admin Panel

Creation of own pages

To create an own page in Admin Panel follow the next steps:

  1. In "models/customs/" folder create php file with the name which then goes to URL (without extension), for example "mypage.php"
  2. Now this page will be available by the link "/adminpanel/custom/?view=mypage".
  3. To redirect to this page usually you need to add a button or a link to the page of model, for this create a file (for example "model-index-bottom.php") as described in the Model Setting section (insert a code in Admin Panel).
  4. Include in "mypage.php" file header and footer of the page as shown on an example below. The inner structure of HTML tags can be different, for example for dividing the page into columns, you may take the structure of tags from another page of Admin Panel.
include $registry -> getSetting("IncludeAdminPath")."includes/header.php";
<div id="columns-wrapper">
  <div id="model-form">
    <div class="column-inner">
       <h3 class="column-header">Mypage</h3>
       // ...
       //Page content, messages, forms, etc.
       // ...
       <input type="button" class="button-light" value="Button 1" />
       <input type="button" class="button-dark" value="Button 2" onclick="..." />
include $registry -> getSetting("IncludeAdminPath")."includes/footer.php";

Objects of models can be created through classes of models. All object properties of Registry are accessible as described in System settings section and also additional properties may be required.

  • AdminPanelPath - URL path from server root to Admin Panel of the project, on the working server is "/adminpanel/" usually
  • IncludeAdminPath - the path from file system root to the folder of Admin Panel, to include files
//Call the objects of required models
$products = new Products();
$catalogs = new Catalogs();
$producers = new Producers();

//Check the user rights for a given model
//Parameters : model name in lower case 
//and one of the rights "create", "read", "update" or "delete" 
$system -> user -> extraCheckModelRights("products", "update");

//Messages about errors and successful operations 
echo "<div class="form-no-errors"><p>Data are successfully updated </p></div>";
echo "<div class="form-errors"><p>Error occurred ...</p></div>";