%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 Common_model extends CI_Model { function save($data, $tbl="", $pKey="id"){ $id=$this->db->escape_str($data[$pKey]); unset($data[$pKey]); if($id){ $data['updated']=currentDT(); $data['updated_by']=USER_ID; $this->dba->update($tbl, $data, "$pKey='$id'"); if(!$this->db->affected_rows()){ return; } }else{ $data['created']=$data['updated']=currentDT(); $data['created_by']=USER_ID; $data['updated_by']=USER_ID; $id=$this->dba->insert($tbl, $data); } return $id; } function getCounter($type){ $c=(int)$this->db->get_where("master_data", array('datakey'=>$type))->row()->datavalue; $this->db->update("master_data", array('datavalue'=>$c+1, 'updated'=>currentDT()), array('datakey'=>$type)); return $c; } function allStates($active=FALSE){ if($active){ $this->db->where(array('status'=>1)); } return $this->db->select("S.id, S.title, S.code, COUNT(C.id) AS noOfCities")->from("master_states AS S")->join("master_cities AS C", "C.state_id=S.id", "LEFT")->group_by("S.id")->order_by("S.title")->get()->result_array(); } function allPrograms($active=FALSE){ if($active){ $this->db->where(array('P.status'=>1)); } return $this->db->select("P.id, P.title, COUNT(PP.id) AS noOfPlans", FALSE) ->from("master_programs AS P") ->join("master_program_plans AS PP", "PP.program_id=P.id", "LEFT") ->group_by("P.id")->order_by("P.title")->get()->result_array(); } function allCoupans($active=FALSE){ if($active){ $this->db->where(array('status'=>1, 'expiry_date >='=>date('Y-m-d'))); } return $this->db->select("id, title, amt, DATE_FORMAT(expiry_date, '%d %b %Y') AS expiry_date, disp_odr, status")->from("master_coupans")->order_by("disp_odr")->get()->result_array(); } function allLandingPages($active=FALSE){ if($active){ $this->db->where(array('P.status'=>1)); } return $this->db->select("P.id, P.title, COUNT(DISTINCT PP.id) AS noOfProg, COUNT(DISTINCT PF.id) AS noOfFaq", FALSE) ->from("landing_pages AS P") ->join("landing_page_programs AS PP", "PP.lpage_id=P.id", "LEFT") ->join("landing_page_faqs AS PF", "PF.lpage_id=P.id", "LEFT") ->group_by("P.id")->order_by("P.title")->get()->result_array(); } function getNDAContent(){ $rs=$this->db->get_where("master_data", array('datakey'=>'nda'))->row()->datavalue; return encode_script($rs); } function getGACode(){ $gacode_head=$this->db->get_where("master_data", array('datakey'=>'gacode_head'))->row()->datavalue; $gacode_body=$this->db->get_where("master_data", array('datakey'=>'gacode_body'))->row()->datavalue; $gacode_key=$this->db->get_where("master_data", array('datakey'=>'gacode_key'))->row()->datavalue; return array('head'=>$gacode_head, 'body'=>$gacode_body, 'key'=>$gacode_key); } function utmGroups($active=FALSE){ if($active){ $this->db->where('status', 1); } $rs=$this->db->select("DISTINCT grp", false)->order_by("grp")->get_where("master_utm_sources", ['grp !='=>''])->result_array(); return $rs; } function allUtmSources($active=FALSE, $camp_med=FALSE){ if($active){ $this->db->where('status', 1); } $rs=$this->db->select("id, title")->from("master_utm_sources")->order_by("title")->get()->result_array(); if($camp_med){ foreach($rs as &$r){ $camps=$this->db->select("DISTINCT utm_campaign", false)->get_where("applicants", array('utm_source_id'=>$r['id']))->result_array(); $meds=$this->db->select("DISTINCT utm_medium", false)->get_where("applicants", array('utm_source_id'=>$r['id']))->result_array(); $r['campaigns']=[]; $r['mediums']=[]; foreach($camps as $c){ $r['campaigns'][]=$c['utm_campaign']; } foreach($meds as $c){ $r['mediums'][]=$c['utm_medium']; } } } return $rs; } function faqCats($active=FALSE){ $qs=trim_array($this->input->get()); if($active){ $this->db->where("status", 1); } if($qs['k']){ $this->db->like("title", $qs['k']); } return $this->db->order_by("title")->get("master_faq_cats")->result_array(); } function applicantCats(){ return $this->db->select("id, title")->from("master_applicat_cats")->where("status", 1)->order_by("disp_odr")->get()->result_array(); } function religions(){ return $this->db->select("id, title")->from("master_applicat_religions")->where("status", 1)->order_by("disp_odr")->get()->result_array(); } function boards(){ return $this->db->select("id, title")->from("master_edu_boards")->where("status", 1)->order_by("title")->get()->result_array(); } function universities(){ return $this->db->select("id, title")->from("master_universities")->where("status", 1)->order_by("title")->get()->result_array(); } function markingSchemes(){ $res = $this->db->select("id, title, allowed_data")->from("master_marking_schemes")->where("status", 1)->order_by("disp_odr")->get()->result_array(); foreach($res as $k=>$v){ $v['allowed_data']=trim($v['allowed_data']); $res[$k]['allowed_values'] = explode(',',$v['allowed_data']); } return $res; } function states(){ return $this->db->select("id, title")->order_by("title")->get_where("master_states", array('status'=>1))->result_array(); } function cities($state_id=0){ $cond=array('status'=>1); if($state_id){ $cond['state_id']=$state_id; } return $this->db->select("id, state_id, title, pincode")->order_by("title")->get_where("master_cities", $cond)->result_array(); } function academicCareers(){ return $this->db->select("id, title")->order_by("disp_odr")->get_where("master_academic_careers", array('status'=>1))->result_array(); } function acDtl($ac_id){ $dtl=$this->db->select("title, req_10th, req_12th, req_ug, req_pg")->get_where("master_academic_careers", array('id'=>$ac_id))->row_array(); if($dtl){ $dtl['req_10th']=(int)$dtl['req_10th']; $dtl['req_12th']=(int)$dtl['req_12th']; $dtl['req_ug']=(int)$dtl['req_ug']; $dtl['req_pg']=(int)$dtl['req_pg']; } return $dtl; } function schools(){ return $this->db->select("id, title")->order_by("disp_odr")->get_where("master_schools", array('status'=>1))->result_array(); } function disciplines(){ return $this->db->select("id, title")->order_by("disp_odr")->get_where("master_disciplines", array('status'=>1))->result_array(); } function programs($ac_id=0){ $cond=array('P.status'=>1); if($ac_id){ $cond['P.ac_id']=$ac_id; } return $this->db->select("P.id, P.type_id, P.ac_id, P.discipline_id, P.school_id, P.title") ->from("master_programs AS P") ->where($cond) ->order_by("title")->get()->result_array(); } function plans($program_id=0){ $cond=array('status'=>1); if($program_id){ $cond['program_id']=$program_id; } $rs=$this->db->select("id, program_id, title, code") ->from("master_program_plans") ->where($cond) ->order_by("title")->get()->result_array(); return $rs; } /** */ function applicationNdUsrInfo($appId){ $dtl=$this->db->select("A.id, A.applicant_id, A.application_no, A.step_completed, A.created, A.pay_trans_id, A.payment_status, A.payment_mode, P.type_id, P.id AS program_id, A.plan_id, PP.title AS plan, P.title AS program, P.image AS progImage, P.brochure AS progBrochure") ->from("applications AS A") ->join("master_program_plans AS PP", "A.plan_id=PP.id") ->join("master_programs AS P", "PP.program_id=P.id") ->where(array('A.id'=>$appId)) ->get()->row_array(); $dtl['progImageUrl']=$dtl['progImage']?UP_URLF.'programs_images/'.$dtl['progImage']:''; $dtl['progBrochureUrl']=$dtl['progBrochure']?UP_URLF.'brochure/'.$dtl['progBrochure']:''; $dtl['progBrochureDwnUrl']=$dtl['progBrochure']?(URL.'common/downloadFile/'.encode(UP_PATHF.'brochure/'.$dtl['progBrochure'])):''; $dtl['usr']=$this->db->select("lpage_id, name, email, mob, dob, address, city, pincode, state_id, utm_source_id")->get_where("applicants", array('id'=>$dtl['applicant_id']))->row_array(); $dtl['usr']['state']=$this->db->select("title")->get_where("master_states", array('id'=>$dtl['usr']['state_id']))->row()->title; if($dtl['payment_mode']=='CASH'){ $dtl['trans']=$this->db->select("amount txn_amt, 'CASH' bank_name, 'SUCCESS' txn_status, 'N/A' txn_id, created txn_date", false)->get_where("cash_collections", array('application_id'=>$dtl['id']))->row_array(); if($dtl['trans']){ $dtl['trans']['txn_date']=date('d-m-Y h:i s A', strtotime($dtl['trans']['txn_date'])); } }else{ $dtl['trans']=$this->db->get_where("pay_trans", array('id'=>$dtl['pay_trans_id']))->row_array(); if($dtl['trans']){ $dtl['trans']['txn_date']=date('d-m-Y h:i s A', strtotime($dtl['trans']['txn_date'])); $dtl['trans']['full_resp']=unserialize($dtl['trans']['full_resp']); } } $dtl['programType']=$this->db->select("title")->get_where("master_program_types", array('id'=>$dtl['type_id']))->row()->title; $dtl['lpage']=rtrim($this->db->select("title")->get_where("landing_pages", array('id'=>$dtl['usr']['lpage_id']))->row()->title, "/"); $dtl['utmSource']=$this->db->select("title")->get_where("master_utm_sources", array('id'=>$dtl['usr']['utm_source_id']))->row()->title; $dtl['loginUrl']=generate_login_url($dtl['lpage'], $dtl['usr']['mob']); $dtl['receiptDownloadUrl']=URL.'common/downloadReceipt/'.$appId; $dtl['SuatSlotBookUrl']=SUAT_SLOT_BOOK_URL; return $dtl; } function sendSystemIdGenMsg($appId){ $dtl=$this->applicationNdUsrInfo($appId); $usrName=strtoupper($dtl['usr']['name']); $systemId=$dtl['application_no']; if(strtolower($dtl['programType'])=='suat'){ $sms="Dear $usrName, Thank you for applying at Sharda University. Your System ID is - $systemId. Login at {$dtl['loginUrl']} to complete your SUAT-2019 application. Call us at 0120-4570011 for any queries."; }else{ $sms="Dear $usrName, Thank you for applying at Sharda University. Your System ID is - $systemId. Login at {$dtl['loginUrl']} to complete your application. Call us at 0120-4570011 for any queries."; } $emailSub="Dear $usrName, Your System ID $systemId is Generated !!!"; $emailMsg=$this->load->view("email/system_id_gen", $dtl, TRUE); send_sms($dtl['usr']['mob'], $sms); send_email($dtl['usr']['email'], $emailSub, $emailMsg); } function sendPaymentConfirmMsg($appId){ $dtl=$this->applicationNdUsrInfo($appId); $usrName=strtoupper($dtl['usr']['name']); $systemId=$dtl['application_no']; if(strtolower($dtl['programType'])=='suat'){ $sms="Dear $usrName, Congratulations! You have successfully applied for {$dtl['plan']}. Your System ID is - $systemId. We are processing your application, once you will receive your application number, login at {$dtl['SuatSlotBookUrl']} to book your slot for SUAT-2019. Call us at 0120-4570011 for any queries."; }else{ $sms="Dear $usrName, Congratulations! You have successfully applied for {$dtl['plan']}. Your System ID is - $systemId. We are processing your application, once you will receive your application number, login at {$dtl['loginUrl']} to Schedule a visit. Call us at 0120-4570011 for any queries."; } $emailSub="Congratulations! You have successfully applied for {$dtl['plan']} at Sharda University"; $emailMsg=$this->load->view("email/payment_confirm", $dtl, TRUE); send_sms($dtl['usr']['mob'], $sms); send_email($dtl['usr']['email'], $emailSub, $emailMsg); } function sendPaymentAlertToAdmin($appId){ $emails=$this->db->select("email")->get_where("master_admin_emails", array('send_payment_alert'=>1))->result_array(); if($emails){ $emails=key_val_array($emails, '', 'email'); $emails=implode(",", $emails); $dtl=$this->applicationNdUsrInfo($appId); $emailMsg=$this->load->view("email/payment_alert_admin", $dtl, TRUE); $sub=$dtl['payment_status']?"Payment Alert: SUCCESS":"Payment Alert: FAIL"; send_email($emails, $sub, $emailMsg); } } function sendIssueCommentToApplicant($id, $comment){ $rs=$this->db->select("applicant_id, cat, issue")->get_where("issues_reported", array('id'=>$id))->row_array(); $email=$this->db->select("email")->get_where("applicants", array('id'=>$rs['applicant_id']))->row()->email; if($email){ $msg="Issue: [{$rs['cat']}] {$rs['issue']} <br><br> Comment: <br><br>".$comment; $sub="Reply: ".$rs['cat']; send_email($email, $sub, $msg); } } function send_campaign_email($data){ ignore_user_abort(1); if(ENVIRONMENT=='development'){ //return TRUE; } $smtpdtl=array( 'host'=>'smtp.pepipost.com', 'user'=>'shardapepi', 'pass'=>'SUsocial@2019', 'port'=>'25', ); $fromname="Sharda University"; $fromemail="info@shardauniversity.com"; $this->load->library('email'); foreach($data as $d){ $this->email->clear(); $config['charset'] = 'utf-8'; $config['wordwrap'] = TRUE; $config['mailtype'] = 'html'; $config['protocol'] = "smtp"; $config['smtp_host'] = $smtpdtl['host']; $config['smtp_user'] = $smtpdtl['user']; $config['smtp_pass'] = $smtpdtl['pass']; $config['smtp_port'] = $smtpdtl['port']; $config['_auth_smtp'] = TRUE; $config['newline'] = "\r\n"; $config['crlf'] = "\r\n"; //$config['smtp_crypto'] = 'tls'; $config['smtp_keepalive']=true; $this->email->initialize($config); $this->email->from($fromemail, $fromname); $this->email->reply_to('noreply@shardauniversity', $fromname); $this->email->to($d['email']); $this->email->subject($d['subject']); $this->email->message($d['msg']); //pr($this->email->print_debugger()); $res=$this->email->send(); } return $res; } function send_campaign_sms($data){ ignore_user_abort(1); if(ENVIRONMENT=='development'){ //return TRUE; } foreach($data as $d){ if(!$d['mob']){ continue; } send_sms($d['mob'], $d['msg']); } return $res; } function master_data_for_leads(){ $states=$this->db->select("id,code,title")->get("master_states")->result_array(); $md['states']=key_val_array($states, 'id', 'title'); $md['state_codes']=key_val_array($states, 'id', 'code'); $plans=$this->db->select("id,code,title,program_code,ac_code")->get("master_program_plans")->result_array(); $md['plans']=key_val_array($plans, 'id', 'title'); $md['plan_codes']=key_val_array($plans, 'id', 'code'); $md['plan_prg_codes']=key_val_array($plans, 'id', 'program_code'); $md['plan_ac_codes']=key_val_array($plans, 'id', 'ac_code'); $md['lpages']=key_val_array($this->db->select("id,title")->get("landing_pages")->result_array(), 'id', 'title'); $md['acs']=key_val_array($this->db->select("id,title")->get("master_academic_careers")->result_array(), 'id', 'title'); $md['disciplines']=key_val_array($this->db->select("id,title")->get("master_disciplines")->result_array(), 'id', 'title'); $md['program_types']=key_val_array($this->db->select("id,title")->get("master_program_types")->result_array(), 'id', 'title'); //$md['utm_sources']=key_val_array($this->db->select("id,title")->get("master_utm_sources")->result_array(), 'id', 'title'); $md['lpages']=key_val_array($this->db->select("id,title")->get("landing_pages")->result_array(), 'id', 'title'); $md['mark_schemes']=key_val_array($this->db->select("id,title")->get("master_marking_schemes")->result_array(), 'id', 'title'); $md['soc_cats']=key_val_array($this->db->select("id,title")->get("master_applicat_cats")->result_array(), 'id', 'title'); $md['religions']=key_val_array($this->db->select("id,title")->get("master_applicat_religions")->result_array(), 'id', 'title'); return $md; } } //End of file