CrashGordon Posted April 27, 2010 Report Posted April 27, 2010 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. Quote
Moderators mark1million Posted April 27, 2010 Moderators Report Posted April 27, 2010 It does say its meant to be in there twice and not to remove Quote
Strider Posted April 27, 2010 Report Posted April 27, 2010 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 Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 I wasn't thinking of removing it. Just trying to wrap what's left of my brain around it. My next question is can it be ported to reality. I could use a longer weekend. Quote
Administrators simpilot Posted April 27, 2010 Administrators Report Posted April 27, 2010 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..... 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. Quote
Administrators Nabeel Posted April 27, 2010 Administrators Report Posted April 27, 2010 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) Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 Hmmm, now if I can only get Excel to keep and save the leading zero while saving a CSV. Quote
Tom Posted April 27, 2010 Report Posted April 27, 2010 Format all the cells needing a leading 0 to "Text" - should work. Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 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. Quote
Tom Posted April 27, 2010 Report Posted April 27, 2010 Do the numbers have to be consecutive? If not you could just do 1234560 Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 A great question! Never tried that. Will check it out later today. Quote
Administrators Nabeel Posted April 27, 2010 Administrators Report Posted April 27, 2010 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 Quote
TennShadow Posted April 27, 2010 Report Posted April 27, 2010 A great question! Never tried that. Will check it out later today. Yeap, that works. I've been doing that way since December. 1234560 Keith Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 I never think outside the box. I probably wouldn't have thought of doing that in a thousand years. Quote
Moderators Kyle Posted April 27, 2010 Moderators Report Posted April 27, 2010 I never think outside the box. I probably wouldn't have thought of doing that in a thousand years. I useally leave the days of week blank and when i upload it, it will auto fill everyday format. Quote
CrashGordon Posted April 27, 2010 Author Report Posted April 27, 2010 Who'da thunk it? That's even easier. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.