| Server IP : 103.48.194.25 / Your IP : 216.73.216.44 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hocthongminh.net-bk/public_html/webadmin/components/robot/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class cauhinh extends MX_Controller
{
public $_module_name = "";
function __construct()
{
parent::__construct();
$this->_module_name = $this->router->fetch_module();
//$this->session->set_userdata(array('Url'=>uri_string()));
$this->permit_library->check_permit(1);
$this->session->set_userdata(array('Url'=>uri_string()));
$this->lang->load('auto');
$this->load->model('cauhinh_model','cauhinh');
$this->pre_message = "" ;
}
function index($start=0)
{
$data['add'] = $this->_module_name.'/cauhinh/add';
$data['title'] = "Cấu hình";
$config['total_rows'] = $this->cauhinh->get_num_cauhinh();
$data['num'] = $config['total_rows'];
$config['per_page'] = 20;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$data['list'] = $this->cauhinh->get_all_cauhinh($config['per_page'],$start);
$data['start']= $start;
$data["page"] = 'cauhinh/index';
$this->load->view("layout/skin",$data);
}
function add()
{
//$this->acl->check('add','','',site);
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('robo_name',lang('code'),'trim|required');
$this->form_validation->set_rules('robot_url',lang('robot_url'),'trim|required');
$this->form_validation->set_rules('rule_list',lang('rule_list'),'trim|required');
$this->form_validation->set_rules('rule_detail',lang('rule_list'),'trim|required');
$this->form_validation->set_rules('dateformat',lang('dateformat'),'trim|required');
if($this->form_validation->run()== FALSE)
{
$this->pre_message = validation_errors();
}
else
{
$req = $this-> build_data(1);
if($this->cauhinh->save_cauhinh($req))
{
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'/cauhinh');
}
}
}
$data['title'] = lang('add_news');
$data['message'] = $this->pre_message;
$data['list_cat']= $this->cauhinh->get_cat();
$data['list_trade']= $this->cauhinh->get_trade();
$data['list_modern']= $this->cauhinh->get_modern();
$data["page"] = 'cauhinh/add';
$this->load->view("layout/skin",$data);
}
function edit($id,$start=0)
{
$data['list_cat']= $this->cauhinh->get_cat();
$data['list_trade']= $this->cauhinh->get_trade();
$data['list_modern']= $this->cauhinh->get_modern();
$data['rs'] = $this->cauhinh->get_id($id);
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('robo_name',lang('code'),'trim|required');
$this->form_validation->set_rules('robot_url',lang('robot_url'),'trim|required');
$this->form_validation->set_rules('rule_list',lang('rule_list'),'trim|required');
$this->form_validation->set_rules('rule_detail',lang('rule_list'),'trim|required');
$this->form_validation->set_rules('dateformat',lang('dateformat'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$req = $this->build_data();
if($this->cauhinh->save_cauhinh($req,$id)){
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'/cauhinh/index/'.$start);
}
}
}
$data['title'] = "Cập nhật ".$data['rs']->robo_name;
$data["page"] = 'cauhinh/edit';
$this->load->view("layout/skin",$data);
}
function build_data($flag=1)
{
$req["catid"] = (int) $this->input->post("catid");
$req["trade_id"] = (int) $this->input->post("trade_id");
$req["modern_id"] = (int) $this->input->post("modern_id");
$req["robo_name"] = $this->input->post("robo_name");
$req["robot_url"] = $this->input->post("robot_url");
$req["rule_list"] = $this->input->post("rule_list");
$req["rule_detail"] = $this->input->post("rule_detail");
$req["field_name"] = $this->input->post("field_name");
$req["dateformat"] = $this->input->post("dateformat");
$req["bl_active"] = (int) $this->input->post("bl_active");
if($flag) $req["dt_create"]= date("Y-m-d H:i:s");
return $req;
}
function del($id,$start=0)
{
$this->acl->check('del','','',site);
if($this->cauhinh->del_cauhinh($id))
$this->session->set_flashdata('message',lang('admin.delete_successful'));
else
$this->session->set_flashdata('message',lang('admin.delete_unsuccessful'));
redirect($this->_module_name.'/cauhinh/index/'.$start);
}
function dels()
{
$this->acl->check('dels','','',site);
if(!empty($_POST['ar_id']))
{
$start = (int)$this->input->post('start');
$ar_id = $this->input->post('ar_id');
if(!empty($_POST['btn_submit']))
{
for($i = 0; $i < sizeof($ar_id); $i ++) {
if ($ar_id[$i]){
if($this->cauhinh->del_cauhinh($ar_id[$i]))
$this->session->set_flashdata('message',lang('admin.delete_successful'));
else
$this->session->set_flashdata('message',lang('admin.delete_unsuccessful'));
}
}
}
}
redirect($this->_module_name.'/cauhinh/index/'.$start);
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */