芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/breadwinnerv2/application/controllers/Clientgroup.php
load->model('clientgroup_model', 'clientgroup'); $this->load->model('customers_model', 'customers'); $this->load->library("Aauth"); if (!$this->aauth->is_loggedin()) { redirect('/user/', 'refresh'); } if ($this->aauth->get_user()->roleid < 3) { exit('
Sorry! You have insufficient permissions to access this section
'); } } //groups public function index() { $data['group'] = $this->customers->group_list(); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Client Groups'; $this->load->view('fixed/header', $head); $this->load->view('groups/groups', $data); $this->load->view('fixed/footer'); } //view public function groupview() { $head['usernm'] = $this->aauth->get_user()->username; $id = $this->input->get('id'); $data['group'] = $this->clientgroup->details($id); $head['title'] = 'Group View'; $this->load->view('fixed/header', $head); $this->load->view('groups/groupview', $data); $this->load->view('fixed/footer'); } //datatable public function grouplist() { $base = base_url() . 'customers/'; $id = $this->input->get('id',true); $list = $this->customers->get_datatables($id); $data = array(); $no = $this->input->post('start',true); foreach ($list as $customers) { $no++; $row = array(); $row[] = $no; $row[] = '
' . $customers->name . '
'; $row[] = $customers->address . ',' . $customers->city . ',' . $customers->country; $row[] = $customers->email; $row[] = $customers->phone; $row[] = '
'.$this->lang->line('Edit').'
'; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->customers->count_all($id), "recordsFiltered" => $this->customers->count_filtered($id), "data" => $data, ); //output to json format echo json_encode($output); } public function create() { $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Create Group'; $this->load->view('fixed/header', $head); $this->load->view('groups/add'); $this->load->view('fixed/footer'); } public function add() { $group_name = $this->input->post('group_name',true); $group_desc = $this->input->post('group_desc',true); if ($group_name) { $this->clientgroup->add($group_name, $group_desc); } } public function editgroup() { $gid = $this->input->get('id',true); $this->db->select('*'); $this->db->from('customers_group'); $this->db->where('id', $gid); $query = $this->db->get(); $data['group'] = $query->row_array(); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Edit Group'; $this->load->view('fixed/header', $head); $this->load->view('groups/groupedit', $data); $this->load->view('fixed/footer'); } public function editgroupupdate() { $gid = $this->input->post('gid',true); $group_name = $this->input->post('group_name',true); $group_desc = $this->input->post('group_desc',true); if ($gid) { $this->clientgroup->editgroupupdate($gid, $group_name, $group_desc); } } public function delete_i() { $id = $this->input->post('deleteid',true); if ($id != 1) { $this->db->delete('customers_group', array('id' => $id)); $this->db->set(array('gid' => 1)); $this->db->where('gid', $id); $this->db->update('customers'); echo json_encode(array('status' => 'Success', 'message' => $this->lang->line('DELETED'))); } else if ($id == 1) { echo json_encode(array('status' => 'Error', 'message' => 'You can not delete the default group!')); } else { echo json_encode(array('status' => 'Error', 'message' => $this->lang->line('ERROR'))); } } function sendGroup() { $id = $this->input->post('gid'); $subject = $this->input->post('subject'); $message = $this->input->post('text'); $attachmenttrue = false; $attachment = ''; $recipients = $this->clientgroup->recipients($id); $this->load->model('communication_model'); $this->communication_model->group_email($recipients, $subject, $message, $attachmenttrue, $attachment); } }