function printFollowups($show_filters = false) { $cpt = 0; $my_list_pos = intval(_request('list_pos', 0)); show_page_subtitle(_T('case_subtitle_followups'), 'cases_followups'); // Show filters (if not shown in ajaxed page) if ($show_filters) { // By default, show from "case creation date" to NOW(). $link = new Link(); $link->delVar('date_start_day'); $link->delVar('date_start_month'); $link->delVar('date_start_year'); $link->delVar('date_end_day'); $link->delVar('date_end_month'); $link->delVar('date_end_year'); echo $link->getForm(); $date_end = get_datetime_from_array($_REQUEST, 'date_end', 'end', '0000-00-00 00:00:00'); // date('Y-m-d H:i:s')); $date_start = get_datetime_from_array($_REQUEST, 'date_start', 'start', '0000-00-00 00:00:00'); // $row['date_creation']); echo _Ti('time_input_date_start'); echo get_date_inputs('date_start', $date_start); echo _Ti('time_input_date_end'); echo get_date_inputs('date_end', $date_end); echo ' <button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n"; echo "</form>\n"; echo "<div style='margin-bottom: 4px;'> </div>\n"; // FIXME patch for now (leave small space between filter and list) } show_listfu_start('general', false); for ($cpt = 0, $this->getFollowupStart(); !$this->getFollowupDone(); $cpt++) { $item = $this->getFollowupIterator(); show_listfu_item($item, $cpt); } if (!$cpt) { echo "No followups"; } // TRAD show_list_end($my_list_pos, $this->getFollowupTotal(), true); }
$list_pos = 0; } // Position to the page info start if ($list_pos > 0) { if (!lcm_data_seek($result, $list_pos)) { lcm_panic("Error seeking position {$list_pos} in the result"); } } $show_all = false; } elseif ($list_pos == 'all') { $show_all = true; } // Process the output of the query // [ML] I don't know if I'm drinking too much coffee, but "$list_pos == 'all'" would always return 1 for ($i = 0; ($i < $prefs['page_rows'] || $show_all) && ($row = lcm_fetch_array($result)); $i++) { show_listfu_item($row, $i, 'author'); } show_list_end($list_pos, $number_of_rows, true); echo "</p>\n"; // Total hours for period $q = "SELECT sum(IF(UNIX_TIMESTAMP(date_end) > UNIX_TIMESTAMP(date_start), \n\t\t\t\t\t\t\t\tUNIX_TIMESTAMP(date_end)-UNIX_TIMESTAMP(date_start), 0)) as total_time\n\t\t\t\t\tFROM lcm_followup\n\t\t\t\t\tWHERE id_author = {$author}\n\t\t\t\t\t AND UNIX_TIMESTAMP(date_start) >= UNIX_TIMESTAMP('" . $date_start . "') "; if ($date_end != "-1") { $q .= " AND UNIX_TIMESTAMP(date_end) <= UNIX_TIMESTAMP('" . $date_end . "')"; } $q .= "\tGROUP BY id_author"; $result = lcm_query($q); $row = lcm_fetch_array($result); echo '<p class="normal_text">'; echo _Ti('generic_input_total') . format_time_interval($row['total_time'], true) . " " . _T('time_info_short_hour') . "<br />\n"; echo "</p>\n"; break;
// Add ordering $fu_order = "DESC"; if (isset($_REQUEST['fu_order'])) { if ($_REQUEST['fu_order'] == 'ASC' || $_REQUEST['fu_order'] == 'DESC') { $fu_order = $_REQUEST['fu_order']; } } $q .= " ORDER BY date_start {$fu_order}, id_followup {$fu_order}"; $result = lcm_query($q); // Check for correct start position of the list $number_of_rows = lcm_num_rows($result); $fu_list_pos = 0; if (isset($_REQUEST['fu_list_pos'])) { $fu_list_pos = $_REQUEST['fu_list_pos']; } if ($fu_list_pos >= $number_of_rows) { $fu_list_pos = 0; } // Position to the page info start if ($fu_list_pos > 0) { if (!lcm_data_seek($result, $fu_list_pos)) { lcm_panic("Error seeking position {$fu_list_pos} in the result"); } } // Process the output of the query for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) { show_listfu_item($row, $i, 'general'); } show_list_end($fu_list_pos, $number_of_rows, false, 'fu'); echo "</p>\n"; lcm_page_end();