imaxAcordeon.php
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* @version 1.2
*/
class imaxAcordeon {
function __construct($modulePath) {
$this->context = Context::getContext();
$this->_path = $modulePath;
$this->addCSS('acordeon.css');
$this->addJS('acordeon.js');
}
/**
* CREA UN ACORDEN
* @param string $titulo Titulo del acordeon
* @param string $contenido Html con todo el contenido
* @param boolean $interno True si va a estar dentro de otro acordeon
*/
function renderAcordeon($titulo, $contenido, $interno = false) {
$class = 'acordeon';
if ($interno != false) {
$class = 'acordeonInterno';
}
$html = '';
$html = '<dl class="' . $class . '">';
$html .= '<dt>' . $titulo . '</dt>';
$html .= '<dd>';
$html .= $contenido;
$html .= '</dd>';
$html .= '</dl>';
return $html;
}
private function addCSS($css) {
$tab = Tools::getValue('tab', 0);
if (!$tab || ($tab && $tab != 'AdminSelfUpgrade')) {
if ($this->context->controller instanceof stdClass) {
$this->context->controller = new AdminModulesController();
}
$this->context->controller->addCss($this->_path . 'acordeon/' . $css, 'all');
}
return;
}
private function addJS($js) {
$tab = Tools::getValue('tab', 0);
if (!$tab || ($tab && $tab != 'AdminSelfUpgrade')) {
if ($this->context->controller instanceof stdClass) {
$this->context->controller = new AdminModulesController();
}
$this->context->controller->addJs($this->_path . 'acordeon/' . $js);
}
return;
}
}