'; print_r($array); exit(); } function cuurentNepaliDate($dateObj) { $date_arr = explode('-', date('Y-m-d')); list($y, $m, $d) = $date_arr; // Convert BS to AD. $datearr = $dateObj->convertAdToBs($y, $m, $d); extract($datearr); $string = $year.'-'.$month.'-'.$day; $date = date_create_from_format('Y-m-d', $string); return $php_date = date_format($date, 'Y-m-d H:i:s'); } function convert_BSdate_to_ADdate($dateObj,$date,$character='-') { $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; $datearr = $dateObj->convertBsToAd($y, $m, $d); extract($datearr); $string = $year.'-'.$month.'-'.$day; $date = date_create_from_format('Y-m-d', $string); return $php_date = date_format($date, 'Y-m-d'); } function convert_ADdate_to_BSdate($dateObj,$date,$character='-') { $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; $datearr = $dateObj->convertAdToBs($y, $m, $d); extract($datearr); $string = $year.'-'.$month.'-'.$day; $date = date_create_from_format('Y-m-d', $string); return $php_date = date_format($date, 'Y-m-d'); } function convert_BSdateTime_to_ADdateTime($dateObj,$dateTime,$character='-') { $date = date('Y-m-d', strtotime($dateTime)); $time = date('H:i:s', strtotime($dateTime)); $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; $datearr = $dateObj->convertBsToAd($y, $m, $d); extract($datearr); $string = $year.'-'.$month.'-'.$day.' '.$time; $date = date_create_from_format('Y-m-d H:i:s', $string); return $php_date = date_format($date, 'Y-m-d H:i:s'); } function convert_ADdateTime_to_BSdateTime($dateObj,$dateTime,$character='-') { $date = date('Y-m-d', strtotime($dateTime)); $time = date('H:i:s', strtotime($dateTime)); $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; $datearr = $dateObj->convertAdToBs($y, $m, $d); extract($datearr); $string = $year.'-'.$month.'-'.$day.' '.$time; $date = date_create_from_format('Y-m-d H:i:s', $string); return $php_date = date_format($date, 'Y-m-d H:i:s'); } function get_complete_BS_date_info($dateObj, $date) { $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; return $date = $dateObj->getDetails($y, $m, $d, 'bs'); } function get_complete_AD_date_info($dateObj, $date) { $date_arr = explode('-', $date); list($y, $m, $d) = $date_arr; return $date = $dateObj->getDetails($y, $m, $d, 'ad'); } //Do not make any changes to this function for now.. Just call and use it as it is // function ciSendEmail($data=array()) // { // $CI = &get_instance(); // $CI->load->library('email'); // // $config = Array( // // 'protocol' => 'smtp', // // 'smtp_host' => 'smtp.gmail.com', // // 'smtp_port' => 465, // // 'smtp_user' => 'info@blackboard.com.np', // // 'smtp_pass' => 'pfG3OdbHKaCu', // // 'smtp_crypto'=>'ssl', // // 'mailtype'=>'html', // // 'newline'=>"\r\n", // // 'crlf' => "\r\n" // // ); // $config = Array( // 'protocol' => 'ssmtp', // 'smtp_host' => 'ssmtp.gmail.com', // 'smtp_port' => 465, // 'smtp_user' => 'bb.blackboardnepal@gmail.com', // 'smtp_pass' => 'Black#312', // 'mailtype' => 'html', // 'charset' => 'utf-8' // ); // $CI->email->initialize($config); // $CI->email->set_newline("\r\n"); // $CI->email->from('bb.blackboardnepal@gmail.com', 'Blackboard'); // $CI->email->to($data['to']); // //if(isset($data['cc_to']) && $data['cc_to']!='') // //$CI->email->cc($data['cc_to']); // $CI->email->subject($data['subject']); // $CI->email->message($data['message']); // $CI->email->set_newline("\r\n"); // $CI->email->set_mailtype('html'); // $res = $CI->email->send(); // echo "Mailer Error: " . $CI->email->print_debugger(); // return $res; // } // php Mail send function sendMail($to,$subject,$message){ $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From:'.FROM_EMAIL. "\r\n"; $retval =mail($to,$subject,$message,$headers); return $retval; } // For batch display format by shivu function batchdateFormat($date1,$date2){ return date('M-Y', strtotime($date1)) . '/' . date('M-Y', strtotime($date2)); } function batchdateFormatTo($date1,$date2){ return date('M-Y', strtotime($date1)) . ' to ' . date('M-Y', strtotime($date2)); } function student_grade_show($marks_frm) { $ci =& get_instance(); $ci->load->database(); $sql = 'SELECT * FROM grades where CAST(marks_from AS DECIMAL) <= CAST('. $marks_frm .' AS DECIMAL) AND CAST(marks_upto AS DECIMAL) >= CAST('. $marks_frm . ' AS DECIMAL)'; $q = $ci->db->query($sql); if($q->num_rows() > 0) { return $q->row_array(); } return false; } //helper function to set response type. if (!function_exists('setResponse')) { function setResponse($status, $data = array(), $message = "", $code = 200) { $ci = & get_instance(); $response['status'] = $status; $response['data'] = isset($data) ? $data : new stdClass(); $response['message'] = $message; $ci->OutputResult = $response; header('Content-Type: application/json', true, $code); echo json_encode($response); } } function currency_data() { $data = array('NPR-Rs'); return $data; } function amountInWords(float $amount) { $amount_after_decimal = round($amount - ($num = floor($amount)), 2) * 100; $amt_hundred = null; $count_length = strlen($num); $x = 0; $string = array(); $change_words = array(0 => '', 1 => 'One', 2 => 'Two', 3 => 'Three', 4 => 'Four', 5 => 'Five', 6 => 'Six', 7 => 'Seven', 8 => 'Eight', 9 => 'Nine', 10 => 'Ten', 11 => 'Eleven', 12 => 'Twelve', 13 => 'Thirteen', 14 => 'Fourteen', 15 => 'Fifteen', 16 => 'Sixteen', 17 => 'Seventeen', 18 => 'Eighteen', 19 => 'Nineteen', 20 => 'Twenty', 30 => 'Thirty', 40 => 'Forty', 50 => 'Fifty', 60 => 'Sixty', 70 => 'Seventy', 80 => 'Eighty', 90 => 'Ninety'); $here_digits = array('', 'Hundred','Thousand','Lakh', 'Crore'); while( $x < $count_length ) { $get_divider = ($x == 2) ? 10 : 100; $amount = floor($num % $get_divider); $num = floor($num / $get_divider); $x += $get_divider == 10 ? 1 : 2; if ($amount) { $add_plural = (($counter = count($string)) && $amount > 9) ? 's' : null; $amt_hundred = ($counter == 1 && $string[0]) ? ' and ' : null; $string [] = ($amount < 21) ? $change_words[$amount].' '. $here_digits[$counter]. $add_plural.' '.$amt_hundred:$change_words[floor($amount / 10) * 10].' '.$change_words[$amount % 10]. ' '.$here_digits[$counter].$add_plural.' '.$amt_hundred; } else $string[] = null; } $implode_to_Rupees = implode('', array_reverse($string)); $get_paise = ($amount_after_decimal > 0) ? "And " . ($change_words[$amount_after_decimal / 10] . " " . $change_words[$amount_after_decimal % 10]) . ' Paise' : ''; return ($implode_to_Rupees ? $implode_to_Rupees . 'Rupees ' : '') . $get_paise . 'Only'; } function cuurentNepaliDateShankar($dateObj) { $date_arr = explode('-', date('Y-m-d')); list($y, $m, $d) = $date_arr; // Convert BS to AD. $datearr = $dateObj->convertAdToBs($y, $m, $d); extract($datearr); $month = ($month < 10) ? '0'.$month : $month; $string = $year.'-'.$month.'-'.$day; return $string." ".date('H:i:s'); } function cuurentNepaliDateShankarYMD($dateObj) { $date_arr = explode('-', date('Y-m-d')); list($y, $m, $d) = $date_arr; // Convert BS to AD. $datearr = $dateObj->convertAdToBs($y, $m, $d); extract($datearr); $month = ($month < 10) ? '0'.$month : $month; $string = $year.'-'.$month.'-'.$day; return $string; } ?>