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 Institutes extends BaseAdminController { function __construct() { parent::__construct(); } //College List function index(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Institutes'; $this->theme->title($this->data['page_title'])->load('users/vw_institutes', $this->data); }else{ redirect($this->data['base_url']); } } //College List function indexBranches(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Institute Branches'; if($this->data['userdata']->user_type=='system_admin'){ $branch_can_be_uploaded='yes'; }else{ $total_branch_uploaded=$this->um->get_count_branches(array('branch_parent_inst_id'=>$this->data['userdata']->user_id)); if($this->data['userdata']->user_can_add_branch=='yes'){ if($total_branch_uploaded==$this->data['userdata']->user_max_branch){ $branch_can_be_uploaded='no'; }else{ $branch_can_be_uploaded='yes'; } }else{ $branch_can_be_uploaded='not_eligible'; } } $this->data['branch_can_be_uploaded']=$branch_can_be_uploaded; $this->theme->title($this->data['page_title'])->load('users/vw_institutes_branches', $this->data); }else{ redirect($this->data['base_url']); } } //College Add Edit public function indexAddEdit(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ $this->data['page_title']='Institute Registration'; $college_profile_id=$this->uri->segment(3,0); if($college_profile_id!='0'){ $college_profile_id=decode_data($college_profile_id); } $_states=array(); $college_id=''; $college_data=array(); $_pacakges=array(); $pacakges=$this->sm->get_packages(array('package_status'=>'active'),FALSE); if(isset($college_profile_id) && !empty($college_profile_id)){ $college_data=$this->um->get_user(array('user_profile_id'=>$college_profile_id),'institute'); $college_id=$college_data->user_id; } //print_obj($college_data);die; if(!empty($pacakges)){ foreach ($pacakges as $key => $value) { $_pacakges[]=array( 'package_id'=>$value->package_id, 'package_name'=>$value->package_name.'('.number_format($value->package_cost,2).')', 'pacakge_cost'=>$value->package_cost, 'selected'=>(!empty($college_data) && ($value->package_id==$college_data->user_package_id))?'selected':'' ); } } $states=$this->sm->_get_states(array('state_country_id'=>'1'),FALSE); if(!empty($states)){ foreach ($states as $key => $value) { $_states[]=array( 'state_id'=>$value->state_id, 'state_name'=>$value->state_name, 'selected'=>(!empty($college_data) && ($value->state_id==$college_data->user_state))?'selected':'' ); } } $link_printing_logo_data=$this->sm->get_file(array('storage_type'=>'college_printing_logo','storage_type_id'=>$college_id)); $link_logo_data=$this->sm->get_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id)); $link_report_card_logo_data=$this->sm->get_file(array('storage_type'=>'college_report_card_logo','storage_type_id'=>$college_id)); if(!empty($link_logo_data) && !empty($link_logo_data->media_disk_path) && file_exists(FCPATH.$link_logo_data->media_disk_path)){ $link_logo=base_url($link_logo_data->media_disk_path_relative); }else{ $link_logo=$this->data['no_image']; } $college_imgseal_data=$this->sm->get_file(array('storage_type'=>'college_seal_logo','storage_type_id'=>$college_id)); if(!empty($college_imgseal_data) && is_file(FCPATH.$college_imgseal_data->media_disk_path)){ $college_seal_logo=base_url($college_imgseal_data->media_disk_path_relative); }else{ $college_seal_logo=$this->data['no_image']; } $college_signature_data=$this->sm->get_file(array('storage_type'=>'college_authorize_signature_logo','storage_type_id'=>$college_id)); if(!empty($college_signature_data) && is_file(FCPATH.$college_signature_data->media_disk_path)){ $college_authorized_signature_logo=base_url($college_signature_data->media_disk_path_relative); }else{ $college_authorized_signature_logo=$this->data['no_image']; } $current_date=date('Y-m-d'); if(NCRIPTECH_SOFTWARE_RENEWAL_SCHEDULE=='monthly'){ $expiry_date=date('d-m-Y', strtotime('+1 month', strtotime($current_date))); }else if(NCRIPTECH_SOFTWARE_RENEWAL_SCHEDULE=='yearly'){ $expiry_date=date('d-m-Y', strtotime('+1 year', strtotime($current_date))); } $this->data['college_logo']=$link_logo; $this->data['college_seal_logo']=$college_seal_logo; $this->data['college_authorized_signature_logo']=$college_authorized_signature_logo; $this->data['states']=$_states; $this->data['college_data']=$college_data; $this->data['pacakges']=$_pacakges; $this->data['expiry_date']=$expiry_date; //print_obj($this->data['college_data']);die; $this->theme->title($this->data['page_title'])->load('users/vw_institutes_add_edit', $this->data); }else{ redirect($this->data['base_url']); } } //Branche Add Edit public function indexBranchesAddEdit($branch_id=null){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ $this->data['page_title']='Institute Branch Registration'; //print_obj($this->data['userdata']);die; if($this->data['userdata']->user_type=='system_admin'){ $branch_can_be_uploaded='yes'; }else{ $total_branch_uploaded=$this->um->get_count_branches(array('branch_parent_inst_id'=>$this->data['userdata']->user_id)); if($this->data['userdata']->user_can_add_branch=='yes'){ if($total_branch_uploaded==$this->data['userdata']->user_max_branch){ $branch_can_be_uploaded='no'; }else{ $branch_can_be_uploaded='yes'; } }else{ $branch_can_be_uploaded='not_eligible'; } } $this->data['branch_can_be_uploaded']=$branch_can_be_uploaded; $branch_data=array(); if(!empty($branch_id)){ $branch_id=decode_data($branch_id); $branch_data=$this->um->get_user(array('branch_id'=>$branch_id),'institute_branch'); } //print_obj($branch_data);die; $_states=array(); $states=$this->sm->_get_states(array('state_country_id'=>'1'),FALSE); if(!empty($states)){ foreach ($states as $key => $value) { $_states[]=array( 'state_id'=>$value->state_id, 'state_name'=>$value->state_name, 'selected'=>(isset($branch_data) && !empty($branch_data) && ($branch_data->branch_state==$value->state_id))?'selected':'' ); } } $link_logo_data=$this->sm->get_file(array('storage_type'=>'college_branch_logo','storage_type_id'=>$branch_data->branch_user_id)); if(!empty($link_logo_data) && !empty($link_logo_data->media_disk_path) && file_exists(FCPATH.$link_logo_data->media_disk_path)){ $link_logo=base_url($link_logo_data->media_disk_path_relative); }else{ $link_logo=$this->data['no_image']; } //print_obj($branch_data);die; $this->data['states']=$_states; $this->data['branch_data']=$branch_data; $this->data['branch_logo']=$link_logo; $system_payment_gateways=$this->sm->get_system_payment_gateways(null,FALSE); if(!empty($system_payment_gateways)){ foreach ($system_payment_gateways as $key => $value) { $inst_payment_gateways_settings=$this->sm->get_payment_gateway_institutes_settings(array('payment_gateway_id'=>$value->gateway_id,'payment_gateway_inst_id'=>$branch_data->branch_user_id)); //print_obj($inst_payment_gateways_settings); $_payment_gateways[]=array( 'gateway_id'=>$value->gateway_id, 'gateway_name'=>$value->gateway_name, 'gateway_logo'=>base_url($value->gateway_image), 'selected'=>(!empty($inst_payment_gateways_settings) && $inst_payment_gateways_settings->payment_gateway_id==$value->gateway_id)?'checked':'' ); } } //die; $this->data['payment_gateways']=$_payment_gateways; //print_obj($branch_data);die; $this->theme->title($this->data['page_title'])->load('users/vw_institutes_branches_add_edit', $this->data); }else{ redirect($this->data['base_url']); } } public function onCheckEmailExists(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ $college_email=post_data('college_email'); $college_id=post_data('college_id'); if($college_id!=''){ $college_id=decode_data($college_id); $college_data=$this->um->get_user(array('user_email'=>$college_email,'user_id!='=>$college_id),'institute'); }else{ $college_data=$this->um->get_user(array('user_email'=>$college_email),'institute'); } if(!empty($college_data)){ echo false; }else{ echo 'true'; } } } //Colleges Add Edit public function onAddEditCollege(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $user_id=$this->data['userdata']->user_id; $college_id=post_data('_college'); $college_name=post_data('college_name'); $college_email=post_data('college_email'); $college_phone=post_data('college_phone'); $college_pan=post_data('college_pan'); $college_gst_no=post_data('college_gst_no'); $college_tan_no=post_data('college_tan_no'); $college_estd_year=post_data('college_estd_year'); $college_country=post_data('college_country'); $college_state=post_data('college_state'); $college_city=post_data('college_city'); $college_address=post_data('college_address'); $college_pincode=post_data('college_pincode'); $college_website=post_data('college_website'); $college_affiliation=post_data('college_affiliation'); $college_affiliation_no=post_data('college_affiliation_no'); $college_trust_name=post_data('college_trust_name'); $college_trust_pan_no=post_data('college_trust_pan_no'); $college_trust_contact_no=post_data('college_trust_contact_no'); $college_max_student_upload=post_data('college_max_student_upload'); $college_max_course_upload=post_data('college_max_course_upload'); $college_max_branch_upload=post_data('college_max_branch_add'); $user_max_count_upload=post_data('user_max_count_upload'); $college_can_upload_session=post_data('college_can_upload_session'); $college_can_upload_course=post_data('college_can_upload_course'); $college_has_hrms_access=post_data('college_has_hrms_access'); $college_has_lms_access=post_data('college_has_lms_access'); $college_has_ctms_access=post_data('college_has_ctms_access'); $college_has_ams_access=post_data('college_has_ams_access'); $college_has_ams_access=post_data('college_has_ams_access'); $college_pacakge=post_data('college_pacakge'); $college_password=post_data('college_password'); $college_status=post_data('college_status'); $college_code=post_data('college_code'); $college_account_expiry_date=post_data('college_account_expiry_date'); $pacakge_data=$this->sm->get_packages(array('package_id'=>$college_pacakge)); $current_date=date('Y-m-d'); if($pacakge_data->package_duration=='monthly'){ $expiry_date=date('Y-m-d', strtotime('+1 month', strtotime($current_date))); }else if($pacakge_data->package_duration=='yearly'){ $expiry_date=date('Y-m-d', strtotime('+1 year', strtotime($current_date))); } $db_group=strtolower($college_code); if(empty($college_id)){ $college_data=$this->um->get_user(array('user_email'=>$college_email),'institute'); if(!empty($college_data)){ $user_code=$college_data->data->user_code; }else{ $user_code=$college_code;// ge_rand_code(random_username($college_name)); } $user_code=cleanString($user_code); $storage_dir='institutes/'.$user_code;//.'/'.date('Y'); $_college_data=array( 'user_package_id'=>$college_pacakge, 'user_code'=>$user_code, 'user_profile_name'=>$college_name, 'user_email'=>$college_email, 'user_contact_no'=>$college_phone, 'user_pan_no'=>$college_pan, 'user_tan_no'=>$college_tan_no, 'user_gst_no'=>$college_gst_no, 'user_estd_year'=>$college_estd_year, 'user_website'=>$college_website, 'user_affiliation'=>$college_affiliation, 'user_affiliation_no'=>$college_affiliation_no, 'user_address_1'=>$college_address, 'user_country'=>$college_country, 'user_state'=>$college_state, 'user_city'=>$college_city, 'user_pincode'=>$college_pincode, 'user_trust_name'=>$college_trust_name, 'user_trust_pan_no'=>$college_trust_pan_no, 'user_trust_contact_no'=>$college_trust_contact_no, 'user_max_students'=>$college_max_student_upload, 'user_max_course'=>$college_max_course_upload, 'user_max_branch'=>$college_max_branch_upload, 'user_max_count'=>$user_max_count_upload, 'user_can_add_course'=>$college_can_upload_course, 'user_can_add_session'=>$college_can_upload_session, 'user_can_add_branch'=>($college_max_branch_upload>0)?'yes':'no', 'user_has_lms_access'=>$college_has_hrms_access, 'user_has_hrms_access'=>$college_has_lms_access, 'user_has_ctms_access'=>$college_has_ctms_access, 'user_has_asm_access'=>$college_has_ams_access, 'user_has_ams_access'=>$college_has_ams_access, 'user_expire_at'=>$expiry_date ); if(empty($college_data)){ $college_profile_data=$this->um->get_institute(array('user_code'=>$user_code)); if(empty($college_profile_data)){ $college_profile_id=$this->um->store_intitutes($_college_data); if($college_profile_id){ $college_password=(!empty($college_password))?$college_password:'Password@123'; $password=password_hash($college_password, PASSWORD_BCRYPT, array('cost'=>12)); $college_user_data=array( 'user_role'=>'1', 'user_name'=>$college_email, 'user_password'=>$password, 'user_type'=>'institute', 'user_code'=>$user_code, 'user_status'=>$college_status, 'created_by_type'=>'ntadmin', 'created_by'=>$user_id, 'created_at'=>date('Y-m-d H:i:s') ); $college_id=$this->um->store_users($college_user_data); if($college_id){ $this->um->update_institute(array('user_pk_id'=>$college_id),array('user_profile_id'=>$college_profile_id)); add_tenant_database_config($db_group); $cgst=($pacakge_data->package_cost*CGST)/100; $sgst=($pacakge_data->package_cost*CGST)/100; $total_tax=$cgst+$sgst; $package_total_payment=$pacakge_data->package_cost+$total_tax; //Add payment Data $payment_data=array( 'pacakge_pk_id'=>$pacakge_data->package_id, 'package_inst_type'=>'institute', 'package_institute_id'=>$college_id, 'pacakge_invoice_no'=>generate_pacakge_invoice_no(), 'package_txn_id'=>'TXN'.date('Ymd').$college_id, 'package_subtotal'=>$pacakge_data->package_cost, 'package_discount'=>'0', 'package_sgst_tax_rate'=>SGST, 'package_cgst_tax_rate'=>CGST, 'package_cgst_tax_amount'=>$cgst, 'package_sgst_tax_amount'=>$sgst, 'pacakge_tax_amount'=>$total_tax, 'package_total_payment'=>$package_total_payment, 'package_order_id'=>null, 'package_payment_signature'=>null, 'package_payment_payment_id'=>null, 'package_renewed'=>'yes', 'package_payment_status'=>'paid', 'package_payment_gate_way'=>'DIRECT_ONLINE_TRANSFER', 'package_payment_gate_way_status'=>'success', 'package_payee_email'=>null, 'package_payee_phno'=>null, 'package_payment_date'=>date('Y-m-d H:i:s'), 'package_renewal_date'=>$expiry_date, 'package_created_date'=>date('Y-m-d') ); $this->pacm->store_system_package_payments($payment_data); if(isset($_FILES['college_logo']) && $_FILES['college_logo']['name']!=''){ $college_logo=$this->sm->get_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_logo)){ if(is_dir(FCPATH.$college_logo->media_disk_path)){ @unlink($college_logo->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'new', 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_logo_data,$db_group); } if(isset($_FILES['college_seal_logo']) && $_FILES['college_seal_logo']['name']!=''){ $college_seal_logo=$this->sm->get_file(array('storage_type'=>'college_seal_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_seal_logo)){ if(is_dir(FCPATH.$college_seal_logo->media_disk_path)){ @unlink($college_seal_logo->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_seal_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_seal_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_seal_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_seal_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_seal_logo_data,$db_group); } if(isset($_FILES['college_authorize_signature_logo']) && $_FILES['college_authorize_signature_logo']['name']!=''){ $college_authorize_signature_logo=$this->sm->get_file(array('storage_type'=>'college_authorize_signature_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_authorize_signature_logo)){ if(is_dir(FCPATH.$college_authorize_signature_logo->media_disk_path)){ @unlink($college_authorize_signature_logo->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_authorize_signature_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_authorize_signature_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_authorize_signature_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_authorize_signature_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_authorize_signature_logo_data,$db_group); } if(isset($_FILES['college_letter_head_image']) && $_FILES['college_letter_head_image']['name']!=''){ $college_letter_head_image=$this->sm->get_file(array('storage_type'=>'college_letter_head_image','storage_type_id'=>$college_id),$db_group); if(!empty($college_letter_head_image)){ if(is_dir(FCPATH.$college_letter_head_image->media_disk_path)){ @unlink($college_letter_head_image->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_letter_head_image','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_letter_head_image_data=array( 'file_size'=>'1', 'file_name'=>'college_letter_head_image', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_letter_head_image', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_letter_head_image_data,$db_group); } } $system_links=$this->sm->_get_system_links(array('link_inst_id'=>$college_id)); if(empty($system_links)){ $this->sm->store_system_links(array('link_code'=>$user_code,'link_inst_id'=>$college_id,'link_status'=>$college_status,'created_at'=>date('Y-m-d H:i:s'))); } $college_logo_found=$this->sm->get_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id),$db_group); //print_obj($college_logo_found);die; $payment_settings_array=array( 'PAYMENT_MODE'=>'TEST', 'PAYMENT_TEST_MERCHANT_MID'=>'FfdqnYfXWp2bpC', 'PAYMENT_TEST_MERCHANT_KEY'=>'rzp_test_JOC0wRKpLH1cVW', 'PAYMENT_TEST_CHANNEL_ID'=>'WEB', 'PAYMENT_TEST_INDUSTRY_TYPE_ID'=>'Retail', 'PAYMENT_TEST_MERCHANT_WEBSITE'=>'WEBSTAGING', 'PAYMENT_PROD_MERCHANT_MID'=>'Nirmal36659055439647', 'PAYMENT_PROD_MERCHANT_KEY'=>'XYTQ40T7Jijqt2lb', 'PAYMENT_PROD_CHANNEL_ID'=>'WEB', 'PAYMENT_PROD_INDUSTRY_TYPE_ID'=>'ECommerce', 'PAYMENT_PROD_MERCHANT_WEBSITE'=>'DEFAULT' ); $payment_settings= serialize($payment_settings_array); $this->sm->store_system_settings(array('settings_inst_id'=>$college_id,'settings_type_id'=>'1','settings_type'=>'payment_gateway','settings_type_key'=>'PAYTM','settings_value'=>$payment_settings)); $mail_settings=array( 'MAIL_PROTOCOL'=>SYSTEM_MAIL_PROTOCOL, 'MAIL_SERVER'=>SYSTEM_MAIL_SERVER, 'MAIL_USER'=>SYSTEM_WEBMASTER_EMAIL, 'MAIL_PASSWORD'=>SYSTEM_WEBMASTER_MAIL_PASS, 'MAIL_PORT'=>SYSTEM_MAIL_PORT, 'WEBMASTER_EMAIL'=>SYSTEM_WEBMASTER_EMAIL, 'INFO_EMAIL'=>SYSTEM_INFO_EMAIL ); $this->sm->store_system_settings(array('settings_inst_id'=>$college_id,'settings_type'=>'email_settings','settings_type_key'=>'EMAIL SETTINGS','settings_value'=>serialize($mail_settings))); $this->sm->store_system_settings(array('settings_inst_id'=>$college_id,'settings_type'=>'student_code','settings_type_key'=>'STUDENT CODE','settings_value'=>'college_code/course_code/session/student_number')); $mail_data['is_superadmin']=true; $mail_data['inst_id']=$college_id; $mail_data['mail_from']='webmaster'; $mail_data['to_email']=$college_email; $mail_data['mail_from_name']='Ncriptech'; $mail_data['mail_subject']=ucwords($college_name).' CMS portal account details'; $mail_data['mail_type']='html'; $mail_data['mail_custom_type']='html'; $mail_data['mail_data']=array( 'full_name'=>ucwords($college_name), 'short_name'=>strtoupper($user_code), 'access_url'=>str_replace('/admin', '', $this->data['base_url']).'/'.$user_code, 'access_name'=>$college_email, 'access_password'=>$college_password, 'portal_logo'=>base_url($college_logo_found->media_disk_path_relative) ); $mail_data['debug']=false; $mail_data['log_type']='email_institute_creation'; $mail_data['mail_view']='_pages/mails/vw_registration_college_mail'; $msg=$this->onSendMail($mail_data); $return['success']='College added successfully'; }else{ $return['error']='College not added'; } }else{ $return['error']='College already exists with same code.'; } }else{ $return['error']='College already exists with the same name or email address'; } }else{ $college_id=decode_data($college_id); $college_data=$this->um->get_user(array('user_id'=>$college_id),'institute',null); if(!empty($college_data)){ $user_code=cleanString($college_data->user_code); $storage_dir='institutes/'.$user_code; $college_profile_data=$this->um->get_user(array('user_pk_id!='=>$college_id,'user_email'=>$college_email),'institute'); if(empty($college_profile_data)){ $_college_data=array( 'user_code'=>$user_code, 'user_package_id'=>$college_pacakge, 'user_profile_name'=>$college_name, 'user_email'=>$college_email, 'user_contact_no'=>$college_phone, 'user_pan_no'=>$college_pan, 'user_tan_no'=>$college_tan_no, 'user_gst_no'=>$college_gst_no, 'user_estd_year'=>$college_estd_year, 'user_website'=>$college_website, 'user_affiliation'=>$college_affiliation, 'user_address_1'=>$college_address, 'user_country'=>$college_country, 'user_state'=>$college_state, 'user_city'=>$college_city, 'user_pincode'=>$college_pincode, 'user_trust_name'=>$college_trust_name, 'user_trust_pan_no'=>$college_trust_pan_no, 'user_trust_contact_no'=>$college_trust_contact_no, 'user_max_students'=>$college_max_student_upload, 'user_max_course'=>$college_max_course_upload, 'user_max_branch'=>$college_max_branch_upload, 'user_max_count'=>$user_max_count_upload, 'user_can_add_course'=>$college_can_upload_course, 'user_can_add_session'=>$college_can_upload_session, 'user_can_add_branch'=>($college_max_branch_upload>0)?'yes':'no', 'user_has_lms_access'=>$college_has_hrms_access, 'user_has_hrms_access'=>$college_has_lms_access, 'user_has_ctms_access'=>$college_has_ctms_access, 'user_has_ams_access'=>$college_has_ams_access, 'user_expire_at'=>date('Y-m-d',strtotime($college_account_expiry_date)) ); $updated=$this->um->update_institute($_college_data,array('user_pk_id'=>$college_id)); if($updated){ $tenant_college_data=$this->um->get_user(array('nt_institute.user_code'=>$db_group),'institute',null,$db_group); if(empty($tenant_college_data)){ $this->um->store_intitutes($_college_data,$db_group); }else{ $this->um->update_institute($_college_data,array('user_code'=>$db_group),FALSE,$db_group); $college_id=$tenant_college_data->user_id; } //print_obj($tenant_college_data);die; if(!empty($college_password)){ $password=password_hash($college_password, PASSWORD_BCRYPT, array('cost'=>12)); $college_user_data=array( 'user_name'=>$college_email, 'user_password'=>$password, 'user_type'=>'institute', 'user_code'=>$user_code, 'user_status'=>$college_status, 'created_by_type'=>'ntadmin', 'created_by'=>$user_id, 'created_at'=>date('Y-m-d H:i:s') ); if(empty($tenant_college_data)){ $tenant_college_user_id=$this->um->store_users($college_user_data,$db_group); $this->um->update_institute(array('user_pk_id'=>$tenant_college_user_id),array('user_code'=>$db_group),FALSE,$db_group); }else{ $tenant_college_user_id=$tenant_college_data->user_id; $this->um->update_users($college_user_data,array('user_id'=>$college_data->user_pk_id,'user_type'=>'institute'),FALSE,$db_group); $this->um->update_institute(array('user_pk_id'=>$tenant_college_user_id),array('user_code'=>$db_group),FALSE,$db_group); } $tenant_system_links=$this->sm->_get_system_links(array('link_inst_id'=>$tenant_college_user_id),TRUE,$db_group); if(empty($tenant_system_links)){ $this->sm->store_system_links(array('link_code'=>$db_group,'link_inst_id'=>$tenant_college_user_id,'link_status'=>$college_status,'created_at'=>date('Y-m-d H:i:s')),$db_group); } } if(isset($_FILES['college_logo']) && $_FILES['college_logo']['name']!=''){ $college_logo=$this->sm->get_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_logo)){ $logo_path = FCPATH . $college_logo->media_disk_path; // Normalize the path $logo_path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $logo_path); if (file_exists($logo_path)) { if (@unlink($logo_path)) { // File deleted successfully log_message('info', "File deleted: $logo_path"); } else { // Failed to delete the file $error = error_get_last(); log_message('error', "Failed to delete file: $logo_path. Error: " . ($error['message'] ?? 'Unknown error')); } } else { log_message('warning', "File does not exist: $logo_path"); } $this->sm->delete_file(array('storage_type'=>'college_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'new', 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_logo_data,$db_group); } if(isset($_FILES['college_seal_logo']) && $_FILES['college_seal_logo']['name']!=''){ $college_seal_logo=$this->sm->get_file(array('storage_type'=>'college_seal_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_seal_logo)){ if(is_dir(FCPATH.$college_seal_logo->media_disk_path)){ @unlink($college_seal_logo->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_seal_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_seal_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_seal_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_seal_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_seal_logo_data,$db_group); } if(isset($_FILES['college_authorize_signature_logo']) && $_FILES['college_authorize_signature_logo']['name']!=''){ $college_authorize_signature_logo=$this->sm->get_file(array('storage_type'=>'college_authorize_signature_logo','storage_type_id'=>$college_id),$db_group); if(!empty($college_authorize_signature_logo)){ if(is_dir(FCPATH.$college_authorize_signature_logo->media_disk_path)){ @unlink($college_authorize_signature_logo->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_authorize_signature_logo','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_authorize_signature_logo_data=array( 'file_size'=>'1', 'file_name'=>'college_authorize_signature_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_authorize_signature_logo', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_authorize_signature_logo_data,$db_group); } if(isset($_FILES['college_letter_head_image']) && $_FILES['college_letter_head_image']['name']!=''){ $college_letter_head_image=$this->sm->get_file(array('storage_type'=>'college_letter_head_image','storage_type_id'=>$college_id),$db_group); if(!empty($college_letter_head_image)){ if(is_dir(FCPATH.$college_letter_head_image->media_disk_path)){ @unlink($college_letter_head_image->media_disk_path); } $this->sm->delete_file(array('storage_type'=>'college_letter_head_image','storage_type_id'=>$college_id),$db_group); $file_operation_type='update'; }else{ $file_operation_type='new'; } $college_letter_head_image_data=array( 'file_size'=>'1', 'file_name'=>'college_letter_head_image', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_letter_head_image', 'file_type_of'=>'institute', 'file_storage_type_id'=>$college_id, 'file_parent_id'=>$college_id, 'file_resize'=>false, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>$file_operation_type, 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($college_letter_head_image_data,$db_group); } // $system_links=$this->sm->_get_system_links(array('link_inst_id'=>$college_profile_id)); // if(!empty($systrem_links)){ // $this->sm->update_system_links(array('link_code'=>$user_code,'link_status'=>$college_status,'created_at'=>date('Y-m-d H:i:s')),array('link_inst_id'=>$college_profile_id)); // } $return['success']='College data updated'; }else{ $return['error']='College data not updated'; } }else{ $return['error']='Another college exists with the same email'; } }else{ $return['error']='College not found'; } } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } //Branches Add Edit public function onAddEditCollegeBranch(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $user_id=$this->data['userdata']->user_id; $college_id=$this->data['userdata']->user_id; $_branch=post_data('_branch'); $branch_name=post_data('branch_name'); $branch_code=post_data('branch_code'); $branch_email=post_data('branch_email'); $branch_phone=post_data('branch_phone'); $branch_estd_year=post_data('branch_estd_year'); $branch_country=post_data('branch_country'); $branch_state=post_data('branch_state'); $branch_city=post_data('branch_city'); $branch_pincode=post_data('branch_pincode'); $branch_address=post_data('branch_address'); $branch_website=post_data('branch_website'); $branch_max_student_upload=post_data('branch_max_student_upload'); $branch_max_course_upload=post_data('branch_max_course_upload'); $branch_can_add_session=post_data('branch_can_upload_session'); $branch_can_add_course=post_data('branch_can_upload_course'); $branch_password=post_data('branch_password'); $branch_status=post_data('branch_status'); $user_code=$this->data['userdata']->user_code; $storage_dir='institutes/'.$user_code; //echo $storage_dir;die; if(empty($_branch)){ $branch_exists=$this->um->get_user(array('branch_email'=>$branch_email),'institute_branch'); //print_obj($branch_exists);die; if(empty($branch_exists)){ $branch_data=array( 'branch_parent_inst_id'=>$college_id, 'branch_name'=>$branch_name, 'branch_code'=>$branch_code, 'branch_address'=>$branch_address, 'branch_email'=>$branch_email, 'branch_contact_no'=>$branch_phone, 'branch_country'=>$branch_country, 'branch_state'=>$branch_state, 'branch_city'=>$branch_city, 'branch_pincode'=>$branch_pincode, 'branch_website'=>$branch_website, 'branch_max_students'=>$branch_max_student_upload, 'branch_max_course'=>$branch_max_course_upload, 'branch_can_add_session'=>$branch_can_add_session, 'branch_can_add_course'=>$branch_can_add_course, 'branch_status'=>$branch_status ); $branch_id=$this->um->store_intitutes_branch($branch_data); if($branch_id){ $_password=(!empty($branch_password))?$branch_password:'Password@123'; $password=password_hash($_password, PASSWORD_BCRYPT, array('cost'=>12)); $branch_user_data=array( 'user_name'=>$branch_email, 'user_code'=>strtolower($branch_code), 'user_password'=>$password, 'user_type'=>'institute_branch', 'user_status'=>$branch_status, 'created_by_type'=>'institute', 'created_by'=>$user_id, 'created_at'=>date('Y-m-d H:i:s') ); $branch_user_id=$this->um->store_users($branch_user_data); if($user_id){ $this->um->update_institute_branch(array('branch_user_id'=>$branch_user_id),array('branch_id'=>$branch_id)); } $branch_payment_gateway=$this->input->post('branch_payment_gateway'); if(!empty($branch_payment_gateway)){ $this->sm->delete_payment_gateway_institutes_settings(array('payment_gateway_inst_id'=>$branch_id)); foreach ($branch_payment_gateway as $key => $value) { $branch_payment_gateway_data=array( 'payment_gateway_id'=>$value, 'payment_gateway_inst_id'=>$branch_id, 'payment_gateway_status'=>'yes' ); $this->sm->store_payment_gateway_institutes_settings($branch_payment_gateway_data); } } $system_links=$this->sm->_get_system_links(array('link_inst_id'=>$branch_user_id)); if(empty($system_links)){ $this->sm->store_system_links(array('link_code'=>strtolower($branch_code),'link_inst_id'=>$branch_user_id,'link_status'=>$branch_status,'link_type'=>'college_branch','created_at'=>date('Y-m-d H:i:s'))); } //print_obj($_FILES['branch_file_logo']);die; if(isset($_FILES['branch_logo']) && $_FILES['branch_logo']['name']!=''){ $logo_data=array( 'file_size'=>'5', 'file_name'=>'branch_logo', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_branch_logo', 'file_storage_type_id'=>$branch_user_id, 'file_parent_id'=>$user_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'new', 'file_uploaded_by'=>$this->data['userdata']->user_id ); //print_obj($logo_data); $file_id=$this->onUploadFiles($logo_data); } if(isset($_FILES['branch_printing_logo']) && $_FILES['branch_printing_logo']['name']!=''){ $printing_logo_data=array( 'file_size'=>'5', 'file_name'=>'branch_printing_logo', 'file_types'=>'png,jpg,jpeg', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_branch_printing_logo', 'file_storage_type_id'=>$branch_user_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'new', 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($printing_logo_data); } if(isset($_FILES['branch_report_card_logo']) && $_FILES['branch_report_card_logo']['name']!=''){ $reportcard_logo_data=array( 'file_size'=>'5', 'file_name'=>'branch_report_card_logo', 'file_types'=>'png,jpg,jpeg', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_branch_report_card_logo', 'file_storage_type_id'=>$branch_user_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'new', 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($reportcard_logo_data); } $return['success']='Branch added successfully'; }else{ $return['error']='Branch not added'; } }else{ $return['error']='Branch already exists with same email id and phone no'; } }else{ $branch_id=decode_data($_branch); $branch_exists=$this->um->get_user(array('branch_id'=>$branch_id),'institute_branch'); if(!empty($branch_exists)){ $_branch_exists=$this->um->get_user(array('branch_id!='=>$branch_id,'branch_name'=>$branch_name),'institute_branch'); if(empty($_branch_exists)){ $branch_data=array( 'branch_parent_inst_id'=>$branch_exists->branch_parent_inst_id, 'branch_name'=>$branch_name, 'branch_address'=>$branch_address, 'branch_email'=>$branch_email, 'branch_contact_no'=>$branch_phone, 'branch_country'=>$branch_country, 'branch_state'=>$branch_state, 'branch_city'=>$branch_city, 'branch_pincode'=>$branch_pincode, 'branch_website'=>$branch_website, 'branch_max_students'=>$branch_max_student_upload, 'branch_max_course'=>$branch_max_course_upload, 'branch_can_add_session'=>$branch_can_add_session, 'branch_can_add_course'=>$branch_can_add_course, 'branch_status'=>$branch_status ); //print_obj($branch_data);die; $updated=$this->um->update_institute_branch($branch_data,array('branch_id'=>$branch_id,'branch_parent_inst_id'=>$branch_exists->branch_parent_inst_id)); if($updated){ if(!empty($branch_password)){ $_password=(!empty($branch_password))?$branch_password:'Password@123'; $password=password_hash($_password, PASSWORD_BCRYPT, array('cost'=>12)); $branch_user_data=array( 'user_name'=>$branch_email, 'user_password'=>$password, 'user_type'=>'institute_branch', 'user_status'=>$branch_status, 'created_by_type'=>'institute', 'created_by'=>$user_id, 'created_at'=>date('Y-m-d H:i:s') ); $this->um->update_users($branch_user_data,array('user_id'=>$branch_exists->user_id)); } $branch_payment_gateway=$this->input->post('branch_payment_gateway'); if(!empty($branch_payment_gateway)){ $this->sm->delete_payment_gateway_institutes_settings(array('payment_gateway_inst_id'=>$branch_id)); foreach ($branch_payment_gateway as $key => $value) { $branch_payment_gateway_data=array( 'payment_gateway_id'=>$value, 'payment_gateway_inst_id'=>$branch_id, 'payment_gateway_status'=>'yes' ); $this->sm->store_payment_gateway_institutes_settings($branch_payment_gateway_data); } } //print_obj($_FILES['branch_logo']);exit; if(isset($_FILES['branch_logo']) && $_FILES['branch_logo']['name']!=''){ $logo_data=array( 'file_size'=>'1', 'file_name'=>'branch_logo', 'file_types'=>'png,jpg,jpeg', 'file_types'=>'png,jpg,jpeg', 'file_storage_dir'=>$storage_dir, 'file_storage_type'=>'college_branch_logo', 'file_storage_type_id'=>$branch_exists->user_id, 'file_parent_id'=>$user_id, 'file_resize'=>true, 'file_resize_width'=>'200', 'file_resize_height'=>'200', 'file_compress'=>false, 'file_operation_type'=>'update', 'file_uploaded_by'=>$this->data['userdata']->user_id ); $this->onUploadFiles($logo_data); } // if(isset($_FILES['branch_printing_logo']) && $_FILES['branch_printing_logo']['name']!=''){ // $printing_logo_data=array( // 'file_size'=>'5', // 'file_name'=>'branch_printing_logo', // 'file_types'=>'png,jpg,jpeg', // 'file_storage_type'=>'college_branch_printing_logo', // 'file_storage_type_id'=>$branch_id, // 'file_resize'=>true, // 'file_resize_width'=>'200', // 'file_resize_height'=>'200', // 'file_compress'=>false, // 'file_operation_type'=>'update', // 'file_uploaded_by'=>$this->data['userdata']->user_id // ); // $this->onUploadFiles($printing_logo_data); // } // if(isset($_FILES['branch_report_card_logo']) && $_FILES['branch_report_card_logo']['name']!=''){ // $reportcard_logo_data=array( // 'file_size'=>'5', // 'file_name'=>'branch_report_card_logo', // 'file_types'=>'png,jpg,jpeg', // 'file_storage_type'=>'college_branch_report_card_logo', // 'file_storage_type_id'=>$branch_id, // 'file_resize'=>true, // 'file_resize_width'=>'200', // 'file_resize_height'=>'200', // 'file_compress'=>false, // 'file_operation_type'=>'update', // 'file_uploaded_by'=>$this->data['userdata']->user_id // ); // $this->onUploadFiles($reportcard_logo_data); // } $return['success']='Branch data updated successfully'; }else{ $return['error']='Branch data not updated'; } }else{ $return['error']='Branch with same name already exists in the system.'; } }else{ $return['error']='Barnch not found'; } } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } //Colleges public function onSearchCollegesList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $param['column_order'] = array( null, 'user_profile_name' ); $param['column_search'] = array('user_profile_name'); $param['order'] = array('user_profile_id' => 'ASC'); $posts=$this->input->post(); //$param['created_by']=session_userdata('admin_id'); $list = $this->um->_get_colleges($posts,$param,FALSE,FALSE); //print_obj($list);die; $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; foreach ($list as $college){ $no++; $row = array(); $pacake_details=$this->sm->_get_packages(array('pacakge_id'=>$college->user_package_id)); $link_logo_data=$this->sm->get_file(array('storage_type'=>'college_logo','storage_type_id'=>$college->user_id)); if(!empty($link_logo_data) && file_exists(FCPATH.$link_logo_data->media_disk_path)){ $_logo=base_url($link_logo_data->media_disk_path_relative); }else{ $_logo=$this->data['no_image']; } $logo='<img src="'.$_logo.'" width="100px" height="100px">'; $otherdata='<b>Name:</b>'.$college->user_profile_name.'<br><b>Email:</b>'.$college->user_email.'<b><br><b>Phone No.:</b>'.$college->user_contact_no; if($college->user_status=='active'){ $status='<span class="btn btn-xs btn-success">Active</span>'; }else if($college->user_status=='deactive'){ $status='<span class="btn btn-xs btn-danger">Deactive</span>'; } $row[] = $no; $row[] = $logo.'<br>'.$otherdata.'<br>State/City:'.$college->user_city.','.$college->state_name.'<br>URL:'.base_url($college->user_code); //$row[] = $college->user_city; $row[] = $status; $row[] = '<b>'.$pacake_details->package_name.'('.number_format($pacake_details->package_cost,2).')</b>'; $row[] = '<a href="'.$this->data['base_url'].'/colleges/add/'.encode_data($college->user_profile_id).'" class="btn btn-xs btn-dark btn-floating btn-info btn_edit_college"><i class="fa fa-edit"></i></a> <button type="button" class="btn btn-xs btn-danger btn-floating" data-session="'.encode_data($college->user_profile_id).'"><i class="fa fa-trash"></i></button>'; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->um->_get_colleges($posts,$param,TRUE), "recordsFiltered" => $this->um->_get_colleges($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } //Branches public function onSearchCollegesBranchList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $userdata=$this->data['userdata']; if($userdata->user_type=='system_admin'){ //$param['inst_id']=$userdata->user_profile_id; }else if($userdata->user_type=='institute'){ $param['inst_id']=$userdata->user_id; } $param['column_order'] = array( null, 'branch_name', 'branch_status' ); $param['column_search'] = array('branch_name'); $param['order'] = array('user_profile_id' => 'ASC'); $posts=$this->input->post(); //$param['inst_id']=$this->data['userdata']->user_id;//session_userdata('admin_id'); $list = $this->um->_get_college_branches($posts,$param,FALSE,FALSE); $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; //print_obj($list);die; foreach ($list as $branch){ $no++; $row = array(); $barnch_image=$this->sm->get_file(array('storage_type'=>'college_branch_logo','storage_type_id'=>$branch->branch_user_id)); if(!empty($barnch_image) && is_file(FCPATH.$barnch_image->media_disk_path)){ $image=base_url($barnch_image->media_disk_path); }else{ $image=$this->data['no_image']; } $row[] = $no; //$row[] = $branch->college_name; $row[] = '<img src="'.$image.'" height="50px" width="50px" draggable="false">'; $row[] = $branch->branch_name.'<br>Email:'.$branch->branch_email.'<br>Phone No:'.$branch->branch_contact_no.'<br>State:'.$branch->state_name.'<br>URL:'.base_url($branch->user_code); $row[] = $branch->branch_status; //$row[] = $branch->branch_contact_no; // $row[] = $branch->branch_city; //$row[] = $branch->state_name; $row[] = '<a href="'.$this->data['base_url'].'/colleges/branches/add/'.encode_data($branch->branch_id).'" class="btn btn-xs btn-info"><i class="fa fa-edit"></i></a> <button type="button" class="btn btn-xs btn-danger" data-branch="'.encode_data($branch->branch_id).'"><i class="fa fa-trash"></i></button>'; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->um->_get_college_branches($posts,$param,TRUE), "recordsFiltered" => $this->um->_get_college_branches($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }