phpMyEdit date and time handling specification ---------------------------------------------- Based on the ideas by Shaun Johnston and Ondrej Jombik 28/Aug/2002 -- There are as you probably already know some 'datemask' and 'daterange' parameters in particular field of $fdd. I tested them, but they seem not to be used, so we can freely remove them. We will use only 'date' array for date specific things (as you created it). -- OK, now my idea how to handle whole date & time stuff. It will be probably long, but what can I do? :-) I suppose that you already know the function date(). If not, than please refer to you PHP manual. That function can format date & time in such extensible format. And my idea is to "emulate" date() function format and to be compatible as much as possible with this date() format during date entering in form. Specific options such as "Skip this field" check box will be covered by ['date']['flags'] field (similar to $fdd['options']) and the rest, what cannot by covered by two previous will get own ['date']['something']. So we have: ['date']['mask'] - this defines mask for date & time form edit ['date']['flags'] - this defines flags for date & time form edit Now description how to parse ['date']['mask']. We must realize, that it is impossible to emulate it exactly and with all elements. We will emulate only _subset_ of elements (that ones that you have already programmed) and via _specific_ way. When I'm speaking about specific way I mean situations like following one: when printing date via date(), you can set up format, that show month in numeric and also character form (in one printing). But when using that format for date entering, it is strange to have two month input fields for one date. So we will use only the first one and the rest will be ignored (skipped). Also elements of format that we will not support during edit operation will be simply skipped. The main advantage of this is, that subset of supported elements can be extended in future. Another issue is, that user can use not all required elements in format. For example in date edition he/she will have only months and days but not years filed. For now, let make that it will be initialized to 0. In future, some kind of default values handling will be implemented, but I must firstly re-think this part. Any idea is of course welcome. Now ['date']['mask'] parsing algorithm is following. This is some kind of parsing engine specification. 1. Get next element (element is one character from mask). 2. Is it supported and its type not already used? If so go [5]. 3. Not supported. Is it backslashed character? Than print it. If it is unsupported element or its type was already used just skip it. 4. Go to [1]. 5. Now we have supported element. Show appropriate input field. 6. Mark that some type of element was used (type is year, month, day, ...). This is because when another element with the same type will occur, it will be skiped. 7. Go to [1]. OK, we have algorithm. Now we need to know the list of supported elements, its type and imput field. I compile this table according to features you have already implemented. element supported? type input ------- ---------- ---- ----- a currently unsuported [hour] N/A A currently unsuported [hour] N/A B unsupported N/A N/A d supported day select: 01, 02, ... 31 D unsupported ? N/A F supported month select: January ... December g currently unsupported [hour] N/A G supported hour select: 0, 1, 2, ... 24 h currently unsupported [hour] N/A H supported hour select: 00, 01, 02, ... 24 i supported minutes select: 00, 01, 02, ... 59 I unsupported N/A N/A j supported day select: 1, 2, ... 31 l unsupported ? N/A L unsupported ? N/A m supported month select: 01, 02, 03, ... 12 M supported month select: Jan, Feb, ... Dec n supported month select: 1, 2, 3, ... 12 r unsupported ? N/A s supported seconds select: 00, 01, 02, ... 59 S unsupported ? N/A t unsupported ? N/A T currently unsupported ? N/A U unsupported ? N/A w unsupported ? N/A Y supported year select: 1997, 1998, ... 2002 y supported year select: 97, 98, ... 02 z unsupported ? N/A Z unsupported ? N/A Unsupported means that it has no sence to implement it. Curently unsupported means that it should be implement in future. Type in backets mean that element does not fully defines that type. Don't worry about 00 vs. 0, 01 vs. 1, 02 vs. 2 and so on. You can just implement only one type of graduations in select inputs. So for example elements 'm' and 'n' will be the same. It could be fixed in future. We should add one special element (what is not in date()). Character '!'. If it will be present before element, values in input will be in descending order. By default they will be in ascending order. No go to ['date']['flags']. The following list describes list of possible flags: V - format inputs vertically (if not present horizontally will be used) D - label divs used s - skip field is present and it is unchecked (by default it is not present) S - skip field is present and it is pre-checked That are all flags for now. The advantage is, that it could be easily extended in future and no other keys needed to be added into ['date'] array. And at the end let discover what from your options was not covered by ['date']['mask'] and ['date']['flags']. I see only these: ['date']['year']['lower'] and ['date']['year']['higher'] We can leave them as they are. I want suggest change of default interval to current_year - 5 and current_year + 5. But it is only a detail.