function showDocument(&$drow) { global $ISSUE_TYPES, $auth_med; $docdate = $drow['docdate']; echo "<tr class='text docrow' id='" . htmlspecialchars($drow['id'], ENT_QUOTES) . "' title='" . htmlspecialchars(xl('View document'), ENT_QUOTES) . "'>\n"; // show date echo "<td>" . htmlspecialchars(oeFormatShortDate($docdate), ENT_NOQUOTES) . "</td>\n"; // show associated issue, if any echo "<td>"; if ($auth_med) { $irow = sqlQuery("SELECT type, title, begdate " . "FROM lists WHERE " . "id = ? " . "LIMIT 1", array($drow['list_id'])); if ($irow) { $tcode = $irow['type']; if ($ISSUE_TYPES[$tcode]) { $tcode = $ISSUE_TYPES[$tcode][2]; } echo htmlspecialchars("{$tcode}: " . $irow['title'], ENT_NOQUOTES); } } else { echo "(" . htmlspecialchars(xl('No access'), ENT_NOQUOTES) . ")"; } echo "</td>\n"; // show document name and category echo "<td colspan='3'>" . htmlspecialchars(xl('Document') . ": " . basename($drow['url']) . ' (' . xl_document_category($drow['name']) . ')', ENT_NOQUOTES) . "</td>\n"; // skip billing and insurance columns if (!$GLOBALS['athletic_team']) { echo "<td colspan=5> </td>\n"; } echo "</tr>\n"; }
function add_node_action_process() { if ($_POST['process'] != "true") { return; } $name = $_POST['name']; $parent_is = $_POST['parent_is']; $parent_name = $this->tree->get_node_name($parent_is); $this->tree->add_node($parent_is, $name); $trans_message = xl('Sub-category', '', '', ' ') . "'" . xl_document_category($name) . "'" . xl('successfully added to category,', '', ' ', ' ') . "'" . $parent_name . "'"; $this->assign("message", $trans_message); $this->_state = false; return $this->list_action(); }
$myrow2 = sqlQuery($query); if ($myrow2) { $parentId = $myrow2['id']; $query = "SELECT id, name FROM categories WHERE parent='{$parentId}'"; $resNew1 = sqlStatement($query); while ($myrows3 = sqlFetchArray($resNew1)) { $categoryId = $myrows3['id']; $nameDoc = $myrows3['name']; $query = "SELECT documents.date, documents.id " . "FROM documents " . "INNER JOIN categories_to_documents " . "ON categories_to_documents.document_id=documents.id " . "WHERE categories_to_documents.category_id='{$categoryId}' " . "AND documents.foreign_id='{$pid}' " . "ORDER BY documents.date DESC"; $resNew2 = sqlStatement($query); $counterFlag = false; //flag used to check for empty categories while ($myrows4 = sqlFetchArray($resNew2)) { $dateTimeDoc = $myrows4['date']; $idDoc = $myrows4['id']; echo "<br>"; echo "<a href='{$web_root}/controller.php?document&retrieve&patient_id={$pid}&document_id=" . $idDoc . "&as_file=true'>" . xl_document_category($nameDoc) . "</a> " . $dateTimeDoc; $counterFlag = true; } // if no associated docs with category then show it's empty if (!$counterFlag) { echo "<br>"; echo $nameDoc . " <span style='color:red;'>[" . xl('EMPTY') . "]</span>"; } } } ?> </div> </body> </html>
$query = "SELECT id, name FROM categories WHERE parent=?"; $resNew1 = sqlStatement($query, array($parentId)); while ($myrows3 = sqlFetchArray($resNew1)) { $categoryId = $myrows3['id']; $nameDoc = $myrows3['name']; $query = "SELECT documents.date, documents.id " . "FROM documents " . "INNER JOIN categories_to_documents " . "ON categories_to_documents.document_id=documents.id " . "WHERE categories_to_documents.category_id=? " . "AND documents.foreign_id=? " . "ORDER BY documents.date DESC"; $resNew2 = sqlStatement($query, array($categoryId, $pid)); $limitCounter = 0; // limit to one entry per category while (($myrows4 = sqlFetchArray($resNew2)) && $limitCounter == 0) { $dateTimeDoc = $myrows4['date']; // remove time from datetime stamp $tempParse = explode(" ", $dateTimeDoc); $dateDoc = $tempParse[0]; $idDoc = $myrows4['id']; echo "<a href='{$web_root}/controller.php?document&retrieve&patient_id=" . htmlspecialchars($pid, ENT_QUOTES) . "&document_id=" . htmlspecialchars($idDoc, ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" . htmlspecialchars(xl_document_category($nameDoc), ENT_NOQUOTES) . "</a> " . htmlspecialchars($dateDoc, ENT_NOQUOTES); echo "<br>"; $limitCounter = $limitCounter + 1; $counterFlag = true; } } } if (!$counterFlag) { echo " " . htmlspecialchars(xl('None'), ENT_NOQUOTES); } ?> </div> <?php } // close advanced dir block // This is a feature for a specific client. -- Rod
xl('Documents', 'e'); ?> </span>:<br> <ul> <?php // show available documents $db = $GLOBALS['adodb']['db']; $sql = "SELECT d.id, d.url, c.name FROM documents AS d " . "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " . "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " . "d.foreign_id = " . $db->qstr($pid); $result = $db->Execute($sql); if ($db->ErrorMsg()) { echo $db->ErrorMsg(); } while ($result && !$result->EOF) { echo "<li class='bold'>"; echo '<input type="checkbox" name="documents[]" value="' . $result->fields['id'] . '">'; echo ' <i>' . xl_document_category($result->fields['name']) . "</i>"; echo ' ' . xl('Name') . ': <i>' . basename($result->fields['url']) . "</i>"; echo '</li>'; $result->MoveNext(); } ?> </ul> </form> <input type="button" class="genreport" value="<?php xl('Generate Report', 'e'); ?> " /> <input type="button" class="genpdfrep" value="<?php xl('Download PDF', 'e'); ?>
"ON categories_to_documents.document_id=documents.id " . "WHERE categories_to_documents.category_id=? " . "AND documents.foreign_id=? " . "ORDER BY documents.date DESC"; $resNew2 = sqlStatement($query, array($categoryId, $pid) ); $limitCounter = 0; // limit to one entry per category while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) { $dateTimeDoc = $myrows4['date']; // remove time from datetime stamp $tempParse = explode(" ",$dateTimeDoc); $dateDoc = $tempParse[0]; $idDoc = $myrows4['id']; echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" . htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" . htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" . htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " . htmlspecialchars($dateDoc,ENT_NOQUOTES); echo "<br>"; $limitCounter = $limitCounter + 1; $counterFlag = true; } } } if (!$counterFlag) { echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES); } ?> </div> <?php } // close advanced dir block // This is a feature for a specific client. -- Rod if ($GLOBALS['cene_specific']) {
function load_tree() { $root = $this->_root; $tree = array(); $tree_tmp = array(); //get the left and right value of the root node $sql = "SELECT * FROM " . $this->_table . " WHERE id='" . $root . "'"; if ($this->root_type == ROOT_TYPE_NAME) { $sql = "SELECT * FROM " . $this->_table . " WHERE name='" . $root . "'"; } $result = $this->_db->Execute($sql) or die("Error: " . $this->_db->ErrorMsg()); $row = array(); if ($result && !$result->EOF) { $row = $result->fields; } else { $this->tree = array(); } // start with an empty right stack $right = array(); // now, retrieve all descendants of the root node $sql = "SELECT * FROM " . $this->_table . " WHERE lft BETWEEN " . $row['lft'] . " AND " . $row['rght'] . " ORDER BY parent,name ASC;"; $result = $this->_db->Execute($sql); $this->_id_name = array(); while ($result && !$result->EOF) { $ar = array(); $row = $result->fields; //create a lookup table of id to name for every node that will end up in this tree, this is used //by the array building code below to find the chain of parents for each node // ADDED below by BM on 06-2009 to translate categories, if applicable if ($this->_table == "categories") { $this->_id_name[$row['id']] = array("id" => $row['id'], "name" => xl_document_category($row['name']), "parent" => $row['parent']); } else { $this->_id_name[$row['id']] = array("id" => $row['id'], "name" => $row['name'], "parent" => $row['parent']); } // only check stack if there is one if (count($right) > 0) { // check if we should remove a node from the stack while ($right[count($right) - 1] < $row['rght']) { array_pop($right); } } //set up necessary variables to then determine the chain of parents for each node $parent = $row['parent']; $loop = 0; //this is a string that gets evaled below to create the array representing the tree $ar_string = "[\"" . $row['id'] . "\"] = \$row[\"value\"]"; //if parent is 0 then the node has no parents, the number of nodes in the id_name lookup always includes any nodes //that could be the parent of any future node in the record set, the order is deterministic because of the algorithm while ($parent != 0 && $loop < count($this->_id_name)) { $ar_string = "[\"" . $this->_id_name[$parent]['id'] . "\"]" . $ar_string; $loop++; $parent = $this->_id_name[$parent]['parent']; } $ar_string = '$ar' . $ar_string . ";"; //echo $ar_string; //now eval the string to create the tree array //there must be a more efficient way to do this than eval? eval($ar_string); //merge the evaled array with all of the already exsiting tree elements, //merge recursive is used so that no keys are replaced in other words a key //with a specific value will not be replace but instead that value will be turned into an array //consisting of the previous value and the new value $tree = array_merge_n($tree, $ar); // add this node to the stack $right[] = $row['rght']; $result->MoveNext(); } $this->tree = $tree; }