function printGeneral($show_subtitle = true, $allow_edit = true) { // Read site configuration preferences $case_assignment_date = read_meta('case_assignment_date'); $case_alledged_crime = read_meta('case_alledged_crime'); $case_legal_reason = read_meta('case_legal_reason'); if ($show_subtitle) { show_page_subtitle(_T('generic_subtitle_general'), 'cases_intro'); } $add = allowed($this->data['case'], 'w'); $edit = allowed($this->data['case'], 'e'); $admin = allowed($this->data['case'], 'a'); // // Show various stages info // $q = "SELECT * FROM lcm_stage WHERE id_case = " . $this->data['case'] . " ORDER BY date_creation DESC"; $result = lcm_query($q); echo '<div style="float: right; width: 180px;">'; show_page_subtitle(_T('case_subtitle_stage'), 'cases_intro'); echo '<ul>'; while ($row = lcm_fetch_array($result)) { echo '<li>' . format_date($row['date_creation'], 'date_short') . ': <br/>' . _Tkw('stage', $row['kw_case_stage']) . '</li>'; } echo "</ul>\n"; echo "</div>\n"; // // Show case info // echo '<ul class="info">'; // Case ID echo '<li>' . '<span class="label1">' . _Ti('case_input_id') . '</span>' . '<span class="value1">' . show_case_id($this->getDataInt('id_case')) . '</span>' . "</li>\n"; // Case title echo '<li>' . '<span class="label1">' . _Ti('case_input_title') . '</span>' . '<span class="value1">' . $this->getDataString('title') . '</span>' . "</li>\n"; // Show users assigned to the case $q = "SELECT id_case, a.id_author, name_first, name_middle, name_last\n\t\t\t\tFROM lcm_case_author as ca, lcm_author as a\n\t\t\t\tWHERE (id_case=" . $this->getDataInt('id_case') . "\n\t\t\t\t AND ca.id_author = a.id_author)"; $authors_result = lcm_query($q); $cpt = 0; if (lcm_num_rows($authors_result) > 1) { echo '<li>' . '<span class="label2">' . _Ti('case_input_authors') . '</span>'; } else { echo '<li>' . '<span class="label2">' . _Ti('case_input_author') . '</span>'; } while ($author = lcm_fetch_array($authors_result)) { if ($cpt) { echo "; "; } $name = htmlspecialchars(get_person_name($author)); echo '<span class="value2">' . '<a href="author_det.php?author=' . $author['id_author'] . '" class="content_link"' . ' title="' . _T('case_tooltip_view_author_details', array('author' => $name)) . '">' . $name . "</a>" . '</span>'; if ($admin) { echo '<span class="noprint">'; echo ' <a href="edit_auth.php?case=' . $this->getDataInt('id_case') . '&author=' . $author['id_author'] . '"' . ' title="' . _T('case_tooltip_view_access_rights', array('author' => $name)) . '">' . '<img src="images/jimmac/stock_access_rights-16.png" width="16" height="16" border="0" alt="" />' . '</a>'; echo "</span>\n"; } $cpt++; } // [ML]Â FIXME Double-check if this is OK here in all scenarios if ($admin) { echo '<span class="noprint">'; echo '<a href="sel_auth.php?case=' . $this->getDataInt('id_case') . '" title="' . _T('add_user_case') . '">' . '<img src="images/jimmac/stock_attach-16.png" width="16" height="16" border="0" alt="' . _T('add_user_case') . '" />' . '</a>'; echo "</span>\n"; } echo "</li>\n"; echo '<li>' . '<span class="label2">' . _Ti('case_input_date_creation') . '</span>' . '<span class="value2">' . format_date($this->getDataString('date_creation')) . '</span>' . "</li>\n"; if ($case_assignment_date == 'yes') { // [ML] Case is assigned/unassigned when authors are added/remove // + case is auto-assigned when created. if ($this->data['date_assignment']) { echo '<li>' . '<span class="label2">' . _Ti('case_input_date_assigned') . '</span>' . '<span class="value2">' . format_date($this->getDataString('date_assignment')) . '</span>' . "</li>\n"; } } // Total time spent on case (redundant with "reports/times") $query = "SELECT " . lcm_query_sum_time('fu.date_start', 'fu.date_end') . " as time\n\t\t\t\t\tFROM lcm_followup as fu \n\t\t\t\t\tWHERE fu.id_case = " . $this->getDataInt('id_case', '__ASSERT__') . "\n\t\t\t\t\t AND fu.hidden = 'N'"; $result = lcm_query($query); $row_tmp = lcm_fetch_array($result); echo '<li>' . '<span class="label2">' . _Ti('case_input_total_time') . '</span>' . '<span class="value2">' . format_time_interval_prefs($row_tmp['time']) . ' ' . _T('time_info_short_hour') . '</span>' . "</li>\n"; if (substr($case_legal_reason, 0, 3) == 'yes') { echo '<li>' . '<span class="label2">' . _Ti('case_input_legal_reason') . '</span>' . '<span class="value2">' . clean_output($this->getDataString('legal_reason')) . '</span>' . "</li>\n"; } if (substr($case_alledged_crime, 0, 3) == 'yes') { echo '<li>' . '<span class="label2">' . _Ti('case_input_alledged_crime') . '</span>' . '<span class="value2">' . clean_output($this->getDataString('alledged_crime')) . '</span>' . "</li>\n"; } // Keywords show_all_keywords('case', $this->getDataInt('id_case')); if ($this->data['stage']) { // There should always be a stage, but in early versions, < 0.6.0, // it might have been missing, causing a lcm_panic(). $stage = get_kw_from_name('stage', $this->getDataString('stage', '__ASSERT__')); $id_stage = $stage['id_keyword']; show_all_keywords('stage', $this->getDataInt('id_case'), $id_stage); } // Notes echo '<li class="large">' . '<span class="label2">' . _Ti('case_input_notes') . '</span>' . '<span class="value2">' . nl2br($this->getDataString('notes')) . '</span>' . "</li>\n"; // echo "</ul>\n"; // echo "<p class='normal_text'>"; if ($allow_edit && $admin) { // Show case status (if closed, only site admin can re-open) echo '<li>'; echo "<form action='edit_fu.php' method='get'>\n"; echo "<input type='hidden' name='case' value='" . $this->getDataInt('id_case') . "' />\n"; echo _Ti('case_input_status'); echo "<select name='type' class='sel_frm' onchange='lcm_show(\"submit_status\")'>\n"; // in inc/inc_acc.php $statuses = get_possible_case_statuses($this->getDataString('status')); foreach ($statuses as $s => $futype) { $sel = $s == $this->getDataString('status') ? ' selected="selected"' : ''; echo '<option value="' . $futype . '"' . $sel . '>' . _T('case_status_option_' . $s) . "</option>\n"; } echo "</select>\n"; echo "<button type='submit' name='submit' id='submit_status' value='set_status' style='visibility: hidden;' class='simple_form_btn'>" . _T('button_validate') . "</button>\n"; echo "</form>\n"; // Show case stage echo "<form action='edit_fu.php' method='get'>\n"; echo "<input type='hidden' name='case' value='" . $this->getDataInt('id_case') . "' />\n"; echo "<input type='hidden' name='type' value='stage_change' />\n"; echo _Ti('case_input_stage'); echo "<select name='stage' class='sel_frm' onchange='lcm_show(\"submit_stage\")'>\n"; $stage_kws = get_keywords_in_group_name('stage'); foreach ($stage_kws as $kw) { $sel = $kw['name'] == $this->data['stage'] ? ' selected="selected"' : ''; echo "\t\t<option value='" . $kw['name'] . "'" . "{$sel}>" . _T(remove_number_prefix($kw['title'])) . "</option>\n"; } echo "</select>\n"; echo "<button type='submit' name='submit' id='submit_stage' value='set_stage' style='visibility: hidden;' class='simple_form_btn'>" . _T('button_validate') . "</button>\n"; echo "</form>\n"; echo "</li>\n"; } else { echo '<li>' . _Ti('case_input_status') . _T('case_status_option_' . $this->getDataString('status')) . "</li>\n"; echo '<li>' . _Ti('case_input_stage') . _Tkw('stage', $this->data['stage']) . "</li>\n"; } // If case closed, show conclusion if ($this->data['status'] == 'closed') { // get the last relevant conclusion $q_tmp = "SELECT * \n\t\t\t\tFROM lcm_followup\n\t\t\t\tWHERE id_case = " . $this->getDataInt('id_case') . "\n\t\t\t\tAND (type = 'conclusion'\n\t\t\t\t\t\tOR type = 'stage_change')\n\t\t\t\tORDER BY id_followup DESC \n\t\t\t\tLIMIT 1"; $r_tmp = lcm_query($q_tmp); $row_tmp = lcm_fetch_array($r_tmp); if ($row_tmp) { echo '<li>'; echo '<div style="background: #f0f0f0; padding: 4px; border: 1px solid #aaa;">'; echo _Ti('fu_input_conclusion'); echo get_fu_description($row_tmp, false); echo ' <a class="content_link" href="fu_det.php?followup=' . $row_tmp['id_followup'] . '">...</a>'; echo "</div>\n"; echo "</li>\n"; } } echo '<li>' . _Ti('case_input_collaboration'); echo "<ul style='padding-top: 1px; margin-top: 1px;'>"; echo "<li>" . _Ti('case_input_collaboration_read') . _T('info_' . ($this->getDataInt('public') ? 'yes' : 'no')) . "</li>\n"; echo "<li>" . _Ti('case_input_collaboration_write') . _T('info_' . ($this->getDataInt('pub_write') ? 'yes' : 'no')) . "</li>\n"; echo "</ul>\n"; echo "</li>\n"; echo "</ul>\n"; // clear the right column with stage info echo "<div style='clear: right;'></div>\n"; }
function show_listcase_item($item, $cpt, $find_case_string = '', $url = '__DEFAULT__', $url_extra = '') { include_lcm('inc_acc'); $ac_read = allowed($item['id_case'], 'r'); $ac_edit = allowed($item['id_case'], 'e'); $css = $cpt % 2 ? "dark" : "light"; if ($url == '__DEFAULT__') { $url = 'case_det.php?case=' . $item['id_case']; } echo "<tr>\n"; // Case ID echo "<td class='tbl_cont_" . $css . "'>"; echo highlight_matches(show_case_id($item['id_case']), $find_case_string); echo "</td>\n"; // Date creation echo "<td class='tbl_cont_" . $css . "'>"; echo format_date($item['date_creation'], 'date_short'); echo "</td>\n"; // Title echo "<td class='tbl_cont_" . $css . "'>"; if ($ac_read) { echo '<a href="' . $url . '" class="content_link" ' . $url_extra . '>'; } echo highlight_matches(clean_output($item['title']), $find_case_string); if (allowed($item['id_case'], 'r')) { echo '</a>'; } echo "</td>\n"; // Status echo "<td class='tbl_cont_" . $css . "'>"; if ($item['status']) { echo _T('case_status_option_' . $item['status']); } echo "</td>\n"; echo "</tr>\n"; }