Datei: plugins/example.acp.php

Quellcode
Darstellung:
  1. <?php
  2. /**
  3.  * Plugin example: ACP
  4.  *
  5.  */
  6. class ACPExample extends BMPlugin 
  7. {
  8.    function ACPExample()
  9.    {
  10.       $this->name             'ACP example';
  11.       $this->author           'B1G Software';
  12.       $this->web              'http://www.b1g.de';
  13.       $this->mail             'info@b1g.de';
  14.       $this->version          '1.1';
  15.       $this->designedfor         '7.2.0';
  16.       $this->type             BMPLUGIN_DEFAULT;
  17.       
  18.       $this->admin_pages         true;
  19.       $this->admin_page_title    'ACP example';
  20.    }
  21.    
  22.    function AdminHandler()
  23.    {
  24.       global $tpl;
  25.       
  26.       if(!isset($_REQUEST['action']))
  27.          $_REQUEST['action'] = 'page1';
  28.       
  29.       $tabs = array(
  30.          0 => array(
  31.             'title'     => 'Page 1',
  32.             'link'      => $this->_adminLink() . '&action=page1&',
  33.             'active' => $_REQUEST['action'] == 'page1'
  34.          ),
  35.          1 => array(
  36.             'title'     => 'Page 2',
  37.             'link'      => $this->_adminLink() . '&action=page2&',
  38.             'active' => $_REQUEST['action'] == 'page2'
  39.          )
  40.       );
  41.  
  42.       $tpl->assign('tabs'$tabs);
  43.       
  44.       if($_REQUEST['action'] == 'page1')
  45.          $tpl->assign('page'$this->_templatePath('acpsample.page1.tpl'));
  46.       else if($_REQUEST['action'] == 'page2')
  47.          $tpl->assign('page'$this->_templatePath('acpsample.page2.tpl'));
  48.    }
  49.    
  50.    function getNotices()
  51.    {
  52.       $notices = array();
  53.       
  54.       $notices[] = array('type'  => 'info',
  55.                      'text'   => 'ACP example plugin is activated',
  56.                      'link'   => $this->_adminLink() . '&');
  57.       
  58.       return($notices);
  59.    }
  60. }
  61.  
  62. /**
  63.  * register plugin
  64.  */
  65. $plugins->registerPlugin('ACPExample');
  66. ?>