%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php class Admform extends MY_Controller { function __construct() { parent::__construct(); //not_logged_res(); ini_set('memory_limit', '1024M'); set_time_limit(0); $this->load->model('admform_model', 'adm'); define('APP_ID', USER_ID); } function init(){ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $res=['success'=>true, 'msg'=>'', 'dds'=>[]]; $res['dds']['acs']=$this->adm->acs(); $res['dds']['disciplines']=$this->adm->disciplines(); $res['dds']['programs']=$this->adm->programs(); $res['dds']['plans']=$this->adm->plans(); $res['dds']['states']=$this->adm->states(); $res['dds']['cities']=$this->adm->cities(); $res['dds']['boards']=$this->adm->boards(); $res['dds']['universities']=$this->adm->universities(); $res['dds']['marking_schemes']=$this->adm->marking_schemes(); $res['dds']['marking_schemes_values']=key_val_array($this->db->select("id, allowed_data")->get("master_marking_schemes")->result_array(), 'id', 'allowed_data'); foreach($res['dds']['marking_schemes_values'] as $k=>$v){ $res['dds']['marking_schemes_values'][$k]=explode(",", $v); } $res['dds']['religions']=$this->adm->religions(); $res['dds']['applicant_cats']=$this->adm->applicant_cats(); $res['dds']['pyears']=[]; for($i=date('Y')+1; $i>=date('Y')-70; $i--){ $res['dds']['pyears'][]=$i; } $res['data']=$this->adm->detail(); $res['susat_details'] = $this->adm->getSUSATExamDate(); //deadline change $originalDate = $res['susat_details']->deadline; $date = new DateTime($originalDate); $formattedDate = $date->format('d F Y'); $res['susat_details']->deadline = $formattedDate; //exam date change $exam_date = $res['susat_details']->exam_date; $date_formatter = new DateTime($exam_date); $formatexamDate = $date_formatter->format('d F Y'); $res['susat_details']->exam_date = $formatexamDate; //result date $result_date = $res['susat_details']->result_date; $result_dformatter = new DateTime($result_date); $format_result_date = $result_dformatter->format('d F Y'); $res['susat_details']->result_date = $format_result_date; json_data($res); } function dob_validation($v){ if (strtotime($v) > strtotime("-16 years", time())){ $this->form_validation->set_message("dob_validation", "DOB must be before 16 years"); return FALSE; }else{ return TRUE; } } function save_step1(){ $res=[ 'success'=>false, 'msg'=>'Error!' ]; $post=trim_array($this->input->post()); try{ $adm_dtl=$this->db->select('id,step_completed,final_submitted') ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if($adm_dtl && $adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't be Done"); } $v = $this->form_validation; $v->set_rules('name', 'Full Name', "required", $this->req); $v->set_rules('mob', 'Mobile', "required", $this->req); $v->set_rules('email', 'Email ID', "required|valid_email", $this->req); $v->set_rules('ac_id', 'Academic Career', "required|numeric", $this->req); $v->set_rules('program_id', 'Programme', "required|numeric", $this->req); $v->set_rules('plan_id', 'Specialization', "required|numeric", $this->req); $v->set_rules('dob', "Applicant's DOB", "required|callback_dob_validation", $this->req); $v->set_rules('gender', "Applicant's Gender", "required", $this->req); $v->set_rules('cat_id', "Applicant's Category", "required|numeric", $this->req); $v->set_rules('religion_id', "Applicant's Religion", "required|numeric", $this->req); $v->set_rules('address', "Permanent Address", "required", $this->req); $v->set_rules('state_id', 'State', "required|numeric", $this->req); $v->set_rules('city_id', 'City', "required|numeric", $this->req); $v->set_rules('pincode', 'Pincode', "required|numeric", $this->req); $v->set_rules('pob', 'Place Of Birth', "required", $this->req); $v->set_rules('domicile_state_id', 'Domicile State', "required|numeric", $this->req); $v->set_rules('physically_challenged', 'Physically Challenged', "required", $this->req); $v->set_rules('nationality', 'Nationality', "required", $this->req); $v->set_rules('mother_name', "Mother's Name", "required", $this->req); $v->set_rules('mother_qualification', "Mother's Qualification", "required", $this->req); $v->set_rules('mother_occupation', "Mother's Occupation", "required", $this->req); $v->set_rules('father_name', "Father's Name", "required", $this->req); $v->set_rules('father_qualification', "Father's Qualification", "required", $this->req); $v->set_rules('father_occupation', "Father's Occupation", "required", $this->req); $v->set_rules('house_income', "Household Income (Per Annum)", "required", $this->req); $v->set_rules('id_proof', "ID Proof", "required", $this->req); $v->set_rules('id_proof_dtl', 'ID Proof Details', "required", $this->req); $v->set_rules('abc_id', 'ABC ID', "integer|max_length[12]", $this->req); //$v->set_rules('landline', 'Landline No', "required", $this->req); //$v->set_rules('parent_mob', "Parent's Mobile No", "required", $this->req); $v->set_rules('parent_email', "Parent's Email Id", "valid_email", $this->req); $v->set_rules('source_of_info', "Source of Information", "required", $this->req); if(@$this->form_validation->run() == FALSE){ $res['errors']=$this->form_validation->get_errors(); throw new Exception(reset($res['errors'])); }else{ $data=filter_value($post, ['name','mob','email','ac_id','program_id','plan_id','dob','gender','cat_id','religion_id','address','state_id','city_id','pincode','pob','domicile_state_id','physically_challenged','nationality','mother_name','mother_qualification','mother_occupation','father_name','father_qualification','father_occupation','house_income','id_proof','id_proof_dtl','landline','parent_mob','parent_email','source_of_info', 'abc_id']); $data['dob']=to_date_format($data['dob']); if(!$adm_dtl){ $data['step_completed']=1; } $data['status']='Pending'; $this->adm->save_step1($data); } $res['msg']="Personal Details Completed Successfully"; $res['success']=true; $st=$this->adm->get_step_completed(); $res['step_completed']=$st['step_completed']; $res['final_submitted']=$st['final_submitted']; }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function save_step2(){ $res=['success'=>false, 'msg'=>'Error!']; $zeroCols=[ 'board_id_10th', 'marking_scheme_id_10th', 'school_state_id_10th', 'board_id_12th', 'marking_scheme_id_12th', 'school_state_id_12th', 'university_id_ug', 'marking_scheme_id_ug', 'school_state_id_ug', 'university_id_pg', 'marking_scheme_id_pg', 'school_state_id_pg', ]; foreach($zeroCols as $c){ if(!$_POST[$c]){ $_POST[$c]=''; } } $post=trim_array($this->input->post()); try{ $adm_dtl = $this->db->select('id, ac_id, step_completed, final_submitted') ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if($adm_dtl['step_completed'] < 1){ throw new \Exception("Step1 is Not Completed"); }else if($adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't Done"); } $acDtl=$this->common->acDtl($adm_dtl['ac_id']); $v = $this->form_validation; $v->set_rules('status_10th', "10th Exam Details (Passed)", "required", $this->req); $v->set_rules('board_id_10th', "10th Board", "required|numeric", $this->req); $v->set_rules('marking_scheme_id_10th', "10th Marking Scheme", "required", $this->req); $v->set_rules('marks_10th', "Aggregate %/CGPA/Points", "required", $this->req); $v->set_rules('passing_year_10th', "10th Passing Year", "required", $this->req); $v->set_rules('school_name_10th', "10th School Name", "required", $this->req); $v->set_rules('school_state_id_10th', "10th School State", "required", $this->req); $v->set_rules('school_city_10th', "10th School City", "required", $this->req); if($acDtl['req_12th']){ $v->set_rules('board_id_12th', "12th Board", "required", $this->req); $v->set_rules('marking_scheme_id_12th', "12th Marking Scheme", "required", $this->req); if($post['status_12th']){ $v->set_rules('marks_12th', "12th Aggregate %/CGPA/Points", "required", $this->req); $v->set_rules('passing_year_12th', "12th Passing Year", "required", $this->req); } $v->set_rules('school_name_12th', "12th School Name", "required", $this->req); $v->set_rules('school_state_id_12th', "12th School State", "required", $this->req); $v->set_rules('school_city_12th', "12th School City", "required", $this->req); } if($acDtl['req_ug']){ $v->set_rules('university_id_ug', "UG University", "required", $this->req); $v->set_rules('marking_scheme_id_ug', "UG Marking Scheme", "required", $this->req); if($post['status_ug']){ $v->set_rules('marks_ug', "UG Aggregate %/CGPA/Points", "required", $this->req); $v->set_rules('passing_year_ug', "UG Passing Year", "required", $this->req); } $v->set_rules('school_name_ug', "UG School Name", "required", $this->req); $v->set_rules('school_state_id_ug', "UG School State", "required", $this->req); $v->set_rules('school_city_ug', "UG School City", "required", $this->req); $v->set_rules('degree_name_ug', "UG Degree Name", "required", $this->req); } if($acDtl['req_pg']){ $v->set_rules('university_id_pg', "PG University", "required", $this->req); $v->set_rules('marking_scheme_id_pg', "PG Marking Scheme", "required", $this->req); if($post['status_pg']){ $v->set_rules('marks_pg', "PG Aggregate %/CGPA/Points", "required", $this->req); $v->set_rules('passing_year_pg', "PG Passing Year", "required", $this->req); } $v->set_rules('school_name_pg', "PG School Name", "required", $this->req); $v->set_rules('school_state_id_pg', "PG School State", "required", $this->req); $v->set_rules('school_city_pg', "PG School City", "required", $this->req); $v->set_rules('degree_name_pg', "PG Degree Name", "required", $this->req); } $v->set_rules('sibling_studies_here', "Does any of your sibling(s) studies at any of the Sharda Group of Institutions", "required", $this->req); if(@$this->form_validation->run() == FALSE){ $res['errors']=$this->form_validation->get_errors(); throw new Exception(reset($res['errors'])); }else{ $data=filter_value($post, [ 'status_10th','board_id_10th','board_10th','marking_scheme_id_10th','marks_10th','passing_year_10th','school_name_10th','school_state_id_10th','school_city_10th', 'status_12th','board_id_12th','board_12th','marking_scheme_id_12th','marks_12th','passing_year_12th','school_name_12th','school_state_id_12th','school_city_12th', 'status_dip','board_id_dip','board_dip','marking_scheme_id_dip','marks_dip','passing_year_dip','school_name_dip','school_state_id_dip','school_city_dip', 'status_ug','university_id_ug', 'university_ug', 'marking_scheme_id_ug','marks_ug','passing_year_ug','school_name_ug','school_state_id_ug','school_city_ug','degree_name_ug', 'status_pg','university_id_pg', 'university_pg', 'marking_scheme_id_pg','marks_pg','passing_year_pg','school_name_pg','school_state_id_pg','school_city_pg','degree_name_pg', 'status_othr','university_id_othr', 'university_othr', 'marking_scheme_id_othr','marks_othr','passing_year_othr','school_name_othr','school_state_id_othr','school_city_othr','degree_name_othr', 'pcm','pcb','pcsm','school_no','center_no','roll_no','id_card_no','jee_rank_air','upsee_rank_gen','upsee_rank_biotech','mat_percentile','cat_percentile','xat_percentile', 'nata_score', 'clat_score','lsat_score','neet_score','suat_score', 'net', 'gate', 'slet', 'mphil', 'other_entrance_exam_dtl','sibling_studies_here','sibling_name','sibling_relation','sibling_program', 'sibling_system_id','sibling_adm_year']); $boards=key_val_array($this->adm->boards(), 'id', 'title'); $universities=key_val_array($this->adm->universities(), 'id', 'title'); if(!$data['board_10th']){ $data['board_10th']=replace_null($boards[$data['board_id_10th']]); } if(!$data['board_12th']){ $data['board_12th']=replace_null($boards[$data['board_id_12th']]); } if(!$data['board_dip']){ $data['board_dip']=replace_null($boards[$data['board_id_dip']]); } if(!$data['university_ug']){ $data['university_ug']=replace_null($universities[$data['university_id_ug']]); } if(!$data['university_pg']){ $data['university_pg']=replace_null($universities[$data['university_id_pg']]); } if(!$data['university_othr']){ $data['university_othr']=replace_null($universities[$data['university_id_othr']]); } if($adm_dtl['step_completed'] < 2){ $data['step_completed']=2; } $data['status']='Pending'; $res = $this->adm->save_step2($data); $st=$this->adm->get_step_completed(); $res['step_completed']=$st['step_completed']; $res['final_submitted']=$st['final_submitted']; } }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function save_step3(){ $res=['success'=>false, 'msg'=>'Error!']; $post=trim_array($this->input->post()); $dir=UP_PATHF.'admissions/'; $this->load->library('upload'); try{ $adm_dtl=$this->db->select('id,profile_photo,signature,step_completed,final_submitted') ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if($adm_dtl['step_completed'] < 2){ throw new \Exception("Step2 is Not Completed"); }else if($adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't Done"); } if(!$adm_dtl['profile_photo'] && $_FILES['profile_photo']['name'] == '' && $post['el_name']==='profile_photo'){ throw new \Exception("Profile photo required"); } if(!$adm_dtl['signature'] && $_FILES['signature']['name'] == '' && $post['el_name']==='signature'){ throw new \Exception("Signature required"); } if($_FILES['profile_photo']['name']){ $file=upload_img('profile_photo',$dir.'profiles/',$this); if($adm_dtl['profile_photo']){ @unlink($dir.'profiles/'.$adm_dtl['profile_photo']); } $adm_dtl['profile_photo']=$file; } if($_FILES['signature']['name']){ $file=upload_img('signature',$dir.'signatures/',$this); if($adm_dtl['signature']){ @unlink($dir.'signatures/'.$adm_dtl['signature']); } $adm_dtl['signature'] = $file; } if($adm_dtl['step_completed'] < 3 && $adm_dtl['profile_photo'] && $adm_dtl['signature']){ $adm_dtl['step_completed']=3; } $adm_dtl['status']='Pending'; $this->dba->save('adm_form', $adm_dtl); if($adm_dtl['profile_photo'] && $adm_dtl['signature']){ $res['msg']="Photo & Signature Uploaded Successfully"; }elseif($adm_dtl['profile_photo']){ $res['msg']="Photo Uploaded Successfully"; }elseif($adm_dtl['signature']){ $res['msg']="Signature Uploaded Successfully"; } $res['success']=true; $res['result']=[ 'signature_url'=>$adm_dtl['signature']?UP_URLF.'admissions/signatures/'.$adm_dtl['signature']:'', 'profile_photo_url'=>$adm_dtl['profile_photo']?UP_URLF.'admissions/profiles/'.$adm_dtl['profile_photo']:'' ]; $st=$this->adm->get_step_completed(); $res['step_completed']=$st['step_completed']; $res['final_submitted']=$st['final_submitted']; }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function delete_step3_img(){ $res=['success'=>false, 'msg'=>'Error!']; $post=trim_array($this->input->post()); $dir = UP_PATHF.'admissions/'; try{ $adm_dtl=$this->db->select('id, final_submitted, step_completed') ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if($adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't Done"); } $v=$this->form_validation; $field = isset($post['field']) ? $post['field'] : ''; if($field != 'signature' && $field != 'profile_photo'){ throw new \Exception("Please Send Valid Field"); } $title = ($field == 'signature') ? "Signature Image" : "Profile Photo"; $folder = ($field == 'signature') ? "signatures/" : "profiles/"; $adm_dtl = $this->db->select("id,$field") ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if(!$adm_dtl[$field]){ throw new \Exception("$title Not Found"); } @unlink($dir.$folder.$adm_dtl[$field]); $adm_dtl[$field] = ''; $adm_dtl['step_completed']=3; $adm_dtl['status']='Pending'; $this->dba->save('adm_form', $adm_dtl); $res['msg']="$title Deleted Successfully"; $res['success']=true; $st=$this->adm->get_step_completed(); $res['step_completed']=$st['step_completed']; $res['final_submitted']=$st['final_submitted']; }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function save_step4(){ $res=['success'=>false, 'msg'=>'Error!']; $post=trim_array($this->input->post()); $dir = UP_PATHF.'admissions/docs/'; $this->load->library('upload'); try{ $f='id, final_submitted, step_completed, marksheet_10th, marksheet_12th, marksheet_dip, marksheet_ug, marksheet_pg, marksheet_othr, entrance_exam_scoreboard, id_proof_img, cat_support_doc, physically_challange_certificate'; $adm_dtl=$this->db->select($f) ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); $v=$this->form_validation; if($adm_dtl['step_completed'] < 3){ throw new \Exception("Step3 Is Not Completed"); }else if($adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't Done"); } $v->set_rules('key', "Key", "required", $this->req); if(!$adm_dtl['marksheet_10th'] && $_FILES['marksheet_10th']['name'] == '' && ($post['el_name']==='marksheet_10th' || $post['el_name']==='Step4')){ $v->set_rules('marksheet_10th', "10th Certificate", "required", $this->req); } if(!$adm_dtl['id_proof_img'] && $_FILES['id_proof_img']['name'] == '' && ($post['el_name']==='id_proof_img' || $post['el_name']==='Step4')){ $v->set_rules('id_proof_img', "Aadhar Card", "required", $this->req); } if(@$this->form_validation->run() == FALSE){ $res['errors']=$this->form_validation->get_errors(); throw new Exception(reset($res['errors'])); } if($_FILES['marksheet_10th']['name']){ $file=upload_img_pdf('marksheet_10th',$dir,$this); if($adm_dtl['marksheet_10th']){ @unlink($dir.$adm_dtl['marksheet_10th']); } $adm_dtl['marksheet_10th'] = $file; } if($_FILES['marksheet_12th']['name']){ $file=upload_img_pdf('marksheet_12th',$dir,$this); if($adm_dtl['marksheet_12th']){ @unlink($dir.$adm_dtl['marksheet_12th']); } $adm_dtl['marksheet_12th']=$file; } if($_FILES['marksheet_dip']['name']){ $file=upload_img_pdf('marksheet_dip',$dir,$this); if($adm_dtl['marksheet_dip']){ @unlink($dir.$adm_dtl['marksheet_dip']); } $adm_dtl['marksheet_dip']=$file; } $adm_dtl['marksheet_ug'].=","; foreach($_FILES as $key=>&$FILE){ $is_marksheet_ug = substr($key,0,13); if($is_marksheet_ug == 'marksheet_ug_' && $_FILES[$key]['name'] != ''){ $adm_dtl['marksheet_ug'].=upload_img_pdf($key,$dir,$this).","; } } $adm_dtl['marksheet_ug'] = trim($adm_dtl['marksheet_ug'],","); $adm_dtl['marksheet_pg'].=","; foreach($_FILES as $key=>&$FILE){ $is_marksheet_pg = substr($key,0,13); if($is_marksheet_pg == 'marksheet_pg_' && $_FILES[$key]['name'] != ''){ $adm_dtl['marksheet_pg'].=upload_img_pdf($key,$dir,$this).","; } } $adm_dtl['marksheet_pg'] = trim($adm_dtl['marksheet_pg'],","); $adm_dtl['marksheet_othr'].=","; foreach($_FILES as $key=>&$FILE){ $is_marksheet_othr = substr($key,0,15); if($is_marksheet_othr == 'marksheet_othr_' && $_FILES[$key]['name'] != ''){ $adm_dtl['marksheet_othr'].=upload_img_pdf($key,$dir,$this).","; } } $adm_dtl['marksheet_othr'] = trim($adm_dtl['marksheet_othr'],","); if($_FILES['entrance_exam_scoreboard']['name']){ $file=upload_img_pdf('entrance_exam_scoreboard',$dir,$this); if($adm_dtl['entrance_exam_scoreboard']){ @unlink($dir.$adm_dtl['entrance_exam_scoreboard']); } $adm_dtl['entrance_exam_scoreboard'] = $file; } if($_FILES['id_proof_img']['name']){ $file=upload_img_pdf('id_proof_img',$dir,$this); if($adm_dtl['id_proof_img']){ @unlink($dir.$adm_dtl['id_proof_img']); } $adm_dtl['id_proof_img']=$file; } if($_FILES['cat_support_doc']['name']){ $file=upload_img_pdf('cat_support_doc',$dir,$this); if($adm_dtl['cat_support_doc']){ @unlink($dir.$adm_dtl['cat_support_doc']); } $adm_dtl['cat_support_doc'] = $file; } if($_FILES['physically_challange_certificate']['name']){ $file=upload_img_pdf('physically_challange_certificate',$dir,$this); if($adm_dtl['physically_challange_certificate']){ @unlink($dir.$adm_dtl['physically_challange_certificate']); } $adm_dtl['physically_challange_certificate'] = $file; } if($post['el_name']==='Step4'){ $adm_dtl['step_completed']=4; } $adm_dtl['status']='Pending'; $this->dba->save('adm_form', $adm_dtl); $res['msg']="Documents Uploaded Successfully"; $res['success']=true; $res['result'] = [ 'marksheet_10th'=>$adm_dtl['marksheet_10th'], 'marksheet_10th_url' => $adm_dtl['marksheet_10th']?UP_URLF.'admissions/docs/'.$adm_dtl['marksheet_10th']:'', 'marksheet_12th'=>$adm_dtl['marksheet_12th'], 'marksheet_12th_url' => $adm_dtl['marksheet_12th']?UP_URLF.'admissions/docs/'.$adm_dtl['marksheet_12th']:'', 'marksheet_dip'=>$adm_dtl['marksheet_dip'], 'marksheet_dip_url' => $adm_dtl['marksheet_dip']?UP_URLF.'admissions/docs/'.$adm_dtl['marksheet_dip']:'', 'entrance_exam_scoreboard'=>$adm_dtl['entrance_exam_scoreboard'], 'entrance_exam_scoreboard_url' => $adm_dtl['entrance_exam_scoreboard']?UP_URLF.'admissions/docs/'.$adm_dtl['entrance_exam_scoreboard']:'', 'id_proof_img'=>$adm_dtl['id_proof_img'], 'id_proof_img_url' => $adm_dtl['id_proof_img']?UP_URLF.'admissions/docs/'.$adm_dtl['id_proof_img']:'', 'cat_support_doc'=>$adm_dtl['cat_support_doc'], 'cat_support_doc_url' => $adm_dtl['cat_support_doc']?UP_URLF.'admissions/docs/'.$adm_dtl['cat_support_doc']:'', 'physically_challange_certificate'=>$adm_dtl['physically_challange_certificate'], 'physically_challange_certificate_url' => $adm_dtl['physically_challange_certificate']?UP_URLF.'admissions/docs/'.$adm_dtl['physically_challange_certificate']:'', ]; if($adm_dtl['marksheet_ug']){ $marksheet_ug = explode(",",$adm_dtl['marksheet_ug']); $adm_dtl['marksheet_ug']=[]; foreach($marksheet_ug as $i=>$r){ $res['result']['marksheet_ug'][$i]['url'] = UP_URLF.'admissions/docs/'.$r; $res['result']['marksheet_ug'][$i]['name'] = $r; } } if($adm_dtl['marksheet_pg']){ $marksheet_pg = explode(",",$adm_dtl['marksheet_pg']); $adm_dtl['marksheet_pg']=[]; foreach($marksheet_pg as $i=>$r){ $res['result']['marksheet_pg'][$i]['url'] = UP_URLF.'admissions/docs/'.$r; $res['result']['marksheet_pg'][$i]['name'] = $r; } } if($adm_dtl['marksheet_othr']){ $marksheet_othr = explode(",",$adm_dtl['marksheet_othr']); $adm_dtl['marksheet_othr']=[]; foreach($marksheet_othr as $i=>$r){ $res['result']['marksheet_othr'][$i]['url'] = UP_URLF.'admissions/docs/'.$r; $res['result']['marksheet_othr'][$i]['name'] = $r; } } $st=$this->adm->get_step_completed(); $res['step_completed']=$st['step_completed']; $res['final_submitted']=$st['final_submitted']; }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function delete_doc(){ $res=['success'=>false, 'msg'=>'Error!']; try{ $adm_dtl=$this->db->select('id, final_submitted, step_completed') ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if($adm_dtl['final_submitted'] == 1){ throw new \Exception("Form Is Final Submitted, Modification Can't Done"); } $post=trim_array($this->input->post()); $dir = UP_PATHF.'admissions/docs/'; $this->form_validation->set_rules('key', "Key", "required", $this->req); $this->form_validation->set_rules('name', "File Name", "required", $this->req); if(@$this->form_validation->run() == FALSE){ $res['errors']=$this->form_validation->get_errors(); throw new Exception(reset($res['errors'])); } $key = $post['key']; $adm_dtl=$this->db->select("id, $key") ->from('adm_form') ->where(['app_id'=>APP_ID]) ->limit(1) ->get()->row_array(); if(!$adm_dtl){ throw new Exception("Details Not Found"); } $files = explode(",", $adm_dtl[$key]); //pr($files); die; $index = -1; foreach($files as $i=>$file){ if($file == $post['name']){ $index = $i; @unlink($dir.$file); break; } } if($index < 0){ throw new Exception("No File Found"); } unset($files[$index]); $adm_dtl[$key] = implode(",", $files); $this->dba->save('adm_form', $adm_dtl); $res['success'] = true; $res['msg'] = "File Deleted Successfully"; }catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } function finalSubmit(){ $res=['success'=>false, 'msg'=>'Error!']; $st=$this->adm->get_step_completed(); if($st['final_submitted']){ $res['msg']="Already final submitted"; json_data($res); } $this->db->where(['app_id'=>APP_ID])->update('adm_form', ['final_submitted'=>1, 'updated'=>currentDT(), 'updated_by'=>USER_ID]); if($this->db->affected_rows()>0){ $res['success']=true; $res['msg']="Final submission done successfully"; $res['final_submitted']=1; } json_data($res); } function admission_form($app_id='', $system_id=''){//213924 error_reporting(0); $url=URL.'admform/download_adm_form_pdf/'.$app_id; //$url="https://www.google.com/"; //$url="http://aweblms.sharda.ac.in/student-panel/api/admform/download_adm_form_pdf/Mjk3Nzgw"; //ini_set("user_agent" , "Mozilla/3.0\r\nAccept: */*\r\nX-Padding: Foo\r\nAuthorization: key=AAAAiQXvgZA:APA91bGKc12FiRd3l3jzIgMVsF9Dkn25xF\r\nContent-Type: application/json"); $config=['http'=>['method'=>'GET', 'header'=>"Referer: $url"]]; $context=stream_context_create($config); $fp=fopen('http://pdfcrowd.com/url_to_pdf/?height=-1&use_print_media=1&no_javascript=1', 'r', false, $context); header('Content-Type: application/pdf'); header("Content-Disposition: attachment; filename={$system_id}-admission-form.pdf"); fpassthru($fp); fclose($fp); //echo $url; die; /* $data['dtl']=$this->adm->detail(decode($app_id)); $html=$this->load->view("pages/adm_form", $data, true); echo $html; die; create_pdf($html, "admission-card.pdf", "I"); */ } function download_adm_form_pdf($app_id){ error_reporting(0); $data['dtl']=$this->adm->detail(decode($app_id)); $html=$this->load->view("pages/adm_form", $data, true); echo $html; die; } //SUSAT registration form public function susatRegistration() { $res =['success' => false,'msg' => 'Error!']; $susat_value = trim_array($this->input->post('suat_status')); $st = $this->adm->getStepCompletion(); //echo "<pre>"; print_r($st); die; try { if($st && $st['step_completed'] == 3){ throw new \Exception("You have already applied for SUSAT, modification can't be done"); } $v = $this->form_validation; $v->set_rules('suat_status', 'SUSAT Registration', "required", $this->req); if(@$this->form_validation->run() == FALSE){ $res['errors']=$this->form_validation->get_errors(); throw new Exception(reset($res['errors'])); } else { $update_data = $this->db->where(['id'=>APP_ID])->update('applications', ['suat_status' => $susat_value,'step_completed' => 3, 'step3date' => currentDT(), 'step3_by'=>USER_ID]); if($update_data > 0) { $res['msg'] = "Your application for SUSAT has been successfully submitted."; $res['success'] = true; } else { $res['msg'] = "Your application for SUSAT submission has failed."; $res['success'] = false; } } } catch(Exception $e){ $res['msg']=$e->getMessage(); } json_data($res); } } //EOF