%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 if (!defined('BASEPATH')) { exit('No direct script access allowed'); } // Define API Url define('API_URL','http://api.shardahospital.org/api/PatientApp/'); define('FACILITY_ID','3'); define('SH_FACILITY_ID','2'); define('PORTAL_NAME','Doctor Appointment Booking Portal'); function encode_img_base64( $img_path = false, $img_type = 'png' ){ if( $img_path ){ //convert image into Binary data $img_data = fopen ( $img_path, 'rb' ); $img_size = filesize ( $img_path ); $binary_image = fread ( $img_data, $img_size ); fclose ( $img_data ); //Build the src string to place inside your img tag $img_src = "data:image/".$img_type.";base64,".str_replace ("\n", "", base64_encode($binary_image)); return $img_src; } return false; } /* * Function : setHistory */ function setHistory($activity) { $ci=& get_instance(); $ci->load->database(); $user = $ci->session->userdata('userName'); if (!$ci->db->insert('history', array( 'activity' => $activity, 'username' => $user, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'time' => time()) )) { log_message('error', print_r($ci->db->error(), true)); show_error(lang('database_error')); } } /* * Function : resizeImage * */ function resizeImage($filename, $width=250, $height=250, $path='attachments/testimonial_images') { $source_path = $_SERVER['DOCUMENT_ROOT'] . '/'. $path.'/'. $filename; $target_path = $_SERVER['DOCUMENT_ROOT'] . '/'.$path.'/thumbnail/'; $config_manip = array( 'image_library' => 'gd2', 'source_image' => $source_path, 'new_image' => $target_path, 'maintain_ratio' => TRUE, 'create_thumb' => TRUE, 'thumb_marker' => '', 'width' => $width, 'height' => $height ); $CI =& get_instance(); $CI->load->library('image_lib', $config_manip); if (!$CI->image_lib->resize()) { echo $CI->image_lib->display_errors(); die; } $CI->image_lib->clear(); } function remove_html_tags($string) { return preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($string))); } function except_letters($string) { // $onlyLetters = mb_ereg_replace('[^\\p{L}\s]', '', $string); $onlyLetters = preg_replace('/([\s])\1+/', ' ', $onlyLetters); $onlyLetters = preg_replace('/\s/', '_', trim($onlyLetters)); return $onlyLetters; } function allletters_lowercase($string) { $only_lowercase = strtolower($string); return replaceblankspace($only_lowercase); } function firstletterCapital($string) { $ucwords = ucwords(strtolower($string)); return $ucwords; } function striphtmltags($string) { $removeallhtmlchar = strip_tags($string); return $removeallhtmlchar; } function replaceblankspace($string) { $only_replaceblankspace = str_replace(" ","-",$string); return $only_replaceblankspace; } function setcharlimit($string, $limit=15, $start=0) { $return_string = ''; $return_string .= substr(html_entity_decode($string),$start,$limit); if(strlen($string)>$limit) { $return_string .= '...'; } return $return_string; } /* * Function : Get Default Image Name */ function getDefaultImage($string) { $response = ''; $stringArray = explode(" ",$string); if(count($stringArray)>=2) { $response = substr($stringArray[0],0,1).''.substr($stringArray[1],0,1); } else { $response = substr($string,0,2); } return '<span class="frist-letter">'.strtoupper($response).'</span>'; } function splitArrayAlphabetOrder($records) { $temp=array(); $first_char=""; for($i=0;$i<count($records);$i++) { $first_char= strtoupper ($records[$i][0]); if(!in_array($first_char, $temp)) { echo strtoupper($first_char).'<br>'; //print A / B / C etc } $temp[]= $first_char; echo $records[$i]."<br>"; } } function valid_seo_friendly_url($string){ $string = str_replace(array('[\', \']',"’",":",";","|","%","@","$","^","*","(",")","?","&","<",">",",",".","/","--","+"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); $string = strtolower(str_replace(" ","-",$string)); return cleanString(trim($string, '-')); } function seo_friendly_url($string){ $string = str_replace(array('[\', \']',"’"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); return cleanString(trim($string, '-')); } function seo_friendly_url_desc($string){ $string = str_replace(array('[\', \']',"’"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); return cleanString(trim($string, '-')); } function cleanString($text) { $utf8 = array( '/[áàâãªä]/u' => 'a', '/[ÁÀÂÃÄ]/u' => 'A', '/[ÍÌÎÏ]/u' => 'I', '/[íìîï]/u' => 'i', '/[éèêë]/u' => 'e', '/[ÉÈÊË]/u' => 'E', '/[óòôõºö]/u' => 'o', '/[ÓÒÔÕÖ]/u' => 'O', '/[úùûü]/u' => 'u', '/[ÚÙÛÜ]/u' => 'U', '/ç/' => 'c', '/Ç/' => 'C', '/ñ/' => 'n', '/Ñ/' => 'N', '/–/' => '-', // UTF-8 hyphen to "normal" hyphen '/[’‘‹›‚]/u' => ' ', // Literally a single quote '/[“”«»„]/u' => ' ', // Double quote '/ /' => ' ', // nonbreaking space (equiv. to 0x160) ); return preg_replace(array_keys($utf8), array_values($utf8), $text); } /* * Get common array details */ function getDependantList( $cond=array()) { $results = ''; $ci=& get_instance(); $ci->load->database(); $ci->db->select('*'); $ci->db->where('status', '1'); /* Where Condition */ if(!empty($cond)) { foreach($cond as $key=>$val){ $ci->db->where($key, $val); } } /* Final Query */ $query = $ci->db->get('tbl_dependant_registration '); //echo $ci->db->last_query(); die; $results = $query->result_array(); return $results; } /* * Get common array details */ function getDoctorDetails( $cond=array()) { $results = ''; $ci=& get_instance(); $ci->load->database(); $ci->db->select('*'); $ci->db->where('status', '1'); /* Where Condition */ if(!empty($cond)) { foreach($cond as $key=>$val){ $ci->db->where($key, $val); } } /* Final Query */ $query = $ci->db->get('tbl_doctor_master'); //echo $ci->db->last_query(); die; $results = $query->row_array(); return $results; } /* * Get common array details */ function getCommonArray($tbl_name='tbl_title_master', $col='*', $cond=array(), $orderBy=array()) { $results = ''; $ci=& get_instance(); $ci->load->database(); $ci->db->select($col); $ci->db->where('status', '1'); /* Where Condition */ if(!empty($cond)) { foreach($cond as $key=>$val){ $ci->db->where($key, $val); } } /* Order By */ if(!empty($orderBy)) { foreach($orderBy as $key=>$val){ $ci->db->order_by($key, $val); } } /* Final Query */ $query = $ci->db->get($tbl_name); //echo $ci->db->last_query(); die; $results = $query->result_array(); return $results; } /* * Get Single common array details */ function getSingleCommonRecord($tbl_name='tbl_title_master', $col='*', $cond=array(), $orderBy=array()) { $results = ''; $ci=& get_instance(); $ci->load->database(); $ci->db->select($col); $ci->db->where('status', '1'); /* Where Condition */ if(!empty($cond)) { foreach($cond as $key=>$val){ $ci->db->where($key, $val); } } /* Order By */ if(!empty($orderBy)) { foreach($orderBy as $key=>$val){ $ci->db->order_by($key, $val); } } /* Final Query */ $query = $ci->db->get($tbl_name); //echo $ci->db->last_query(); die; $results = $query->row_array(); return $results; } function barcode( $filepath="", $text="0", $size="20", $orientation="horizontal", $code_type="code128", $print=false, $SizeFactor=1 ) { $code_string = ""; // Translate the $text into barcode the correct $code_type if ( in_array(strtolower($code_type), array("code128", "code128b")) ) { $chksum = 104; // Must not change order of array elements as the checksum depends on the array's key to validate final code $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","\`"=>"111422","a"=>"121124","b"=>"121421","c"=>"141122","d"=>"141221","e"=>"112214","f"=>"112412","g"=>"122114","h"=>"122411","i"=>"142112","j"=>"142211","k"=>"241211","l"=>"221114","m"=>"413111","n"=>"241112","o"=>"134111","p"=>"111242","q"=>"121142","r"=>"121241","s"=>"114212","t"=>"124112","u"=>"124211","v"=>"411212","w"=>"421112","x"=>"421211","y"=>"212141","z"=>"214121","{"=>"412121","|"=>"111143","}"=>"111341","~"=>"131141","DEL"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","FNC 4"=>"114131","CODE A"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); $code_keys = array_keys($code_array); $code_values = array_flip($code_keys); for ( $X = 1; $X <= strlen($text); $X++ ) { $activeKey = substr( $text, ($X-1), 1); $code_string .= $code_array[$activeKey]; $chksum=($chksum + ($code_values[$activeKey] * $X)); } $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; $code_string = "211214" . $code_string . "2331112"; } elseif ( strtolower($code_type) == "code128a" ) { $chksum = 103; $text = strtoupper($text); // Code 128A doesn't support lower case // Must not change order of array elements as the checksum depends on the array's key to validate final code $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","NUL"=>"111422","SOH"=>"121124","STX"=>"121421","ETX"=>"141122","EOT"=>"141221","ENQ"=>"112214","ACK"=>"112412","BEL"=>"122114","BS"=>"122411","HT"=>"142112","LF"=>"142211","VT"=>"241211","FF"=>"221114","CR"=>"413111","SO"=>"241112","SI"=>"134111","DLE"=>"111242","DC1"=>"121142","DC2"=>"121241","DC3"=>"114212","DC4"=>"124112","NAK"=>"124211","SYN"=>"411212","ETB"=>"421112","CAN"=>"421211","EM"=>"212141","SUB"=>"214121","ESC"=>"412121","FS"=>"111143","GS"=>"111341","RS"=>"131141","US"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","CODE B"=>"114131","FNC 4"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); $code_keys = array_keys($code_array); $code_values = array_flip($code_keys); for ( $X = 1; $X <= strlen($text); $X++ ) { $activeKey = substr( $text, ($X-1), 1); $code_string .= $code_array[$activeKey]; $chksum=($chksum + ($code_values[$activeKey] * $X)); } $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; $code_string = "211412" . $code_string . "2331112"; } elseif ( strtolower($code_type) == "code39" ) { $code_array = array("0"=>"111221211","1"=>"211211112","2"=>"112211112","3"=>"212211111","4"=>"111221112","5"=>"211221111","6"=>"112221111","7"=>"111211212","8"=>"211211211","9"=>"112211211","A"=>"211112112","B"=>"112112112","C"=>"212112111","D"=>"111122112","E"=>"211122111","F"=>"112122111","G"=>"111112212","H"=>"211112211","I"=>"112112211","J"=>"111122211","K"=>"211111122","L"=>"112111122","M"=>"212111121","N"=>"111121122","O"=>"211121121","P"=>"112121121","Q"=>"111111222","R"=>"211111221","S"=>"112111221","T"=>"111121221","U"=>"221111112","V"=>"122111112","W"=>"222111111","X"=>"121121112","Y"=>"221121111","Z"=>"122121111","-"=>"121111212","."=>"221111211"," "=>"122111211","$"=>"121212111","/"=>"121211121","+"=>"121112121","%"=>"111212121","*"=>"121121211"); // Convert to uppercase $upper_text = strtoupper($text); for ( $X = 1; $X<=strlen($upper_text); $X++ ) { $code_string .= $code_array[substr( $upper_text, ($X-1), 1)] . "1"; } $code_string = "1211212111" . $code_string . "121121211"; } elseif ( strtolower($code_type) == "code25" ) { $code_array1 = array("1","2","3","4","5","6","7","8","9","0"); $code_array2 = array("3-1-1-1-3","1-3-1-1-3","3-3-1-1-1","1-1-3-1-3","3-1-3-1-1","1-3-3-1-1","1-1-1-3-3","3-1-1-3-1","1-3-1-3-1","1-1-3-3-1"); for ( $X = 1; $X <= strlen($text); $X++ ) { for ( $Y = 0; $Y < count($code_array1); $Y++ ) { if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) $temp[$X] = $code_array2[$Y]; } } for ( $X=1; $X<=strlen($text); $X+=2 ) { if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) { $temp1 = explode( "-", $temp[$X] ); $temp2 = explode( "-", $temp[($X + 1)] ); for ( $Y = 0; $Y < count($temp1); $Y++ ) $code_string .= $temp1[$Y] . $temp2[$Y]; } } $code_string = "1111" . $code_string . "311"; } elseif ( strtolower($code_type) == "codabar" ) { $code_array1 = array("1","2","3","4","5","6","7","8","9","0","-","$",":","/",".","+","A","B","C","D"); $code_array2 = array("1111221","1112112","2211111","1121121","2111121","1211112","1211211","1221111","2112111","1111122","1112211","1122111","2111212","2121112","2121211","1121212","1122121","1212112","1112122","1112221"); // Convert to uppercase $upper_text = strtoupper($text); for ( $X = 1; $X<=strlen($upper_text); $X++ ) { for ( $Y = 0; $Y<count($code_array1); $Y++ ) { if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) $code_string .= $code_array2[$Y] . "1"; } } $code_string = "11221211" . $code_string . "1122121"; } // Pad the edges of the barcode $code_length = 20; if ($print) { $text_height = 30; } else { $text_height = 0; } for ( $i=1; $i <= strlen($code_string); $i++ ){ $code_length = $code_length + (integer)(substr($code_string,($i-1),1)); } if ( strtolower($orientation) == "horizontal" ) { $img_width = $code_length*$SizeFactor; $img_height = $size; } else { $img_width = $size; $img_height = $code_length*$SizeFactor; } $image = imagecreate($img_width, $img_height + $text_height); $black = imagecolorallocate ($image, 0, 0, 0); $white = imagecolorallocate ($image, 255, 255, 255); imagefill( $image, 0, 0, $white ); if ( $print ) { imagestring($image, 5, 31, $img_height, $text, $black ); } $location = 10; for ( $position = 1 ; $position <= strlen($code_string); $position++ ) { $cur_size = $location + ( substr($code_string, ($position-1), 1) ); if ( strtolower($orientation) == "horizontal" ) imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); else imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); $location = $cur_size; } // Draw barcode to the screen or save in a file if ( $filepath=="" ) { header ('Content-type: image/png'); imagepng($image); imagedestroy($image); } else { imagepng($image,$filepath); imagedestroy($image); } } /* * Function : sdHisGetListAPI * Desc : thirdpary Create New Patient API * */ function sdHisGetListAPI($url='CreatePatient', $params) { $getUrl = API_URL.$url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$getUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); $response = curl_exec($ch); $result = json_decode($response); curl_close($ch); // Close the connection return $result; } /* * Function : sdCreatePatient * Desc : thirdpary Create New Patient API * */ function sdCreatePatient($apiUrl='CreatePatient', $post) { $url = API_URL.$apiUrl; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); $response = curl_exec($ch); $result = json_decode($response); curl_close($ch); // Close the connection return $result; } /* * Function : sdGetPatientList * Desc : thirdpary get patient details API * */ function sdGetPatientList($url = 'http://api.shardahospital.org/api/PatientApp/GetPatientList', $params) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); $response = curl_exec($ch); $result = json_decode($response); curl_close($ch); // Close the connection return $result; } /* * Function : phpcurlpostdataapi * Desc : thirdpary set new details API * */ function phpcurlpostdataapi($apiUrl, $data='') { $url = API_URL.$apiUrl; //$data = json_encode($data); //print_r($data); $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( "Content-Type: application/json", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); //for debug only! curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl); //print_r($response); $http = curl_getinfo($curl, CURLINFO_HTTP_CODE); if (curl_errno($curl)) { $error_msg = curl_error($curl); print_r($error_msg); die('TEST'); } curl_close($curl); // Close the connection if ($http == 200) { $json = @json_decode($response, TRUE); return $json; } else { echo "$http => There was a problem fetching your details..."; } } function postReview($apiUrl, $post_array=''){ $url = API_URL.$apiUrl; $curl = curl_init(); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_array); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); $result = curl_exec($curl); if(!$result){die("Connection Failure");} curl_close($curl); return $result; } function postExistingRequest($apiUrl, $payload='') { $url = API_URL.$apiUrl; // Create a new cURL resource $ch = curl_init($url); // Attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); // Set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); // Return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the POST request $result = curl_exec($ch); // Close cURL resource curl_close($ch); return $result; } function generate_otp(){ return rand(111111, 999999); //return '232524'; } function send_sms($mob, $message){ //echo $mob.' '.$otp; //$mob='91'.$mob; $msg= $message;//"Your OTP is $otp. Please use this code to initiate your application for Sharda University. Call us at +91120-4570000 for any queries."; $msg=urlencode($msg); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, "http://bulkpush.mytoday.com/BulkSms/SingleMsgApi"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "feedid=363901&username=9015129267&password=wgtpt&To=".$mob."&Text=".$msg."&time=&senderid=shardacom_trans"); $buffer = curl_exec($ch); curl_close($ch); return true; }