public function GetHeaderHTML() { if ($this->_header_html_called) { return; } $this->_header_html_called = true; $config = cmsms()->GetConfig(); $ret = ' <link rel=stylesheet href="' . $config['root_url'] . '/modules/AdvancedContent/css/jpicker.css" type="text/css" /> <script language="javascript" type="text/javascript" src="' . $config['root_url'] . '/modules/AdvancedContent/js/jquery.jpicker.min.js" defer="true"></script> <script language="javascript" type="text/javascript"> /* <![CDATA[ */ ac_onload.push(function(){ (function($){ $.fn.jPicker.defaults.images.clientPath="' . $config['root_url'] . '/modules/AdvancedContent/images/jpicker/";'; foreach (acContentBlockManager::GetBlocksByType('colorpicker') as $block_id) { $ret .= '$("#' . $block_id . '").jPicker();'; } return $ret . ' })(jQuery); }); /* ]]> */ </script>'; }
public function GetHeaderHTML() { if ($this->_header_html_called) { return; } $this->_header_html_called = true; $ret = ' <script language="javascript" type="text/javascript"> /* <![CDATA[ */ ac_onload.push(function(){ (function($){'; foreach (acContentBlockManager::GetBlocksByType('date') as $block_id) { $contentBlock =& $this->content_obj->GetContentBlock($block_id); if ($contentBlock->GetProperty('mode') == 'calendar') { $ret .= ' $("#' . $block_id . '_AdvancedContentDatePickerDisplay").datepicker({ numberOfMonths: 3, showButtonPanel: true, showOn: "button", buttonImage: "../modules/AdvancedContent/images/calendar.png", altField: "#' . $block_id . '_AdvancedContentDate", altFormat: "@", buttonImageOnly: true });'; } } return $ret . ' })(jQuery); }); /* ]]> */ </script>'; }
public function GetHeaderHTML() { if ($this->_header_html_called) { return; } $this->_header_html_called = true; $ret = ' <script language="javascript" type="text/javascript"> /* <![CDATA[ */ ac_onload.push(function(){ (function($){'; foreach (acContentBlockManager::GetBlocksByType('ui_slider') as $block_id) { $contentBlock =& $this->content_obj->GetContentBlock($block_id); $slider_params = $contentBlock->GetProperty('slider_params'); $ret .= ' $("#' . $block_id . '_slider").slider({ slide: function( event, ui ) {'; if (isset($slider_params['range'])) { $ret .= ' $("#' . $block_id . '").val( ui.values ); $("#' . $block_id . '_display").html( ui.values[0] + \' - \' + ui.values[1] + " ' . $contentBlock->GetProperty('unit') . '");'; } else { $ret .= ' $("#' . $block_id . '").val( ui.value ); $("#' . $block_id . '_display").html( ui.value + " ' . $contentBlock->GetProperty('unit') . '");'; } $ret .= ' },'; if (isset($slider_params['range'])) { $_values = explode(',', $contentBlock->GetContent()); if ($slider_params['range'] === true || $slider_params['range'] === false) { if (count($_values) < 2) { $value_min = isset($slider_params['min']) ? $slider_params['min'] : 0; $value_max = intval($_values[0]); } else { $value_min = intval($_values[0]); $value_max = intval($_values[1]); } } else { if ($slider_params['range'] == 'min') { $value_min = isset($slider_params['min']) ? $slider_params['min'] : 0; $value_max = count($_values) < 2 ? $_values[0] : $_values[1]; } else { if ($slider_params['range'] == 'max') { $value_min = count($_values) < 2 ? $_values[0] : $_values[1]; $value_max = isset($slider_params['max']) ? $slider_params['max'] : 10; } } } if (isset($slider_params['max']) && $slider_params['max'] < $value_max) { $value_max = $slider_params['max']; } if (isset($slider_params['min']) && $slider_params['min'] > $value_min) { $value_min = $slider_params['min']; } $ret .= 'values: [' . $value_min . ',' . $value_max . ']'; } else { $ret .= 'value: ' . intval($contentBlock->GetContent()); } if (count($slider_params)) { $ret .= ','; $slider_settings = array(); foreach ($slider_params as $paramName => $paramValue) { if (is_bool($paramValue)) { $slider_settings[] = $paramName . ': ' . ($paramValue ? 'true' : 'false'); } else { $slider_settings[] = $paramName . ': ' . (is_numeric($paramValue) ? $paramValue : '"' . $paramValue . '"'); } } $ret .= implode(',', $slider_settings); } $ret .= ' });'; } return $ret . ' })(jQuery); }); /* ]]> */ </script>'; }