forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Lightwindow with CI
Derek Jones edited this page Jul 5, 2012
·
4 revisions
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');?>
<?
//This CLASS is enable you to call lightwindow (Lightbox alike) by CI.
//Please visit http://www.stickmanlabs.com/lightwindow/ to download and try Lightwindow
//Created by Gin2
//=============
//USAGE EXAMPLE
//=============
/*
----------------------------------------
in your controller. e.g: 'my_lightwindow.php'
----------------------------------------
function index(){
$this->load->library('Lightwindow');
$this->load->view('my_lightwindow');
}
--------------------------------------
in your view ('my_lightwindow.php')
--------------------------------------
<link href="base_url().'javascript/ajax_lightwindow/css/lightwindow.css'" type="text/css" rel=stylesheet />
<s\cript type="text/javascript" src="<?=base_url()?>javascript/prototype/prototype-1.6.0.2.js">
<s\cript type="text/javascript" src="<?=base_url()?>javascript/scriptaculous/scriptaculous.compressed.js?load=effects">
<a href="#" onClick="FuncName(); return false;">Open Lighwindow</a>
<?=$this->lightwindow->ajax('FuncName', 'index.php/file_to_open', 'My LightWindow', 'Good Work', 'My Name');?>
==============================================================================//
*/
class Lightwindow{
var $funcName = '';
var $url = '';
var $title = '';
var $w = 300;
var $h = 300;
function ext($funcName='', $url='', $title='', $caption, $author = '', $w=0, $h=0){
$block = $this->jsBlock();
$output = "function ".$funcName."(){
myLightWindow.activateWindow({
href: '".$url."',
title: '".$title."',
author: '".$author."',
caption: '".$caption."',
type: 'external',
width:$w, height:$h })
};";
return $block['open'].$output.$block['close'];
}
function ajax($funcName='', $url='', $title='', $caption='', $author=''){
$block = $this->jsBlock();
$output = "function ".$funcName."(){
myLightWindow.activateWindow({
href: '".$url."',
title: '".$title."',
author: '".$author."',
caption: '".$caption."',
type: 'page'
})
};";
return $block['open'].$output.$block['close'];
}
function full($funcName='', $url='', $title='', $caption='', $author=''){
$block = $this->jsBlock();
$output = "function ".$funcName."(){
myLightWindow.activateWindow({
href: '".$url."',
title: '".$title."',
author: '".$author."',
caption: '".$caption."',
type: 'external'})
};";
return $block['open'].$output.$block['close'];
}
function alert($url='', $title='', $caption='', $author=''){
$block = $this->jsBlock();
$output = "myLightWindow.activateWindow({
href: '".$url."',
title: '".$title."',
author: 'QuickCMS',
caption: '".$caption."',
type: 'page',
height: 60
});";
return $block['open'].$output.$block['close'];
}
function jsBlock(){
$blocks = array(
'open'=>''."\n\t",
'close'=>''."\n\t"
);
return $blocks;
}
}
?>