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