Server IP : 192.185.129.71 / Your IP : 18.118.3.199 Web Server : Apache System : Linux bh-ht-3.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : svymadmin ( 4072) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home4/svymadmin/public_html/vivekaexcel.edu.in/bkp/school/application/controllers/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Librarian extends CI_Controller { function __construct() { parent::__construct(); $this->load->database(); $this->load->library('session'); $this->load->model(array('Ajaxdataload_model' => 'ajaxload')); $this->load->model('Library_model'); /*cache control*/ $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); $this->output->set_header('Pragma: no-cache'); } public function index() { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if ($this->session->userdata('librarian_login') == 1) redirect(site_url('librarian/dashboard'), 'refresh'); } // LIBRARIAN DASHBOARD function dashboard() { if ($this->session->userdata('librarian_login') != 1) redirect(base_url(), 'refresh'); $page_data['page_name'] = 'dashboard'; $page_data['page_title'] = get_phrase('librarian_dashboard'); $this->load->view('backend/index', $page_data); } // MANAGE OWN PROFILE AND CHANGE PASSWORD function manage_profile($param1 = '', $param2 = '', $param3 = '') { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if ($param1 == 'update_profile_info') { $data['name'] = $this->input->post('name'); $data['email'] = $this->input->post('email'); $validation = email_validation_for_edit($data['email'], $this->session->userdata('librarian_id'), 'librarian'); if($validation == 1){ $this->db->where('librarian_id', $this->session->userdata('librarian_id')); $this->db->update('librarian', $data); $this->session->set_flashdata('flash_message', get_phrase('account_updated')); } else{ $this->session->set_flashdata('error_message', get_phrase('this_email_id_is_not_available')); } redirect(site_url('librarian/manage_profile'), 'refresh'); } if ($param1 == 'change_password') { $data['password'] = sha1($this->input->post('password')); $data['new_password'] = sha1($this->input->post('new_password')); $data['confirm_new_password'] = sha1($this->input->post('confirm_new_password')); $current_password = $this->db->get_where('librarian', array( 'librarian_id' => $this->session->userdata('librarian_id') ))->row()->password; if ($current_password == $data['password'] && $data['new_password'] == $data['confirm_new_password']) { $this->db->where('librarian_id', $this->session->userdata('librarian_id')); $this->db->update('librarian', array( 'password' => $data['new_password'] )); $this->session->set_flashdata('flash_message', get_phrase('password_updated')); } else { $this->session->set_flashdata('flash_message', get_phrase('password_mismatch')); } redirect(site_url('librarian/manage_profile'), 'refresh'); } $page_data['page_name'] = 'manage_profile'; $page_data['page_title'] = get_phrase('manage_profile'); $page_data['edit_data'] = $this->db->get_where('librarian', array( 'librarian_id' => $this->session->userdata('librarian_id') ))->result_array(); $this->load->view('backend/index', $page_data); } /**********MANAGE LIBRARY / BOOKS********************/ function book($param1 = '', $param2 = '', $param3 = '') { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if ($param1 == 'create') { for($i=0;$i<$this->input->post('number_of_copies');$i++){ //$data['title'] = implode(' ', str_word_count(strval($this->input->post('title')),1)); $data['title'] = $this->input->post('title'); $data['published_by'] = $this->input->post('published_by'); $data['description'] = $this->input->post('description'); $data['per_unit_price'] = $this->input->post('per_unit_price'); $data['author'] = $this->input->post('author'); $data['category_name'] = $this->input->post('category_name'); $data['material_name'] = $this->input->post('material_name'); $data['isbn'] = $this->input->post('isbn'); $data['number_of_page'] = $this->input->post('number_of_page'); $accession_number = $this->input->post('accession_number')[$i]; $data['accession_number'] = $accession_number; $data['call_number'] = $this->input->post('call_number'); $data['language'] = $this->input->post('language'); $data['subject'] = $this->input->post('subject'); $data['location'] = $this->input->post('location'); $data['rack_number'] = $this->input->post('rack_number'); $data['shelves_number'] = $this->input->post('shelves_number'); $data['publisher_name'] = $this->input->post("publisher_name"); $data['publication_place'] = $this->input->post("publication_place"); $data['publication_year'] = $this->input->post("publication_year"); $data['total_copies'] = '1'; $data['remaining_book'] = '1'; $id=$this->Library_model->insert("book",$data); if(!empty($_FILES["file_name"]["name"])) { $target_file = "uploads/books/" . basename($_FILES["file_name"]["name"]); $FileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); $file_name=$id.".".$FileType; move_uploaded_file($_FILES["file_name"]["tmp_name"], "uploads/books/" . $file_name ); $this->Library_model->update("book",array("file_name" => $file_name),array("book_id" => $id )); } // $this->Library_model->update_book_quantity('1',$id); } $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/book/view'), 'refresh'); } if ($param1 == 'edit') { $data['title'] = implode(' ', str_word_count($this->input->post('title'),1)); $data['published_by'] = $this->input->post('published_by'); $data['description'] = $this->input->post('description'); $data['per_unit_price'] = $this->input->post('per_unit_price'); $data['author'] = $this->input->post('author'); $data['category_name'] = $this->input->post('category_name'); $data['material_name'] = $this->input->post('material_name'); $data['isbn'] = $this->input->post('isbn'); $data['number_of_page'] = $this->input->post('number_of_page'); $data['accession_number'] = $this->input->post('accession_number'); $data['call_number'] = $this->input->post('call_number'); $data['language'] = $this->input->post('language'); $data['subject'] = $this->input->post('subject'); $data['location'] = $this->input->post('location'); $data['rack_number'] = $this->input->post('rack_number'); $data['shelves_number'] = $this->input->post('shelves_number'); $data['publisher_name'] = $this->input->post("publisher_name"); $data['publication_place'] = $this->input->post("publication_place"); $data['publication_year'] = $this->input->post("publication_year"); $id=$this->Library_model->update("book",$data,array("book_id" => $param2 )); // if(!empty($_FILES["file_name"]["name"])) { // move_uploaded_file($_FILES["file_name"]["tmp_name"], "uploads/document/" . $_FILES["file_name"]["name"]); // } $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/book/view'), 'refresh'); } if ($param1 == 'delete') { $this->db->where('book_id', $param2); $this->db->delete('book'); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted')); redirect(site_url('librarian/book/view'), 'refresh'); } if($param1 == 'view'){ $page_data["books"] = $this->Library_model->get_book(); $page_data['page_name'] = 'book'; $page_data['page_title'] = get_phrase('manage_library_books'); $this->load->view('backend/index', $page_data); } } function category($param1="",$param2="") { if($param1=="create"){ $data= array( "category_name" => $this->input->post("category_name") ); $id=$this->Library_model->insert("category",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/category/view'), 'refresh'); } if($param1=="edit"){ $data= array( "category_name" => $this->input->post("category_name") ); $id=$this->Library_model->update("category",$data,array("category_id" => $param2)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/category/view'), 'refresh'); } if($param1=="delete"){ $id=$this->Library_model->delete("category","category_id",$param2); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted_successfully')); redirect(site_url('librarian/category/view'), 'refresh'); } $page_data["category"] =$this->Library_model->get("category"); $page_data['page_name'] = 'category'; $page_data['page_title'] =get_phrase('manage_category'); $this->load->view('backend/index', $page_data); } function source($param1="",$param2="") { if($param1=="create"){ $data= array( "source_name" => $this->input->post("source_name") ); $id=$this->Library_model->insert("source",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/source/view'), 'refresh'); } if($param1=="edit"){ $data= array( "source_name" => $this->input->post("source_name") ); $id=$this->Library_model->update("source",$data,array("source_id" => $param2)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/source/view'), 'refresh'); } if($param1=="delete"){ $id=$this->Library_model->delete("source","category_id",$param2); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted_successfully')); redirect(site_url('librarian/source/view'), 'refresh'); } $page_data["source"] =$this->Library_model->get("source"); $page_data['page_name'] = 'source'; $page_data['page_title'] =get_phrase('manage_source'); $this->load->view('backend/index', $page_data); } function material($param1="",$param2="") { if($param1=="create"){ $data= array( "material_name" => $this->input->post("material_name") ); $id=$this->Library_model->insert("material",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/material/view'), 'refresh'); } if($param1=="edit"){ $data= array( "material_name" => $this->input->post("material_name") ); $id=$this->Library_model->update("material",$data,array("material_id" => $param2)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/material/view'), 'refresh'); } if($param1=="delete"){ $id=$this->Library_model->delete("material","material_id",$param2); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted_successfully')); redirect(site_url('librarian/material/view'), 'refresh'); } $page_data["material"] =$this->Library_model->get("material"); $page_data['page_name'] = 'material'; $page_data['page_title'] =get_phrase('manage_material'); $this->load->view('backend/index', $page_data); } function publisher($param1 = '',$id="") { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1=="create"){ $data= array( "publisher_name" => $this->input->post("publisher_name"), "publisher_details" => $this->input->post("publisher_details") ); $id=$this->Library_model->insert("publisher",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/publisher/view'), 'refresh'); } if($param1=="edit"){ $data= array( "publisher_name" => $this->input->post("publisher_name"), "publisher_details" => $this->input->post("publisher_details") ); $id=$this->Library_model->update("publisher",$data,array("publisher_id" => $id)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/publisher/view'), 'refresh'); } if($param1=="delete"){ $id=$this->Library_model->delete("publisher","publisher_id",$id); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted_successfully')); redirect(site_url('librarian/publisher/view'), 'refresh'); } if($param1=="view"){ $page_data["publisher"] =$this->Library_model->get("publisher"); $page_data['page_name'] = 'publisher'; $page_data['page_title'] =get_phrase('manage_publisher'); $this->load->view('backend/index', $page_data); } } function library_stock_register($param1="",$id){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1=="create"){ //$this->Library_model->update_book_quantity($this->input->post("total_quantity"),$this->input->post("book_id")); $data= array( "supplier_name" => $this->input->post("supplier_name"), "supplier_details" => $this->input->post("supplier_details"), "total_quantity" => $this->input->post("total_quantity"), "total_price" => $this->input->post("total_price"), "invoice_details" => $this->input->post("invoice_details"), "receive_date" => $this->input->post("receive_date"), "book_id" => $this->input->post("book_id") ); $id=$this->Library_model->insert("library_stock_register",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/library_stock_register/view'), 'refresh'); } if($param1=="edit"){ $data=$this->Library_model->get_where("library_stock_register",array("id" => $id)); if($data != NULL){ // $temp_quantity=$data[0]['total_quantity'] - $this->input->post("quantity"); // $this->Library_model->update_book_register($temp_quantity,$this->input->post("book_id")); $data= array( "supplier_name" => $this->input->post("supplier_name"), "supplier_details" => $this->input->post("supplier_details"), "total_quantity" => $this->input->post("quantity"), "total_price" => $this->input->post("total_price"), "invoice_details" => $this->input->post("invoice_details"), "receive_date" => $this->input->post("receive_date"), ); $this->Library_model->update("library_stock_register",$data,array("id" => $id)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/library_stock_register/view'), 'refresh'); } } if($param1=="view"){ $page_data["library_stock_register"] = $this->Library_model->get_libraryStockRegister(); $page_data['page_name'] = 'library_stock_register'; $page_data['page_title'] =get_phrase('manage_library_stock_register'); $this->load->view('backend/index', $page_data); } } function library_settings($param1=""){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1=="edit"){ $data= array( "number_of_book" => $this->input->post("number_of_book"), "per_day_cost" => $this->input->post("per_day_cost"), "maximum_date" => $this->input->post("maximum_date") ); $this->Library_model->update("library_settings",$data,array("user_type" => $this->input->post("user_type"))); $this->session->set_flashdata('flash_message' , get_phrase('setting_updated_successfully')); redirect(site_url('librarian/library_settings/view'), 'refresh'); } if($param1="view"){ $page_data["library_settings"] = $this->Library_model->get("library_settings"); $page_data['page_name'] = 'library_settings'; $page_data['page_title'] =get_phrase('library_settings'); $this->load->view('backend/index', $page_data); } } function library_book_requests($param1=""){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1="view"){ $page_data["library_settings"] = $this->Library_model->get("library_settings"); $page_data['page_name'] = 'library_book_requests'; $page_data['page_title'] =get_phrase('library_book_requests'); $page_data["book_request"]= $this->Library_model->get_book_requested($user_type,$user_id); $this->load->view('backend/index', $page_data); } } function get_books() { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); $columns = array( 0 => 'book_id', 1 => 'name', 2 => 'author', 3 => 'description', 4 => 'price', 5 => 'class', 6 => 'download', 7 => 'options', 8 => 'book_id' ); $limit = $this->input->post('length'); $start = $this->input->post('start'); $order = $columns[$this->input->post('order')[0]['column']]; $dir = $this->input->post('order')[0]['dir']; $totalData = $this->ajaxload->all_books_count(); $totalFiltered = $totalData; if(empty($this->input->post('search')['value'])) { $books = $this->ajaxload->all_books($limit,$start,$order,$dir); } else { $search = $this->input->post('search')['value']; $books = $this->ajaxload->book_search($limit,$start,$search,$order,$dir); $totalFiltered = $this->ajaxload->book_search_count($search); } $data = array(); if(!empty($books)) { foreach ($books as $row) { if ($row->file_name == null) $download = ''; else $download = '<a href="'.site_url("uploads/document/$row->file_name").'" class="btn btn-blue btn-icon icon-left"><i class="entypo-download"></i>'.get_phrase('download').'</a>'; $options = '<div class="btn-group"><button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Action <span class="caret"></span></button><ul class="dropdown-menu dropdown-default pull-right" role="menu"><li><a href="#" onclick="book_edit_modal('.$row->book_id.')"><i class="entypo-pencil"></i> '.get_phrase('edit').'</a></li><li class="divider"></li><li><a href="#" onclick="book_delete_confirm('.$row->book_id.')"><i class="entypo-trash"></i> '.get_phrase('delete').'</a></li></ul></div>'; $nestedData['book_id'] = $row->book_id; $nestedData['name'] = $row->name; $nestedData['author'] = $row->author; $nestedData['description'] = $row->description; $nestedData['price'] = $row->price; $nestedData['class'] = $this->db->get_where('class', array('class_id' => $row->class_id))->row()->name; $nestedData['download'] = $download; $nestedData['options'] = $options; $data[] = $nestedData; } } $json_data = array( "draw" => intval($this->input->post('draw')), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data ); echo json_encode($json_data); } function library_register($param1="",$param2="",$param3=" ",$book_id=""){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1=="user"){ if($param2==""){ $user_type=$this->input->post("user_type"); $user_id=$this->input->post("user_id"); $student_id =$this->input->post("student_id"); }else{ $user_type=$param2; $user_id=$param3; $student_id =$param3; } if($user_type == 'student'){ $user_id=$student_id; //$page_data["issued_books"]=$this->Library_model->get_issued_book($user_type,$student_id); $page_data["issued_books"]=$this->Library_model->issued_book_get($user_type,$user_id); }else{ //$page_data["issued_books"]=$this->Library_model->get_issued_book($user_type,$user_id); $page_data["issued_books"]=$this->Library_model->issued_book_get($user_type,$user_id); } // $page_data['user_type']=$user_type; // $page_data['user_id']=$user_id; // $page_data["books"]=$this->Library_model->get_book_for_issue($user_type,$user_id); // $page_data["fine_table"]= $this->Library_model->get_fine_details($user_type,$user_id); // $page_data["book_requests"]= $this->Library_model->get_requested_book($user_type,$user_id); // $page_data["library_settings"]=$this->Library_model->get_where("library_settings",array("user_type" => $user_type )); $page_data['user_type']=$user_type; $page_data['user_id']=$user_id; $page_data["books"]=$this->Library_model->book_for_issue_get($user_type,$user_id); $page_data["fine_table"]= $this->Library_model->fine_details_get($user_type,$user_id); $page_data["book_requests"]= $this->Library_model->requested_book_get($user_type,$user_id); $page_data["library_settings"]=$this->Library_model->get_where("library_settings",array("user_type" => $user_type )); $name=$this->db->get_where($user_type,array($user_type."_id" => $user_id))->row()->name; $page_data['page_name'] = 'library_user_page'; $page_data['page_title'] =get_phrase('library_register-'.$name); $this->load->view('backend/index', $page_data); } if($param1=="barcode"){ if($param2==""){ $user_type=$this->input->post("user_type"); $user_details= $this->db->get_where($user_type,array($user_type.'_code'=> $this->input->post("user_code")))->result_array(); // echo $this->input->post("user_code"); // echo $user_type; // print_r($user_details);exit(); if($user_details!=NULL){ $user_id=$user_details[0][$user_type.'_id']; } // $student_id =$this->input->post("student_id"); }else{ $user_type=$param2; $user_id=$param3; $student_id =$param3; } if($user_type == 'student'){ //$user_id=$student_id; //$page_data["issued_books"]=$this->Library_model->get_issued_book($user_type,$user_id); $page_data["issued_books"]=$this->Library_model->issued_book_get($user_type,$user_id); }else{ //$page_data["issued_books"]=$this->Library_model->get_issued_book($user_type,$user_id); $page_data["issued_books"]=$this->Library_model->issued_book_get($user_type,$user_id); } $page_data['user_type']=$user_type; $page_data['user_id']=$user_id; $page_data["books"]=$this->Library_model->book_for_issue_get($user_type,$user_id); $page_data["fine_table"]= $this->Library_model->fine_details_get($user_type,$user_id); $page_data["book_requests"]= $this->Library_model->requested_book_get($user_type,$user_id); $page_data["library_settings"]=$this->Library_model->get_where("library_settings",array("user_type" => $user_type )); // $page_data['user_type']=$user_type; // $page_data['user_id']=$user_id; // $page_data["books"]=$this->Library_model->get_book_for_issue($user_type,$user_id); // $page_data["fine_table"]= $this->Library_model->get_fine_details($user_type,$user_id); // $page_data["book_requests"]= $this->Library_model->get_requested_book($user_type,$user_id); // $page_data["library_settings"]=$this->Library_model->get_where("library_settings",array("user_type" => $user_type )); $name=$this->db->get_where($user_type,array($user_type."_id" => $user_id))->row()->name; $page_data['page_name'] = 'library_user_page'; $page_data['page_title'] =get_phrase('library_register-'.$name); $this->load->view('backend/index', $page_data); } if($param1=="issue_book"){ $data =array( 'user_id' => $param3, 'user_type' => $param2, 'book_id' =>$book_id, 'status' => "issued", 'register_date' => date("Y-m-d") ); $this->Library_model->insert("library_register",$data); $this->Library_model->book_update($book_id); $this->session->set_flashdata('flash_message' , get_phrase('book_has_been_issued_successfully')); redirect(site_url('librarian/library_register/user/'.$param2.'/'.$param3), 'refresh'); } if($param1=="return_book"){ $this->Library_model->return_book($param2,$param3,$book_id); $this->session->set_flashdata('flash_message' , get_phrase('book_has_been_returned_successfully')); redirect(site_url('librarian/library_register/user/'.$param2.'/'.$param3), 'refresh'); } if($param1=="view"){ $page_data['page_name'] = 'library_register'; $page_data['page_title'] =get_phrase('library_register'); $this->load->view('backend/index', $page_data); } } function get_other_lib_user($type){ $data=$this->Library_model->get($type); echo "<option value=''>select user</option>"; foreach($data as $row){ $temp=$type.'_id'; echo "<option value='".$row[$temp]."'>".$row['name']."</option>"; } } function get_lib_section($class_id){ $sections =$this->Library_model->get_where('section' , array('class_id' => $class_id)); foreach($sections as $row){ echo "<option value='".$row['section_id']."'>".$row['name']."</option>"; } } function get_lib_student($class_id,$section_id){ $students = $this->Library_model->get_where('enroll' , array( 'class_id' => $class_id ,'section_id' => $section_id, 'year' => $this->db->get_where('settings' , array('type' => 'running_year'))->row()->description )); foreach ($students as $row) { $student = $this->Library_model->get_where('student' , array('student_id' => $row['student_id'])); foreach ($student as $row1) { echo '<option value="'.$row1['student_id'].'">'.$row1['name'].'['.$row1['student_code'].']</option>'; } } } function generate_bulk_book_csv() { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); $file = fopen("uploads/bulk_book.csv", "w"); $line = array('book Title','Author name','category_name','material_name','book price','ISBN','number_of_page','accession_number','call_number','location','rack_number','shelves_number','publisher_name','publication_place','publication_year'); fputcsv($file, $line, ','); echo $file_path = base_url() .'uploads/bulk_book.csv'; } function bulk_book_add_using_csv($param1 = '') { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if ($param1 == 'import') { move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/bulk_book.csv'); $csv = array_map('str_getcsv', file('uploads/bulk_book.csv')); $count = 1; $array_size = sizeof($csv); foreach ($csv as $row) { if ($count == 1) { $count++; continue; } $data['title'] = $row[0]; $data['author'] = $row[1]; $data['category_name'] = $row[2]; $data['material_name'] = $row[3]; $data['per_unit_price'] = $row[4]; $data['isbn'] = $row[5]; $data['number_of_page'] = $row[6]; $data['accession_number'] = $row[7]; $data['call_number'] = $row[8]; $data['location'] = $row[9]; $data['rack_number'] = $row[10]; $data['shelves_number'] = $row[11]; $data['publisher_name'] = $row[12]; $data['publication_place'] = $row[13]; $data['publication_year'] = $row[14]; $data['total_copies'] = '1'; $data['remaining_book'] = '1'; $this->Library_model->insert('book', $data); } $this->session->set_flashdata('flash_message', get_phrase('book_imported')); redirect(site_url('librarian/book/view'), 'refresh'); } } function generate_bulk_publisher_csv() { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); $file = fopen("uploads/bulk_publisher.csv", "w"); $line = array('publisher_name','publisher_details'); fputcsv($file, $line, ','); echo $file_path = base_url() . 'uploads/bulk_publisher.csv'; } function bulk_publisher_add_using_csv($param1 = '') { if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if ($param1 == 'import') { move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/bulk_publisher.csv'); $csv = array_map('str_getcsv', file('uploads/bulk_publisher.csv')); $count = 1; $array_size = sizeof($csv); foreach ($csv as $row) { if ($count == 1) { $count++; continue; } $data['publisher_name'] = $row[0]; $data['publisher_details'] = $row[1]; $this->Library_model->insert('publisher', $data); } $this->session->set_flashdata('flash_message', get_phrase('publishers_imported')); redirect(site_url('librarian/publisher/view'), 'refresh'); } } function other_staff($param1 = '',$id=""){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1=="create"){ $data= array( 'name' =>$this->input->post("staff_name"), 'phonenumber' =>$this->input->post("phonenumber"), 'address' =>$this->input->post("address"), 'designation' =>$this->input->post("designation") ); $id=$this->Library_model->insert("other_staff",$data); $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully')); redirect(site_url('librarian/other_staff/view'), 'refresh'); } if($param1=="edit"){ $data= array( 'staff_name' =>$this->input->post("staff_name"), 'phonenumber' =>$this->input->post("phonenumber"), 'address' =>$this->input->post("address"), 'designation' =>$this->input->post("designation") ); $this->Library_model->update("other_staff",$data,array("other_staff_id" => $id)); $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully')); redirect(site_url('librarian/other_staff/view'), 'refresh'); } if($param1=="delete"){ $this->Library_model->delete("other_staff","other_staff_id",$id); $this->session->set_flashdata('flash_message' , get_phrase('data_deleted')); redirect(site_url('librarian/other_staff/view'), 'refresh'); } if($param1=="view"){ $page_data['other_staff'] = $this->Library_model->get("other_staff"); $page_data['page_name'] = 'other_staff'; $page_data['page_title'] =get_phrase('visitor'); $this->load->view('backend/index', $page_data); } } //===========================================Report===========================================// /* Fine Amount of Student*/ function fine_amount($param1 = "",$param2 = ""){ if ($this->session->userdata('librarian_login') != 1) redirect(site_url('login'), 'refresh'); if($param1 == "monthly_report") { $month = $this->input->post('month'); $year = $this->input->post('year'); $pagedata['monthly_report'] = $this->Library_model->monthly_report($year,$month); echo $this->load->view('backend/librarian/monthly_report_fine_amount_page',$pagedata,true); } if($param1 == "view"){ $page_data['total_fine_amount'] = $this->Library_model->total_fine_amount(); $page_data['page_name'] = 'fine_amount'; $page_data['page_title'] =get_phrase('fine_amount_report'); $this->load->view('backend/index',$page_data); } } /* Monthly Book Issued Details */ function monthly_book_issued($param1 = "",$param2 = "") { if($param1 == "view"){ $page_data['total_book_issued'] = $this->Library_model->total_book_issued(); $page_data['page_name'] = 'monthly_book_issued'; $page_data['page_title'] =get_phrase('monthly_issued_book_report'); $this->load->view('backend/index',$page_data); } } }