Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/ecampus.ncriptech.com/application/controllers/admin/lms/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class BooksPublisher extends BaseAdminController { function __construct() { parent::__construct(); $institute_data=check_institute($this->data['userdata']); //print_obj($institute_data); $this->user_type=$this->data['userdata']->user_type; //print_obj($institute_data);die; $this->inst_id=$institute_data['institute_id']; $this->inst_parent_id=$institute_data['inst_parent_id']; $this->inst_code=$institute_data['inst_code']; $this->inst_type=$institute_data['inst_type']; $this->session_upload_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_upload_access']; $this->session_edit_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_edit_access']; $this->session_delete_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_delete_access']; $this->session_course_add_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_add_course']; $this->session_course_edit_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_edit_course']; $this->session_course_delete_access=(in_array($this->user_type, array('institute','institute_branch')))?'yes':$institute_data['session_delete_course']; $this->user_permissions=$institute_data['user_permissions']; $this->load->model('lms/category_model','lmscm'); $this->load->model('lms/publisher_model','lmspm'); $this->load->model('lms/author_model','lmsam'); $this->load->model('lms/rack_model','rm'); } function index($publisher_id=null){ if($this->data['userdata']->user_type=='student' || $this->data['userdata']->user_type=='agent' ){ redirect($this->data['base_url']); } if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Books Publisher'; // print_obj($this->data['userdata']); // die(); $edit_access= check_access_control($this->data['userdata'],'lms_books_publishers','edit'); $add_access= check_access_control($this->data['userdata'],'lms_books_publishers','add'); $view_access=check_access_control($this->data['userdata'],'lms_books_publishers','view'); $view='lms/vw_lms_permission_denied'; if($this->data['userdata']->user_role==1){ $add_access='yes'; $edit_access="yes"; $view_access="yes"; } $this->data['add_access_option']='no'; if($add_access=='yes') { $this->data['add_access_option']=$add_access; } if($view_access==='yes'){ $view='lms/vw_books_publishers'; } if(!empty($publisher_id)){ $publisher_id=decode_data($publisher_id); $this->data['publisher_data']=$this->lmspm->get_book_publisher(array('publisher_id'=>$publisher_id)); if($edit_access=='yes'){ $this->data['edit_access_option']=$edit_access; } else{ $this->data['edit_access_option']='no'; } } $this->theme->title($this->data['page_title'])->load($view, $this->data); }else{ redirect($this->data['base_url']); } } public function onDeleteBooksPublisher(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $publisher_id=post_data('publisher_id'); if(!empty($publisher_id)){ $publisher_id=decode_data($publisher_id); // print($publisher_id); // die(); $publisher_data=$this->lmspm->delete_book_publisher_data(array('publisher_id'=>$publisher_id)); if(!empty($publisher_data)){ if($publisher_data){ $return['success']='publisher has been removed from the system.'; }else{ $return['error']='publisher can not be removed'; } }else{ $return['error']='publisher data not found in the system'; } }else{ $return['error']='No publisher data found'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onAddEditBooksPublisher() { if (session_userdata('isAdminLoggedin') == TRUE && session_userdata('admin_id')) { if ($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD') == 'POST') { if ( $this->session_upload_access == 'yes' ) { $book_publisher_name = post_data('book_publisher_name'); $book_publisher_url = post_data('book_publisher_url'); $book_publisher_established_year = post_data('book_publisher_established_year'); $book_publisher_bio = post_data('book_publisher_bio'); $_bookPublisher = post_data('publisher_id'); $this->form_validation->set_rules('book_publisher_name', 'Publisher name', 'trim|required'); //$this->form_validation->set_rules('book_publisher_url', 'Publisher URL', 'trim|required|valid_url'); $this->form_validation->set_rules('book_publisher_established_year', 'Established Year', 'trim'); if ($this->form_validation->run() == true) { if (empty($_bookPublisher)) { $book_publisher_data = $this->lmspm->get_book_publisher([ 'publisher_inst_id' => $this->inst_id, 'publisher_inst_type' => $this->inst_type, 'publisher_name' => $book_publisher_name, 'publisher_url' => $book_publisher_url ]); if (empty($book_publisher_data)) { $added = $this->lmspm->store_book_publisher_data([ 'publisher_inst_id' => $this->inst_id, 'publisher_inst_type' => $this->inst_type, 'publisher_name' => $book_publisher_name, 'publisher_url' => $book_publisher_url, 'publisher_bio' => $book_publisher_bio, 'publisher_estd_year' => $book_publisher_established_year, 'publisher_status' => 'active', 'publisher_created_by' => $this->data['userdata']->user_id ]); if ($added) { $return['success'] = 'Publisher added successfully'; } else { $return['error'] = 'Publisher not added'; } } else { $return['error'] = 'Publisher name already exists'; } } else { //$_bookPublisher = decode_data($_bookPublisher); //print($_bookPublisher);die(); // Assuming update logic for an existing publisher $updated = $this->lmspm->update_book_publisher_data(array( 'publisher_name' => $book_publisher_name, 'publisher_url' => $book_publisher_url, 'publisher_bio' => $book_publisher_bio, 'publisher_estd_year' => $book_publisher_established_year, 'publisher_status' => 'active' ), array('publisher_id' => $_bookPublisher)); //print_obj($updated); // die(); if ($updated) { $return['success'] = 'Publisher updated successfully'; } else { $return['error'] = 'Publisher not updated'; } } } else { $return['error'] = 'Validation error occurred'; } } else { $return['error'] = 'Permission denied.'; } } else { $return['error'] = 'Action not allowed'; } return json_headers($return); } else { redirect($this->data['base_url']); } } public function onSearchBooksPublisher(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $edit_access= check_access_control($this->data['userdata'],'lms_books_publishers','edit'); $add_access= check_access_control($this->data['userdata'],'lms_books_publishers','add'); $delete_access= check_access_control($this->data['userdata'],'lms_books_publishers','delete'); $param['column_order'] = array( null, 'publisher_name', 'publisher_estd_year', 'publisher_bio' ); $param['column_search'] = array('publisher_name'); $param['order'] = array('publisher_id ' => 'ASC'); $posts=$this->input->post(); $param['created_by']=session_userdata('admin_id'); $list = $this->lmspm->_get_book_publisher_data($posts,$param,FALSE,FALSE); $data = array(); $no = 0; $action=''; foreach ($list as $publisherdata){ $no++; $row = array(); $row[] = $no; $row[] = $publisherdata->publisher_name; $row[] = $publisherdata->publisher_estd_year; $row[] = $publisherdata->publisher_bio; $action='<div class="btn-group btn-group-rounded" role="group" aria-label="Basic example">'; if($delete_access=='yes' && $edit_access=='yes'){ $action.= '<a class="btn btn-xs btn-dark" href="'.$this->data['base_url'].'/lms/books/publishers/'.encode_data($publisherdata->publisher_id).'" ><i class="fa fa-edit"></i></a> <button type="button" class="btn btn-xs btn-danger btn-del-publisher" data-book_publisher_id="'.encode_data($publisherdata->publisher_id ).'"><i class="fa fa-trash"></i></button>'; } else if($edit_access=='yes'){ $action.= ' <a class="btn btn-xs btn-dark" href="'.$this->data['base_url'].'/lms/books/publishers/'.encode_data($publisherdata->publisher_id).'" ><i class="fa fa-edit"></i></a>'; } else if($delete_access=='yes'){ $action.= ' <button type="button" class="btn btn-xs btn-danger btn-del-publisher" data-book_publisher_id="'.encode_data($publisherdata->publisher_id ).'"><i class="fa fa-trash"></i></button>'; } else{ $action.='action not permitted'; } $action.='</div>'; $row[]=$action; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->lmspm->_get_book_publisher_data($posts,$param,TRUE), "recordsFiltered" => $this->lmspm->_get_book_publisher_data($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }