1 <?php
2 3 4 5 6 7
8 defined('FOF_INCLUDED') or die;
9
10 11 12 13 14 15
16 class FOFRenderJoomla3 extends FOFRenderStrapper
17 {
18 19 20
21 public function __construct()
22 {
23 $this->priority = 55;
24 $this->enabled = version_compare(JVERSION, '3.0', 'ge');
25 }
26
27 28 29 30 31 32 33 34 35 36
37 public function preRender($view, $task, $input, $config = array())
38 {
39 $format = $input->getCmd('format', 'html');
40
41 if (empty($format))
42 {
43 $format = 'html';
44 }
45
46 if ($format != 'html')
47 {
48 return;
49 }
50
51 $platform = FOFPlatform::getInstance();
52
53 if ($platform->isCli())
54 {
55 return;
56 }
57
58 if (version_compare(JVERSION, '3.3.0', 'ge'))
59 {
60 JHtml::_('behavior.core');
61 }
62 else
63 {
64 JHtml::_('behavior.framework', true);
65 }
66
67 JHtml::_('jquery.framework');
68
69 if ($platform->isBackend())
70 {
71
72 $version = new JVersion;
73 $versionParts = explode('.', $version->RELEASE);
74 $minorVersion = str_replace('.', '', $version->RELEASE);
75 $majorVersion = array_shift($versionParts);
76
77 $option = $input->getCmd('option', '');
78 $view = $input->getCmd('view', '');
79 $layout = $input->getCmd('layout', '');
80 $task = $input->getCmd('task', '');
81
82 $classes = ' class="' . implode(array(
83 'joomla-version-' . $majorVersion,
84 'joomla-version-' . $minorVersion,
85 'admin',
86 $option,
87 'view-' . $view,
88 'layout-' . $layout,
89 'task-' . $task,
90 ), ' ') . '"';
91 }
92 else
93 {
94 $classes = '';
95 }
96
97 echo '<div id="akeeba-renderjoomla"' . $classes . ">\n";
98
99
100 if ($input->getBool('render_toolbar', true))
101 {
102 $this->renderButtons($view, $task, $input, $config);
103 $this->renderLinkbar($view, $task, $input, $config);
104 }
105 }
106
107 108 109 110 111 112 113 114 115 116
117 public function postRender($view, $task, $input, $config = array())
118 {
119 $format = $input->getCmd('format', 'html');
120
121 if (empty($format))
122 {
123 $format = 'html';
124 }
125
126 if ($format != 'html')
127 {
128 return;
129 }
130
131
132 if (FOFPlatform::getInstance()->isCli())
133 {
134 return;
135 }
136
137 echo "</div>\n";
138 }
139
140 141 142 143 144 145 146 147 148 149
150 protected function renderLinkbar($view, $task, $input, $config = array())
151 {
152 $style = 'joomla';
153
154 if (array_key_exists('linkbar_style', $config))
155 {
156 $style = $config['linkbar_style'];
157 }
158
159 switch ($style)
160 {
161 case 'joomla':
162 $this->renderLinkbar_joomla($view, $task, $input);
163 break;
164
165 case 'classic':
166 default:
167 $this->renderLinkbar_classic($view, $task, $input);
168 break;
169 }
170 }
171
172 173 174 175 176 177 178 179 180
181 protected function renderFieldsetLabel($field, FOFForm &$form, $title)
182 {
183 $html = '';
184
185 $labelClass = $field->labelClass ? $field->labelClass : $field->labelclass;
186 $required = $field->required;
187
188 $tooltip = $form->getFieldAttribute($field->fieldname, 'tooltip', '', $field->group);
189
190 if (!empty($tooltip))
191 {
192 JHtml::_('bootstrap.tooltip');
193
194 $tooltipText = '<strong>' . JText::_($title) . '</strong><br />' . JText::_($tooltip);
195
196 $html .= "\t\t\t\t" . '<label class="control-label hasTooltip ' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" rel="tooltip">';
197 }
198 else
199 {
200 $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">';
201 }
202
203 $html .= JText::_($title);
204
205 if ($required)
206 {
207 $html .= ' *';
208 }
209
210 $html .= '</label>' . PHP_EOL;
211
212 return $html;
213 }
214 }
215