Пример #1
0
 private function _prepareHook()
 {
     $slider = array();
     foreach ($this->_configs as $key => $config) {
         $slider[$key] = $this->getParams()->get($key, $config);
     }
     $source = $this->getParams()->get("source", 'images');
     $path = _PS_CACHEFS_DIRECTORY_ . $this->name;
     if (!file_exists($path)) {
         mkdir($path, 0777);
     }
     $site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'cache/cachefs/' . $this->name;
     $slides = LeoBaseSource::getSource($source)->setModuleName('leobtslider', $path, $site_url)->getData($this->getParams());
     if (!$slides) {
         return false;
     }
     //echo '<pre>'.print_r($slides,1); die;
     $this->smarty->assign('leobtslider_slides', $slides);
     $this->smarty->assign('leobtslider', $slider);
     $this->smarty->assign('leobtslider_modid', $this->id);
     return true;
 }
Пример #2
0
        /**
         *
         */
        public function getSourceDataTag($current)
        {
            $path = dirname(__FILE__) . '/sources/';
            if (!is_dir($path)) {
                return $this->l("Could not found any themes in 'themes' folder");
            }
            $sources = $this->getFolderList($path);
            $html = '<label for="source">' . $this->l('Source:') . '</label>
			<div class="margin-form">';
            $html .= '<select name="' . $this->getFieldName('source') . '" id="source">';
            foreach ($sources as $source) {
                $selected = $source == $current ? 'selected="selected"' : '';
                $html .= '<option value="' . $source . '" ' . $selected . '>' . $source . '</option>';
            }
            $html .= '</select>';
            $html .= '</div>';
            $html .= '<div class="group_configs" id="groupconfigs">';
            foreach ($sources as $source) {
                $html .= '<div class="source-group source' . $source . '">';
                $html .= LeoBaseSource::getSource($source)->renderForm($this);
                $html .= '</div>';
            }
            $html .= '</div>';
            $html .= '<script>';
            $html .= '
				$(document).ready( function(){
					$(".source-group").hide();
					$(".source"+$("#source").val() ).show();
					$("#source").change(function(){
					$(".source-group").hide();
					$(".source"+$(this).val() ).show();
				} );	
			} )';
            $html .= '</script>';
            return $html;
        }