Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
manager.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\help;
015
016 /**
017 * Class help page manager
018 */
019 class manager
020 {
021 /** @var \phpbb\event\dispatcher */
022 protected $dispatcher;
023
024 /** @var \phpbb\language\language */
025 protected $language;
026
027 /** @var \phpbb\template\template */
028 protected $template;
029
030 /** @var bool */
031 protected $switched_column;
032
033 /**
034 * Constructor
035 *
036 * @param \phpbb\event\dispatcher $dispatcher
037 * @param \phpbb\language\language $language
038 * @param \phpbb\template\template $template
039 */
040 public function __construct(\phpbb\event\dispatcher $dispatcher, \phpbb\language\language $language, \phpbb\template\template $template)
041 {
042 $this->dispatcher = $dispatcher;
043 $this->language = $language;
044 $this->template = $template;
045 }
046
047 /**
048 * Add a new faq block
049 *
050 * @param string $block_name Name or language key with the name of the block
051 * @param bool $switch_column Switch the column of the menu
052 * @param array $questions Array of frequently asked questions
053 */
054 public function add_block($block_name, $switch_column = false, $questions = array())
055 {
056 /**
057 * You can use this event to add a block before the current one.
058 *
059 * @event core.help_manager_add_block_before
060 * @var string block_name Language key of the block headline
061 * @var bool switch_column Should we switch the menu column before this headline
062 * @var array questions Array with questions
063 * @since 3.2.0-a1
064 */
065 $vars = array('block_name', 'switch_column', 'questions');
066 extract($this->dispatcher->trigger_event('core.help_manager_add_block_before', compact($vars)));
067
068 $this->template->assign_block_vars('faq_block', array(
069 'BLOCK_TITLE' => $this->language->lang($block_name),
070 'SWITCH_COLUMN' => !$this->switched_column && $switch_column,
071 ));
072
073 foreach ($questions as $question => $answer)
074 {
075 $this->add_question($question, $answer);
076 }
077
078 $this->switched_column = $this->switched_column || $switch_column;
079
080 /**
081 * You can use this event to add a block after the current one.
082 *
083 * @event core.help_manager_add_block_after
084 * @var string block_name Language key of the block headline
085 * @var bool switch_column Should we switch the menu column before this headline
086 * @var array questions Array with questions
087 * @since 3.2.0-a1
088 */
089 $vars = array('block_name', 'switch_column', 'questions');
090 extract($this->dispatcher->trigger_event('core.help_manager_add_block_after', compact($vars)));
091 }
092
093 /**
094 * Add a new faq question
095 *
096 * @param string $question Question or language key with the question of the block
097 * @param string $answer Answer or language key with the answer of the block
098 */
099 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 }
138