Jump to content

Recommended Posts

Posted

I've been looking around the code in app.config.php and spotted this.

Config::Set('DAYS_COMPACT',  array('Su', 'M', 'T', 'W', 'Th', 'F', 'S', 'Su'));

Config::Set('DAYS_LONG', 
array('Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
)
);

I know as much about PHP as I know about quantum mechanics, so I am curious as to why Sunday/Su is in the array twice. Sorry if this is a dumb question.

Posted

He is asking why is it there twice, it is curious why it is in there twice myself, i have not removed it, and i dont think crashgordon is going to either, just wants to know why it is there.

Cheers

Dan C

  • Administrators
Posted

I am not 100% sure but I think Nabeel built it that way to try and combat the 0123456 and 1234567 issues with flight schedules and the sql tables and the excell import file where 0 or 7 could be a Sunday. I think..... :blink:

and Crash, if you figure out how to add a Sunday to the weekend, please let me know, I have lost a lot of hair trying to figure it out. :unsure:

  • Administrators
Posted

Yup to account for 0 being Sunday, and if 7 is used for Sunday. PHP uses 0 for Sunday with date('w'). It's in there twice since array numbering starts from 0, so the first Sunday is 0, Monday 1... then on through the 2nd Sunday in which ends up being 7. Which is why you enter the dates with 0-7, it's easy to map to the name that way.

I added a line in the importer to replace any 7's with 0's so then you can use 1-7. The Sunday was in there twice for if you did use 1-7, it would show up properly, but I didn't realize date('w') returns 0 for a Sunday. Here's the fix (at least the schedule view piece, which I also added into schedule_results.tpl for the next):

http://forum.phpvms....dpost__p__17915

But any imports should now convert 7s to 0s (as of 932/next update this week)

Posted

Tried that. Excel always tells me that if I save as a csv, I will lose all formating. Sure enough, the saved file never has the leading zero.

Just thought of something. I could open the file with a text editor and replace all 123456 with 0123456. That wouldn'

t work for those that weren't scheduled for all days. but would relieve me of a lot of subsequent editing.

  • Administrators
Posted

Do the numbers have to be consecutive? If not you could just do 1234560

They don't have to be consecutive.

But, as of 932 you can use 7 for Sunday

  • Moderators
Posted

I never think outside the box. I probably wouldn't have thought of doing that in a thousand years.unsure.gif

I useally leave the days of week blank and when i upload it, it will auto fill everyday format.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...