Commit 36ecd5ca by Phạm Văn Đoan

xóa file thừa

parent a0adad45
......@@ -394,6 +394,7 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsContest/listContestAjax',
'backend/cmsTrack/listTrackAjax',
'backend/cmsArtist/listArtistAjax',
'backend/cmsSetting/listGroupAjax',
'backend/cmsSetting/listUserAdminAjax',
......
......@@ -7,28 +7,27 @@
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class CmsContest extends CI_Controller
class CmsArtist extends CI_Controller
{
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
//
$this->load->model('mcontest');
$this->load->model('mcontest_details');
$this->load->model('muser');
$this->load->model('mactionlog');
}
public function listContest()
public function listArtist()
{
$this->_data['functionName'] = 'QL Cuộc đua';
$this->_data['action'] = 'listContest';
$this->_data['titlePage'] = 'QL Cuộc đua';
$this->_data['loadPage'] = 'backend/cms_contest/list_contest_view';
$this->_data['functionName'] = 'Nghệ sĩ';
$this->_data['action'] = 'listArtist';
$this->_data['titlePage'] = 'Nghệ sĩ';
$this->_data['loadPage'] = 'backend/cms_artist/list_artist_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
public function listContestAjax()
public function listArtistAjax()
{
$data = array();
$fByName = $this->input->post('fByName');
......@@ -36,19 +35,19 @@ class CmsContest extends CI_Controller
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 20;
$limit = 25;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->mcontest->cmsCountAll($fByName);
$totalRecord = $this->muser->cmsCountAll($fByName);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->mcontest->cmsGetPagination($limit, $offset, $fByName);
$data['listData'] = $this->muser->cmsGetPagination($limit, $offset, $fByName);
//
$this->load->view('backend/ajax/cms_contest/list_contest_view', $data);
$this->load->view('backend/ajax/cms_artist/list_artist_view', $data);
}
public function editContest($contest_id)
{
$this->_data['contest'] = $contest = $this->mcontest->getById($contest_id);
$this->_data['contest'] = $contest = $this->mtrack->getById($contest_id);
// Kiểm tra trùng giá trị nếu thay đổi ở form
// Thiết lập validate
......@@ -80,7 +79,7 @@ class CmsContest extends CI_Controller
$this->_data['functionName'] = 'QL Cuộc đua';
$this->_data['action'] = 'editContest';
$this->_data['titlePage'] = 'QL Cuộc đua';
$this->_data['loadPage'] = 'backend/cms_contest/edit_contest_view';
$this->_data['loadPage'] = 'backend/cms_track/edit_track_view';
$this->load->view('backend/admin_template_view', $this->_data);
}else{
$date_limit = intval(trim($this->input->post('date_limit')));
......@@ -91,7 +90,7 @@ class CmsContest extends CI_Controller
'date_from' => $date_from,
'updated_at'=> date("Y-m-d H:i:s")
);
$this->mcontest->update($contest_id, $dataUpdate);
$this->mtrack->update($contest_id, $dataUpdate);
// Cap nhat mang thoi gian ngay tham gia tu so ngay
for($i=1; $i <= $date_limit; $i++){
$data_update_contest_details = array(
......
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 25/12/2015
* Time: 2:22 CH
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class CmsStatistic extends CI_Controller
{
protected $_data;
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
//
$this->load->model('muser');
$this->load->model('mgame');
$this->load->model('mgamedetails');
$this->load->model('mcontest');
$this->load->model('mlink_clicked');
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê DS các lần chơi
*/
public function listGame()
{
$this->_data['functionName'] = 'QL Các lần chơi';
$this->_data['action'] = 'listGame';
$this->_data['titlePage'] = 'QL Các lần chơi';
$this->_data['loadPage'] = 'backend/cms_statistic/list_game_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
public function listGameAjax()
{
$data = array();
$fByName = $this->input->post('fByName');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 10;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->mgamedetails->cmsCountAll2($fByName);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->mgamedetails->cmsGetPagination2($limit, $offset, $fByName);
//
$this->load->view('backend/ajax/cms_statistic/list_game_view', $data);
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê top
*/
public function listTop()
{
$this->_data['functionName'] = 'QL Top 10';
$this->_data['action'] = 'listTop';
$this->_data['titlePage'] = 'QL Top 10';
$this->_data['loadPage'] = 'backend/cms_statistic/list_top_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
public function listTopAjax()
{
$data = array();
$fByDate = $this->input->post('fByDate');
$fByName = $this->input->post('fByName');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
if($fByDate == '' || $fByDate == null){
$fByDate = date('Y-m-d');
}else{
$fByDate = date('Y-m-d', strtotime($fByDate));
}
//
$limit = 10;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
//$totalRecord = $this->mgamedetails->cmsCountAll3($fByName);
//$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
//$data['listData'] = $this->mgamedetails->cmsGetPagination3($limit, $offset, $fByName);
$this->load->model('mgame_details');
//$data['listData'] = $this->mgame_details->getTopByDate($limit, $offset, $fByDate, $fByName);
$data['listData'] = $this->mgame_details->getTopByDateInOneGame($limit, $offset, $fByDate, $fByName);
//
$this->load->view('backend/ajax/cms_statistic/list_top_view', $data);
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê top
*/
public function listTopWeek()
{
// Lay tong so ngay chay chuong trinh
$contest = $this->mcontest->getCurrentContest();
if($contest){
$this->_data['date_limit'] = $contest[0]['date_limit'];
}else{
$this->_data['date_limit'] = 28;
}
//
$this->_data['functionName'] = 'QL Top 1 trong tuần';
$this->_data['action'] = 'listTopWeek';
$this->_data['titlePage'] = 'QL Top 1 trong tuần';
$this->_data['loadPage'] = 'backend/cms_statistic/list_top_week_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê người chơi
*/
public function listUser()
{
$this->_data['functionName'] = 'QL Người chơi';
$this->_data['action'] = 'listUser';
$this->_data['titlePage'] = 'QL Người chơi';
$this->_data['loadPage'] = 'backend/cms_statistic/list_user_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
public function listUserAjax()
{
$data = array();
$fByName = $this->input->post('fByName');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 10;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->muser->cmsCountAll2($fByName);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->muser->cmsGetPagination2($limit, $offset, $fByName);
//
$this->load->view('backend/ajax/cms_statistic/list_user_view', $data);
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê DS các lần Người chơi click vào link
*/
public function listUserClick()
{
$this->_data['functionName'] = 'QL Các lần chơi';
$this->_data['action'] = 'listGame';
$this->_data['titlePage'] = 'QL Các lần chơi';
$this->_data['loadPage'] = 'backend/cms_statistic/list_user_click_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
public function listUserClickAjax()
{
$data = array();
$fByName = $this->input->post('fByName');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 10;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->mlink_clicked->cmsCountAll($fByName);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->mlink_clicked->cmsGetPagination($limit, $offset, $fByName);
//
$this->load->view('backend/ajax/cms_statistic/list_user_click_view', $data);
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Xuất file mã dự thưởng
*/
public function listExport()
{
try {
// Thiết lập mặc định
$this->load->library('excel');
$maxRow = 1000;
$sheetPwd = MyHelper::genExportPassword();
// Lấy khoảng thời gian từ form submit
$totalRecord = $this->muser->exportCountAll();
$numSheet = ceil($totalRecord / $maxRow);
// Xử lý dữ liệu
if ($numSheet >= 1) {
//1.SHEET chi tiết theo phân trang =========================================================================
for ($sh = 0; $sh < $numSheet; $sh++) {
$this->excel->createSheet($sh + 1);
$this->excel->setActiveSheetIndex($sh + 1);
$this->excel->getActiveSheet()->setShowGridlines(false);
$this->excel->getActiveSheet()->setTitle('User-' . ($sh + 1));
//
$this->excel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Times New Roman');
$this->excel->getActiveSheet()->getDefaultStyle()->getFont()->setSize('12');
$this->excel->getActiveSheet()->getColumnDimension('A')->setWidth('8'); //STT
$this->excel->getActiveSheet()->getColumnDimension('B')->setWidth('20'); //Tên hiển thị
$this->excel->getActiveSheet()->getColumnDimension('C')->setWidth('30'); //Tài khoản
$this->excel->getActiveSheet()->getColumnDimension('D')->setWidth('30'); //Email
$this->excel->getActiveSheet()->getColumnDimension('E')->setWidth('15'); //SĐT
$this->excel->getActiveSheet()->getColumnDimension('F')->setWidth('20'); //Mã dự thưởng
//
$this->excel->getActiveSheet()->setCellValue('A1', 'Công ty CP DV BĐS Ngôi Sao Toàn Cầu ');
$this->excel->getActiveSheet()->setCellValue('E1', 'THỐNG KÊ MÃ DỰ THƯỞNG');
$this->excel->getActiveSheet()->getStyle('A1:E1')->getFont()->setSize(15);
$this->excel->getActiveSheet()->getStyle('A1:E1')->getFont()->setBold(true);
$this->excel->getActiveSheet()->mergeCells('A1:D1');
$this->excel->getActiveSheet()->mergeCells('E1:G1');
$this->excel->getActiveSheet()->getStyle('A1:E2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
//
$this->excel->getActiveSheet()->setCellValue('A2', '(Thành viên của Cenland)');
$this->excel->getActiveSheet()->setCellValue('E2', '(Hệ thống quản lý Game)');
$this->excel->getActiveSheet()->mergeCells('A2:D2');
$this->excel->getActiveSheet()->mergeCells('E2:G2');
$styleArray = array(
'font' => array(
'underline' => PHPExcel_Style_Font::UNDERLINE_SINGLE
)
);
$this->excel->getActiveSheet()->getStyle('A2:E2')->applyFromArray($styleArray);
//
$this->excel->getActiveSheet()->setCellValue('A5', 'Thời điểm xuất thống kê');
$this->excel->getActiveSheet()->setCellValue('A6', 'Người xuất thống kê');
//
$this->excel->getActiveSheet()->setCellValue('C5', ': ' . date('d/m/Y H:i:s'));
$this->excel->getActiveSheet()->setCellValue('C6', ': ' . $this->session->userdata('username'));
//
$this->excel->getActiveSheet()->setCellValue('A8', 'TT');
$this->excel->getActiveSheet()->setCellValue('B8', 'Tên hiển thị');
$this->excel->getActiveSheet()->setCellValue('C8', 'Tên tài khoản');
$this->excel->getActiveSheet()->setCellValue('D8', 'Email');
$this->excel->getActiveSheet()->setCellValue('E8', 'Số điện thoại');
$this->excel->getActiveSheet()->setCellValue('F8', 'Mã dự thưởng');
//
$this->excel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb' => '#ffb752')
),
'borders' => array(
'allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)
),
'font' => array('bold' => true),
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
'vertical' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER
)
),
"A8:F8"
);
//
$subData = $this->muser->exportGetPagination($maxRow, $sh * $maxRow);
$index = 8;
foreach ($subData as $key => $subItem) {
$index += 1;
// 1.STT ------------------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('A' . $index, ($sh * $maxRow + $key + 1), PHPExcel_Cell_DataType::TYPE_NUMERIC);
// 2.ID, SID -----------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('B' . $index, $subItem['fullname'], PHPExcel_Cell_DataType::TYPE_STRING);
// 3.Msisdn -----------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('C' . $index, $subItem['username'], PHPExcel_Cell_DataType::TYPE_STRING);
// 4.Username -----------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('D' . $index, $subItem['email'], PHPExcel_Cell_DataType::TYPE_STRING);
// 5.Channel -----------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('E' . $index, $subItem['mobile'], PHPExcel_Cell_DataType::TYPE_STRING);
// 7.Ngày tạo ------------------------------------------------------------------------------------------
$this->excel->getActiveSheet()->setCellValueExplicit('F' . $index, $subItem['reward_code'], PHPExcel_Cell_DataType::TYPE_STRING);
// Định dạng vùng dữ liệu
$this->excel->getActiveSheet()->duplicateStyleArray(
array(
'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT),
'borders' => array(
'allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)
),
),
"A" . $index . ":F" . $index
);
// Căn lề các ô, cột dữ liệu
$this->excel->getActiveSheet()->getStyle('A' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('B' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$this->excel->getActiveSheet()->getStyle('C' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$this->excel->getActiveSheet()->getStyle('D' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$this->excel->getActiveSheet()->getStyle('E' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->excel->getActiveSheet()->getStyle('F' . $index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
}
// Thiết lập mật khẩu cho sheet
$this->excel->setActiveSheetIndex($sh+1);
$this->excel->getActiveSheet()->getProtection()->setSheet(true);
$this->excel->getActiveSheet()->getProtection()->setSort(true);
$this->excel->getActiveSheet()->getProtection()->setPassword($sheetPwd);
}
// Download file ------------------------------------------------------------------------------------------
$filename = date('Ymd_His_') . $sheetPwd . '_MaDuThuong.xls'; //save our workbook as this file name
header('Content-Type: application/vnd.ms-excel'); //mime type
header('Content-Disposition: attachment;filename="' . $filename . '"'); //tell browser what's the file name
header('Cache-Control: max-age=0'); //no cache
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
$objWriter->save('php://output');
$this->session->set_flashdata('success', 'Xuất dữ liệu thành công.');
redirect(base_url('backend/home/index'));
die();
} else {
$this->session->set_flashdata('error', 'Không có dữ liệu nào được xuất ra Excel.');
redirect(base_url('backend/home/index'));
}
} catch (Exception $e) {
$this->session->set_flashdata('error', 'Xuất dữ liệu không thành công.');
redirect(base_url('backend/home/index'));
}
}
}
\ No newline at end of file
......@@ -16,7 +16,6 @@ class CmsTrack extends CI_Controller
//
$this->load->model('mtrack');
$this->load->model('muser');
$this->load->model('mcontest_details');
$this->load->model('mactionlog');
}
......@@ -31,20 +30,16 @@ class CmsTrack extends CI_Controller
public function listTrackAjax()
{
error_log('a day roi');
$data = array();
$fByName = $this->input->post('fByName');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 20;
$limit = 25;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->mtrack->cmsCountAll($fByName);
$data['listUser'] = $this->muser->getIdFullname();
//MyHelper::echoPreDie($data['listUser']);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->mtrack->cmsGetPagination($limit, $offset, $fByName);
//
......
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mgamedetails extends CI_Model {
protected $_table='game_details';
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert){
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate){
try{
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
return true;
}catch (Exception $e){
return false;
}
}
public function getById($id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox(){
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table.'.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
public function cmsCountAll($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if($name != null){
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination($record, $start, $name=null){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
if($name != null){
$this->db->like($this->_table.'.fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$this->db->order_by($this->_table.'.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê danh sách các lần chơi: Tài khoản, Số điểm, thời gian hoàn thành, thời gian chơi
* @param null $name
* @return int
*/
public function cmsCountAll2($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination2($record, $start, $name=null){
$this->db->select('gd.*, u.fullname, u.username');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id', 'left');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->order_by('gd.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê danh sách top: sắp xếp theo thứ tự ưu tiên thời gian hoàn thành, điểm
* @param null $name
* @return int
*/
public function cmsCountAll3($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->where('time >', 0);
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination3($record, $start, $name=null){
$this->db->select('gd.*, u.fullname, u.username, u.email, u.mobile');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id', 'left');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->where('time >', 0);
$this->db->order_by('gd.time asc, gd.point desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mgamedetails extends CI_Model {
protected $_table='game_details';
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert){
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate){
try{
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
return true;
}catch (Exception $e){
return false;
}
}
public function getById($id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox(){
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table.'.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
public function cmsCountAll($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if($name != null){
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination($record, $start, $name=null){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
if($name != null){
$this->db->like($this->_table.'.fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$this->db->order_by($this->_table.'.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê danh sách các lần chơi: Tài khoản, Số điểm, thời gian hoàn thành, thời gian chơi
* @param null $name
* @return int
*/
public function cmsCountAll2($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination2($record, $start, $name=null){
$this->db->select('gd.*, u.fullname, u.username');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id', 'left');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->order_by('gd.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
/**
* -----------------------------------------------------------------------------------------------------------------
* Thống kê danh sách top: sắp xếp theo thứ tự ưu tiên thời gian hoàn thành, điểm
* @param null $name
* @return int
*/
public function cmsCountAll3($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->where('time >', 0);
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination3($record, $start, $name=null){
$this->db->select('gd.*, u.fullname, u.username');
$this->db->from($this->_table.' gd');
$this->db->join('user u', 'u.id = gd.user_id', 'left');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->where('time >', 0);
$this->db->order_by('gd.time asc, gd.point desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mgame extends CI_Model {
protected $_table='game';
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert){
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate){
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
}
public function getById($id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$query = $this->db->get();
return $query->result_array();
}
/**
* Lay thong tin Game theo UserId
* @param $user_id
* @return mixed
*/
public function getByUserId($user_id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.user_id', $user_id);
$query = $this->db->get();
return $query->result_array();
}
public function getResultByUserId($user_id){
$this->db->select('g.*, u.fullname, u.username, u.email, u.token');
$this->db->from($this->_table.' g');
$this->db->join('user u', 'u.id = g.user_id', 'left');
$this->db->where('g.user_id', $user_id);
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
public function getFullnameById($id){
$this->db->select($this->_table.'.fullname');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$this->db->limit(1);
$query = $this->db->get();
$arr = array();
$arr = $query->result_array();
return $arr[0]['fullname'];
}
public function cmsCountAll($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if($name != null){
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination($record, $start, $name=null){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
if($name != null){
$this->db->like($this->_table.'.fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$this->db->order_by($this->_table.'.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox(){
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table.'.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
......@@ -78,12 +78,9 @@ class Muser extends CI_Model
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if ($name != null) {
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->like('username', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
$this->db->or_like('full_name', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
......@@ -99,16 +96,14 @@ class Muser extends CI_Model
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
if ($name != null) {
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->like('username', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
$this->db->or_like('full_name', $name, 'both');
}
$this->db->order_by($this->_table . '.created_at', 'desc');
$this->db->order_by($this->_table . '.username', 'asc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
......
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Mcontest extends CI_Model
{
protected $_table = 'contest';
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert)
{
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate)
{
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
}
public function getById($id)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.id', $id);
$query = $this->db->get();
return $query->result_array();
}
/**
* Lay cuoc thi hien hanh
* @return mixed
*/
public function getCurrentContest()
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where('is_active', 1);
$this->db->order_by('created_at', 'desc');
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
public function cmsCountAll($name = null)
{
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if ($name != null) {
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if ($result) {
return $result[0]['totalResults'];
} else {
return 0;
}
}
public function cmsGetPagination($record, $start, $name = null)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
if ($name != null) {
$this->db->like($this->_table . '.fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$this->db->order_by($this->_table . '.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox()
{
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table . '.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Mcontest_details extends CI_Model
{
protected $_table = 'contest_details';
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert)
{
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate)
{
try {
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
return true;
} catch (Exception $e) {
return false;
}
}
public function getById($id)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.id', $id);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox()
{
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table . '.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
/**
* Lay cuoc thi hien hanh
* @return mixed
*/
public function getDateOrderByToday()
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where('DATE(date_play)', date('Y-m-d'));
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
public function getByDateOrder($date_order){
$this->db->select('*');
$this->db->from($this->_table);
$this->db->where('date_order', $date_order);
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mgame extends CI_Model {
protected $_table='game';
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert){
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate){
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
}
public function getById($id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$query = $this->db->get();
return $query->result_array();
}
/**
* Lay thong tin Game theo UserId
* @param $user_id
* @return mixed
*/
public function getByUserId($user_id){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
$this->db->where($this->_table.'.user_id', $user_id);
$query = $this->db->get();
return $query->result_array();
}
public function getResultByUserId($user_id){
$this->db->select('g.*, u.fullname, u.username, u.email, u.token');
$this->db->from($this->_table.' g');
$this->db->join('user u', 'u.id = g.user_id', 'left');
$this->db->where('g.user_id', $user_id);
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
public function getFullnameById($id){
$this->db->select($this->_table.'.fullname');
$this->db->from($this->_table);
$this->db->where($this->_table.'.id', $id);
$this->db->limit(1);
$query = $this->db->get();
$arr = array();
$arr = $query->result_array();
return $arr[0]['fullname'];
}
public function cmsCountAll($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if($name != null){
$this->db->like('fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination($record, $start, $name=null){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
if($name != null){
$this->db->like($this->_table.'.fullname', $name, 'both');
$this->db->or_like('username', $name, 'both');
$this->db->or_like('address', $name, 'both');
$this->db->or_like('email', $name, 'both');
$this->db->or_like('mobile', $name, 'both');
$this->db->or_like('reward_code', $name, 'both');
}
$this->db->order_by($this->_table.'.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
public function getListForSelectBox(){
$this->db->select('id, fullname, username, sid');
$this->db->from($this->_table);
$this->db->where('sid !=', '');
$this->db->order_by($this->_table.'.username', 'asc');
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Mgame_details extends CI_Model
{
protected $_table = 'game_details';
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert)
{
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate)
{
try {
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
return true;
} catch (Exception $e) {
return false;
}
}
/**
* Lấy kết quả theo ngày để hiển thị bảng kết quả
* @return mixed
*/
public function getResultByDate()
{
$this->db->select(
'DATE(gd.created_at) as created_at,
gd.user_id,
u.fullname as fullname,
SUM(gd.point) AS total_point,
SUM(gd.time) AS total_time'
);
$this->db->from($this->_table. ' gd');
$this->db->join('user u', 'u.id = gd.user_id');
$this->db->group_by(array('DATE(gd.created_at)', 'gd.user_id'));
$this->db->order_by('DATE(gd.created_at) ASC, total_point DESC, total_time` ASC');
$query = $this->db->get();
return $query->result_array();
}
/**
* Lấy top 10 theo từng ngày chơi
* @param null $date
* @return mixed
*/
public function getTopByDate($limit=10, $offset=0, $date=null, $name=null)
{
$this->db->select(
'DATE(gd.created_at) as created_at,
gd.user_id,
u.fullname as fullname,
u.username as username,
u.email as email,
u.mobile as mobile,
u.avatar as avatar,
SUM(gd.point) AS total_point,
SUM(gd.time) AS total_time'
);
$this->db->from($this->_table. ' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($date != null){
$this->db->where('DATE(gd.created_at)', $date);
}else{
$this->db->where('DATE(gd.created_at)', date('Y-m-d'));
}
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->group_by(array('DATE(gd.created_at)', 'gd.user_id'));
$this->db->order_by('DATE(gd.created_at) ASC, total_point DESC, total_time` ASC');
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result_array();
}
public function getTopByDateInOneGame($limit=10, $offset=0, $date=null, $name=null)
{
/*SELECT MAX(gd.`point`) AS max_point, u.`fullname`
FROM `game_details` gd
LEFT JOIN USER u ON u.`id` = gd.`user_id`
WHERE DATE(gd.`created_at`) = '2017-02-23'
GROUP BY gd.`user_id`
ORDER BY max_point DESC
LIMIT 10;*/
$this->db->select(
'MAX(gd.point) as max_point, gd.time, DATE(gd.created_at) as created_at,
gd.user_id,
u.fullname as fullname,
u.username as username,
u.email as email,
u.mobile as mobile,
u.avatar as avatar,
u.reward_code as reward_code,
SUM(gd.point) AS total_point,
SUM(gd.time) AS total_time'
);
$this->db->from($this->_table. ' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($date != null){
$this->db->where('DATE(gd.created_at)', $date);
}else{
$this->db->where('DATE(gd.created_at)', date('Y-m-d'));
}
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
}
$this->db->group_by(array('gd.user_id'));
$this->db->order_by('max_point DESC');
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result_array();
}
public function getTopWeek($date1=null, $date7=null)
{
/*SELECT MAX(gd.`point`) AS max_point, u.`fullname`
FROM `game_details` gd
LEFT JOIN USER u ON u.`id` = gd.`user_id`
WHERE DATE(gd.`created_at`) = '2017-02-23'
GROUP BY gd.`user_id`
ORDER BY max_point DESC
LIMIT 10;*/
$this->db->select(
'MAX(gd.point) as max_point, gd.time, DATE(gd.created_at) as created_at,
gd.user_id,
u.fullname as fullname,
u.username as username,
u.email as email,
u.mobile as mobile,
u.avatar as avatar,
u.reward_code as reward_code,
SUM(gd.point) AS total_point,
SUM(gd.time) AS total_time'
);
$this->db->from($this->_table. ' gd');
$this->db->join('user u', 'u.id = gd.user_id');
if($date1 != null && $date7 != null){
$this->db->where('DATE(gd.created_at) >=', $date1);
$this->db->where('DATE(gd.created_at) <=', $date7);
}
$this->db->group_by(array('gd.user_id'));
$this->db->order_by('max_point DESC');
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
public function getByUserId($user_id)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.user_id', $user_id);
$this->db->order_by($this->_table . '.created_at', 'desc');
$this->db->limit(1);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Mlink_clicked extends CI_Model
{
protected $_table = 'link_clicked';
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
public function add($dataInsert)
{
$this->db->insert($this->_table, $dataInsert);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function update($id, $dataUpdate)
{
try {
$this->db->where('id', $id);
$this->db->update($this->_table, $dataUpdate);
return true;
} catch (Exception $e) {
return false;
}
}
public function cmsCountAll($name=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table.' lc');
$this->db->join('user u', 'u.id = lc.user_id');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
$this->db->or_like('lc.link', $name, 'both');
}
$query = $this->db->get();
$result = $query->result_array();
if($result){
return $result[0]['totalResults'];
}else{
return 0;
}
}
public function cmsGetPagination($record, $start, $name=null){
$this->db->select('lc.*, u.fullname, u.username, u.email, u.mobile, u.reward_code');
$this->db->from($this->_table.' lc');
$this->db->join('user u', 'u.id = lc.user_id', 'left');
if($name != null){
$this->db->like('u.fullname', $name, 'both');
$this->db->or_like('u.username', $name, 'both');
$this->db->or_like('u.address', $name, 'both');
$this->db->or_like('u.email', $name, 'both');
$this->db->or_like('u.mobile', $name, 'both');
$this->db->or_like('u.reward_code', $name, 'both');
$this->db->or_like('lc.link', $name, 'both');
}
$this->db->order_by('lc.created_at', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
......@@ -68,7 +68,7 @@ class Mtrack extends CI_Model
public function cmsGetPagination($record, $start, $name = null)
{
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, u2.full_name AS composer_name');
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, u2.full_name AS composer_name, track_user.name AS singer_name2, track_artists.name AS composer_name2');
$this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join('track_artists', 'track_artists.track_id = tracks.id', 'left');
......@@ -83,6 +83,7 @@ class Mtrack extends CI_Model
$this->db->order_by($this->_table . '.title', 'asc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
......
......@@ -63,7 +63,6 @@ $action = $CI->router->fetch_method();
<small>CMS for Administrator</small>
</a>
</div>
<?php //die('a:'.$CI->session->userdata('username')) ?>
<div class="navbar-buttons navbar-header pull-right" role="navigation">
<ul class="nav ace-nav">
<li class="light-blue">
......@@ -178,7 +177,7 @@ $action = $CI->router->fetch_method();
</li>
<!-- Quan ly User -->
<li class="<?php if($controller && $controller == 'cmsUser') echo 'active open'?>">
<li class="<?php if($controller && $controller == 'cmsArtist') echo 'active open'?>">
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-users"></i>
<span class="menu-text">Nghệ sĩ</span>
......@@ -186,15 +185,9 @@ $action = $CI->router->fetch_method();
</a>
<b class="arrow"></b>
<ul class="submenu">
<li class="<?php if($action && (in_array($action, array('listUser','showUser')))) echo 'active'?>">
<a href="<?php echo base_url('backend/cmsUser/listUser'); ?>">
<i class="menu-icon fa fa-caret-right"></i>Ca sĩ
</a>
<b class="arrow"></b>
</li>
<li class="<?php if($action && (in_array($action, array('listUser','showUser')))) echo 'active'?>">
<a href="<?php echo base_url('backend/cmsUser/listUser'); ?>">
<i class="menu-icon fa fa-caret-right"></i>Nhạc sĩ
<li class="<?php if($action && (in_array($action, array('listArtist','showArtist')))) echo 'active'?>">
<a href="<?php echo base_url('backend/cmsArtist/listArtist'); ?>">
<i class="menu-icon fa fa-caret-right"></i>Ca sĩ/Nhạc sĩ
</a>
<b class="arrow"></b>
</li>
......
......@@ -3,10 +3,10 @@
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">Số ngày triển khai</th>
<th style="text-align: center">Ngày bắt đầu</th>
<th style="text-align: center">Ngày kết thúc</th>
<th style="text-align: center">Trạng thái</th>
<th style="text-align: center">#ID</th>
<th style="text-align: center">Tên Ca sĩ/Nhạc sĩ</th>
<th style="text-align: center">Tài khoản</th>
<th style="text-align: center">Email</th>
<th style="text-align: center">Xử lý</th>
</tr>
</thead>
......@@ -14,12 +14,12 @@
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center"><?php echo $data['date_limit']; ?></td>
<td style="text-align: center"><?php echo MyHelper::reFormatDate($data['date_from'], 'd/m/Y'); ?></td>
<td style="text-align: center"><?php echo date('d/m/Y', strtotime($data['date_from']) + ($data['date_limit'] - 1)*86400); ?></td>
<td style="text-align: center"><?php echo $data['is_active']; ?></td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: left"><?php echo $data['full_name']; ?></td>
<td style="text-align: left"><?php echo $data['username']; ?></td>
<td style="text-align: left"><?php echo $data['email']; ?></td>
<td style="text-align: center">
<a href="<?php echo base_url().'backend/cmsContest/editContest/'.$data['id']; ?>" title="Xem chi tiết">
<a href="<?php echo base_url().'backend/cmsArtist/editArtist/'.$data['id']; ?>" title="Xem chi tiết">
<i class="ace-icon fa fa-pencil bigger-130"></i>
</a>
</td>
......
<!--<div style="max-height: 465px; overflow: scroll">-->
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">Tên người chơi</th>
<th style="text-align: center">Tên tài khoản</th>
<th style="text-align: center">Điểm</th>
<th style="text-align: center">Thời gian hoàn thành (H:i:s)</th>
<th style="text-align: center">Thời gian chơi</th>
</tr>
</thead>
<tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td><?php echo $data['fullname']; ?></td>
<td><?php echo $data['username']; ?></td>
<td style="text-align: right"><?php echo number_format($data['point']); ?></td>
<td style="text-align: center"><?php echo gmdate('H:i:s', $data['time']); ?></td>
<td style="text-align: center"><?php echo MyHelper::reFormatDate($data['time_play_2']); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="10" style="color: red; font-style: italic">Không có dữ liệu nào!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div>
\ No newline at end of file
<!--<div style="max-height: 465px; overflow: scroll">-->
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">Ảnh đại diện</th>
<th style="text-align: center">Tên người chơi</th>
<th style="text-align: center">Mã dự thưởng</th>
<th style="text-align: center">Email</th>
<th style="text-align: center">Số điện thoại</th>
<th style="text-align: center">Thời gian hoàn thành<br>(H:i:s)</th>
<th style="text-align: center">Điểm cao nhất<br>(1 lần đua/ngày)</th>
<th style="text-align: center">Ngày chơi</th>
</tr>
</thead>
<tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center">
<?php ($data['avatar'] != '') ? $avatar_path = $data['avatar'] : $avatar_path = 'upload/avatar/user.jpg' ?>
<img src="<?php echo base_url($avatar_path);?>" style="width: 60px; height: 60px">
</td>
<td><?php echo $data['fullname']; ?></td>
<td style="text-align: center"><?php echo $data['reward_code']; ?></td>
<td><?php echo $data['email']; ?></td>
<td><?php echo $data['mobile']; ?></td>
<td style="text-align: center"><?php echo gmdate('H:i:s', $data['time']).'(s)'; ?></td>
<td style="text-align: right"><?php echo number_format($data['max_point']); ?></td>
<td style="text-align: center"><?php echo MyHelper::reFormatDate($data['created_at'], 'd/m/Y'); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="10" style="color: red; font-style: italic">Không có dữ liệu nào!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php //echo $pagination; ?></div>
<div>
<p style="font-style: italic; color: red">Lưu ý: Đây TOP 10 Người chơi cao điểm nhất trong ngày theo tìm kiếm, mặc định ngày hôm nay.</p>
</div>
\ No newline at end of file
<!--<div style="max-height: 465px; overflow: scroll">-->
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">Tên hiển thị</th>
<th style="text-align: center">Mã dự thưởng</th>
<th style="text-align: center">Email</th>
<th style="text-align: center">Số điện thoại</th>
<th style="text-align: center">Link đã click</th>
<th style="text-align: center">Thời gian click</th>
</tr>
</thead>
<tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td><?php echo $data['fullname']; ?></td>
<td style="text-align: center"><?php echo $data['reward_code']; ?></td>
<td><?php echo $data['email']; ?></td>
<td><?php echo $data['mobile']; ?></td>
<td style="text-align: left"><?php echo $data['link']; ?></td>
<td style="text-align: center"><?php echo MyHelper::reFormatDate($data['created_at']); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="10" style="color: red; font-style: italic">Không có dữ liệu nào!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div>
\ No newline at end of file
<!--<div style="max-height: 465px; overflow: scroll">-->
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">Tên người chơi</th>
<th style="text-align: center">Tên tài khoản</th>
<th style="text-align: center">Mã dự thưởng</th>
<th style="text-align: center">Tổng điểm</th>
<th style="text-align: center">Thời gian hoàn thành (H:i:s)</th>
<th style="text-align: center">Số lần chơi</th>
</tr>
</thead>
<tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td><?php echo $data['fullname']; ?></td>
<td><?php echo $data['username']; ?></td>
<td style="text-align: center"><?php echo $data['reward_code']; ?></td>
<td style="text-align: right"><?php echo number_format($data['total_point']); ?></td>
<td style="text-align: center"><?php echo gmdate('H:i:s', $data['total_time']); ?></td>
<td style="text-align: right"><?php echo number_format($data['total_game']); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="10" style="color: red; font-style: italic">Không có dữ liệu nào!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div>
\ No newline at end of file
......@@ -16,8 +16,8 @@
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: left"><?php echo $data['title']; ?></td>
<td style="text-align: left"><?php echo $data['singer_name']; ?></td>
<td style="text-align: left"><?php echo $data['composer_name']; ?></td>
<td style="text-align: left"><?php echo ($data['singer_name']) ? $data['singer_name'] : $data['singer_name2']; ?></td>
<td style="text-align: left"><?php echo ($data['composer_name']) ? $data['composer_name'] : $data['composer_name2']; ?></td>
<td style="text-align: center">
<a href="<?php echo base_url().'backend/cmsTrack/editTrack/'.$data['id']; ?>" title="Xem chi tiết">
<i class="ace-icon fa fa-pencil bigger-130"></i>
......
......@@ -22,13 +22,13 @@
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsTrack/listContestAjax'); ?>
<?php echo form_open(base_url().'backend/cmsArtist/listContestAjax'); ?>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Tên user,username,address,email,mobile,reward_code..."/>
placeholder="Nhập tên nghệ sĩ, email..."/>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
......@@ -41,13 +41,16 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
<div class="col-lg-12">
<div id="div-response"></div>
</div>
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>';
var url = '<?php echo base_url("backend/cmsArtist/listArtistAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
......@@ -136,7 +139,7 @@
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsTrack/listTrackAjax"; ?>';
var url = '<?php echo base_url()."backend/cmsArtist/listArtistAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
......
......@@ -41,17 +41,21 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-mo-list">
<table class="table table-striped table-bordered table-hover">
<thead></thead>
<tbody></tbody>
</table>
<div class="col-lg-12">
<div id="div-mo-list">
<table class="table table-striped table-bordered table-hover">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<div class="row">
<a href="<?php echo base_url().'backend/cmsSetting/addGroup'?>">
<button class="btn btn-sm btn-primary">+ Thêm mới</button>
</a>
<div class="col-lg-12">
<a href="<?php echo base_url().'backend/cmsSetting/addGroup'?>">
<button class="btn btn-sm btn-primary">+ Thêm mới</button>
</a>
</div>
</div>
<script type="text/javascript">
......
......@@ -41,17 +41,21 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-mo-list">
<table class="table table-striped table-bordered table-hover">
<thead></thead>
<tbody></tbody>
</table>
<div class="col-lg-12">
<div id="div-mo-list">
<table class="table table-striped table-bordered table-hover">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<div class="row">
<a href="<?php echo base_url().'backend/cmsSetting/addUserAdmin'?>">
<button class="btn btn-sm btn-primary">+ Thêm mới</button>
</a>
<div class="col-lg-12">
<a href="<?php echo base_url().'backend/cmsSetting/addUserAdmin'?>">
<button class="btn btn-sm btn-primary">+ Thêm mới</button>
</a>
</div>
</div>
<script type="text/javascript">
......
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsStatistic/listGameAjax'); ?>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Tên user,username,address,email,mobile,reward_code..."/>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php echo form_close(); ?>
</div>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsStatistic/listGameAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
changePagination('0');
return false;
});
changePagination('0');
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsStatistic/listGameAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsStatistic/listTopAjax'); ?>
<div class="col-lg-3">
<div class="input-group">
<input
class="form-control date-picker"
id="date-picker" name="date-picker" readonly
value="<?php echo date('d-m-Y')?>"
type="text" data-date-format="dd-mm-yyyy">
<span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Tên user,username,address,email,mobile,reward_code..."/>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php echo form_close(); ?>
</div>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsStatistic/listTopAjax"); ?>';
//link
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
maxDate: "<?php echo date('d-m-Y')?>"
}).on('change', function(){
//console.log($('#date-picker').val());
//console.log($('#date-picker').val());
loadDataByAjaxDate(url);
});
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
$('#date-picker').val('<?php echo date("d-m-Y")?>');
changePagination('0');
return false;
});
changePagination('0');
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByDate = $('#date-picker').val();
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByDate: fByDate,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByDate = $('#date-picker').val();
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByDate: fByDate,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
});
}
function loadDataByAjaxDate(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByDate = $('#date-picker').val();
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByDate: fByDate,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByDate: fByDate,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsStatistic/listTopAjax"; ?>';
var fByDate = $('#date-picker').val();
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByDate: fByDate,
fByName: fByName,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script>
\ No newline at end of file
<div class="space-6"></div>
<div class="row" >
<!--<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>-->
<div class="table-wrapper">
<table class="table">
<tbody>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">Tuần</th>
<th style="text-align: center">Từ ngày - Đến ngày</th>
<th style="text-align: center">Điểm cao nhất<br>(của 1 lần đua)</th>
<th style="text-align: center">Thuộc về Người chơi</th>
<th style="text-align: center">Ảnh đại diện</th>
<th style="text-align: center">Mã dự thưởng</th>
<th style="text-align: center">Email</th>
<th style="text-align: center">Số điện thoại</th>
</tr>
</thead>
<tbody>
<?php
$row = 0;
$total_week = ceil($date_limit/7);
for($week=1; $week <= $total_week; $week++):
$row += 1;
$date1 = MyHelper::getDatePlayByDateOrder(($row-1)*7 + 1);
$date7 = MyHelper::getDatePlayByDateOrder(($row-1)*7 + 7);
$data = MyHelper::getTopByWeek($date1, $date7);
?>
<tr>
<td style="text-align: center"><?php echo $week ?></td>
<td style="text-align: center">
<?php echo MyHelper::reFormatDate($date1, 'd/m/Y').' - '.MyHelper::reFormatDate($date7, 'd/m/Y') ?>
</td>
<td style="text-align: right">
<?php echo (count($data) > 0) ? number_format($data['max_point']) : 'Đang cập nhật'?>
</td>
<td style="text-align: left">
<?php echo (count($data) > 0) ? $data['fullname'] : '...'?>
</td>
<td style="text-align: center">
<?php if(count($data) > 0):?>
<?php ($data['avatar'] != '') ? $avatar_path = $data['avatar'] : $avatar_path = 'upload/avatar/user.jpg' ?>
<img src="<?php echo base_url($avatar_path);?>" style="width: 60px; height: 60px">
<?php endif?>
</td>
<td style="text-align: center">
<?php echo (count($data) > 0) ? $data['reward_code'] : '...'?>
</td>
<td style="text-align: left">
<?php echo (count($data) > 0) ? $data['email'] : '...'?>
</td>
<td style="text-align: left">
<?php echo (count($data) > 0) ? $data['mobile'] : '...'?>
</td>
</tr>
<?php endfor; ?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsStatistic/listUserClickAjax'); ?>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Tên user,username,address,email,mobile,reward_code..."/>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php echo form_close(); ?>
</div>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsStatistic/listUserClickAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
changePagination('0');
return false;
});
changePagination('0');
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsStatistic/listUserClickAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsStatistic/listUserAjax'); ?>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Tên user,username,address,email,mobile,reward_code..."/>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php echo form_close(); ?>
</div>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsStatistic/listUserAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
changePagination('0');
return false;
});
changePagination('0');
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
},
error: function (request, status, error) {
//alert(request.responseText);
console.log(request.responseText);
}
});
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsStatistic/listUserAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script>
\ No newline at end of file
......@@ -41,7 +41,9 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div id="div-response"></div>
<div class="col-lg-12">
<div id="div-response"></div>
</div>
</div>
<script type="text/javascript">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment