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/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class Certificates extends BaseAdminController { function __construct() { parent::__construct(); } public function indexIDCards(){ if($this->data[userdata]->user_type=='student'){ redirect($this->data['base_url']); } if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='ID Cards'; // $input_file=FCPATH.'uploads/app/samples/id-card-template-1.xlsx'; // // echo $input_file;die; // $output_file=FCPATH.'uploads/temp_files/'; // write_excel_to_pdf($input_file,$output_file); $this->theme->title($this->data['page_title'])->load('master/vw_id_cards', $this->data); }else{ redirect($this->data['base_url']); } } public function indexIDCardsTemplates(){ // print_obj($this->data['userdata']); if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='ID Cards'; $this->theme->title($this->data['page_title'])->load('master/vw_id_cards_templates', $this->data); }else{ redirect($this->data['base_url']); } } public function indexIDCardsGenerate(){ // print_obj($this->data['userdata']->user_type); if($this->data['userdata']->user_type=='student' || $this->data['userdata']->user_type=='agent' ) { redirect($this->data['base_url']); } // die(); if(session_userdata('isAdminLoggedin')){ $institute_data=check_institute($this->data['userdata']); $inst_id=$institute_data['institute_id']; $inst_type=$institute_data['inst_type']; $this->data['page_title']='ID Cards'; $icard_templates=$this->sm->get_cards_template_data(array('template_inst'=>$inst_id,'template_inst_type'=>$inst_type),FALSE); if(!empty($icard_templates)){ foreach ($icard_templates as $key => $value) { $template_data[]=array( 'template_id'=>$value->template_id, 'template_value'=>$this->theme->view('_pages/master/templates/'.$value->template_value,array('institute_data'=>$institute_data),TRUE) ); } } //print_obj($institute_data);die; $this->data['templates']=$template_data; $this->data['icrd_templates']=$icard_templates; $this->data['sessions']=$this->sessm->get_session(array('session_inst_id'=>$inst_id,'session_status'=>'active'),FALSE); $this->theme->title($this->data['page_title'])->load('master/vw_id_cards_generate', $this->data); }else{ redirect($this->data['base_url']); } } public function onSearchStudentsList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $institute_data=check_institute($this->data['userdata']); $inst_id=$institute_data['inst_id']; $inst_type=$institute_data['inst_type']; $param['column_order'] = array( null, 'stu_first_name' ); $param['column_search'] = array('stu_first_name','stu_mid_name','stu_last_name'); $param['is_removed']='no'; $param['order'] = array('stu_id' => 'ASC'); $posts=$this->input->post(); if($posts['data_of']==='own'){ $param['inst_id']=$this->data['userdata']->user_id; }else if($posts['data_of']==='branch'){ $param['inst_parent_id']=$this->data['userdata']->user_id; } if(isset($posts['data_of_id']) && !empty($posts['data_of_id'])){ $param['inst_id']=$posts['data_of_id']; } if(isset($posts['stu_status']) && !empty($posts['stu_status'])){ $param['stu_status']=$posts['stu_status']; } //$param['created_by']=session_userdata('admin_id'); $list = $this->um->_get_students($posts,$param,FALSE,FALSE);; //print_obj($list);die; // $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; //print_obj($list);die; foreach ($list as $stu){ $no++; $row = array(); $row[] = $no; if($stu->stu_mid_name!=''){ $stu_name=$stu->stu_first_name.' '.$stu->stu_mid_name.' '.$stu->stu_last_name; }else{ $stu_name=$stu->stu_first_name.' '.$stu->stu_last_name; } $stu_image=$this->sm->get_file(array('storage_type'=>'student_profile_photo','storage_type_id'=>$stu->stu_user_id,'storage_parent_id'=>$stu->stu_inst_id)); if(!empty($stu_image) && is_file(FCPATH.$stu_image->media_disk_path)){ $image=base_url($stu_image->media_disk_path); $action='<input type="checkbox" class="single-checkbox" name="student_ids[]" value="'.$stu->stu_user_id.'">'; }else{ $image=$this->data['no_image']; $action=''; } //$image=base_url($stu_image->media_disk_path); $action='<input type="checkbox" class="single-checkbox" name="student_ids[]" value="'.$stu->stu_user_id.'">'; $row[] = $stu->stu_user_code.'<br>'.$stu_name.'<br>'.$stu->stu_user_id.$image_found; $row[] = '<img class="img-thumbnail" src="'.$image.'" height="30px;" width="30px;">'; $row[] = $action; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->adm->_get_admissions_data($posts,$param,TRUE), "recordsFiltered" => $this->adm->_get_admissions_data($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onGenerateIDCard(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $institute_data=check_institute($this->data['userdata']); $inst_id=$institute_data['institute_id']; $inst_type=$institute_data['inst_type']; $inst_name=$institute_data['inst_name']; $inst_email=$institute_data['inst_email']; $inst_ph=$institute_data['inst_phno']; $inst_address=$institute_data['inst_address']; $inst_logo=$institute_data['inst_logo_url']; $inst_signature_logo=$institute_data['inst_signature_logo_url']; $template_id=post_data('template_id'); $valid_upto_date=post_data('valid_upto_date'); $student_ids=$this->input->post('student_ids'); $session=post_data('session'); $course=post_data('course'); $template='basic';//post_data('template_id'); $_data_to_print=array(); $data_to_print=array(); $college_imgprincipal_sign_data=$this->sm->get_file(array('storage_type'=>'principal_signature','storage_type_id'=>$inst_id)); if(!empty($college_imgprincipal_sign_data) && is_file(FCPATH.$college_imgprincipal_sign_data->media_disk_path)){ $principal_sign=base_url($college_imgprincipal_sign_data->media_disk_path_relative); }else{ $principal_sign=$this->data['no_image']; } if(!empty($student_ids)){ $course_data=$this->cm->get_course(array('course_id'=>$course,'course_inst_id'=>$inst_id)); $session_data=$this->sessm->get_session(array('session_id'=>$session)); foreach ($student_ids as $key => $value) { $student_data=$this->um->get_students(array('stu_user_id'=>$value)); if(!empty($student_data)){ $student_ids[]=$value; if($student_data->stu_mid_name!=''){ $stu_name=$student_data->stu_first_name.' '.$student_data->stu_mid_name.' '.$student_data->stu_last_name; }else if($student_data->stu_mid_name!=''){ $stu_name=$student_data->stu_first_name.' '.$student_data->stu_last_name; } $stu_image=$this->sm->get_file(array('storage_type'=>'student_profile_photo','storage_type_id'=>$student_data->stu_user_id,'storage_parent_id'=>$student_data->stu_inst_id)); if(!empty($stu_image) && is_file(FCPATH.$stu_image->media_disk_path)){ $image=base_url($stu_image->media_disk_path_relative); }else{ $image=$this->data['no_image']; } $stu_code=$student_data->stu_user_code; $ph_no=$student_data->stu_ph_no; $stu_emergency_ph_no=$student_data->stu_emergency_ph_no; $stu_email=$student_data->stu_email; $stu_dob=$student_data->stu_dob; $gender=ucwords($student_data->stu_gender); $blood_group=$student_data->stu_blood_group; $course_code=$course_data->course_code; $session=$session_data->session_start_year.'-'.$session_data->session_end_year; $valid_up_to=post_data('valid_upto_date'); $_data_to_print[]=array( 'stu_code'=>$stu_code, 'stu_name'=>$stu_name, 'stu_emergency_ph_no'=>$stu_emergency_ph_no, 'stu_dob'=>$stu_dob, 'stu_email'=>$stu_email, 'ph_no'=>$ph_no, 'principal_sign'=>$principal_sign, 'stu_image'=>$image, 'gender'=>$gender, 'blood_group'=>$blood_group, 'course_code'=>$course_code, 'session'=>$session, 'valid_up_to'=>date('d-m-Y',strtotime($valid_up_to)), 'inst_name'=>$inst_name, 'inst_logo'=>$inst_logo, 'inst_signature_logo'=>$inst_signature_logo, 'inst_address'=>$inst_address, 'inst_ph'=>$inst_ph, 'inst_email'=>$inst_email ); } } if(!empty($_data_to_print)){ $data_to_print=array_chunk($_data_to_print, 2); } //print_obj($data_to_print);die; $this->data['icard_data']=$data_to_print; $icard_template=$this->sm->get_cards_template_data(array('template_id'=>$template_id)); //$print_data=$this->theme->view('_pages/master/templates/icards/'.$icard_template->template_value,$this->data,true); $print_data=$this->theme->view('_pages/master/templates/icards/vw_icard_template_basic1',$this->data,true); //print_obj($print_data); //die(); $print_data=array( 'print_inst_id'=>$inst_id, 'print_inst_type'=>$inst_type, 'print_type'=>'icard', 'print_data'=>$print_data, 'print_student_ids'=>json_encode($student_ids) ); // print_obj($print_data); //die(); $print_id=$this->sm->store_cards_print_data($print_data); $return['redirect']=$this->data['base_url'].'/students/idcards/'.encode_data($print_id); }else{ $return['error']='No students selected.'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function indexPrintGeneratedIDCard(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ $print_id=$this->uri->segment(4,0); // print_obj($print_id); // print_obj($this->uri); // die(); if(!empty($print_id)){ $print_id=decode_data($print_id); // print_obj($print_id); //die(); $print_data=$this->sm->get_cards_print_data(array('print_id'=>$print_id)); //print_obj($print_data); // die(); echo $print_data->print_data; //print("print_obj"); //print_obj($print_data); //die(); } }else{ redirect($this->data['base_url']); } } public function onGenerateIDCardExcel(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $institute_data=check_institute($this->data['userdata']); //print_obj($institute_data);die; $inst_id=$institute_data['institute_id']; $inst_type=$institute_data['inst_type']; $inst_name=$institute_data['inst_name']; $inst_email=$institute_data['inst_email']; $inst_ph=$institute_data['inst_phno']; $inst_address=$institute_data['inst_address']; $valid_upto_date=post_data('valid_upto_date'); $student_ids=$this->input->post('student_ids'); $session=post_data('session'); $course=post_data('course'); if(!empty($student_ids)){ $course_data=$this->cm->get_course(array('course_id'=>$course,'course_inst_id'=>$inst_id)); $session_data=$this->sessm->get_session(array('session_id'=>$session)); foreach ($student_ids as $key => $value) { $student_data=$this->um->get_students(array('stu_user_id'=>$value)); //print_obj($student_data); if(!empty($student_data)){ if($student_data->stu_mid_name!=''){ $stu_name=$student_data->stu_first_name.' '.$student_data->stu_mid_name.' '.$student_data->stu_last_name; }else if($student_data->stu_mid_name!=''){ $stu_name=$student_data->stu_first_name.' '.$student_data->stu_last_name; } $stu_image=$this->sm->get_file(array('storage_type'=>'student_profile_photo','storage_type_id'=>$student_data->stu_user_id,'storage_parent_id'=>$student_data->stu_inst_id)); if(!empty($stu_image) && is_file(FCPATH.$stu_image->media_disk_path)){ $image=FCPATH.$stu_image->media_disk_path; }else{ $image=$this->data['no_image']; } $stu_code=$student_data->stu_user_code; $ph_no=$student_data->stu_ph_no; $stu_emergency_ph_no=$student_data->stu_emergency_ph_no; $stu_email=$student_data->stu_email; $gender=ucwords($student_data->stu_gender); $blood_group=$student_data->stu_blood_group; $course_code=$course_data->course_code; $session=$session_data->session_start_year.'-'.$session_data->session_end_year; $valid_up_to=date('d-m-Y'); if($key==0){ $data_to_write[$key]=array( 'C1'=>$inst_name, 'C2'=>$inst_address, 'B4'=>$stu_name, 'C6'=>$stu_code, 'C7'=>$stu_emergency_ph_no, 'C8'=>$gender, 'C9'=>$blood_group, 'C10'=>$course_code, 'C11'=>$session, 'C12'=>$valid_up_to, 'B14'=>$inst_email ); $stu_image_draw[$key]=array( 'image_path'=>$image, 'image_coordinate'=>'E4' ); // $college_logo_draw[$key]=array( // 'image_path'=>$institute_data['inst_logo_path'], // 'image_coordinate'=>'B1', // 'image_height'=>61.44, // 'image_width'=>61.44 // ); }else if($key==1){ $data_to_write[$key]=array( 'J1'=>$inst_name, 'J2'=>$inst_address, 'I4'=>$stu_name, 'J6'=>$stu_code, 'J7'=>$stu_emergency_ph_no, 'J8'=>$gender, 'J9'=>$blood_group, 'J10'=>$course_code, 'J11'=>$session, 'J12'=>$valid_up_to, 'I14'=>$inst_email ); $stu_image_draw[$key]=array( 'image_path'=>$image, 'image_coordinate'=>'L4' ); // $college_logo_draw[$key]=array( // 'image_path'=>$institute_data['inst_logo_path'], // 'image_coordinate'=>'I1', // 'image_height'=>61.44, // 'image_width'=>61.44 // ); } } } //print_obj($data_to_write); $input_file=FCPATH.'uploads/app/samples/id-card-template-1.xlsx'; // echo $input_file;die; $output_file='id-card-template-1'; write_excel_to_pdf($input_file,$data_to_write,$stu_image_draw,$output_file); }else{ $return['error']='No students selected.'; } }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }