php code to send email using find function in forloop - php

I have startdate and end date in my table like below.
startdate = 2016-01-01
Enddate = 2016-06-20
Now i want to send email automatically before 1 month from end date.
everything is working fine...email is also sending..
But my problem is i want to send email to multiple users if there are 2 rows match in table with my conditions then email is gone to both the users.
But my code only send email to only single users..not all users.
I want email is gone to all users one by one.
public function certificateExpired()
{
$this->autoRender = False;
$this->loadModel('Certificate');
$data = $this->Certificate->find("all", array(
'recursive' => -1, // should be used with joins
'fields' => array('User.*', 'Certificate.*'),
'joins' => array(
array(
'table' => 'users',
'alias' => 'User',
'type' => 'LEFT',
'conditions' => array('User.id = Certificate.user_id')
)
),
'conditions' => array('Certificate.is_expirable' => 1,'Certificate.status' => 1)
));
foreach ($data as $row) {
$currentdate = date("Y-m-d");
$date = $row['Certificate']['end_date'];
$newdate = strtotime($date .' -1 months');
$enddate = date('Y-m-d', $newdate);
if ($currentdate >= $enddate) {
//For sending email
$data['email'] = $row['User']['email'];
$data['name'] = $row['User']['name'];
$data['document_name'] = $row['Certificate']['name'];
$data['templateid'] = 19;
$send_mail = $this->EmailFunctions->certificateExpiredTemplate($data);
if ($send_mail) {
$this->redirect(array('controller' => 'Dashboards', 'action' => 'shipperDashboard'));
}
}
}
}

foreach ($data as $row) {
$currentdate = date("Y-m-d");
$date = $row['Certificate']['end_date'];
$newdate = strtotime($date .' -1 months');
$enddate = date('Y-m-d', $newdate);
if ($currentdate >= $enddate) {
//For sending email
$data['email'] = $row['User']['email'];
$data['name'] = $row['User']['name'];
$data['document_name'] = $row['Certificate']['name'];
$data['templateid'] = 19;
$send_mail = $this->EmailFunctions->certificateExpiredTemplate($data);
}
}
$this->redirect(array('controller' => 'Dashboards', 'action' => 'shipperDashboard'));
Change the foreach loop as above.

Related

Create attendance for employee when pressing the check in button and set the status when check in on time or late

