function view_action($patient_id = "", $doc_id) { // Added by Rod to support document delete: global $gacl_object, $phpgacl_location; global $ISSUE_TYPES; require_once dirname(__FILE__) . "/../library/acl.inc"; require_once dirname(__FILE__) . "/../library/lists.inc"; $d = new Document($doc_id); $n = new Note(); $notes = $n->notes_factory($doc_id); $this->assign("file", $d); $this->assign("web_path", $this->_link("retrieve") . "document_id=" . $d->get_id() . "&"); $this->assign("NOTE_ACTION", $this->_link("note")); $this->assign("MOVE_ACTION", $this->_link("move") . "document_id=" . $d->get_id() . "&process=true"); $this->assign("hide_encryption", $GLOBALS['hide_document_encryption']); // Added by Rod to support document delete: $delete_string = ''; if (acl_check('admin', 'super')) { $delete_string = "<a href='' class='css_button' onclick='return deleteme(" . $d->get_id() . ")'><span><font color='red'>" . xl('Delete') . "</font></span></a>"; } $this->assign("delete_string", $delete_string); $this->assign("REFRESH_ACTION", $this->_link("list")); $this->assign("VALIDATE_ACTION", $this->_link("validate") . "document_id=" . $d->get_id() . "&process=true"); // Added by Rod to support document date update: $this->assign("DOCDATE", $d->get_docdate()); $this->assign("UPDATE_ACTION", $this->_link("update") . "document_id=" . $d->get_id() . "&process=true"); // Added by Rod to support document issue update: $issues_options = "<option value='0'>-- " . xl('Select Issue') . " --</option>"; $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " . "pid = {$patient_id} " . "ORDER BY type, begdate"); while ($irow = sqlFetchArray($ires)) { $desc = $irow['type']; if ($ISSUE_TYPES[$desc]) { $desc = $ISSUE_TYPES[$desc][2]; } $desc .= ": " . $irow['begdate'] . " " . htmlspecialchars(substr($irow['title'], 0, 40)); $sel = $irow['id'] == $d->get_list_id() ? ' selected' : ''; $issues_options .= "<option value='" . $irow['id'] . "'{$sel}>{$desc}</option>"; } $this->assign("ISSUES_LIST", $issues_options); $this->assign("notes", $notes); $this->_last_node = null; $menu = new HTML_TreeMenu(); //pass an empty array because we don't want the documents for each category showing up in this list box $rnode = $this->_array_recurse($this->tree->tree, array()); $menu->addItem($rnode); $treeMenu_listbox =& new HTML_TreeMenu_Listbox($menu, array("promoText" => xl('Move Document to Category:'))); $this->assign("tree_html_listbox", $treeMenu_listbox->toHTML()); $activity = $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_view.html"); $this->assign("activity", $activity); return $this->list_action($patient_id); }
// if ($key == "documents") { echo "<hr />"; echo "<div class='text documents'>"; foreach ($val as $valkey => $valvalue) { $document_id = $valvalue; if (!is_numeric($document_id)) { continue; } $d = new Document($document_id); $fname = basename($d->get_url()); $couch_docid = $d->get_couch_docid(); $couch_revid = $d->get_couch_revid(); $extension = substr($fname, strrpos($fname, ".")); echo "<h1>" . xl('Document') . " '" . $fname . "'</h1>"; $notes = Note::notes_factory($d->get_id()); if (!empty($notes)) { echo "<table>"; } foreach ($notes as $note) { echo '<tr>'; echo '<td>' . xl('Note') . ' #' . $note->get_id() . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . xl('Date') . ': ' . oeFormatShortDate($note->get_date()) . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . $note->get_note() . '<br><br></td>'; echo '</tr>'; } if (!empty($notes)) {
// if ($key == "documents") { echo "<hr />"; echo "<div class='text documents'>"; foreach ($val as $valkey => $valvalue) { $document_id = $valvalue; if (!is_numeric($document_id)) { continue; } $d = new Document($document_id); $fname = basename($d->get_url()); $couch_docid = $d->get_couch_docid(); $couch_revid = $d->get_couch_revid(); echo "<h1>" . xl('Document') . " '" . $fname . "'</h1>"; $n = new Note(); $notes = $n->notes_factory($d->get_id()); if (!empty($notes)) { echo "<table>"; } foreach ($notes as $note) { echo '<tr>'; echo '<td>' . xl('Note') . ' #' . $note->get_id() . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . xl('Date') . ': ' . oeFormatShortDate($note->get_date()) . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . $note->get_note() . '<br><br></td>'; echo '</tr>'; } if (!empty($notes)) {
function view_action($patient_id = "", $doc_id) { // Added by Rod to support document delete: global $gacl_object, $phpgacl_location; global $ISSUE_TYPES; require_once dirname(__FILE__) . "/../library/acl.inc"; require_once dirname(__FILE__) . "/../library/lists.inc"; $d = new Document($doc_id); $n = new Note(); $notes = $n->notes_factory($doc_id); $this->assign("file", $d); $this->assign("web_path", $this->_link("retrieve") . "document_id=" . $d->get_id() . "&"); $this->assign("NOTE_ACTION", $this->_link("note")); $this->assign("MOVE_ACTION", $this->_link("move") . "document_id=" . $d->get_id() . "&process=true"); $this->assign("hide_encryption", $GLOBALS['hide_document_encryption']); // Added by Rod to support document delete: $delete_string = ''; if (acl_check('admin', 'super')) { $delete_string = "<a href='' class='css_button' onclick='return deleteme(" . $d->get_id() . ")'><span><font color='red'>" . xl('Delete') . "</font></span></a>"; } $this->assign("delete_string", $delete_string); $this->assign("REFRESH_ACTION", $this->_link("list")); $this->assign("VALIDATE_ACTION", $this->_link("validate") . "document_id=" . $d->get_id() . "&process=true"); // Added by Rod to support document date update: $this->assign("DOCDATE", $d->get_docdate()); $this->assign("UPDATE_ACTION", $this->_link("update") . "document_id=" . $d->get_id() . "&process=true"); // Added by Rod to support document issue update: $issues_options = "<option value='0'>-- " . xl('Select Issue') . " --</option>"; $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " . "pid = ? " . "ORDER BY type, begdate", array($patient_id)); while ($irow = sqlFetchArray($ires)) { $desc = $irow['type']; if ($ISSUE_TYPES[$desc]) { $desc = $ISSUE_TYPES[$desc][2]; } $desc .= ": " . $irow['begdate'] . " " . htmlspecialchars(substr($irow['title'], 0, 40)); $sel = $irow['id'] == $d->get_list_id() ? ' selected' : ''; $issues_options .= "<option value='" . $irow['id'] . "'{$sel}>{$desc}</option>"; } $this->assign("ISSUES_LIST", $issues_options); // For tagging to encounter // Populate the dropdown with patient's encounter list $this->assign("TAG_ACTION", $this->_link("tag") . "document_id=" . $d->get_id() . "&process=true"); $encOptions = "<option value='0'>-- " . xlt('Select Encounter') . " --</option>"; $result_docs = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " . "LEFT JOIN openemr_postcalendar_categories ON fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? ORDER BY fe.date desc", array($patient_id)); if (sqlNumRows($result_docs) > 0) { while ($row_result_docs = sqlFetchArray($result_docs)) { $sel_enc = $row_result_docs['encounter'] == $d->get_encounter_id() ? ' selected' : ''; $encOptions .= "<option value='" . attr($row_result_docs['encounter']) . "' {$sel_enc}>" . oeFormatShortDate(date('Y-m-d', strtotime($row_result_docs['date']))) . "-" . text($row_result_docs['pc_catname']) . "</option>"; } } $this->assign("ENC_LIST", $encOptions); //Populate the dropdown with category list $visit_category_list = "<option value='0'>-- " . xlt('Select One') . " --</option>"; $cres = sqlStatement("SELECT pc_catid, pc_catname FROM openemr_postcalendar_categories ORDER BY pc_catname"); while ($crow = sqlFetchArray($cres)) { $catid = $crow['pc_catid']; if ($catid < 9 && $catid != 5) { continue; } // Applying same logic as in new encounter page. $visit_category_list .= "<option value='" . attr($catid) . "'>" . text(xl_appt_category($crow['pc_catname'])) . "</option>\n"; } $this->assign("VISIT_CATEGORY_LIST", $visit_category_list); $this->assign("notes", $notes); $this->_last_node = null; $menu = new HTML_TreeMenu(); //pass an empty array because we don't want the documents for each category showing up in this list box $rnode = $this->_array_recurse($this->tree->tree, array()); $menu->addItem($rnode); $treeMenu_listbox = new HTML_TreeMenu_Listbox($menu, array("promoText" => xl('Move Document to Category:'))); $this->assign("tree_html_listbox", $treeMenu_listbox->toHTML()); $activity = $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_view.html"); $this->assign("activity", $activity); return $this->list_action($patient_id); }
function display_draw_image($zone, $encounter, $pid) { global $form_folder; global $web_root; global $PDF_OUTPUT; $side = "OU"; $base_name = $pid . "_" . $encounter . "_" . $side . "_" . $zone . "_VIEW"; $filename = $base_name . ".jpg"; $sql = "SELECT * from documents where documents.url like '%" . $filename . "'"; $doc = sqlQuery($sql); $document_id = $doc['id']; if ($document_id > '1' && is_numeric($document_id)) { $d = new Document($document_id); $fname = basename($d->get_url()); $couch_docid = $d->get_couch_docid(); $couch_revid = $d->get_couch_revid(); $extension = substr($fname, strrpos($fname, ".")); $notes = Note::notes_factory($d->get_id()); if (!empty($notes)) { echo "<table>"; } foreach ($notes as $note) { echo '<tr>'; echo '<td>' . xlt('Note') . ' #' . $note->get_id() . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . xlt('Date') . ': ' . oeFormatShortDate($note->get_date()) . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . $note->get_note() . '<br /><br /></td>'; echo '</tr>'; } if (!empty($notes)) { echo "</table>"; } $url_file = $d->get_url_filepath(); if ($couch_docid && $couch_revid) { $url_file = $d->get_couch_url($pid, $encounter); } // Collect filename and path $from_all = explode("/", $url_file); $from_filename = array_pop($from_all); $from_pathname_array = array(); for ($i = 0; $i < $d->get_path_depth(); $i++) { $from_pathname_array[] = array_pop($from_all); } $from_pathname_array = array_reverse($from_pathname_array); $from_pathname = implode("/", $from_pathname_array); if ($couch_docid && $couch_revid) { $from_file = $GLOBALS['OE_SITE_DIR'] . '/documents/temp/' . $from_filename; $to_file = substr($from_file, 0, strrpos($from_file, '.')) . '_converted.jpg'; } else { $from_file = $GLOBALS["fileroot"] . "/sites/" . $_SESSION['site_id'] . '/documents/' . $from_pathname . '/' . $from_filename; $to_file = substr($from_file, 0, strrpos($from_file, '.')) . '_converted.jpg'; } // if ($extension == ".png" || $extension == ".jpg" || $extension == ".jpeg" || $extension == ".gif") { if ($PDF_OUTPUT) { echo "<img src='" . $from_file . "' style='width:220px;height:120px;'>"; } else { $filetoshow = $GLOBALS['webroot'] . "/controller.php?document&retrieve&patient_id={$pid}&document_id=" . $doc['id'] . "&as_file=false&blahblah=" . rand(); echo "<img src='" . $filetoshow . "' style='width:220px;height:120px;'>"; } } else { $filetoshow = "../../forms/" . $form_folder . "/images/" . $side . "_" . $zone . "_BASE.jpg"; if ($PDF_OUTPUT) { $filetoshow = $GLOBALS["webroot"] . "/interface/forms/" . $form_folder . "/images/" . $side . "_" . $zone . "_BASE.jpg"; } // uncomment to show base image, no touch up by user. // echo "<img src='". $filetoshow."' style='width:220px;height:120px;'>"; } return; }