first commit
This commit is contained in:
53
application/libraries/Util.php
Executable file
53
application/libraries/Util.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Util {
|
||||
|
||||
/*
|
||||
call javascript alert
|
||||
*/
|
||||
public function js_alert($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."');</script>";
|
||||
}
|
||||
}
|
||||
|
||||
public function js_alert_go($msg,$url) {
|
||||
$msg = trim($msg);
|
||||
$url = trim($url);
|
||||
if($msg!='' && $url!='') {
|
||||
echo "<script>alert('".$msg."'); document.location.href='".$url."';</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javascript alert and go back to previous page
|
||||
*/
|
||||
public function js_alert_back($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); history.back();</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javavscript alert and reload page
|
||||
*/
|
||||
public function js_alert_reload($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); document.location.reload();</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javascript alert and go back to previous page
|
||||
*/
|
||||
public function js_alert_parent_reload($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); parent.location.reload();</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user