36 lines
1.0 KiB
PHP
Executable File
36 lines
1.0 KiB
PHP
Executable File
<?php
|
|
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
function createDateTimeForNextEmails($firstEmailData){
|
|
$CI = &get_instance();
|
|
$CI->load->model('mail_settings/Mail_model');
|
|
|
|
$startDateTime=$firstEmailData->email_send_date;
|
|
$mailBody=$CI->Mail_model->getMailBodySettingsByid("1");
|
|
$no_email=$mailBody->max_email;
|
|
$emailPrefArray=json_decode($mailBody->email_interval,true);
|
|
foreach($emailPrefArray as $ep){
|
|
$days=$ep['days'];
|
|
$hours=$ep['hours'];
|
|
$minutes=$ep['minutes'];
|
|
$seconds="0";
|
|
$time=($days*86400+$hours*3600+$minutes*60+$seconds*1);
|
|
|
|
$a=(strtotime($startDateTime)+$time);
|
|
$date=date("Y-m-d H:i:s",$a);
|
|
|
|
if($emailsendDate){
|
|
$length=count($emailsendDate)-1;
|
|
$b=(strtotime($emailsendDate[$length])+$time);
|
|
$date=date("Y-m-d H:i:s",$b);
|
|
$emailsendDate[]=$date;
|
|
}else{
|
|
$emailsendDate[]=$date;
|
|
}
|
|
}
|
|
return $emailsendDate;
|
|
|
|
}
|
|
|
|
|
|
?>
|