TimeZoneOffset

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
butty22
Forum Newbie
Posts: 8
Joined: Tue Apr 21, 2009 2:23 pm

TimeZoneOffset

Post by butty22 »

Hello,

Please i need your help. I have a system that users can use to punch in and out. This system has been working fine however the time went one hour behind on sunday and since then the system has refused to work. I am using IIS server and this is code....

Code: Select all

public function showPunchView($messageType = null, $message = null) {
 
 
 
        $attendanceObj = new AttendanceRecord();
 
        $records['attRecord'] = $attendanceObj->fetchRecords($_SESSION['empID'], null, null, AttendanceRecord::STATUS_ACTIVE,
 
                                                                AttendanceRecord::DB_FIELD_PUNCHIN_TIME, 'DESC', '0, 1', true);
 
        $records['editMode'] = Config::getAttendanceEmpChangeTime();
 
        $records['empId'] = $_SESSION['empID'];
 
        $timeStampDiff = ($_SESSION['userTimeZoneOffset'] - round(date('Z')/3600, 1))*3600;
 
        $records['currentDate'] = date('Y-m-d', time() $timeStampDiff);
 
        $records['currentTime'] = date('H:i', time() $timeStampDiff);
 
        $records['messageType'] = $messageType;
 
        $records['message'] = $message;
 
        $sysConfObj = new sysConf();
 
        $records['timeInputHint'] = $sysConfObj->getTimeInputHint();
Now i get an error message that sya undefined index:userTimeZoneoffset. Your help is greatly appreciated
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: TimeZoneOffset

Post by Eric! »

How are you setting 'userTimeZoneOffset' for your session data? Can you post that code?
butty22
Forum Newbie
Posts: 8
Joined: Tue Apr 21, 2009 2:23 pm

Re: TimeZoneOffset

Post by butty22 »

Hello Eric,

thanks for your response, i am not sure where the code is. I would dig it out and post it or generally where is it meant to be?

Thanks once again
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: TimeZoneOffset

Post by Eric! »

There must be some php code that sets up your session. Somewhere in your pages there should be a $_SESSION[''userTimeZoneOffset']=something before this function is called.
butty22
Forum Newbie
Posts: 8
Joined: Tue Apr 21, 2009 2:23 pm

Re: TimeZoneOffset

Post by butty22 »

Hello,

Just wondering, do you mean this code?

Code: Select all

/* Attendance Methods: Begin */
 
    public function showPunchView($messageType = null, $message = null) {
 
        $attendanceObj = new AttendanceRecord();
        $records['attRecord'] = $attendanceObj->fetchRecords($_SESSION['empID'], null, null, AttendanceRecord::STATUS_ACTIVE,
                                                                AttendanceRecord::DB_FIELD_PUNCHIN_TIME, 'DESC', '0, 1', true);
        $records['editMode'] = Config::getAttendanceEmpChangeTime();
        $records['empId'] = $_SESSION['empID'];
        $timeStampDiff = ($_SESSION['userTimeZoneOffset'] - round(date('Z')/3600, 1))*3600;
        $records['currentDate'] = date('Y-m-d', time()+$timeStampDiff);
        $records['currentTime'] = date('H:i', time()+$timeStampDiff);
        $records['messageType'] = $messageType;
        $records['message'] = $message;
 
        $sysConfObj = new sysConf();
        $records['timeInputHint'] = $sysConfObj->getTimeInputHint();
 
        $path = "/templates/time/punchView.php";
        $template = new TemplateMerger($records, $path);
        $template->display();
    }
 
    public function savePunch() {
 
        $extractor = new EXTRACTOR_AttendanceRecord($_SESSION['userTimeZoneOffset'], round(date('Z')/3600, 1));
        $attendanceObj = $extractor->parsePunchData($_POST);
 
        $attendanceId = $attendanceObj->getAttendanceId();
 
I tried attaching the whole file but it didnt allow php and txt extensions. Thanks for your help
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: TimeZoneOffset

Post by Eric! »

No, there should be a place in your code where $_SESSION['userTimeZoneOffset'] EQUALS something. However I have a feeling that you and I are just going to go in circles trying to debug this in a forum. Perhaps you can pay someone to fix it for you.
Post Reply