| @@ 728-744 (lines=17) @@ | ||
| 725 | ||
| 726 | break; |
|
| 727 | ||
| 728 | case COLUMN_TYPE_AGE: |
|
| 729 | ||
| 730 | array_push($clause_select, '(' . $time . ' - r.creation_time) as opened_age'); |
|
| 731 | array_push($clause_select, '(r.closure_time - r.creation_time) as closed_age'); |
|
| 732 | ||
| 733 | if ($i == $sort) |
|
| 734 | { |
|
| 735 | array_push($clause_order, 'closed_age asc'); |
|
| 736 | array_push($clause_order, 'opened_age asc'); |
|
| 737 | } |
|
| 738 | elseif (-$i == $sort) |
|
| 739 | { |
|
| 740 | array_push($clause_order, 'closed_age desc'); |
|
| 741 | array_push($clause_order, 'opened_age desc'); |
|
| 742 | } |
|
| 743 | ||
| 744 | break; |
|
| 745 | ||
| 746 | case COLUMN_TYPE_CREATION_DATE: |
|
| 747 | ||
| @@ 791-809 (lines=19) @@ | ||
| 788 | ||
| 789 | break; |
|
| 790 | ||
| 791 | case COLUMN_TYPE_LAST_STATE: |
|
| 792 | ||
| 793 | array_push($clause_select, 'st.state_time'); |
|
| 794 | array_push($clause_from, '(select record_id, max(event_time) as state_time' . |
|
| 795 | ' from tbl_events' . |
|
| 796 | ' where event_type = 1 or event_type = 4' . |
|
| 797 | ' group by record_id) st'); |
|
| 798 | array_push($clause_where, 'r.record_id = st.record_id'); |
|
| 799 | ||
| 800 | if ($i == $sort) |
|
| 801 | { |
|
| 802 | array_push($clause_order, 'state_time asc'); |
|
| 803 | } |
|
| 804 | elseif (-$i == $sort) |
|
| 805 | { |
|
| 806 | array_push($clause_order, 'state_time desc'); |
|
| 807 | } |
|
| 808 | ||
| 809 | break; |
|
| 810 | ||
| 811 | case COLUMN_TYPE_FLOAT: |
|
| 812 | ||