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 = '
';
$html .= '- ' . $titulo . '
';
$html .= '- ';
$html .= $contenido;
$html .= '
';
$html .= '
';
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;
}
}