Page 1 of 1

TimeZoneOffset

Posted: Fri Oct 30, 2009 3:40 pm
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

Re: TimeZoneOffset

Posted: Fri Oct 30, 2009 7:02 pm
by Eric!
How are you setting 'userTimeZoneOffset' for your session data? Can you post that code?

Re: TimeZoneOffset

Posted: Sat Oct 31, 2009 8:15 am
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

Re: TimeZoneOffset

Posted: Sat Oct 31, 2009 5:41 pm
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.

Re: TimeZoneOffset

Posted: Mon Nov 02, 2009 12:23 pm
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

Re: TimeZoneOffset

Posted: Mon Nov 02, 2009 12:26 pm
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.