@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | - p($theme->getTitle()); |
|
9 | - ?> |
|
7 | + p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | + p($theme->getTitle()); |
|
9 | + ?> |
|
10 | 10 | </title> |
11 | 11 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
12 | 12 | <meta name="referrer" content="never"> |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | </div> |
43 | 43 | |
44 | 44 | <?php |
45 | - /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
46 | - if($template->getActionCount() !== 0) { |
|
47 | - $primary = $template->getPrimaryAction(); |
|
48 | - $others = $template->getOtherActions(); |
|
49 | - ?> |
|
45 | + /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
46 | + if($template->getActionCount() !== 0) { |
|
47 | + $primary = $template->getPrimaryAction(); |
|
48 | + $others = $template->getOtherActions(); |
|
49 | + ?> |
|
50 | 50 | <div class="header-right"> |
51 | 51 | <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
52 | 52 | <a href="<?php p($primary->getLink()); ?>"> |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | <div id="header-actions-menu" class="popovermenu menu"> |
60 | 60 | <ul> |
61 | 61 | <?php |
62 | - /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
63 | - foreach($template->getOtherActions() as $action) { |
|
64 | - print_unescaped($action->render()); |
|
65 | - } |
|
66 | - ?> |
|
62 | + /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
63 | + foreach($template->getOtherActions() as $action) { |
|
64 | + print_unescaped($action->render()); |
|
65 | + } |
|
66 | + ?> |
|
67 | 67 | </ul> |
68 | 68 | </div> |
69 | 69 | </div> |
@@ -34,125 +34,125 @@ |
||
34 | 34 | */ |
35 | 35 | class PublicTemplateResponse extends TemplateResponse { |
36 | 36 | |
37 | - private $headerTitle = ''; |
|
38 | - private $headerDetails = ''; |
|
39 | - private $headerActions = []; |
|
40 | - private $footerVisible = true; |
|
41 | - |
|
42 | - /** |
|
43 | - * PublicTemplateResponse constructor. |
|
44 | - * |
|
45 | - * @param string $appName |
|
46 | - * @param string $templateName |
|
47 | - * @param array $params |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function __construct(string $appName, string $templateName, array $params = array()) { |
|
51 | - parent::__construct($appName, $templateName, $params, 'public'); |
|
52 | - \OC_Util::addScript('core', 'public/publicpage'); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * @param string $title |
|
57 | - * @since 14.0.0 |
|
58 | - */ |
|
59 | - public function setHeaderTitle(string $title) { |
|
60 | - $this->headerTitle = $title; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * @return string |
|
65 | - * @since 14.0.0 |
|
66 | - */ |
|
67 | - public function getHeaderTitle(): string { |
|
68 | - return $this->headerTitle; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $details |
|
73 | - * @since 14.0.0 |
|
74 | - */ |
|
75 | - public function setHeaderDetails(string $details) { |
|
76 | - $this->headerDetails = $details; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @return string |
|
81 | - * @since 14.0.0 |
|
82 | - */ |
|
83 | - public function getHeaderDetails(): string { |
|
84 | - return $this->headerDetails; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @param array $actions |
|
89 | - * @since 14.0.0 |
|
90 | - * @throws InvalidArgumentException |
|
91 | - */ |
|
92 | - public function setHeaderActions(array $actions) { |
|
93 | - foreach ($actions as $action) { |
|
94 | - if ($actions instanceof IMenuAction) { |
|
95 | - throw new InvalidArgumentException('Actions must be of type IMenuAction'); |
|
96 | - } |
|
97 | - $this->headerActions[] = $action; |
|
98 | - } |
|
99 | - usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) { |
|
100 | - return $a->getPriority() > $b->getPriority(); |
|
101 | - }); |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @return IMenuAction |
|
106 | - * @since 14.0.0 |
|
107 | - * @throws \Exception |
|
108 | - */ |
|
109 | - public function getPrimaryAction(): IMenuAction { |
|
110 | - if ($this->getActionCount() > 0) { |
|
111 | - return $this->headerActions[0]; |
|
112 | - } |
|
113 | - throw new \Exception('No header actions have been set'); |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @return int |
|
118 | - * @since 14.0.0 |
|
119 | - */ |
|
120 | - public function getActionCount(): int { |
|
121 | - return count($this->headerActions); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @return IMenuAction[] |
|
126 | - * @since 14.0.0 |
|
127 | - */ |
|
128 | - public function getOtherActions(): array { |
|
129 | - return array_slice($this->headerActions, 1); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @since 14.0.0 |
|
134 | - */ |
|
135 | - public function setFooterVisible(bool $visible = false) { |
|
136 | - $this->footerVisible = $visible; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @since 14.0.0 |
|
141 | - */ |
|
142 | - public function getFooterVisible(): bool { |
|
143 | - return $this->footerVisible; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @return string |
|
148 | - * @since 14.0.0 |
|
149 | - */ |
|
150 | - public function render(): string { |
|
151 | - $params = array_merge($this->getParams(), [ |
|
152 | - 'template' => $this, |
|
153 | - ]); |
|
154 | - $this->setParams($params); |
|
155 | - return parent::render(); |
|
156 | - } |
|
37 | + private $headerTitle = ''; |
|
38 | + private $headerDetails = ''; |
|
39 | + private $headerActions = []; |
|
40 | + private $footerVisible = true; |
|
41 | + |
|
42 | + /** |
|
43 | + * PublicTemplateResponse constructor. |
|
44 | + * |
|
45 | + * @param string $appName |
|
46 | + * @param string $templateName |
|
47 | + * @param array $params |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function __construct(string $appName, string $templateName, array $params = array()) { |
|
51 | + parent::__construct($appName, $templateName, $params, 'public'); |
|
52 | + \OC_Util::addScript('core', 'public/publicpage'); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * @param string $title |
|
57 | + * @since 14.0.0 |
|
58 | + */ |
|
59 | + public function setHeaderTitle(string $title) { |
|
60 | + $this->headerTitle = $title; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * @return string |
|
65 | + * @since 14.0.0 |
|
66 | + */ |
|
67 | + public function getHeaderTitle(): string { |
|
68 | + return $this->headerTitle; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $details |
|
73 | + * @since 14.0.0 |
|
74 | + */ |
|
75 | + public function setHeaderDetails(string $details) { |
|
76 | + $this->headerDetails = $details; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @return string |
|
81 | + * @since 14.0.0 |
|
82 | + */ |
|
83 | + public function getHeaderDetails(): string { |
|
84 | + return $this->headerDetails; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @param array $actions |
|
89 | + * @since 14.0.0 |
|
90 | + * @throws InvalidArgumentException |
|
91 | + */ |
|
92 | + public function setHeaderActions(array $actions) { |
|
93 | + foreach ($actions as $action) { |
|
94 | + if ($actions instanceof IMenuAction) { |
|
95 | + throw new InvalidArgumentException('Actions must be of type IMenuAction'); |
|
96 | + } |
|
97 | + $this->headerActions[] = $action; |
|
98 | + } |
|
99 | + usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) { |
|
100 | + return $a->getPriority() > $b->getPriority(); |
|
101 | + }); |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @return IMenuAction |
|
106 | + * @since 14.0.0 |
|
107 | + * @throws \Exception |
|
108 | + */ |
|
109 | + public function getPrimaryAction(): IMenuAction { |
|
110 | + if ($this->getActionCount() > 0) { |
|
111 | + return $this->headerActions[0]; |
|
112 | + } |
|
113 | + throw new \Exception('No header actions have been set'); |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @return int |
|
118 | + * @since 14.0.0 |
|
119 | + */ |
|
120 | + public function getActionCount(): int { |
|
121 | + return count($this->headerActions); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @return IMenuAction[] |
|
126 | + * @since 14.0.0 |
|
127 | + */ |
|
128 | + public function getOtherActions(): array { |
|
129 | + return array_slice($this->headerActions, 1); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @since 14.0.0 |
|
134 | + */ |
|
135 | + public function setFooterVisible(bool $visible = false) { |
|
136 | + $this->footerVisible = $visible; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @since 14.0.0 |
|
141 | + */ |
|
142 | + public function getFooterVisible(): bool { |
|
143 | + return $this->footerVisible; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @return string |
|
148 | + * @since 14.0.0 |
|
149 | + */ |
|
150 | + public function render(): string { |
|
151 | + $params = array_merge($this->getParams(), [ |
|
152 | + 'template' => $this, |
|
153 | + ]); |
|
154 | + $this->setParams($params); |
|
155 | + return parent::render(); |
|
156 | + } |
|
157 | 157 | |
158 | 158 | } |
159 | 159 | \ No newline at end of file |