53 lines
1.3 KiB
PHP
Executable File
53 lines
1.3 KiB
PHP
Executable File
<?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>";
|
|
}
|
|
}
|
|
} |