I have a problem about creating a record for attendance of an employee using DATE() and TIME() with NOW() in laravel. I have the table Attendance with column to store the record into database.
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->date('attendance_date')->nullable();
$table->string('scan_in_location')->nullable();
$table->string('scan_out_location')->nullable();
$table->time('scan_in_time')->nullable();
$table->time('scan_out_time')->nullable();
$table->time('work_hour')->nullable();
$table->time('work_hour_total')->nullable();
$table->time('lunch_break')->default('01:00:00');
$table->integer('scan_in_status')->nullable();
$table->integer('scan_out_status')->nullable();
$table->timestamps();
When the employee press CHECK IN on mobile, the record to will stored in column (user_id, scan_in_time, scan_in_location, scan_in_status) but when i only do
$attendance = new Attendance();
if ($this->user->attendance()->save($attendance))
return response()->json([
'success' => true,
'attendance' => $attendance
]);
else
return response()->json([
'success' => false,
'message' => 'Sorry, check in attendance could not be added'
], 500);
This code runs smooth with the account based on user_id. But when i press Create, i want to stored (user_id, scan_in_location, scan_in_time, scan_in_status) and this code return MariaDB version
//declare variable for taking current date - time
$user_id = request('user_id');
//check attendance using user_id
$res = Attendance::select('id')
->where('user_id' , '=' , $user_id)
->where('attendance_date', '=' , DB::RAW('DATE(NOW())'))
->where('user_id' , '!=' , null)
->where('scan_in_time', '!=' , null)
->where('scan_out_time', '=', null)->get()->count();
//set status 0 - Absent, 1 - On time, 2 - Late, 3 - very late, 4 - On leave
$attendance_status = Attendance::where('user_id', '=' , $user_id)
->select(DB::RAW("CASE WHEN TIME(NOW()) >= '08:30:00' AND TIME(NOW()) < '09:00:00' THEN '2' WHEN TIME(NOW()) > '09:00:00' THEN '3' ELSE '1'))
->value('scan_in_status');
if($res > 0){
$res = DB::RAW("UPDATE attendances SET scan_out_time = NOW(),scan_out_location = ? ,work_hour = TIMESTAMPDIFF(MINUTE, scan_in_time, scan_out_time,lunch_break), work_hour_total = TIMESTAMPDIFF(MINUTE, scan_in_time, scan_out_time) WHERE `user_id` = ? AND NOT scan_in_time IS NULL AND scan_out_time IS NULL", [$user_id, $user_id, $scan_out_location]);
return response()->json(
array(
'success' => true,
'user_id' => $user_id,
'action' => 'SCAN_OUT',
'scan_out_location' => $scan_out_location,
'date' => date('Y/m/d'),
'time' => date('H:i:s')
)
);
}else{
$res = DB::RAW("UPDATE attendances SET scan_in_time = NOW(), scan_in_location = ?, scan_in_status = ?
WHERE attendance_date = DATE(NOW()) AND `user_id` = ?", [$scan_in_location, $scan_in_status, $user_id]);
return response()->json(
array(
'success' => true,
'user_id' => $user_id,
'action' => 'SCAN_IN',
'scan_in_location' => $scan_in_location,
'date' => date('Y/m/d'),
'time' => date('H:i:s')
)
);
}
Can anyone give me some advises on this check in attendance using real time DATE(NOW()) and TIME(NOW)). Thank you.
First, get the authenticated user and then get his email-id or user id. after that on the check in button clicked get email-id or userid from button click Attendance of user will be created.
public function createAttandace(Request $req)
{
// getting authenticated userid
$Auth_userid = Auth::user()->userid;
// current year
$curr_year = Carbon::now()->format('Y');
// current month
$curr_month = Carbon::now()->format('F');
// current date
// $curr_date = date('d-m-Y ');
$curr_date = date('Y-m-d H:i:s');
// current day in string
$curr_day = Carbon::parse($curr_date)->format('l');
// current time
$curr_time = Carbon::now()->timezone('Asia/Kolkata')->format('H:i:s');
$lastId = DB::table('attandances')->orderBy('id', 'desc')->first();
$next_day = date('Y-m-d', strtotime(' +1 day'));
$prev_day = date('Y-m-d', strtotime(' -1 day'));
$curr_dateymd = date('Y-m-d');
$office_time = '9:0:0';
$isData = Attandance::where('userid', $Auth_userid)->where('att_date', $curr_dateymd)->get();
if ($isData->isEmpty()) {
$req->validate(
[
'email' => 'required|max:25',
],
[
'email.required' => 'Please enter email id!',
]
);
if($curr_time <= $office_time)
{
$user_attandace = new Attandance;
$user_attandace->userid = $Auth_userid;
$user_attandace->email = $req->email;
$user_attandace->year = $curr_year;
$user_attandace->month = $curr_month;
$user_attandace->att_date = $curr_date;
$user_attandace->att_day = $curr_day;
// $user_attandace->holiday = '-';
$user_attandace->in_time = $curr_time;
$user_attandace->save();
$success['email'] = $user_attandace->email;
$success['in_time'] = $user_attandace->in_time;
$response = [
'success' => true,
'status_code' => '201',
'data' => $success,
'message' => 'Attandance added successfully!!'
];
// in time email message
$fName = Auth::user()->first_name;
$lName = Auth::user()->last_name;
$fullName = $fName . ' ' . $lName;
$toMail = $success['email'];
$mailInTime = $success['in_time'];
$email = your#mail.com';
$someOthermail = 'test#gmail.com';
$details = [
'subject' => $fullName .' checked-in to the office on ' . $curr_date,
'title' => 'Congrats, you are on time. Keep it up!',
];
Mail::to($toMail)->bcc($someOthermail)->send(new attMail($details));
// in time email message
return response()->json($response, 201);
}else{
$user_attandace = new Attandance;
$user_attandace->userid = $Auth_userid;
$user_attandace->email = $req->email;
$user_attandace->year = $curr_year;
$user_attandace->month = $curr_month;
$user_attandace->att_date = $curr_date;
$user_attandace->att_day = $curr_day;
$user_attandace->att_status = 'Late';
$user_attandace->is_late = 1;
$user_attandace->in_time = $curr_time;
$user_attandace->save();
$success['email'] = $user_attandace->email;
$success['in_time'] = $user_attandace->in_time;
$response = [
'success' => true,
'status_code' => '201',
'data' => $success,
'message' => 'Attandance added successfully!!',
'late_message' => "Oops, you are late today. We hope that next time, you make it on time. Please take it on priority."
];
// in time email message
$fName = Auth::user()->first_name;
$lName = Auth::user()->last_name;
$fullName = $fName . ' ' . $lName;
$toMail = $success['email'];
$mailInTime = $success['in_time'];
$email = your#mail.com';
$someOthermail = 'test#gmail.com';
$details = [
'subject' => $fullName .' checked-in to the office on ' . $curr_date,
'title' => 'Oops, you are late today. We hope that next time, you make it on time. Please take it on priority.',
];
Mail::to($toMail)->bcc($someOthermail)->send(new attMail($details));
// in time email message
return response()->json($response, 201);
}
} elseif ($lastId->in_time != null) {
// dd();
$curr_dateymd = date('Y-m-d');
$curr_time = Carbon::now()->timezone('Asia/Kolkata')->format('H:i:s');
$in_time = new Carbon($lastId->in_time);
$out_time = new Carbon($curr_time);
$difff = $in_time->diff($out_time)->format('%H hr : %I min');
$success = DB::table('attandances')->where(['userid' => $Auth_userid])->update(['out_time' => $curr_time]);
$updateTotalHour = DB::table('attandances')->where(['userid' => $Auth_userid])->where(['att_date' => $curr_dateymd])->update(['total_hours' => $difff]);
$successData = Attandance::where('userid', $Auth_userid)->where('att_date', $curr_dateymd)->get();
$response = [
'success' => true,
'status_code' => '201',
'data' => $successData,
'message' => 'Attandance Punched successfully!!'
];
// Out time email message
$fName = Auth::user()->first_name;
$lName = Auth::user()->last_name;
$email = Auth::user()->email;
$fullName = $fName . ' '. $lName;
$toMail = $email;
$email = your#mail.com';
$someOthermail = 'test#gmail.com';
$details = [
'subject' => $fullName .' checked-out from the office on ' . $curr_dateymd . $curr_time,
'title' => $fullName .' checked-out from the office on ' . $curr_dateymd . $curr_time,
];
Mail::to($toMail)->bcc($someOthermail)->send(new attMail($details));
// dd("Mail Send Successfully");
// Out time email message
return response()->json($response, 201);
} else {
echo 'Nothing';
}
}

How to increase the performance of this function

How to increase the performance of following function in phalcon framework. There are thousands of records in the table. I tried different ways, but I am stuck the point. How can I increase the efficiency and reduce the execution time. Following are two methods:
public function currentmonthAction()
{
$payload = $this->request->getJsonRawBody();
$this->setDB();
$ticketsmodel = new Tickets();
$fromcitycondition = "";
if( isset($payload->city->id) )
{
$fromcitycondition = "and fromcity='{$payload->city->id}'";
}
try{
$date = new \Datetime($payload->date);
$year = $date->format('Y');
$month = $date->format('m');
$month = '08';
$daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
/* result for all cities passenger */
$result = array();
// get all cities permutations
$tmpcitiesdata = array();
$rawresultset = Tickets::find (
array(
'columns' => 'fromcity,tocity',
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) ". $fromcitycondition,
'group' => 'fromcity,tocity'
));
foreach ($rawresultset as $rawresult) {
$tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['fromcity'] = $rawresult->fromcity;
$tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['tocity'] = $rawresult->tocity;
}
//var_dump($rawresultset);
// get tickets sold based on cities combinations
$total = 0;
foreach ($tmpcitiesdata as $tmpcities) {
$rawresultset = Tickets::find (
array(
'columns' => 'customer',
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity'],
'group' => 'customer'
));
$totalsoldRaw = count($rawresultset);
// get ticket cancellations
$rawresultset = Tickets::find (
array(
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (3) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity']
));
//make sure cancellations are tickets cancellations not booking cancellations
foreach($rawresultset as $rawresult)
{
$resultNumber = Tickets::find("departure='$rawresult->departure' and seatno={$rawresult->seatno} and id < {$rawresult->id} and tickettype = 1" );
if( count($resultNumber) > 0 ){
$totalsoldRaw = $totalsoldRaw-1;
}
}
$total += $totalsoldRaw;
array_push($result, array('total' => $totalsoldRaw, 'fromcity' => Cities::findFirstById($tmpcities['fromcity'])->name, 'tocity' => Cities::findFirstById($tmpcities['tocity'])->name));
}
//sort result based on counts
arsort($result);
//cut result to max 6 cities
$result = array_slice($result, 0, 6);
$this->response->setContentType('application/json')
->setJsonContent(
array( 'totaltickets' => $total, "allcities" => $result )
);
$this->response->send();
return;
}
catch(\PDOException $e)
{
$this->response->setStatusCode('422','Invalid Payload');
$this->response->setContentType('application/json')
->setJsonContent(array(
'flash' => array(
'class' => 'danger',
'message' => $e->getMessage()
)
));
$this->response->send();
return;
}
}
Use count instead of count(result of find). Also are you sure in // get ticket cancellations you don't need group ? Then you can select all tickets for customers in 1,3 tickettype and then filter resultset.
Also can't your first $rawresulset can't be:
$rawresultset = Tickets::find (
array(
'columns' => 'customer,fromcity,tocity,tickettype ',
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1,3)".$fromcitycondition
'group' => 'customer,fromcity,tocity'
));
?
$ticketCanccelations = $rawresultset->filter(function($row){
if($row->tickettype == 3) {
return $row;
}
});
$resultNumber = Tickets::count("departure='$rawresult->departure' and seatno={$rawresult->seatno} and id < {$rawresult->id} and tickettype = 1" );

