| View previous topic :: View next topic |
| Author |
Message |
bksnbriefs
Joined: 11 Dec 2007 Posts: 3
|
Posted: Tue Dec 11, 2007 7:28 pm Post subject: Any Logic as to Display of All Day Events? |
|
|
Hi all ... I'm still evaluating the software, but wanted to know if there is any logic in the way all day events are ordered/displayed
If I enter
Wang
Adachi
Yu
Evans
Vu
Wargo
Zollman
Amabelie
Gray
as 9 seperate all day events in the order listed,
I get 9 all day events displayed in this order .. from top to bottom:
Zollman
Amabelie
Gray
Wargo
Vu
Adachi
Yu
Evans
Wang
This makes no sense and it is driving me crazy ... lots of people will share this calendar and the lack of any logic to find the data, will make it difficult to implement.
Any suggestions?
Thanks.
Tyler
[/img] |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Tue Dec 11, 2007 7:38 pm Post subject: |
|
|
Hi,
There is logic behind the sorting. The events are sorted by category. If they have the same or no categories associated with them, then they are sorted by the order that they are pulled from the db.
Would you like to customize this sorting? |
|
| Back to top |
|
 |
peiqinglong
Joined: 12 Dec 2007 Posts: 18
|
Posted: Tue Dec 11, 2007 9:39 pm Post subject: |
|
|
| We were hoping that it would sort by title or at the very least by order they were inputted. Is it just a random query of the database and then the results are displayed? |
|
| Back to top |
|
 |
bksnbriefs
Joined: 11 Dec 2007 Posts: 3
|
Posted: Tue Dec 11, 2007 10:03 pm Post subject: |
|
|
this is what I mean ... is there any logic as to how thyme pulls this stuff out of the database?
there seems to be no order as to how all day events are displayed.
 |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Wed Dec 12, 2007 12:27 am Post subject: |
|
|
Yes. They are sorted by category if they have the same start time. If you would like them to be sorted by title, do this:
*) Create a file in Thyme's customize/ folder called event_sort.php with the following contents:
| Code: |
<?php
function custom_event_sort($a,$b) {
if($a['allday'] && $b['allday'])
return strnatcasecmp($a['title'], $b['title']);
if($b['allday'] > 0) return 1;
if($a['allday'] > 0) return -1;
if($a['next'] == $b['next']) {
return strnatcasecmp($a['title'], $b['title']);
}
return ($a['next'] < $b['next']) ? -1 : 1;
}
|
Last edited by esoft_ian on Wed Dec 12, 2007 12:30 am; edited 2 times in total |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Wed Dec 12, 2007 12:28 am Post subject: |
|
|
| Ooops. Change that < at the top to a less-than symbol. < |
|
| Back to top |
|
 |
bksnbriefs
Joined: 11 Dec 2007 Posts: 3
|
Posted: Wed Dec 12, 2007 12:50 am Post subject: |
|
|
yes, but what happens when (as in the example above) they have the SAME category and the SAME time (an all day event) ... in what order do these all day events get pulled out from the dB and displayed? It seem like even if they have the same category and the same time, there is no logic as to how they are getting pulled out from the dB and displayed in the calendar. I wish it was alphabetical. This would make the most sense.
am I missing something?
thanks in advance for your help.
Tyler |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Wed Dec 12, 2007 1:00 am Post subject: |
|
|
I must be misunderstanding the question.
1) Events are pulled from the db in no specific order. There is no 'order' statement. All sorting is done by PHP.
2) Events are sorted by time
3) If they occur at the same time, they are then sorted by category.
4) If they have the same time and category, no further sorting is done.
I'm not sure what you're asking. You seem to be making the statement that there is no logic as to how they are being pulled from the db. They are being pulled from the DB by PHP. If you mean order, then yes, you are correct. Ordering is done through PHP rather than by the database. Making the database sort by title just to have PHP turn around and sort it by time would be inefficient. The snippet above will sort it by title after time though. Do you have a question on how to implement it? I apologize if I am misunderstanding the question. |
|
| Back to top |
|
 |
|