energine
[ class tree: energine ] [ index: energine ] [ all elements ]

Source for file Remover.class.php

Documentation is available at Remover.class.php

  1. <?php
  2. /**
  3.  * Содержит класс Remover
  4.  *
  5.  * @package energine
  6.  * @subpackage core
  7.  * @author dr.Pavka
  8.  * @copyright Energine 2006
  9.  * @version $Id: Remover.class.php,v 1.5 2008/08/27 15:39:16 chyk Exp $
  10.  */
  11.  
  12. //require_once('core/framework/Component.class.php');
  13.  
  14. /**
  15.  * Класс которому передается имя компонента, который необходимо удалить
  16.  * Класс используется для случаев, когда пользователи с разными правми должны видеть разные компоненты
  17.  *
  18.  * @package energine
  19.  * @subpackage core
  20.  * @author dr.Pavka
  21.  */
  22. class Remover extends Component {
  23.     /**
  24.      * Конструктор класса.
  25.      *
  26.      * @access public
  27.      * @param string $name 
  28.      * @param string $module 
  29.      * @param Document $document 
  30.      * @param array $params 
  31.      * @return void 
  32.      */
  33.     public function __construct($name$moduleDocument $document,  array $params null{
  34.         parent::__construct($name$module$document,  $params);
  35.     }
  36.  
  37.     /**
  38.      * Добавлен параметр имя компонента
  39.      *
  40.      * @access protected
  41.      * @return array 
  42.      */
  43.     protected function defineParams({
  44.         return array_merge(
  45.             parent::defineParams(),
  46.             array(
  47.                 'componentName' => false
  48.         ));
  49.     }
  50.  
  51.     /**
  52.      * Дизейблит компонент
  53.      *
  54.      * @return void 
  55.      * @access protected
  56.      */
  57.  
  58.      protected function main({
  59.         if (
  60.             (
  61.                 $this->document->getRights(!= ACCESS_FULL 
  62.                 && 
  63.                 $component $this->document->componentManager->getComponentByName($this->getParam('componentName'))
  64.             )
  65.         {
  66.             $component->disable();
  67.         }
  68.      }
  69. }
В создании документации нам помог: phpDocumentor