Wordpress search through meta_value thats an array

If i use an array for a meta value can i see if a value is in the array when querying it? I have a website that has events that has dates attached to it as a meta value and i need to see if an event is on a certain date through a search.
$dates[] = 05/02/2016
$dates[] = 06/02/2016
$dates[] = 06/02/2016
update_post_meta($event, 'show_dates', $dates);
if i add this to an event how could i check if the 'show_dates' contains a date searched for? below is what i have tried already
$wp_query->set('post_status', array('publish', 'future'));
$wp_query->set("meta_key", "show_dates");
$wp_query->set("orderby", "meta_value");
$wp_query->set("order", "ASC");
$startDate = parseDatePicker($_GET['StartDate'], new \DateTime());
if (!is_null($startDate)) {
$wp_query->set("meta_query", array(
array(
'key' => "show_dates",
'value' => $startDate->format("d/m/Y"),
'compare' => 'IN'
)
));
}
Ok so it turns out the answer to this was easier than i expected. As Wordpress serializes the data in the array you can use LIKE instead of IN which will check the serialized array to see if it contains that date.
$wp_query->set('post_status', array('publish', 'future'));
$wp_query->set("meta_key", "show_dates");
$wp_query->set("orderby", "meta_value");
$wp_query->set("order", "ASC");
$startDate = parseDatePicker($_GET['StartDate'], new \DateTime());
if (!is_null($startDate)) {
$wp_query->set("meta_query", array(
array(
'key' => "show_dates",
'value' => $startDate->format("d/m/Y"),
'compare' => 'LIKE'
)
));
}
my next problem was how to work with a range I managed to figure this out and have posted below incase nayone else has a similar problem
if (!is_null($startDate) && !is_null($endDate) && ($startDate->format('d/m/Y') != $endDate->format('d/m/Y'))) {
$wp_query->set("relation", "OR");
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($startDate, $interval, $endDate);
$dates[] = $startDate->format('d/m/Y');
foreach($period as $day){
$dates[] = array(
'key' => "next_showing_date",
'value' => $day->format('d/m/Y'),
'compare' => 'LIKE',
);
}
$wp_query->set("meta_query", $dates);
}

