private function _renderSlidersForms(&$form, $themeDir, $themeName, $index = 1) { $modes = getSliderModes(); $sliders = getSliders(); $defaultSettings = getSliderDefaultSettings($themeDir); foreach ($sliders as $sliderName => $sliderCaption) { $input = array(); foreach ($modes as $modeName => $modeCaption) { $options = array(array('id_option' => '', 'name' => '')); for ($i = 1; $i <= 8; $i++) { $r = 24 % $i; if ($r) { continue; } $options[] = array('id_option' => 24 / $i, 'name' => $i); } $name = getSliderSettingsName($themeName, $sliderName, $modeName); $value = Configuration::get($name); if ($modeName === 'itemsInRow') { $dv = 2; $input[] = array('type' => 'text', 'label' => $modeCaption, 'name' => $name, 'class' => ' fixed-width-xl'); } else { $dv = ''; $input[] = array('type' => 'select', 'label' => $modeCaption, 'name' => $name, 'options' => array('query' => $options, 'id' => 'id_option', 'name' => 'name')); } $defaultValue = isset($defaultSettings) && !empty($defaultSettings[$modeName]) ? $defaultSettings[$modeName] : $dv; $hasEmptyRecord = is_null($value); // has database record with null value $form['fields_value'][$name] = $hasEmptyRecord ? $dv : ($value ? $value : $defaultValue); } $form['fields_form'][$index]['form'] = array('legend' => array('title' => $sliderCaption, 'icon' => 'icon-edit'), 'input' => $input); $index++; } $form['fields_form'][$index]['form'] = array('input' => array(array('type' => 'hidden', 'name' => 'theme_name', 'value' => $themeName)), 'submit' => array('title' => 'Save', 'id' => 'submitSliderSettings', 'icon' => 'process-icon-save')); }
public function postProcess() { if (Tools::isSubmit('submitAddconfiguration')) { $themeName = $this->_getThemeName(); $modes = getSliderModes(); $sliders = getSliders(); foreach ($sliders as $sliderName => $sliderCaption) { foreach ($modes as $modeName => $modeCaption) { $name = getSliderSettingsName($themeName, $sliderName, $modeName); $value = Tools::getValue($name, ''); if (Validate::isInt($value) || empty($value)) { $value = empty($value) ? '' : $value; Configuration::updateValue($name, $value); } else { $this->errors[] = $this->l('Invalid value for slider "' . $sliderCaption . '" in "' . $modeCaption . '" mode'); } } } $sourceTemplates = getTemplates(); foreach ($sourceTemplates as $type => $caption) { $name = getTemplateName($themeName, $type); $value = Tools::getValue($name, ''); Configuration::updateValue($name, $value); } if (!count($this->errors)) { $this->confirmations[] = $this->l('The settings have been updated.'); } } return parent::postProcess(); }
<?php require_once 'requests/_main.php'; $sliders = getSliders(); $stories = getStories(); $myths = getMyths(); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <title>FuDIT - Conciencia de Vida</title> <link rel="shortcut icon" href="images/favicon.ico" /> <link href="css/fudit_style.css" rel="stylesheet" /> <!--[if IE]> <link href="css/ie.css" rel="stylesheet" /> <![endif]--> <!--@font-face--> <link href="css/stylesheet.css" rel="stylesheet" /> <!--Hover effect--> <link href="css/hover.css" rel="stylesheet" /> <!--Slideshow--> <link rel="stylesheet" type="text/css" href="css/bx_styles.css" /> <!-- Libreria JQuery--> <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script> <!--HTML5 IE--> <script src="js/modernizr-2.5.3.js" type="text/javascript"></script>
function getSliderModeVars() { $vars = array(); $sliders = getSliders(); $modes = getSliderModes(); foreach (Theme::getAvailable(false) as $themeName) { foreach ($sliders as $sliderName => $sliderCaption) { foreach ($modes as $modeName => $modeCaption) { $name = getSliderSettingsName($themeName, $sliderName, $modeName); $vars[$themeName][$sliderName][$modeName] = Configuration::get($name); } } } return $vars; }