MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
theme.class
Ir para a documentação deste ficheiro.
1<?php
33{
34 public function __construct()
35 {
36 parent::__construct('sbootstrap');
37 }
38
39 public function init()
40 {
41 $this->manager->getPage()->addStyle('libs/bootstrap-3.3.7-dist/css/bootstrap.min.css');
42 $this->manager->getPage()->addStyle('libs/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css');
43 $this->manager->getPage()->addStyle('libs/font-awesome-4.7.0/css/font-awesome.min.css');
44 $this->manager->getPage()->addStyle('libs/AdminLTE-2.4.0-rc/css/AdminLTE.min.css');
45 $this->manager->getPage()->addStyle('libs/AdminLTE-2.4.0-rc/css/skins/_all-skins.min.css');
46 $this->manager->getPage()->addStyle('select2.css');
47 $this->manager->getPage()->addStyle('bootstrap-datepicker.min.css');
48 $this->manager->getPage()->addStyle('miolo.css');
49 $this->manager->getPage()->addStyle('libs/fine-uploader/fine-uploader-new.css');
50 $this->manager->getPage()->addStyle('../../extensions/codemirror-5.37.0/lib/codemirror.css');
51 $this->manager->getPage()->addStyle('../../extensions/codemirror-5.37.0/theme/mbo.css');
52 $this->manager->getPage()->addStyle('../../extensions/codemirror-5.37.0/addon/hint/show-hint.css');
53 $this->manager->getPage()->addStyle('jquery.floatingscroll.css');
54
55 $this->manager->getPage()->addScript('push.min.js');
56 $this->manager->getPage()->addScript('jquery.min.js');
57 $this->manager->getPage()->addScript('typeahead.js');
58 $this->manager->getPage()->addScript('fine-uploader/fine-uploader.js');
59 $this->manager->getPage()->addScript('bootstrap-datepicker.js');
60 $this->manager->getPage()->addScript('jquery.maskMoney.min.js');
61 $this->manager->getPage()->addScript('select2.js');
62 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/lib/codemirror.js');
63 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/mode/sql/sql.js');
64 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/mode/xml/xml.js');
65 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/mode/php/php.js');
66 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/mode/clike/clike.js');
67 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/mode/javascript/javascript.js');
68 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/addon/edit/matchbrackets.js');
69 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/addon/hint/show-hint.js');
70 $this->manager->getPage()->addScript('../extensions/codemirror-5.37.0/addon/hint/sql-hint.js');
71 $this->manager->getPage()->addScript('libs/bootstrap-3.3.7-dist/js/bootstrap.min.js');
72 $this->manager->getPage()->addScript('libs/AdminLTE-2.4.0-rc/js/adminlte.min.js');
73 $this->manager->getPage()->addScript("sweetalert.min.js");
74 $this->manager->getPage()->addScript('keycloak/keycloak.js');
75 $this->manager->getPage()->addScript('ckeditor5/build/ckeditor.js');
76 $this->manager->getPage()->addJsCode("const ck_editors = new Map();");
77 $this->manager->getPage()->addScript('keycloaklogin.js');
78 $this->manager->getPage()->addScript('dojoroot/config.js');
79 $this->manager->getPage()->addScript('dojoroot/dojo/dojo.js');
80 $this->manager->getPage()->addScript('jquery.floatingscroll.js');
81
82 if ( strlen((string) $this->manager->getConf('theme.client')) )
83 {
84 $this->manager->getPage()->addStyle( $this->manager->getConf('theme.client') .'.css' );
85 }
86
88
89 $ui = $this->manager->GetUI();
90
91 // navigation
92 $this->setElement('navigation', new MNavigationBar(), 'm-container-topmenu');
93 }
94
95 public function getTemplate()
96 {
97 $theme = $this->manager->getConf('theme.main');
98 $pathName = $this->manager->getConf('home.themes') . "/$theme/template/";
99 $template = new MBTemplate($pathName);
100 $template->set('miolo', $this->manager);
101 $template->set('theme', $this);
102 $template->set('form', $this->manager->getPage()->getFormId());
103 return $template;
104 }
105
106 public function generateBase()
107 {
108 $template = $this->getTemplate();
109 if ( $this->manager->checkMobile() )
110 {
111 return $template->fetch('mobile.php');
112 }
113 return $template->fetch('base.php');
114 }
115
116 public function generate($element='')
117 {
118 $method = "generate" . $this->layout;
119 $this->manager->trace("Theme generate: " . $method);
120 return $this->$method($element);
121 }
122
123 public function generateContent()
124 {
125 $template = $this->getTemplate();
126 return $template->fetch('content.php');
127 }
128
129 public function generateDefault($element)
130 {
131 // main menu
132 $menu = new SMainMenu('mioloMainMenu');
133 $this->setElement('top', $menu, 'm-container-top');
134
135 $action = $this->manager->getPage()->action;
136 $formID = $this->manager->getPage()->name;
137 $loadingMessage = _M('Carregando', 'sagu2');
138
139 // bottom
140 $statusBar = new SStatusBar();
141 $this->SetElement('bottom', $statusBar, 'm-container-bottom');
142
143 // menus
144 if ( $this->manager->GetConf('options.mainmenu') == 2 )
145 {
146 $idModule = 'm-container-module';
147 $idMenu = 'm-container-dhtmlmenu';
148 }
149 else if ( $this->manager->GetConf('options.mainmenu') == 3 )
150 {
151 $idMenu = null;
152 $idModule = 'm-container-module2';
153 $needTable = true;
154 }
155 else
156 {
157 $idMenu = 'm-container-menu';
158 }
159
160 $this->SetElementId('menus', $idMenu);
161
162 // content
163 $idContent = ( ($this->manager->GetConf('options.mainmenu') == 2) || ($this->manager->GetConf('options.mainmenu') == 3) ) ? 'm-container-content-full' : 'm-container-content';
164 $this->SetElementId('content', $idContent);
165
166 $html = <<<HTML
167<script type="text/javascript">
168MIOLO_loadDeps();
169MIOLO_configureHistory("$action");
170dojo.addOnLoad(MIOLO_initHistory);
171</script>
172
173<div id="divSaguMessages" style="display: none;">
174 <div id="divSaguMessagesContent"></div>
175</div>
176
177<div id="m-loading-message-bg" onclick="javascript:hideLoadingDiv()"></div>
178<div id="m-loading-message" onclick="javascript:hideLoadingDiv()">
179
180<div class="sk-circle">
181 <div class="sk-circle1 sk-child"></div>
182 <div class="sk-circle2 sk-child"></div>
183 <div class="sk-circle3 sk-child"></div>
184 <div class="sk-circle4 sk-child"></div>
185 <div class="sk-circle5 sk-child"></div>
186 <div class="sk-circle6 sk-child"></div>
187 <div class="sk-circle7 sk-child"></div>
188 <div class="sk-circle8 sk-child"></div>
189 <div class="sk-circle9 sk-child"></div>
190 <div class="sk-circle10 sk-child"></div>
191 <div class="sk-circle11 sk-child"></div>
192 <div class="sk-circle12 sk-child"></div>
193</div>
194<div id="m-loading-message-text">$loadingMessage...</div>
195
196</div>
197
198<div id="{$formID}__scripts" dojoType="dojox.layout.ContentPane" layoutAlign="client" executeScripts="true" cleanContent="true">
199</div>
200<div id="$formID" dojoType="dojox.layout.ContentPane" layoutAlign="client" executeScripts="true" cleanContent="true">
201</div>
202HTML;
203
204 $html .= "<div class=\"wrapper\">";
205 $html .= "<header class=\"main-header\">";
206 $html .= $this->GenerateElement('top');
207 $html .= "</header>";
208
209 $menu = $this->GenerateElement('menu');
210 $html .= $menu;
211
212 $contentCss = (trim($menu) != '<div id="menu" class=""></div>') ? "content-wrapper" : null;
213
214 $html .= "<div class=\"$contentCss\">";
215 $this->SetElementId('toolbar', 'm-toolbar btn-toolbar');
216 $html .= $tb = $this->GenerateElement('toolbar');
217
218 $html .= '<div id="extContent">';
219 $html .= $this->GenerateElement('content') . SDatabase::getDebugTable();
220 $html .= '</div></div>';
221
222 $html .= '<div id="extBottom" style="z-index: 1000; visibility: visible; position: fixed; bottom:0; width: 100%">';
223 $html .= $this->GenerateElement('bottom');
224 $html .= '</div></div>';
225
226 $html .= '
227<script type="text/javascript">
228
232function inSite()
233{
234 //Try adicionado porque no Firefox window.parent.location.href retorna uma exessão
235 var result = true;
236 try
237 {
238 if ( window.parent.location && window.parent.location.href == undefined )
239 {
240 document.body.className = "site";
241 }
242 }
243 catch (e)
244 {
245 if( dojo.isMozilla )
246 {
247 document.body.className = "site";
248 }
249 result = false;
250 }
251}
252
253function hideLoadingDiv()
254{
255 var bg = document.getElementById("m-loading-message-bg");
256 var fg = document.getElementById("m-loading-message");
257
258 if ( bg != null )
259 {
260 bg.style.display = "none";
261 }
262
263 if ( fg != null )
264 {
265 fg.style.display = "none";
266 }
267}
268
269inSite();
270
271function ajustarVisualizacaoDoTema() {
272 // Tooltips
273 $("[rel=\'tooltip\']").tooltip();
274
275 // Ajusta calendários
276 setTimeout(function(){$("div.m-input-calendar input").datepicker();}, 1000);
277
278 // Visualização de controls na subdetail
279 $(".m-basegroup .m-caption").children(".m-caption-required").hide();
280 $(".m-basegroup .m-caption").children(".m-caption-required").each(function(index, value) {
281 var label = $(this).text();
282 $(this).parent().addClass("m-caption-required");
283 $(this).parent().text(label+":");
284 });
285
286 // Dois pontos repetidos nos labels
287 $(".m-basegroup .m-caption").each(function(index, value) {
288 if ($(this).text().slice(-2) == "::") {
289 $(this).text($(this).text().slice(0, -1));
290 }
291 });
292
293 // Ajuste nos hints
294 $(".m-hint").parent().css("position", "relative");
295 $("span .m-hint:only-child, div .m-hint:only-child").parent().css("width", "0.1%");
296
297 // Ajusta o posicionamento do item ativo no menu
298 var topScrollPx = 0;
299 if ($(".active").length > 0) {
300 topScrollPx = $(".active").last().offset().top - ($(".main-sidebar").last().css("height").replace(/[^-\d\.]/g, "") / 2) + 18;
301 if ($(".main-sidebar").scrollTop() > 0) {
302 topScrollPx = $(".main-sidebar").scrollTop();
303 }
304 }
305
306 $(".main-sidebar").animate({
307 scrollTop: topScrollPx
308 }, 300);
309
310 // Controla a sessão do expandido do menu
311 $(document).on("expanded.pushMenu", function() {
312 document.cookie = "menuExpandido=true";
313 setTimeout(function() { try{ $(".m-grid-body.table").stickyTableHeaders(); } catch (e) {}}, 300);
314 });
315 $(document).on("collapsed.pushMenu", function() {
316 document.cookie = "menuExpandido=false";
317 setTimeout(function() { try{ $(".m-grid-body.table").stickyTableHeaders(); } catch (e) {}}, 300);
318 });
319 if (getCookie("menuExpandido") === "false") {
320 $("body").addClass("sidebar-collapse");
321 }
322}
323
324function getCookie(cname) {
325 var name = cname + "=";
326 var decodedCookie = decodeURIComponent(document.cookie);
327 var ca = decodedCookie.split(\';\');
328 for(var i = 0; i <ca.length; i++) {
329 var c = ca[i];
330 while (c.charAt(0) == \' \') {
331 c = c.substring(1);
332 }
333 if (c.indexOf(name) == 0) {
334 return c.substring(name.length, c.length);
335 }
336 }
337 return "";
338}
339
340$( document ).ready(function() {
341 ajustarVisualizacaoDoTema();
342});
343
344</script>
345';
346
347
348 return $this->painter->div(new Div('m-container', $html));
349 }
350
351 public function generateDynamic($element)
352 {
353 $elements[$element . '_content'] = $this->generateContent();
354 if ( $this->hasMenuOptions() )
355 {
356 $elements[$element . '_menu'] = $this->generateMenu();
357 }
358
359 return $elements;
360 }
361
362 public function generateWindow()
363 {
364 $webForm = $this->getWebForm('window.php');
365 $formId = $this->manager->getPage()->getFormId();
366 $elements[$formId] = $webForm->generate();
367 return $elements;
368 }
369
370 public function generateLookup()
371 {
372 // only 'content' element
373 $html = $this->generateElement('content');
374 $div = new MDiv('m-container', $html);
375 $div->addStyle('width', '100%');
376 return $this->painter->generateToString($div);
377 }
378
379 public function generatePopup()
380 {
381 $page = $this->manager->getPage();
382 $this->setElementId('content', 'm-theme-container-contentpopup');
383 $html = $this->generateElement('content');
384 $divContainer = new MDiv('', $html, 'm-container');
385 $divContainer->addStyle('width', '100%');
386 return $this->painter->generateToString($divContainer);
387 }
388
389 public function generatePrint()
390 {
391 $this->generateDefault();
392 }
393
394 public function generateDOMPdf()
395 {
396 // only 'content' element
397 $html = $this->generateElement('content');
398 $div = new MDiv('m-theme-container', $html);
399 $div->addStyle('width', '100%');
400 return $this->painter->generateToString($div);
401 }
402}
403
404class Theme extends ThemesBootstrap {}
405
406?>
setElement($element, $content, $id='', $key=NULL)
Definição mtheme.class:100
$layout
Definição mtheme.class:5
generateElement($element)
Definição mtheme.class:144
setElementId($element, $id)
Definição mtheme.class:105
hasMenuOptions()
Definição mtheme.class:186
static setType($type)
Definição mtoolbar.class:80
const TYPE_ICON_TEXT
Definição mtoolbar.class:40
generateDefault($element)
Definição theme.class:129
generateDynamic($element)
Definição theme.class:351
generate($element='')
Definição theme.class:116
$action
Definição base.php:4