[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/help/ -> manager.php (source)

   1  <?php
   2  /**
   3   *
   4   * This file is part of the phpBB Forum Software package.
   5   *
   6   * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7   * @license GNU General Public License, version 2 (GPL-2.0)
   8   *
   9   * For full copyright and license information, please see
  10   * the docs/CREDITS.txt file.
  11   *
  12   */
  13  
  14  namespace phpbb\help;
  15  
  16  /**
  17   * Class help page manager
  18   */
  19  class manager
  20  {
  21      /** @var \phpbb\event\dispatcher_interface */
  22      protected $dispatcher;
  23  
  24      /** @var \phpbb\language\language */
  25      protected $language;
  26  
  27      /** @var \phpbb\template\template */
  28      protected $template;
  29  
  30      /** @var bool */
  31      protected $switched_column;
  32  
  33      /**
  34       * Constructor
  35       *
  36       * @param \phpbb\event\dispatcher_interface $dispatcher
  37       * @param \phpbb\language\language $language
  38       * @param \phpbb\template\template $template
  39       */
  40  	public function __construct(\phpbb\event\dispatcher_interface $dispatcher, \phpbb\language\language $language, \phpbb\template\template $template)
  41      {
  42          $this->dispatcher = $dispatcher;
  43          $this->language = $language;
  44          $this->template = $template;
  45      }
  46  
  47      /**
  48       * Add a new faq block
  49       *
  50       * @param string $block_name    Name or language key with the name of the block
  51       * @param bool $switch_column    Switch the column of the menu
  52       * @param array $questions        Array of frequently asked questions
  53       */
  54  	public function add_block($block_name, $switch_column = false, $questions = array())
  55      {
  56          /**
  57           * You can use this event to add a block before the current one.
  58           *
  59           * @event core.help_manager_add_block_before
  60           * @var    string    block_name        Language key of the block headline
  61           * @var    bool    switch_column    Should we switch the menu column before this headline
  62           * @var    array    questions        Array with questions
  63           * @since 3.2.0-a1
  64           */
  65          $vars = array('block_name', 'switch_column', 'questions');
  66          extract($this->dispatcher->trigger_event('core.help_manager_add_block_before', compact($vars)));
  67  
  68          $this->template->assign_block_vars('faq_block', array(
  69              'BLOCK_TITLE'        => $this->language->lang($block_name),
  70              'SWITCH_COLUMN'        => !$this->switched_column && $switch_column,
  71          ));
  72  
  73          foreach ($questions as $question => $answer)
  74          {
  75              $this->add_question($question, $answer);
  76          }
  77  
  78          $this->switched_column = $this->switched_column || $switch_column;
  79  
  80          /**
  81           * You can use this event to add a block after the current one.
  82           *
  83           * @event core.help_manager_add_block_after
  84           * @var    string    block_name        Language key of the block headline
  85           * @var    bool    switch_column    Should we switch the menu column before this headline
  86           * @var    array    questions        Array with questions
  87           * @since 3.2.0-a1
  88           */
  89          $vars = array('block_name', 'switch_column', 'questions');
  90          extract($this->dispatcher->trigger_event('core.help_manager_add_block_after', compact($vars)));
  91      }
  92  
  93      /**
  94       * Add a new faq question
  95       *
  96       * @param string $question    Question or language key with the question of the block
  97       * @param string $answer    Answer or language key with the answer of the block
  98       */
  99  	public function add_question($question, $answer)
 100      {
 101          /**
 102           * You can use this event to add a question before the current one.
 103           *
 104           * @event core.help_manager_add_question_before
 105           * @var    string    question    Language key of the question
 106           * @var    string    answer        Language key of the answer
 107           * @since 3.2.0-a1
 108           */
 109          $vars = array('question', 'answer');
 110          extract($this->dispatcher->trigger_event('core.help_manager_add_question_before', compact($vars)));
 111  
 112          $this->template->assign_block_vars('faq_block.faq_row', array(
 113              'FAQ_QUESTION'        => $this->language->lang($question),
 114              'FAQ_ANSWER'        => $this->language->lang($answer),
 115          ));
 116  
 117          /**
 118           * You can use this event to add a question after the current one.
 119           *
 120           * @event core.help_manager_add_question_after
 121           * @var    string    question    Language key of the question
 122           * @var    string    answer        Language key of the answer
 123           * @since 3.2.0-a1
 124           */
 125          $vars = array('question', 'answer');
 126          extract($this->dispatcher->trigger_event('core.help_manager_add_question_after', compact($vars)));
 127      }
 128  
 129      /**
 130       * Returns whether the block titles switched side
 131       * @return bool
 132       */
 133  	public function switched_column()
 134      {
 135          return $this->switched_column;
 136      }
 137  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1