Current File : /home/giriqfky/public_html/Barga/application/core//Basecontroller.php
<?php
class Basecontroller extends MX_Controller {
public function __construct()
{
$sql = "SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))";
$this->db->query($sql);
parent::__construct();
$this->load->model('notifications/Notifications_model', 'Notifications');
$this->load->library('Fcmpushnotifications');
}
/*
public function sendEmail(string $from_array = array(), $to = "", $bcc = "", $subject, $content)
{
$status = "";
if(IS_SYSTEM_LIVE ==1 && EMAIL_ON == 1){
$data['sitename'] = getSettingValue('company_name');
$data['companytag'] = getSettingValue('company_tag');
$data['company_email'] = getSettingValue('company_email');
$config = array('mailtype' => 'html', 'charset' => 'utf-8', 'wordwrap' => TRUE);
$this->load->library('email',$config);
$this->email->clear(TRUE);
$this->email->from($data['company_email'], $data['sitename']);
if(!empty($bcc)) $this->email->bcc($bcc);
$this->email->reply_to($data['company_email']);
$this->email->subject($subject);
$this->email->to(strtolower(trim($to)));
$emailTemplate = $this->load->view('mailtemplates/email_header',$data,TRUE);
$emailTemplate .= $content;
$emailTemplate .=$this->load->view('mailtemplates/email_footer',$data,TRUE);
$this->email->message($emailTemplate);
$status = $this->email->send();
} else {
$status = 'Email function is disabled';
}
return $status;
}
*/
public function curlGetContents($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
public function sendPushNotification($selectedmembers,$notify_message,$title,$inb_id = "1",$push_notify_img="",$additional_data = array(),$action = array())
{
$notification_ids = $this->Notifications->saveNotification($selectedmembers, $notify_message, $push_notify_img, 1, 1,$additional_data,$title);
$deviceArr_A = $this->Notifications->getDeviceToken('A',$selectedmembers);
$deviceArr_I = $this->Notifications->getDeviceToken('I',$selectedmembers);
$this->fcmpushnotifications->send($deviceArr_A, $notify_message, $title, $push_notify_img, 'A', $notification_ids,$inb_id,$action,$additional_data);
$this->fcmpushnotifications->send($deviceArr_I, $notify_message, $title, $push_notify_img, 'I', $notification_ids,$inb_id,$action,$additional_data);
}
}