Widespread Augmented Reality

Widespread Augmented Reality
Click on the image to get the Android Augmented Reality Heads up Display

Sunday, November 5, 2017

Android to PHP Calendar Week View

I need to display a week of data between the Sunday and Saturday that surround a given date.

Android:

SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//current date on mobile
String formattedDate = df.format(Calendar.getInstance().getTime());
//format the get
String url = HOME_PAGE+"/mobile/getsessions.php?sessDate="+formattedDate";

//
PHP:

$sessDate=mysqli_real_escape_string($dbconn, $sessDate);
//

//Get the day number out of 7 days
$weekdaynum = date('w', strtotime($sessDate));
// the following will handle what happens when a date falls on Sunday or Saturday.
// I DO NOT want to slide a week out in either direction
switch ($weekdaynum) {
case 0: // sunday
$startAtSun = strtotime('this sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));
break;
case 6: // saturday
$startAtSun = strtotime('last sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));
break;
default: // all other days
$startAtSun = strtotime('last sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));
break;
}

$format = 'Y-m-d';
$week_start = date($format, $startAtSun);
$week_end = date($format, $endAtSat);

Thursday, November 2, 2017

Android Program for Making a Week View

To follow up on the previous post, now that I have a PHP/MySQL program ready to send proprietary calendar data to the Android app, I need a week view to receive each appointment. The work done on this GitHub code is tremendous and is a good start. https://github.com/AnilMH/Android-WeekView-Demo.
To be continued...