?
Path : /home/admin/public_html/old/modules/mod_lightboxpopup/ |
Current File : /home/admin/public_html/old/modules/mod_lightboxpopup/mod_lightboxpopup.php |
<?php /** * @version 1.0 * @package Lightbox Popup * @copyright (C) 2010 Thawat Varachai * @license http://www.eng.psu.ac.th GNU/GPL */ /** ensure this file is being included by a parent file */ defined('_JEXEC') or die('Restricted access'); // include the helper file require_once(dirname(__FILE__).DS.'helper.php'); // Get Module Parameter ===== $article_id = (int) $params->get('articleid'); $width = (int) $params->get('width',460); $height = (int) $params->get('height',300); $time_duration=(int) $params->get('popduration',2); // Pop duration in minuite $popup_times=(int) $params->get('poptimes',2); // Poptimes //=====Include Java Lightbox library to template================ $doc =& JFactory::getDocument(); $doc->addScript($mainframe->getBasePath( 0, true )."modules/mod_lightboxpopup/js/moodalbox.js"); $doc->addStyleSheet($mainframe->getBasePath( 0, true )."modules/mod_lightboxpopup/css/moodalbox.css"); $BasePath=$mainframe->getBasePath( 0, true ); //============= // get the items to display from the helper $containners = LightboxPopup2Helper::lightbox_draw($article_id ,$width,$height,$BasePath); // Java Lightbox Call $jscript='<script language="javascript"> window.addEvent("domready", loadMOOdal); function loadMOOdal() { MOOdalBox.init(); MOOdalBox.open("'.$containners["basepath"].'modules/mod_lightboxpopup/containner.html","'.$containners["title"].'", "'.$containners["width"].' '.$containners["height"].'"); } </script>'; //===Start Stop Popup ==// $time_duration=$time_duration*60; // Covert minuite to secound if (isset($_COOKIE['popup_cookie'])) {// ==== Check expire cookies if($_COOKIE['popup_times']!=$popup_times) { //===Check pop count setcookie("popup_times",($_COOKIE['popup_times']+1)); // write to file $strFileName = "modules/mod_lightboxpopup/containner.html"; $objFopen = fopen($strFileName, 'w'); $strText1 = '<div id="lblog">'.$containners["introtext"]."</div>"; fwrite($objFopen, $strText1); fclose($objFopen); //================================ echo $jscript; } } else{ setcookie("popup_cookie","Lightbox",time()+$time_duration); setcookie("popup_times",1); // write to file $strFileName = "modules/mod_lightboxpopup/containner.html"; $objFopen = fopen($strFileName, 'w'); $strText1 = '<div id="lblog">'.$containners["introtext"]."</div>"; fwrite($objFopen, $strText1); fclose($objFopen); //================================ echo $jscript; } ?>