Commit ff2f097c authored by Sven Rhinow's avatar Sven Rhinow

clean old files

parent fd34e0f4
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* TYPOlight webCMS
* Copyright (C) 2005-2009 Leo Feyer
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at http://www.gnu.org/licenses/.
*
* PHP version 5
*/
/**
* Class ModuleVouchersLatest
*
* @copyright sr-tag 2011
* @author Sven Rhinow <support@sr-tag.de>
* @package CampainLayer
*/
class ModuleCampainLayer extends Module
{
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_campain_layer';
/**
* Target pages
* @var array
*/
protected $arrTargets = array();
/**
* Options for JS
* @var array
*/
protected $optionsArr = array();
/**
* show files and layer
* @var bool
*/
protected $show = false;
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### KAMPAGNEN-LAYER ('.$this->cl_substr.') ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'typolight/main.php?do=modules&amp;act=edit&amp;id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}
/**
* Generate module
*/
protected function compile()
{
//sucht in den Get-Keys nach einer bestimmten Teil-Zeichenkette
$pos = false;
if(count($_GET)>0)
{
foreach($_GET AS $k => $v)
{
$k = strip_tags(trim($k));
$getPos = strcmp($k,$this->cl_substr)==0 ? true : false;
}
}
//test Start-Date
if(strlen($this->cl_start) && ($this->cl_start > time()))
{
return false;
}
//test Stop-Date
if(strlen($this->cl_stop) && ($this->cl_stop < time()))
{
return false;
}
//Modul-Flag fuer "keine Parameter notwendig" pruefen
if($this->cl_no_param || $getPos)
{
$this->optionsArr[] = 'showNow: true';
$this->show = true;
}
//Modul-Flag fuer "Layer per Link öffnen" pruefen
if($this->cl_set_mkLinkEvents)
{
$this->optionsArr[] = 'mkLinkEvents: true';
$this->show = true;
}
//Cookie
if($this->cl_set_cookie && $this->show)
{
//Name des Cookies
if(!$this->cl_cookie_name) $this->cl_cookie_name = 'LAYER_'.$this->id.'_COOKIE';
if(!$this->Input->cookie($this->cl_cookie_name))
{
if(!$this->cl_cookie_dauer) $this->cl_cookie_dauer = 3600;
$this->setCookie($this->cl_cookie_name,1,time()+$this->cl_cookie_dauer);
}else $this->show = false;
}
//Session
if($this->cl_set_session && $this->show)
{
$this->import('Session');
$this->cl_session_name = 'LAYER_'.$this->id.'_SESSION';
if(!$this->Session->get($this->cl_session_name))
{
$this->Session->set($this->cl_session_name,'1');
}else $this->show = false;
}
// nur wenn Fund dann CSS, JS und HTML einfuegen
if($this->show)
{
$layerName = $this->cl_substr;
$objTemplate = new FrontendTemplate($this->cl_template);
$objTemplate->content = $this->cl_content;
$templateHTML = $objTemplate->parse();
//other options put in array
if($this->cl_set_drawOverLay == 1) $this->optionsArr[] = 'drawOverLay:true';
if(strlen($this->cl_set_overLayID)) $this->optionsArr[] = "overLayID:'".$this->cl_set_overLayID."'";
if($this->cl_set_drawLayer == 1) $this->optionsArr[] = 'drawLayer:true';
if(strlen($this->cl_set_layerID)) $this->optionsArr[] = "overLayID:'".$this->cl_set_layerID."'";
if($this->cl_set_drawCloseBtn == 1) $this->optionsArr[] = 'drawCloseBtn:true';
if(strlen($this->cl_set_closeID)) $this->optionsArr[] = "closeID:'".$this->cl_set_closeID."'";
if(strlen($this->cl_set_closeClass)) $this->optionsArr[] = "closeClass:'".$this->cl_set_closeClass."'";
if(strlen($this->cl_set_overLayOpacity)) $this->optionsArr[] = 'overLayOpacity:'.$this->cl_set_overLayOpacity;
if(!$this->cl_set_closePerEsc) $this->optionsArr[] = 'closePerEsc:false';
if(!$this->cl_set_closePerLayerClick) $this->optionsArr[] = 'closePerLayerClick:false';
if(!$this->cl_set_drawLayerCenterX) $this->optionsArr[] = 'drawLayerCenterX:false';
if(!$this->cl_set_drawLayerCenterY) $this->optionsArr[] = 'drawLayerCenterY:false';
if(is_numeric($this->cl_option_layerwidth)) $this->optionsArr[] = 'layerWidth:'.$this->cl_option_layerwidth;
if(is_numeric($this->cl_option_layerheight)) $this->optionsArr[] = 'layerHeight:'.$this->cl_option_layerheight;
$jsOptions = implode(', ',$this->optionsArr);
//eigene CSS-Auszeichnungen aus CSS-Datei
if($this->cl_css_file) $GLOBALS['TL_CSS'][] = $this->cl_css_file;
else $GLOBALS['TL_CSS'][] = 'system/modules/campainLayer/html/css/campain_layer.css';
$GLOBALS['TL_MOOTOOLS'][] = $templateHTML;
$GLOBALS['TL_MOOTOOLS'][] = '<script type="text/javascript" src="system/modules/campainLayer/html/js/campainLayer_mootools.js"></script>';
$GLOBALS['TL_MOOTOOLS'][] = '<script type="text/javascript"><!--//--><![CDATA[//><!--
window.addEvent(\'domready\', function() {
var ml = new myLayer({'.$jsOptions.', '.$this->cl_option_other.' });
}); //--><!]]></script>';
}
}
}
?>
\ No newline at end of file
-- ********************************************************
-- * *
-- * IMPORTANT NOTE *
-- * *
-- * Do not import this file manually but use the Contao *
-- * install tool to create and maintain database tables! *
-- * *
-- ********************************************************
--
-- Table `tl_module`
--
CREATE TABLE `tl_module` (
`cl_template` varchar(255) NOT NULL default '',
`cl_substr` varchar(55) NOT NULL default '',
`cl_css_file` varchar(255) NOT NULL default '',
`cl_no_param` char(1) NOT NULL default '',
`cl_content` text NULL,
`cl_set_session` char(1) NOT NULL default '',
`cl_set_cookie` char(1) NOT NULL default '',
`cl_cookie_name` varchar(55) NOT NULL default '',
`cl_cookie_dauer` varchar(55) NOT NULL default '',
`cl_framework` varchar(55) NOT NULL default '',
`cl_option_layerwidth` varchar(55) NOT NULL default '',
`cl_option_layerheight` varchar(55) NOT NULL default '',
`cl_set_drawOverLay` char(1) NOT NULL default '',
`cl_set_overLayID` varchar(55) NOT NULL default 'overLay',
`cl_set_drawLayer` char(1) NOT NULL default '',
`cl_set_LayerID` varchar(55) NOT NULL default 'layer',
`cl_set_drawCloseBtn` char(1) NOT NULL default '',
`cl_set_closeID` varchar(55) NOT NULL default 'closeBtn',
`cl_set_closeClass` varchar(55) NOT NULL default 'closer',
`cl_set_mkLinkEvents` char(1) NOT NULL default '',
`cl_set_overLayOpacity` char(10) NOT NULL default '',
`cl_set_closePerEsc` char(1) NOT NULL default '1',
`cl_set_closePerLayerClick` char(1) NOT NULL default '1',
`cl_set_drawLayerCenterX` char(1) NOT NULL default '1',
`cl_set_drawLayerCenterY` char(1) NOT NULL default '1',
`cl_option_other` text NULL,
`cl_start` varchar(10) NOT NULL default '',
`cl_stop` varchar(10) NOT NULL default '',
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
#overLay{
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
display:none;
/* border:3px solid #f00; */
}
#layer{
position:fixed;
z-index: 9999;
height:460px;
width:790px;
display:none;
background-color: #fff;
padding:20px;
}
#closeBtn {
position:absolute;
right:10px;
top:10px;
width: 21px;
height:21px;
background: transparent url('../images/layer_CloseBtn.png') no-repeat center;
z-index: 10000;
text-indent:-9999px;
cursor: pointer;
}
// author: Sven Rhinow website: http://www.sr-tag.de
// kampagnen_layer is MIT-Licensed
var myLayer = new Class({
Implements: [ Options ],
options:{
parentEl : $('top'),
overLayID: 'overLay',
drawOverLay: false, // false = nicht erstellen wenn ein Element mit dieser ID schon im HTML existiert
overLayOpacity: 0.7,
layerID : 'layer',
layerWidth: 500,
layerHeight: 400,
drawLayer: false, //false = nicht erstellen wenn ein Element mit dieser ID schon im HTML existiert
closePerLayerClick:true,
closePerEsc:true,
closeID : 'closeBtn',
closeClass: 'closer',
drawCloseBtn: false, //false = nicht erstellen wenn ein Element mit dieser ID schon im HTML existiert
contentID : 'layercontent',
drawContent: false,
mlIframe : 'mlIframe',
drawMlIframe: false, //false = nicht erstellen wenn ein Element mit dieser ID schon im HTML existiert
mkLinkEvents: true, // wenn false wird kein Link mit dem Click-Event ausgestattet (z.B. beim sortigen anzeigen)
closeTxt:'close',
duration : 100,
drawLayerCenterY:true,
drawLayerCenterX:true,
// Höhe vom Headimage + Höhe der Hauptnavigation
topheight : 0, // differenz wenn der Layer obere Bereiche überdecken soll
parentsize : '',
initiframe : false, //false = erstellt nur ein leeres div, true = das iFrame wird direkt beim laden der Seite aufgerufen
showNow: false //der Layer wird direkt beim laden der Seite angezeigt
},
initialize: function(options){
//overwrite options
this.setOptions(options);
this.parentEl = this.options.parentEl;
this.overLayID = this.options.overLayID;
this.drawOverLay = this.options.drawOverLay;
this.layerID = this.options.layerID;
this.layerWidth = this.options.layerWidth,
this.layerHeight = this.options.layerHeight,
this.drawLayer = this.options.drawLayer;
this.closePerLayerClick = this.options.closePerLayerClick;
this.closePerEsc = this.options.closePerEsc;
this.closeID = this.options.closeID;
this.closeClass = this.options.closeClass;
this.drawCloseBtn = this.options.drawCloseBtn;
this.contentID = this.options.contentID;
this.drawContent = this.options.drawContent;
this.mlIframe = this.options.mlIframe;
this.drawMlIframe = this.options.drawMlIframe;
this.mkLinkEvents = this.options.mkLinkEvents;
this.closeTxt = this.options.closeTxt;
this.duration = this.options.duration;
this.topheight = this.options.topheight;
this.parentsize = this.options.parentsize;
this.initiframe = this.options.initiframe;
this.showNow = this.options.showNow;
this.overLayOpacity = this.options.overLayOpacity;
this.drawLayerCenterY = this.options.drawLayerCenterY;
this.drawLayerCenterX = this.options.drawLayerCenterX;
//auf Browser-Groessenveraenderung reagieren
window.addEvent('resize', function(){
//your logic goes here
this.parentsize = this.parentEl.getSize();
$(this.overLayID).setStyles({
width : this.parentsize.x,
height : this.parentsize.y
});
if(this.drawLayerCenterX) $(this.layerID).setStyles({ 'left': (this.parentsize.x - this.layerWidth) / 2 });
if(this.drawLayerCenterY) $(this.layerID).setStyles({ 'top': (this.parentsize.y - this.layerHeight) / 2 });
}.bind(this));
// console.log(this.closePerEsc);
//key-events verarbeiten
if(this.closePerEsc){
document.addEvent('keydown', function(event){
switch(event.code){
case 27: // Esc
case 88: // 'x'
case 67: // 'c'
this.close();
break
}
}.bind(this));
}
//URL-parameter zur sofortigen Darstellung auswerten
var myURI = new URI(document.location);
var showif = myURI.getData('showif', 'query');
if(showif==1){
this.initiframe = true;
this.showNow =true;
}
//alle Links mit rel="openlayer" mit Click-Event ausstatten
if(this.mkLinkEvents){
var links = $$("a").filter(function(el) {
return el.rel && el.rel.test(/^openlayer/i);
});
links.each(function(item,index){
item.addEvent('click', function(event){
event.stop(); //Prevents the browser from following the link.
window.scrollTo(0, 0);
this.open(item);
}.bind(this));
}.bind(this));
}
this.createHtml();
if(this.showNow) {
if(this.initiframe){
$(this.mlIframe).tween('opacity',1);
}
$(this.overLayID).setStyle('display', 'block').tween('opacity',this.overLayOpacity);
$(this.layerID).setStyle('display', 'block').tween('opacity',1);
}else{
$(this.layerID).setStyle('display', 'none');
}
},
createHtml: function(){
this.parentsize = this.parentEl.getSize();
// Overlay erstellen
if(this.drawOverLay){
var overLay = new Element('div', {id: this.overLayID, html: ''});
Layer.setStyles({
width : this.parentsize.x,
height : this.parentsize.y,
top: this.topheight,
opacity: this.overLayOpacity
});
Layer.inject(this.parentEl,'top');
}else{
$(this.overLayID).setStyles({
width : this.parentsize.x,
height : this.parentsize.y,
top: this.topheight,
opacity: this.overLayOpacity
});
if(this.closePerLayerClick){
$(this.overLayID).addEvent('click', function(event){
event.stop(); //Prevents the browser from following the link.
this.close();
}.bind(this));
}
}
// Layer erstellen
if(this.drawLayer){
var Layer = new Element('div', {id: this.layerID, html: ''});
Layer.setStyles({
width : this.layerWidth,
height : this.layerHeight,
top: this.topheight
});
Layer.inject(this.parentEl,'top');
}else{
$(this.layerID).setStyles({
width : this.layerWidth,
height : this.layerHeight,
left: (this.parentsize.x - this.layerWidth) / 2,
top: (this.parentsize.y - this.layerHeight) / 2,
opacity: 1
});
}
// // Schliessen-Button per ID erstellen
if(this.drawCloseBtn){
var CloseLink = new Element('a', {id: this.closeID, html: this.closeTxt, href: '.'});
CloseLink.addEvent('click', function(event){
event.stop(); //Prevents the browser from following the link.
this.close();
}.bind(this));
CloseLink.inject(Layer,'top');
}else{
$(this.closeID).addEvent('click', function(event){
event.stop(); //Prevents the browser from following the link.
this.close();
}.bind(this));
}
// // Schliessen-Button per CLass erstellen
if($$(this.closeClass))
{
$$('.'+this.closeClass).addEvent('click', function(event){
event.stop(); //Prevents the browser from following the link.
this.close();
}.bind(this));
}
// Content-Container erstellen
if(this.drawContent){
var Content = new Element('div', {id: this.contentID, html: ''});
Content.inject(Layer,'bottom');
}
// Inhalts-Iframe erstellen (div-Platzhalter)
if(this.initiframe){
var ifr = new Element('iframe',{
src:'map.html',
id:this.mlIframe ,
width:this.parentsize.x-30,
height:this.parentsize.y-40,
backgroundColor: '#F2f2f2',
frameborder:0
});
ifr.inject($(this.contentID),'bottom');
}else{
if(this.drawMlIframe){
var ifr = new Element('div', {id: this.mlIframe, html: ''});
ifr.inject($(this.contentID),'bottom');
}
}
},
close: function(){
if(this.initiframe) $(this.mlIframe).tween('opacity',0);
$(this.layerID).tween('opacity',0).setStyle('display', 'none');
$(this.overLayID).tween('opacity',0).setStyle('display', 'none');
},
open: function(el){
if(this.initiframe){
//eventuell existierendes iframe loeschen
$(this.mlIframe).destroy();
// Inhalts-Iframe erstellen
var ifr = new Element('iframe',{
src:el.href,
id:this.mlIframe ,
width:this.parentsize.x-30,
height:this.parentsize.y-40,
frameborder:0
});
ifr.inject($(this.contentID),'bottom');
$(this.mlIframe).tween('opacity',1);
}
$(this.layerID).tween('opacity',1).setStyle('display', 'block');
$(this.overLayID).tween('opacity',this.overLayOpacity).setStyle('display', 'block');
}
});
//var ml = new myLayer();
<div id="overLay"></div>
<div id="layer">
<div id="closeBtn">schliessen</div>
<?php echo $this->content; ?>
</div><!--#layer-->
<div id="overLay"></div>
<div id="layer">
<div id="closeBtn">schliessen</div>
<?php echo $this->content; ?>
</div><!--#layer-->
<div id="overLay"></div>
<div id="layer">
<div id="closeBtn">schliessen</div>