|
|
|
แจก Codeigniter :: Ajax->Pagination,Insert,Update,Delete |
|
|
|
|
|
|
|
Controllers::
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admin extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper(array('fnc_helper', 'form'));
$this->load->library(array('encrypt', 'session', 'user_agent', 'pagination'));
$this->load->model('admin_model', 'db1');
}
public function index()
{
echo 'test';
}
public function email()
{
$this->load->model('admin/email_model', 'email');
$this->db1->setpage(5);
$data['data'] = $this->email->pages();
$data['pages'] = $this->db1->pagination();
$data['setting'] = $this->db1->settings();
$data['num_rows'] = $this->email->num_rows();
$this->email->add();
$this->email->delete();
$this->load->view('admin/email', $data);
}
}
/* End of file admin.php */
/* Location: ./application/controllers/admin.php */
Models::
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email_model extends CI_Model
{
private $table='email_reciever';
private $view='email';
private $perpage;
public function __construct()
{
parent::__construct();
$this->perpage=$this->db1->perpage();
}
public function add()
{
if ( isset($_POST['submit']) )
{
$query = $this->db->get_where($this->table, array('email' => $this->input->post('email')));
if( $query->num_rows() > 0 )
{
$this->session->set_flashdata('message', '0มีข้อมูล '.$this->input->post('email').' อยู่ในระบบอยู่แล้ว...');
redirect(admin('email/'));
}
else
{
$data = array(
'account' => $this->input->post('account') ,
'email' => $this->input->post('email') ,
'active' => 'Y'
);
$this->db->set('created', 'NOW()', FALSE);//$this->db->set('time', 'NOW() + INTERVAL 1 DAY', FALSE);
$this->db->insert($this->table, $data);
$this->session->set_flashdata('message', '1Inserted # 1 row ('.$this->input->post('email').')');
redirect(admin($this->view.'/'.$this->chk_zero(( ceil($this->db->count_all($this->table) / $this->db1->perpage()) - 1 ) * $this->db1->perpage())));
}
}
}
public function delete()
{
if ( isset($_POST['btnDelete']) )
{
$this->db1->delete($this->table, 'id', $this->input->post('del'));
$this->session->set_flashdata('message', $this->db1->get_message());
sleep(1);
$this->db1->chklink($this->view, $this->db->count_all($this->table), $this->db1->perpage());
exit();
}
}
public function num_rows()
{
return $this->db->count_all($this->table);
}
public function pages()
{
$this->db1->pages($this->num_rows(), $this->view);
return $this->db->get($this->table, $this->db1->perpage(), $this->db1->thispage)->result_array();
}
private function chk_zero($num)
{
if( $num==0 )
$num='';
return $num;
}
public function __destruction()
{
$this->db->close();
}
}
/* End of file email_model.php */
/* Location: ./application/models/email_model.php */
Models ::
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admin_model extends CI_Model
{
public $notification=1;
private $message='';
private $num_exe=0;
public $num_rows;
private $config=array();
private $page;
public $thispage;
private $gen_pages;
public function __construct()
{
parent::__construct();
$this->config();
}
private function config()
{
$this->page['per_page'] = 10;
$this->page['num_links'] = 3;
$this->page['first_link'] = 'First';
$this->page['next_link'] = 'Next';
$this->page['prev_link'] = 'Prev';
$this->page['last_link'] = 'Last';
$this->page['cur_tag_open'] = '<li><a href="#" class="current">';
$this->page['cur_tag_close'] = '</a></li>';
$this->page['full_tag_open'] = '<nav class="pagination">
<ul>';
$this->page['full_tag_close'] = '</ul>
</nav>';
$this->page['next_tag_open'] = '<li>';
$this->page['next_tag_close'] = '</li>';
$this->page['prev_tag_open'] = '<li>';
$this->page['prev_tag_close'] = '</li>';
$this->page['num_tag_open'] = '<li>';
$this->page['num_tag_close'] = '</li>';
$this->page['first_tag_open'] = '<li>';
$this->page['first_tag_close'] = '</li>';
$this->page['last_tag_open'] = '<li>';
$this->page['last_tag_close'] = '</li>';
$this->page['uri_segment'] = 3;
}
public function pages($numtable, $link)
{
$this->page['base_url'] = admin($link);
$this->page['total_rows'] = $numtable;
$this->pagination->initialize($this->page);
$this->thispage = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
}
public function pagination()
{
return $this->pagination->create_links();
}
public function setpage($n)
{
$this->page['per_page'] = $n;
}
public function perpage()
{
return $this->page['per_page'];
}
public function delete($table, $id, $input)
{
try {
$n=0;
$this->db->trans_begin();
foreach($input as $val)
{
$this->db->delete($table, array($id => $val));
++$n;
}
$this->db->trans_commit();
$this->notification=1;
$this->message('Delete has been executed successfully # '.$n.' '.$this->unit($n));
}
catch(PDOException $ex)
{
$this->db->trans_rollback();
die($this->message($ex->getMessage()));
$this->notification=0;
}
}
private function message($message)
{
$this->message=$message;
}
public function get_message($notification=TRUE)
{
$msg=$this->message;
if( $notification==TRUE )
$msg=$this->notification.$this->message;
return $msg;
}
private function unit($n, $str='')
{
$string='row';
if( !empty($str) )
$string=$str;
if( $n>1 )
$string.='s';
return $string;
}
public function chklink($link='', $total=0, $perpage=10, $n=3)
{
$redirect=$link.'/';
if( $this->uri->segment($n) )
{
$segment=$this->uri->segment($n);
if( $segment == $total)
$page=$segment - $perpage;
else
$page=$segment;
if( $total > $perpage )
{
$redirect.=$page;
}
}
return redirect(admin($redirect));
}
public function settings()
{
return $this->db->get('settings')->result_array();
}
public function __destruction()
{
$this->db->close();
}
}
/* End of file admin_model.php */
/* Location: ./application/models/admin_model.php */
Views::
<?php
$n=0;
$page='email/';
if( $this->uri->segment(3)<>FALSE )
{
$n=$this->uri->segment(3);
$page.=$n.'/';
}
$action=$page;
if( $n===0 )
$action='email/0/';
?>
<!DOCTYPE html>
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Admin | E-Mail Setting</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="<?php echo $this->config->item('favicon');?>">
<link href="<?php echo _css('admin'); ?>" rel="stylesheet" />
<link href="<?php echo _css('colors/blue'); ?>" rel="stylesheet" id="colors" />
<!--[if lt IE 9]>
<script src="../../assets/js/html5.js"></script>
<![endif]-->
<script src="<?php echo _js('jquery.min'); ?>" type="text/javascript"></script>
<script src="<?php echo _js('jquery.form-validator.min'); ?>" type="text/javascript"></script>
<script>
$(document).ready(function(){
base_url="<?php echo site_url('getjson')?>" + '/';
});
</script>
<script src="<?php echo _js('admin'); ?>" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<?php $this->load->view('admin/header'); ?>
<nav id="navigation">
<ul class="menu" id="responsive">
<li><a href="<?php echo home();?>"><i class="halflings white home"></i> Home</a></li>
<li><a href="<?php echo admin('about');?>"><i class="halflings white tags"></i> About Us</a>
<ul class="cols3">
<li class="col3">
<h4>Other Link</h4>
</li>
<li class="col1">
<h5>Page Layouts</h5>
<ol>
<li><a href="<?php echo admin('about');?>"> About</a></li>
<li><a href="<?php echo admin('rd');?>"> R&D</a></li>
<li><a href="<?php echo admin('testimonials');?>"> Testimonials</a></li>
</ol>
</li>
<li class="col1">
<h5>Other Pages</h5>
<ol>
<li><a href="<?php echo admin('faq');?>"> FAQ's</a></li>
<li><a href="<?php echo admin('activity');?>"> Activities</a></li>
</ol>
</li>
</ul>
</li>
<li><a href="<?php echo admin('oem');?>"><i class="halflings white globe"></i> OEM</a></li>
<li><a href="<?php echo admin('products');?>"><i class="halflings white qrcode"></i> Products</a></li>
<li><a href="<?php echo admin('faq');?>"><i class="halflings white question-sign"></i> FAQ's</a></li>
<li><a href="<?php echo admin('contact');?>" id="current"><i class="halflings white envelope"></i> Contact</a></li>
</ul>
</nav>
<div class="clearfix"></div>
<div id="content">
<article class="title">
<h2>Admin <span>/ Contact</span></h2>
<ul>
<li>Total<span><?php echo number_format($num_rows);?></span>Record<?php if( $num_rows>1) echo 's';?></li>
</ul>
</article>
<div class="clearfix"></div>
<div class="container" id="alert">
<div class="notification success closeable">
<p>fsdfsdfsdfsd</p>
</div>
</div>
<?php
if($this->session->flashdata('message'))
echo '<div class="container message" style="position:absolute;z-index:1000;margin-top:-12px;">
<div class="notification '.notification(substr($this->session->flashdata('message'),0,1)).' closeable">
<p>'.substr($this->session->flashdata('message'),1).'</p>
</div>
</div>';
?>
<div class="container topbar">
<nav class="tools">
<a href="<?php echo admin('contact');?>" class="button color"><i class="icon-envelope-alt"></i> Message Management</a>
<a href="#" class="button color internal" data-show="divAdd"><i class="icon-plus-sign"></i> เพิ่ม e-mail ผู้รับ Message</a>
<a href="<?php echo admin('email');?>" class="button light refresh"><i class="icon-refresh"></i> Refresh</a>
<a href="<?php echo admin($page);?>" class="button light reload"><i class="icon-rotate-left"></i> Reload</a>
</nav>
<?php
if( $num_rows > 0) :
?>
<form id="contact-frm" action="<?php echo admin($page);?>" method="POST">
<div style="margin:0 15px;">
<table class="data-table email">
<thead>
<tr>
<th width="40">No</th>
<th width="60"><input type="checkbox" id="checkall" /></th>
<th width="60">ID</th>
<th width="240">Account</th>
<th>E-Mail</th>
<th width="80"><i class="icon-edit"></i> Edit</th>
<th width="80">Active</th>
<th width="160">Date Created</th>
<th width="160">Date Modified</th>
</tr>
</thead>
<tbody>
<?php
foreach($data as $key=>$rs)
{
$status=( $rs['active']=='Y' )?'':' inactive';
$id=$rs['id'];
++$n;
echo '<tr class="rowdata'.$status.'" data-id="'.$id.'" id="'.$id.'">
<td class="cn">'.$n.'</td>
<td class="cn"><input type="checkbox" name="del[]" class="chk" value="'.$id.'"></td>
<td class="cn">'.$id.'</td>
<td><div class="left w240 nowrap">'.$rs['account'].'</div></td>
<td><div class="left nowrap">'.$rs['email'].'</div></td>
<td><a href="#" class="edit"><div class="cn w80 nowrap">แก้ไข</div></a></td>
<td class="status"><div class="cn w80 nowrap">'.$rs['active'].'</div></td>
<td><div class="cn w160 nowrap">'.$rs['created'].'</div></td>
<td><div class="cn w160 nowrap">'.substr($rs['updated'],0,16).'</div></td>
</tr>';
}
?>
</tbody>
</table>
<div class="container">
<ul class="pages">
<li>
<button type="submit" name="btnDelete" class="button delete disabled"><i class=" icon-trash"></i> Delete</button><p><a href="#" class="unselectall">ยกเลิกเลือกทั้งหมด</a><a href="#" class="strselectall">เลือกทั้งหมด</a></p><p id="information" class="success"></p>
</li>
<li>
<?php echo $pages; ?>
</li>
</ul>
</div>
<div class="clearfix"></div>
</form>
<?php endif ?>
<div class="container reset divAdd">
<div id="add" class="form" data-type="1" data-id="" data-action="email">
<h2><i class="icon-plus-sign"></i> Add new e-mail<span>/ เพิ่ม e-mail ผู้รับ Message จากหน้าเว็ปไซด์</span></h2>
<form name="addEmail" id="addEmail" action="<?php echo admin($action);?>" method="POST">
<ul>
<li> Account</li>
<li><input type="text" name="account" id="account" data-validation="required" placeholder="กรอก Account"></li>
<li> E-Mail</li>
<li><input type="text" name="email" id="email" data-validation="email" placeholder="กรอก E-Mail"></li>
<li><button type="submit" class="button" name="submit"><i class=" icon-save"></i> Submit</button><input type="reset" class="button light"><p id="information" class="success"></p></li>
</ul>
</form>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<?php
$this->load->view('admin/footer');
?>
</body>
</html>
Helpers ::
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function objectToArray($d)
{
if (is_object($d))
{
$d = get_object_vars($d);
}
if (is_array($d))
{
return array_map(__FUNCTION__, $d);
}
else
{
return $d;
}
}
function arrayToObject($d) {
if (is_array($d))
{
return (object) array_map(__FUNCTION__, $d);
}
else
{
return $d;
}
}
function tis_utf8($tis){
$max=strlen($tis);
for( $i=0 ; $i< $max; $i++ ){
$s = substr($tis, $i, 1);
$val = ord($s);
if( $val < 0x80 ){
$utf8 .= $s;
} elseif ((0xA1 <= $val and $val <= 0xDA) or (0xDF <= $val and $val <= 0xFB)){
$unicode = 0x0E00 + $val - 0xA0;
$utf8 .= chr( 0xE0 | ($unicode >> 12) );
$utf8 .= chr( 0x80 | (($unicode >> 6) & 0x3F) );
$utf8 .= chr( 0x80 | ($unicode & 0x3F) );
}
}
return $utf8;
}
function utf8_tis($string){
$str = $string;
$res = "";
for ($i = 0; $i < strlen($str); $i++){
if (ord($str[$i]) == 224){
$unicode = ord($str[$i+2]) & 0x3F;
$unicode |= (ord($str[$i+1]) & 0x3F) << 6;
$unicode |= (ord($str[$i]) & 0x0F) << 12;
$res .= chr($unicode-0x0E00+0xA0);
$i += 2;
}else{
$res .= $str[$i];
}
}
return $res;
}
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function home($uri=''){
return base_url($uri);
}
function admin($uri=''){
return base_url('admin/'.$uri);
}
function adm($uri=''){
return base_url('adm/'.$uri);
}
function _css($file='',$params2='assets/css/'){
return base_url().$params2.$file.'.css';
}
function _js($file='',$params2='assets/js/'){
return base_url().$params2.$file.'.js';
}
function _image($file='',$param=TRUE){
if($param==TRUE)
$param='assets/images/';
return base_url().$param.$file;
}
function _img($file='',$param=TRUE){
echo _image($file,$param);
}
/*function uri($param=''){
if(!empty($param))
$param='/'.$param;
return base_url().'hr'.$param;
}
*/
function day($param,$type='w')
{
return date($type, mktime(0,0,0,$param[0], $param[1], $param[2])) ;//hour,minute,second,month,day,year
}
function dayinmonth($month,$year){
return day(array($month, 1, $year), 't');
}
function thaiyear($param){
return $param+543;
}
function arr_fullmonth(){
return array('EN'=>array('','January','February','March','April','May','June','July','August','September','October','November','December'),
'TH'=>array('','มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'));
}
function arr_day($param=''){
$arr=array("TH"=>array("อ","จ","อ","พ","พฤ","ศ","ส"),
"EN"=>array("S","M","T","W","T","F","S"),
"TH-FULL"=>array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"),
"EN-FULL"=>array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"));
return ( !empty($param) )? $arr[$param] : $arr;
}
function fullmonth($param=1, $lang='EN'){
$arr=arr_fullmonth();
return $arr[$lang][$param];
}
function showmonth($month, $year, $lang='EN'){
if($lang=='TH')
$year+=543;
return fullmonth($month, $lang).', '.$year;
}
function notification($param)
{
$arr=array('error', 'success', 'waring', 'notice');
return $arr[$param];
}
}
/* End of file fnc_helper.php */
/* Location: ./application/helpers/fnc_helper.php */
Tag : PHP, MySQL, HTML/CSS, Ajax, jQuery, CodeIgniter Framework
|
|
|
|
|
|
Date :
2014-07-18 17:11:46 |
By :
fossil31 |
View :
9262 |
Reply :
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jQuery
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
function item(n){
var str='item';
if (n>1)
str += 's';
return str;
}
function validateEmail(email){
var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
var valid = emailReg.test(email);
if(!valid) {
return false;
} else {
return true;
}
}
(function($){
$(document).ready(function(){
//-------------------------------------------------------------------------------------------------------------
// Variables
//-------------------------------------------------------------------------------------------------------------
animate=['fade','slide','box','fadeAndSlide'];
info=$("#information");
num_select=0;
//-------------------------------------------------------------------------------------------------------------
// On Document Load
//-------------------------------------------------------------------------------------------------------------
$(".disabled").set_disabled();
setTimeout(function(){ $('.container.message').fadeTo(300, 0, function() { $('.container.message').fadeOut(300) } ); }, 2500);
//-------------------------------------------------------------------------------------------------------------
// Click show Elements
//-------------------------------------------------------------------------------------------------------------
$(".internal").click(function(){
var ele=$(this).data('show');
if( $("#add").data('type')==2 )
{
$("#add").data('type', '1').show();
$("#addEmail input[type=reset]").trigger("click");
$("#add > h2").html('<i class="icon-plus-sign"></i> Add new e-mail<span>/ เพิ่ม e-mail ผู้รับ Message จากหน้าเว็ปไซด์</span>');
}
else
$('.'+ele).toggle();
});
//-------------------------------------------------------------------------------------------------------------
// Alert Box
//-------------------------------------------------------------------------------------------------------------
$(document.body).pixusNotifications({
speed: 300,
animation: 'fadeAndSlide',
hideBoxes: false
});
//-------------------------------------------------------------------------------------------------------------
// checkbox checked
//-------------------------------------------------------------------------------------------------------------
$("#checkall").on('click',function(event)
{
$('.chk:not(#checkall)').prop('checked',this.checked);
if ($(this).is(':checked') == true){
$("tbody").find('tr').addClass('checked');
} else {
$("tbody").find('tr').removeClass('checked');
}
chkbutton();
});
$('.chk').on('click',function(event) {
if($("#checkall").is(':checked') == true && this.checked == false) {
$("#checkall").prop('checked',false);
$(this).closest('tr').removeClass('checked');
}
if(this.checked == true) {
$(this).closest('tr').addClass('checked');
CheckSelectAll();
}
if(this.checked == false) {
$(this).closest('tr').removeClass('checked');
}
chkbutton();
});
// if checkbox is checked on page load, highlight table background
$('tbody tr').filter(':has(:checkbox:checked)').addClass('checked').end();
function CheckSelectAll() {
var flag = true;
$('.chk:not(#checkall)').each(function() {
if(this.checked == false)
flag = false;
});
$("#checkall").attr('checked',flag);
}
function chkbutton() {
var n=$(".chk:checked").length;
if( n > 0 ) {
$(".button.delete").set_enable();
info.setclass('success').html('Selected<span>' + addCommas(n) + '</span>' + item(n));
} else {
$(".button.delete").set_disabled();
info.set_empty();
}
}
$(".strselectall").click(function(){
$("tbody").find('tr').setclass('checked');
$(".chk, #checkall").checked();
chkbutton();
});
$(".unselectall").click(function(){
$("tbody").find('tr').removeClass('checked');
$(".chk, #checkall").unchecked();
chkbutton();
});
//-------------------------------------------------------------------------------------------------------------
// Contact Delete Checkbox
//-------------------------------------------------------------------------------------------------------------
$("#contact-frm").submit(function() {
var n=$(".chk:checked").length;
$('.container.message').hide();
if( n == 0 ) {
info.setclass('error').html('กรุณาเลือกอย่างน้อย 1 รายการ...');
return false
}
if(confirm('Confirm Delete ' + n + ' ' + item(n) + ' ?')==true){
info.setclass('loading').html('Deleting ' + n + ' ' + item(n) + '...');
return true;
}
return false;
});
function nchecked(obj)
{
}
//-------------------------------------------------------------------------------------------------------------
// Add E-Mail Form Validation
//-------------------------------------------------------------------------------------------------------------
$.validate({
form : '#addEmail',
validateOnBlur : false,
errorMessagePosition : 'top',
onSuccess : function() {
return true;
}
});
$("#addEmail").submit(function(){
var type=$("#add").data('type');
var id=$("#add").data('id');
if( type==1 )
return true;
else
{
account=$.trim($("input[name=account]").val());
email=$.trim($("input[name=email]").val());
if( account.length==0 )
setmessage('Account ห้ามมีค่าว่าง...', 'error');
else if( validateEmail(email)==false )
setmessage('รูปแบบ E-Mail ไม่ถูกต้อง...', 'error');
else {
var url=base_url + $('#add').data('action');
var data={ account: account, email:email, id:id, type:2 };
$.post( url, data, function(res) {
if ( res==1 ) {
$('#' + id + ' td:nth-child(4)').html('<div class="left w240 nowrap">' + account + '</div>');
$('#' + id + ' td:nth-child(5)').html('<div class="left nowrap">' + email + '</div>');
setmessage('แก้ไขข้อมูลเรียบร้อย...', 'success');
$("#addEmail input[type=text]").val('');
$(".divAdd").slideUp('fast');
}
});
}
return false;
}
return false;
});
$(".edit").click(function(){
var rowid=$(this).closest('tr').data('id');
$("#addEmail input[type=reset]").trigger("click");
$.post( base_url + 'email', { id: rowid, type:1 }, function(res) {
$("#addEmail input[type=reset]").trigger("click");
$("#add > h2").html('<i class=" icon-save"></i> Update an E-mail<span>/ แก้ไข e-mail ผู้รับ Message จากหน้าเว็ปไซด์</span>');
$(".divAdd").show();
var data=jQuery.parseJSON(res);
$("input[name=account]").val(data.account);
$("input[name=email]").val(data.email);
$("#add").data('type', '2');
$("#add").data('id', data.id);
});
});
$(".email .status").click(function(){
var id=$(this).closest('tr').data('id');
$.post( base_url + 'email', { id: id, type:3 }, function(res) {
setmessage('แก้ไขข้อมูลเรียบร้อย...', 'success');
$('#' + id + ' td:nth-child(7)').html('<div class="cn w80 nowrap">' + res + '</div>');
if( res=='Y' )
$('#' + id).removeClass('inactive');
else
$('#' + id).addClass('inactive');
});
});
function setmessage(str, param){
$("#alert").show();
$("#alert >div").removeClass('sucess,error').addClass(param);
$("#alert p").html(str);
setTimeout(function() {
$("#alert").fadeOut();
}, 1500);
}
//-------------------------------------------------------------------------------------------------------------
// $.function() + Document
//-------------------------------------------------------------------------------------------------------------
});
})(this.jQuery);
//-------------------------------------------------------------------------------------------------------------
// Create Function
//-------------------------------------------------------------------------------------------------------------
(function ( $ ) {
$.fn.set_disabled = function() {
return this.attr('disabled', 'disabled').addClass('disabled');
};
$.fn.set_enable = function() {
return this.removeAttr('disabled').removeClass('disabled');
};
$.fn.set_empty = function() {
return this.empty().removeClass();
};
$.fn.checked = function() {
return this.attr('checked', 'checked');
};
$.fn.unchecked = function() {
return this.removeAttr('checked');
};
$.fn.setclass = function(param) {
return this.removeClass().addClass(param);
};
}( jQuery ));
(function()
{
$.fn.pixusNotifications = function(options)
{
var defaults = {
speed: 200,
animation: 'fade',
hideBoxes: false
};
var options = $.extend({}, defaults, options);
return this.each(function()
{
var wrapper = $(this),
notification = wrapper.find('.notification'),
content = notification.find('p'),
title = content.find('strong'),
closeBtn = $('<a class="close" href="#"><i class="icon-remove"></i></a>');
$(document.body).find('.notification').each(function(i)
{
var i = i+1;
$(this).attr('id', 'notification_'+i);
});
notification.filter('.closeable').append(closeBtn);
closeButton = notification.find('> .close');
closeButton.click(function()
{
hideIt( $(this).parent() );
return false;
});
function hideIt(object)
{
switch(options.animation)
{
case 'fade': fadeIt(object); break;
case 'slide': slideIt(object); break;
case 'box': boxAnimIt(object); break;
case 'fadeAndSlide': fadeItSlideIt(object); break;
default: fadeItSlideIt(object);
}
};
function fadeIt(object)
{ object
.fadeOut(options.speed);
}
function slideIt(object)
{ object
.slideUp(options.speed);
}
function fadeItSlideIt(object)
{ object
.fadeTo(options.speed, 0, function() { slideIt(object) } );
}
function boxAnimIt(object)
{ object
.hide(options.speed);
}
if (options.hideBoxes){}
else if (! options.hideBoxes)
{
notification.css({'display': 'block', 'visiblity': 'visible'});
}
});
};
})();
|
|
|
|
|
Date :
2014-07-18 17:15:27 |
By :
fossil31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอแนะนำว่า zip ไฟล์แล้วอัพโหลด เอาลิ้งค์มาแปะ น่าจะสะดวกกว่าไม๊ครับ ขอรบกวนอีกนิด
|
|
|
|
|
Date :
2014-07-18 17:19:59 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ ขอทดสอบก่อนละกัน
|
|
|
|
|
Date :
2015-07-13 15:03:31 |
By :
5401103071016 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ เดี๋ยวเอาไปลองใช้ดู
|
|
|
|
|
Date :
2015-07-13 15:08:49 |
By :
pungpoo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|