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); }
// Author followups // // // Author followups // case 'followups': if (!allowed_author($author, 'r')) { die("Access denied"); } show_page_subtitle(_T('author_subtitle_followups', array('author' => get_person_name($author_data))), 'cases_followups'); $foo = get_date_range_fields(); $date_start = $foo['date_start']; $date_end = $foo['date_end']; echo $foo['html']; echo "<p class=\"normal_text\">\n"; show_listfu_start('author'); $q = "SELECT id_followup, id_case, date_start, date_end, type, description, case_stage, hidden\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_start) <= UNIX_TIMESTAMP('" . $date_end . "')"; } // Add ordering if ($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); $list_pos = 0; if (isset($_REQUEST['list_pos'])) { $list_pos = $_REQUEST['list_pos']; }
echo '<p class="normal_text">' . "\n"; $case_list = new LcmCaseListUI(); $case_list->setSearchTerm($find_case_string); $case_list->start(); $case_list->printList(); $case_list->finish(); echo "</p>\n"; echo '<p><a href="edit_case.php?case=0" class="create_new_lnk">' . _T('case_button_new') . "</a></p>\n"; echo '<p><a href="edit_client.php" class="create_new_lnk">' . _T('client_button_new') . "</a></p>\n"; // // List of recent follow-ups // echo '<a name="fu"></a>' . "\n"; show_page_subtitle(_T('case_subtitle_recent_followups')); echo '<p class="normal_text">' . "\n"; show_listfu_start('general'); $q = "SELECT fu.id_case, fu.id_followup, fu.date_start, fu.date_end, fu.type, fu.description, fu.case_stage,\n\t\t\tfu.hidden, a.name_first, a.name_middle, a.name_last, c.title\n\t\tFROM lcm_followup as fu, lcm_author as a, lcm_case as c \n\t\tWHERE fu.id_author = a.id_author \n\t\t AND c.id_case = fu.id_case "; // Author of the follow-up // START - Get list of cases on which author is assigned $q_temp = "SELECT c.id_case\n\t\t\t\tFROM lcm_case_author as ca, lcm_case as c\n\t\t\t\tWHERE ca.id_case = c.id_case\n\t\t\t\t AND ca.id_author = " . $author_session['id_author']; if ($prefs['case_period'] < 1900) { // since X days // $q_temp .= " AND TO_DAYS(NOW()) - TO_DAYS(c.date_creation) < " . $prefs['case_period']; $q_temp .= " AND " . lcm_query_subst_time('c.date_creation', 'NOW()') . ' < ' . $prefs['case_period'] * 3600 * 24; } else { // for year X // $q_temp .= " AND YEAR(date_creation) = " . $prefs['case_period']; $q_temp .= " AND " . lcm_query_trunc_field('c.date_creation', 'year') . ' = ' . $prefs['case_period']; } $r_temp = lcm_query($q_temp); $list_cases = array();