new Date into Array php

For Google Visualization I coded the JSON by hand (Messy I know) I did not think about ''s in NAME_TEAM which has recently come about an issue as my first team name was entered with an apostrophe. I have read this post and tried to implement php json_encode. I am having an issue with the dates. The new Date works fine in the old messy json format, however I get an error Fatal error: Class 'Date' when I try use anything similar for the Json_encode version. The format must be date for the visualization api to understand the values.
foreach ($data as $row) {
$dateArray = explode('-', $row['THE_DATE']);
$year = $dateArray[0];
$month = $dateArray[1] - 1;
$day = $dateArray[2];
$dataArray[] = "[new Date ($year, $month, $day), {$row['ORANGE']}, {$row['GREEN']}, '{$row['NAME_TEAM']}']";
$itemOutput[] = array(
new Date($year, $month, $day),
$row['ORANGE_SCORE'],
$row['GREEN_SCORE'],
$row['NAME_TEAM'],
);
}
echo "data.addRows(" . json_encode($itemOutput) . ");" ;
Data Table creation
function drawDashboard() {
//var data = new google.visualization.DataTable();
var data = new google.visualization.DataTable(<?php echo json_encode($itemOutput, JSON_NUMERIC_CHECK); ?>);
data.addColumn('date', 'Date');
data.addColumn('number', 'ORANGE_SCORE');
data.addColumn('number', 'GREEN_SCORE');
data.addColumn('string', 'NAME_TEAM');
// data.addRows(<?php echo '[' . implode(',', $dataArray) . ']'; ?>);
ARRAY FORMAT
{"c":[
{"Date":"new Date(2013, 9, 19)"},
{"ORANGE_SCORE":14},
{"GREEN_SCORE":7},
{"NAME_TEAM":"Trigon"}]
},
You can't use Date objects in JSON; the only way to transmit dates is via strings, but the DataTable.addRows method does not parse strings into Date objects, so you will have to convert to the full JSON structure to make this work. Here's an example:
$itemOutput = array(
'cols' => array(
array('type' => 'date', 'label' => 'Date'),
array('type' => 'number', 'label' => 'ORANGE_SCORE'),
array('type' => 'number', 'label' => 'GREEN_SCORE'),
array('type' => 'string', 'label' => 'NAME_TEAM')
),
'rows' => array()
);
foreach ($data as $row) {
$dateArray = explode('-', $row['THE_DATE']);
$year = $dateArray[0];
$month = $dateArray[1] - 1;
$day = $dateArray[2];
$itemOutput['rows'][] = array('c' => array(
array('v' => "Date($year, $month, $day)"),
array('v' => $row['ORANGE_SCORE']),
array('v' => $row['GREEN_SCORE']),
array('v' => $row['NAME_TEAM'])
));
}
Then in javascript:
var data = new google.visualization.DataTable(<?php echo json_encode($itemOutput, JSON_NUMERIC_CHECK); ?>);
If case 1 or 2, What do you want?
result is Case 2.
result link
source link
<?
/***
CREATE TABLE `24992408` (
`THE_DATE` TIMESTAMP NOT NULL DEFAULT DATE ,
`ORANGE` VARCHAR( 50 ) NOT NULL ,
`ORANGE_SCORE` INT( 11 ) NOT NULL ,
`GREEN` VARCHAR( 50 ) NOT NULL ,
`GREEN_SCORE` INT( 11 ) NOT NULL ,
`NAME_TEAM` VARCHAR( 50 ) NOT NULL
) ENGINE = MYISAM ;
INSERT INTO `24992408` (
`THE_DATE` ,
`ORANGE` ,
`ORANGE_SCORE` ,
`GREEN` ,
`GREEN_SCORE` ,
`NAME_TEAM`
)
VALUES (
'2014-07-28' , '1', '1', '1', '2', 'NAME_TEAM'
);
***/
$host = "localhost";
$name = "user";
$db = "db";
$password ="password";
function confirm_query($watever){
global $connection;
if (!$watever) {
die("Database query failed! " . mysqli_error($connection));
}
}
function select_query(){
global $connection;
$query = "SELECT * FROM `24992408` ";
$admin_set = mysqli_query($connection, $query);
confirm_query($admin_set);
return $admin_set;
}
$connection = mysqli_connect($host, $name, $password, $db);
$row = mysqli_fetch_assoc($admin_set = select_query());
$dateArray = explode('-', $row['THE_DATE']);
$year = $dateArray[0]; //echo $year; //2014
$month = $dateArray[1] - 1; //echo $month; //6
$day = $dateArray[2]; //echo $day; //28
// IN PUT
//$date1 = Date('Ymd',strtotime(sprintf('%04d%02d%02d',$year, $month, $day) ) ); //case 1
$date1 = "new Date ($year, $month, $day)"; //case 2
$dataArray[] = "[$date1, {$row['ORANGE']}, {$row['GREEN']}, '{$row['NAME_TEAM']}']";
$itemOutput[] = array( $date1, $row['ORANGE_SCORE'], $row['GREEN_SCORE'], $row['NAME_TEAM'] );
echo "data.addRows(" . json_encode($dataArray) . ");" ;
// OUT PUT
//data.addRows(["[20140628, 1, 2, 'NAME_TEAM']"]); // case 1 output
//data.addRows(["[new Date (2014, 6, 28), 1, 2, 'NAME_TEAM']"]); // case 2 output
?>

Logo change with date script

I just wondered if anybody can point me in the right direction: I'm looking to make a script whereby the logo on my site changes depending on the date; so for instance a haloween style one soon.
I started off by having 2 arrays, 1 of start dates and 1 of end dates(not sure even if this is the best way!):
<?php
$start_dates = array('01/01' => 'New Years',
'14/02' => 'Valentine Day',
'16/02/2010' => 'Pancake Day',
'17/03' => 'St Patricks Day',
'01/04' => 'April Fools',
'02/04/2010' => 'Easter',
'23/04' => 'St Georges Day',
'11/06/2010' => 'World Cup',
'31/10' => 'Halloween',
'05/11' => 'Guy Fawkes',
'11/11' => 'Armistice Day',
'16/10' => 'Today',
'15/12' => 'Christmas');
$end_dates = array( '08/01' => 'New Years',
'15/02' => 'Valentine Day',
'17/02/2010' => 'Pancake Day',
'18/03' => 'St Patricks Day',
'02/04' => 'April Fools',
'06/04/2010' => 'Easter',
'24/04' => 'St Georges Day',
'12/07/2010' => 'World Cup',
'01/11' => 'Halloween',
'06/11' => 'Guy Fawkes',
'12/11' => 'Armistice Day',
'17/10' => 'Today',
'01/01' => 'Christmas');
?>
Easy so far...the problemis that I need a way of working out if todays date falls between the start date and end date, then changing the image file name.
Its a long shot but I hope someone would be kind enough to help.
Thanks,
B.
like this
$events = array(
'New Year' => '01/01 01/08',
'Pancake Day' => '16/02/2010 17/02/2010',
//etc
);
echo find_event($events, '16/02');
where find_event() is
function mdy2time($date) {
$e = explode('/', $date);
if(count($e) < 3)
$e[] = '2010';
return strtotime("$e[1]-$e[0]-$e[2]");
}
function find_event($events, $date = null) {
$date = is_null($date) ? time() : mdy2time($date);
foreach($events as $name => $range) {
list($start, $end) = explode(' ', $range);
if($date >= mdy2time($start) && $date <= mdy2time($end))
return $name;
}
return null;
}
you should use an array more like this:
$dates = array();
$dates[] = array(
'name' => 'New Years'
'start' = '01/14',
'end' => '01/20',
'style' => 'haloween',
);
$dates[] = array(
//...
);
then you can get the style as follows:
$style='default';
// date as number e.g. 130 (january 30th)
$currDate = date('md',time()) * 1;
foreach ($dates AS $k => $v) {
$tmp = explode("/",$v['start'];
$start = ($tmp[1].$tmp[0])*1;
$tmp = explode("/",$v['end'];
$stop = ($tmp[1].$tmp[0])*1;
if ($start <= $currDate && $currDate < $stop) {
$style=$v['style'];
break;
}
}
echo 'style: '.$style;
Didn't check the code yet, so feel free to correct me if iam wrong.

Categories