// Id followup // echo '<td class="tbl_cont_' . $css . '"><img src="images/lcm/dotted_angle.gif" width="15" height="15" align="left" /> ' . $row['id_followup'] . '</td>'; // Start date echo '<td class="tbl_cont_' . $css . '">' . format_date($row['date_start'], 'short') . '</td>'; // Time echo '<td class="tbl_cont_' . $css . '">'; $fu_date_end = vider_date($row['date_end']); if ($prefs['time_intervals'] == 'absolute') { if ($fu_date_end) { echo format_date($row['date_end'], 'short'); } } else { $fu_time = $fu_date_end ? strtotime($row['date_end']) - strtotime($row['date_start']) : 0; echo format_time_interval_prefs($fu_time); } echo '</td>'; // Author initials echo '<td class="tbl_cont_' . $css . '">' . get_person_initials($row) . '</td>'; // Type echo '<td class="tbl_cont_' . $css . '">' . _Tkw('followups', $row['type']) . '</td>'; // Description $short_description = get_fu_description($row); echo '<td class="tbl_cont_' . $css . '">'; echo '<a href="fu_det.php?followup=' . $row['id_followup'] . '" class="content_link">' . $short_description . '</a>'; echo '</td>'; echo "</tr>\n"; } show_list_end($fu_list_pos, $number_of_rows, false, 'fu'); echo "</p>\n"; echo '<p><a href="edit_case.php?case=0" class="create_new_lnk">' . _T('case_button_new') . "</a></p>\n"; lcm_page_end();
function printList() { global $prefs; // Select cases of which the current user is author $q = "SELECT e.id_expense, e.id_case, e.id_author, e.status, e.type, \n\t\t\t\te.description, e.date_creation, e.date_update, e.pub_read,\n\t\t\t\te.pub_write, a.name_first, a.name_middle, a.name_last,\n\t\t\t\tcount(ec.id_expense) as nb_comments, c.title as case_title\n\t\t\tFROM lcm_expense as e\n\t\t\tLEFT JOIN lcm_expense_comment as ec ON (ec.id_expense = e.id_expense)\n\t\t\tLEFT JOIN lcm_author as a ON (a.id_author = e.id_author) \n\t\t\tLEFT JOIN lcm_case as c ON (c.id_case = e.id_case) "; $q .= " WHERE (1=1 "; if ($this->search) { $q .= " AND ("; if (is_numeric($this->search)) { $q .= " e.id_expense = " . $this->search . " OR "; } $q .= " e.description LIKE '%" . $this->search . "%' "; $q .= " )"; } if ($this->id_case) { $q .= " AND e.id_case = " . $this->id_case; } $q .= ")"; // // Apply filters to SQL // // Case owner TODO // $q .= " AND " . $q_owner; // Period (date_creation) to show if ($prefs['case_period'] < 1900) { // since X days // $q .= " AND TO_DAYS(NOW()) - TO_DAYS(date_creation) < " . $prefs['case_period']; $q .= " AND " . lcm_query_subst_time('e.date_creation', 'NOW()') . ' < ' . $prefs['case_period'] * 3600 * 24; } else { // for year X $q .= " AND " . lcm_query_trunc_field('e.date_creation', 'year') . ' = ' . $prefs['case_period']; } $q .= " GROUP BY e.id_expense, e.id_case, e.id_author, e.status, e.type, e.description, e.date_creation, e.date_update, e.pub_read, e.pub_write, a.name_first, a.name_middle, a.name_last, c.title "; // // Sort // $sort_clauses = array(); $sort_allow = array('ASC' => 1, 'DESC' => 1); // Sort by request type if ($sort_allow[_request('type_order')]) { $sort_clauses[] = "type " . _request('type_order'); } if ($sort_allow[_request('status_order')]) { $sort_clauses[] = "status " . _request('status_order'); } // Sort cases by creation or update date if ($sort_allow[_request('date_order')]) { $sort_clauses[] = "date_creation " . _request('date_order'); } elseif ($sort_allow[_request('upddate_order')]) { $sort_clauses[] = "date_update " . _request('upddate_order'); } if (count($sort_clauses)) { $q .= " ORDER BY " . implode(', ', $sort_clauses); } else { $q .= " ORDER BY date_creation DESC"; } // default sort $result = lcm_query($q); // Check for correct start position of the list $this->number_of_rows = lcm_num_rows($result); if ($this->list_pos >= $this->number_of_rows) { $this->list_pos = 0; } // Position to the page info start if ($this->list_pos > 0) { if (!lcm_data_seek($result, $this->list_pos)) { lcm_panic("Error seeking position " . $this->list_pos . " in the result"); } } for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) { $css = $i % 2 ? "dark" : "light"; echo "<tr>\n"; // Expense ID echo "<td class='tbl_cont_" . $css . "'>"; echo highlight_matches($row['id_expense'], $this->search); echo "</td>\n"; // Author echo "<td class='tbl_cont_" . $css . "'>"; echo get_person_initials($row); echo "</td>\n"; // Attached to case.. echo "<td class='tbl_cont_" . $css . "'>"; if ($row['id_case']) { echo '<abbr title="' . $row['case_title'] . '">' . $row['id_case'] . '</a>'; } echo "</td>\n"; // Date creation echo "<td class='tbl_cont_" . $css . "'>"; echo format_date($row['date_creation'], 'short'); echo "</td>\n"; // Type echo "<td class='tbl_cont_" . $css . "'>"; echo _Tkw('_exptypes', $row['type']); echo "</td>\n"; // Description global $fu_desc_len; // configure via my_options.php with $GLOBALS['fu_desc_len'] = NNN; $more_desc = _request('more_desc', 0); $desc_length = isset($fu_desc_len) && $fu_desc_len > 0 ? $fu_desc_len : 256; $description = $row['description']; if ($more_desc || strlen(lcm_utf8_decode($row['description'])) < $desc_length) { $description = $row['description']; } else { $description = substr($row['description'], 0, $desc_length) . '...'; } echo "<td class='tbl_cont_" . $css . "'>"; echo '<a class="content_link" href="exp_det.php?expense=' . $row['id_expense'] . '">'; echo nl2br(highlight_matches($description, $this->search)); echo "</a>"; echo "</td>\n"; // # Comments echo "<td class='tbl_cont_" . $css . "'>"; echo $row['nb_comments']; echo "</td>\n"; // Date update echo "<td class='tbl_cont_" . $css . "'>"; if ($row['date_update'] != $row['date_creation']) { echo format_date($row['date_update'], 'short'); } echo "</td>\n"; // Status echo "<td class='tbl_cont_" . $css . "'>"; echo _T('expense_status_option_' . $row['status']); echo "</td>\n"; echo "</tr>\n"; } }
function show_listfu_item($item, $cpt, $screen = 'general') { global $prefs; echo "<tr>\n"; // Id case if ($screen == 'case') { echo '<td valign="top"><abbr title="' . $item['title'] . '">' . $item['id_case'] . '</abbr></td>'; } else { echo '<td valign="top">' . $item['id_followup'] . '</abbr></td>'; } // Start date echo '<td valign="top">' . format_date($item['date_start'], 'short') . '</td>'; // Time echo '<td valign="top">'; $fu_date_end = vider_date($item['date_end']); if ($prefs['time_intervals'] == 'absolute') { if ($fu_date_end) { echo format_date($item['date_end'], 'short'); } } else { $fu_time = $fu_date_end ? strtotime($item['date_end']) - strtotime($item['date_start']) : 0; echo format_time_interval($fu_time, $prefs['time_intervals_notation'] == 'hours_only'); } echo '</td>'; // Author initials if ($screen != 'author') { echo '<td valign="top">' . get_person_initials($item) . '</td>'; } // Type echo '<td valign="top">' . _Tkw('followups', $item['type']) . '</td>'; // Description $cut_fu = isset($_REQUEST['more_fu_desc']) && $_REQUEST['more_fu_desc'] ? false : true; $short_description = get_fu_description($item, $cut_fu); if ($item['hidden'] == 'Y') { $short_description .= ' <img src="images/jimmac/stock_trash-16.png" ' . 'height="16" width="16" border="0" ' . 'title="' . _T('fu_info_is_deleted') . '" ' . 'alt="' . _T('fu_info_is_deleted') . '" />'; } echo '<td valign="top">'; echo '<a href="fu_det.php?followup=' . $item['id_followup'] . '" class="content_link">' . $short_description . '</a>'; echo '</td>'; echo "</tr>\n"; }