# href for close button $smarty->assign('breakfile', $breakfile); # Window bar title $smarty->assign('sWindowTitle', "{$LDAddress} :: {$LDListAll}"); # Buffer page output ob_start(); ?> <ul> <br> <?php if (is_object($address)) { if ($linecount) { echo str_replace("~nr~", $totalcount, $LDSearchFound) . ' ' . $LDShowing . ' ' . $pagen->BlockStartNr() . ' ' . $LDTo . ' ' . $pagen->BlockEndNr() . '.'; } else { echo str_replace('~nr~', '0', $LDSearchFound); } ?> <table border=0 cellpadding=2 cellspacing=1> <tr class="wardlisttitlerow"> <td><b> <?php if ($oitem == 'name') { $flag = TRUE; } else { $flag = FALSE; } echo $pagen->SortLink($LDCityTownName, 'name', $odir, $flag); ?>
</table> <p> <a href="<?php echo $breakfile; ?> "><img <?php echo createLDImgSrc($root_path, 'cancel.gif', '0'); ?> ></a> <p> <?php //echo $mode; if ($linecount) { echo '<hr width=80% align=left>' . str_replace("~nr~", $totalcount, $LDSearchFound) . ' ' . $LDShowing . ' ' . $pagen->BlockStartNr() . ' ' . $LDTo . ' ' . $pagen->BlockEndNr() . '.'; } else { echo str_replace('~nr~', '0', $LDSearchFound); } if ($enc_obj->record_count) { # Preload common icon images $img_male = createComIcon($root_path, 'spm.gif', '0', '', TRUE); $img_female = createComIcon($root_path, 'spf.gif', '0', '', TRUE); $bgimg = 'tableHeaderbg3.gif'; //$tbg= 'background="'.$root_path.'gui/img/common/'.$theme_com_icon.'/'.$bgimg.'"'; $tbg = 'class="adm_list_titlebar"'; ?> <table border=0 cellpadding=2 cellspacing=1> <tr bgcolor="#abcdef"> <td <?php
$smarty->assign('sHiddenInputs', '<input type="image" ' . createLDImgSrc($root_path, 'searchlamp.gif', '0', 'absmiddle') . '> <input type="hidden" name="sid" value="' . $sid . '"> <input type="hidden" name="lang" value="' . $lang . '"> <input type="hidden" name="noresize" value="' . $noresize . '"> <input type="hidden" name="target" value="' . $target . '"> <input type="hidden" name="user_origin" value="' . $user_origin . '"> <input type="hidden" name="origin" value="' . $origin . '"> <input type="hidden" name="retpath" value="' . $retpath . '"> <input type="hidden" name="aux1" value="' . $aux1 . '"> <input type="hidden" name="ipath" value="' . $ipath . '"> <input type="hidden" name="mode" value="search"> <input type="hidden" name="task" value="' . $task . '"'); $smarty->assign('sCancelButton', '<a href="patient.php' . URL_APPEND . '&target=search"><img ' . createLDImgSrc($root_path, 'cancel.gif', '0') . '></a>'); if ($mode == 'search' || $mode == 'paginate') { if ($linecount) { $smarty->assign('LDSearchFound', str_replace("~nr~", $totalcount, $LDSearchFound) . ' ' . $LDShowing . ' ' . $pagen->BlockStartNr() . ' ' . $LDTo . ' ' . $pagen->BlockEndNr() . '.'); } else { $smarty->assign('LDSearchFound', str_replace('~nr~', '0', $LDSearchFound)); } if ($linecount) { $smarty->assign('bShowResult', TRUE); # Load the common icons and images $img_options = createComIcon($root_path, 'pdata.gif', '0'); $img_male = createComIcon($root_path, 'spm.gif', '0'); $img_female = createComIcon($root_path, 'spf.gif', '0'); $smarty->assign('LDCaseNr', $pagen->makeSortLink($LDCaseNr, 'encounter_nr', $oitem, $odir, $targetappend)); $smarty->assign('LDSex', $pagen->makeSortLink($LDSex, 'sex', $oitem, $odir, $targetappend)); $smarty->assign('LDLastName', $pagen->makeSortLink($LDLastName, 'name_last', $oitem, $odir, $targetappend)); $smarty->assign('LDName2', $pagen->makeSortLink($LDName2, 'name_2', $oitem, $odir, $targetappend)); $smarty->assign('LDFirstName', $pagen->makeSortLink($LDFirstName, 'name_first', $oitem, $odir, $targetappend)); $smarty->assign('LDBday', $pagen->makeSortLink($LDBday, 'date_birth', $oitem, $odir, $targetappend));
/** * Displaying the GUI */ function display($skey = '') { global $db, $searchkey, $root_path, $firstname_too, $HTTP_POST_VARS, $HTTP_GET_VARS, $sid, $lang, $mode, $totalcount, $pgx, $odir, $oitem, $HTTP_SESSION_VARS, $dbf_nodate, $user_origin, $parent_admit, $status, $target, $origin; $this->thisfile = $filename; $this->searchkey = $skey; $this->mode = $mode; if (empty($this->targetfile)) { $withtarget = FALSE; $navcolspan = 5; } else { $withtarget = TRUE; $navcolspan = 6; } if (!empty($skey)) { $searchkey = $skey; } # Load the language tables $lang_tables = $this->langfile; include $root_path . 'include/inc_load_lang_tables.php'; # Initialize pages control variables if ($mode == 'paginate') { $searchkey = $HTTP_SESSION_VARS['sess_searchkey']; //$searchkey='USE_SESSION_SEARCHKEY'; //$mode='search'; } else { # Reset paginator variables $pgx = 0; $totalcount = 0; $odir = ''; $oitem = ''; } # Create an array to hold the config values $GLOBAL_CONFIG = array(); #Load and create paginator object include_once $root_path . 'include/care_api_classes/class_paginator.php'; $pagen = new Paginator($pgx, $this->thisfile, $HTTP_SESSION_VARS['sess_searchkey'], $root_path); include_once $root_path . 'include/care_api_classes/class_globalconfig.php'; $glob_obj = new GlobalConfig($GLOBAL_CONFIG); $glob_obj->getConfig('person_id_%'); # Get the max nr of rows from global config $glob_obj->getConfig('pagin_person_search_max_block_rows'); if (empty($GLOBAL_CONFIG['pagin_person_search_max_block_rows'])) { # Last resort, use the default defined at the start of this page $pagen->setMaxCount($max_block_rows); } else { $pagen->setMaxCount($GLOBAL_CONFIG['pagin_person_search_max_block_rows']); } //$db->debug=true; if (!defined('SHOW_FIRSTNAME_CONTROLLER')) { define('SHOW_FIRSTNAME_CONTROLLER', $this->show_firstname_controller); } if (SHOW_FIRSTNAME_CONTROLLER) { if (isset($HTTP_POST_VARS['firstname_too'])) { if ($HTTP_POST_VARS['firstname_too']) { $firstname_too = 1; } elseif ($mode == 'paginate' && isset($HTTP_GET_VARS['firstname_too']) && $HTTP_GET_VARS['firstname_too']) { $firstname_too = 1; } } elseif ($mode != 'search') { $firstname_too = TRUE; } } if (($this->mode == 'search' || $this->mode == 'paginate') && !empty($searchkey)) { # Translate *? wildcards $searchkey = strtr($searchkey, '*?', '%_'); include_once $root_path . 'include/inc_date_format_functions.php'; include_once $root_path . 'include/care_api_classes/class_person.php'; $person =& new Person(); # Set the sorting directive if (isset($oitem) && !empty($oitem)) { $sql3 = " ORDER BY {$oitem} {$odir}"; } //$sql='SELECT * FROM '.$dbtable.$sql2; if ($mode == 'paginate') { $fromwhere = $HTTP_SESSION_VARS['sess_searchkey']; $sql = 'SELECT pid, name_last, name_first, date_birth, addr_zip, sex, death_date, status FROM ' . $fromwhere . $sql3; $ergebnis = $db->SelectLimit($sql, $pagen->MaxCount(), $pagen->BlockStartIndex()); $linecount = $ergebnis->RecordCount(); } else { $ergebnis = $person->SearchSelect($searchkey, $pagen->MaxCount(), $pagen->BlockStartIndex(), $oitem, $odir, $firstname_too); #Retrieve the sql fromwhere portion $fromwhere = $person->buffer; $HTTP_SESSION_VARS['sess_searchkey'] = $fromwhere; $sql = $person->getLastQuery(); $linecount = $person->LastRecordCount(); } if ($ergebnis) { if ($linecount == 1) { if ($this->auto_show_bynumeric && $person->is_nr || $this->auto_show_byalphanumeric) { $zeile = $ergebnis->FetchRow(); header("location:" . $this->targetfile . "?sid=" . $sid . "&lang=" . $lang . "&pid=" . $zeile['pid'] . "&edit=1&status=" . $status . "&user_origin=" . $user_origin . "&noresize=1&mode="); exit; } } $pagen->setTotalBlockCount($linecount); # If more than one count all available if (isset($totalcount) && $totalcount) { $pagen->setTotalDataCount($totalcount); } else { # Count total available data $sql = 'SELECT COUNT(pid) AS maxnr FROM ' . $fromwhere; if ($result = $db->Execute($sql)) { if ($result->RecordCount()) { $rescount = $result->FetchRow(); $totalcount = $rescount['maxnr']; } } $pagen->setTotalDataCount($totalcount); } # Set the sort parameters $pagen->setSortItem($oitem); $pagen->setSortDirection($odir); } else { if ($show_sqlquery) { echo $sql; } } } else { $mode = ''; } $entry_block_bgcolor = $this->entry_block_bgcolor; $entry_border_bgcolor = $this->entry_border_bgcolor; $entry_body_bgcolor = $this->entry_body_bgcolor; $searchmask_bgcolor = $this->searchmask_bgcolor; ############## Here starts the html output # Start Smarty templating here # Create smarty object without initiliazing the GUI (2nd param = FALSE) include_once $root_path . 'gui/smarty_template/smarty_care.class.php'; $this->smarty = new smarty_care('common', FALSE); # Output any existing text before the search block if (!empty($this->pretext)) { $this->smarty->assign('sPretext', $this->pretext); } # Show tips and tricks link and the javascript if ($this->showtips) { ob_start(); include_once $root_path . 'include/inc_js_gethelp.php'; $sTemp = ob_get_contents(); $this->smarty->assign('sJSGetHelp', $sTemp); ob_end_clean(); $this->smarty->assign('LDTipsTricks', '<a href="javascript:gethelp(\'person_search_tips.php\')">' . $LDTipsTricks . '</a>'); } # # Prepare the javascript validator # if (!isset($searchform_count) || !$searchform_count) { $this->smarty->assign('sJSFormCheck', '<script language="javascript"> <!-- function chkSearch(d){ if((d.searchkey.value=="") || (d.searchkey.value==" ")){ d.searchkey.focus(); return false; }else { return true; } } // --> </script>'); } # # Prepare the search file # if (empty($this->searchfile)) { $search_script = $this->thisfile; } else { $search_script = $this->searchfile; } # # Prepare the form params # $sTemp = 'method="post" name="searchform'; if ($searchform_count) { $sTemp = $sTemp . "_" . $searchform_count; } $sTemp = $sTemp . '" onSubmit="return chkSearch(this)"'; if (isset($search_script) && $search_script != '') { $sTemp = $sTemp . ' action="' . $search_script . '"'; } $this->smarty->assign('sFormParams', $sTemp); if (empty($this->prompt)) { $searchprompt = $LDEntryPrompt; } else { $searchprompt = $this->prompt; } //$searchprompt=$LDEnterEmployeeSearchKey; $this->smarty->assign('searchprompt', $searchprompt); # # Prepare the checkbox input # if (defined('SHOW_FIRSTNAME_CONTROLLER') && SHOW_FIRSTNAME_CONTROLLER) { if (isset($firstname_too) && $firstname_too) { $sTemp = 'checked'; } $this->smarty->assign('sCheckBoxFirstName', '<input type="checkbox" name="firstname_too" ' . $sTemp . '>'); $this->smarty->assign('LDIncludeFirstName', $LDIncludeFirstName); } # # Prepare the hidden inputs # $this->smarty->assign('sHiddenInputs', '<input type="image" ' . createLDImgSrc($root_path, 'searchlamp.gif', '0', 'absmiddle') . '> <input type="hidden" name="sid" value="' . $sid . '"> <input type="hidden" name="lang" value="' . $lang . '"> <input type="hidden" name="noresize" value="' . $noresize . '"> <input type="hidden" name="target" value="' . $target . '"> <input type="hidden" name="user_origin" value="' . $user_origin . '"> <input type="hidden" name="origin" value="' . $origin . '"> <input type="hidden" name="retpath" value="' . $retpath . '"> <input type="hidden" name="aux1" value="' . $aux1 . '"> <input type="hidden" name="ipath" value="' . $ipath . '"> <input type="hidden" name="mode" value="search">'); $this->smarty->assign('sCancelButton', '<a href="' . $this->cancelfile . URL_APPEND . '"><img ' . createLDImgSrc($root_path, 'cancel.gif', '0') . '></a>'); //include($root_path.'include/inc_patient_searchmask.php'); # # Create append data for previous and next page links # $this->targetappend .= "&firstname_too={$firstname_too}&origin={$origin}"; //echo $mode; if ($parent_admit) { $bgimg = 'tableHeaderbg3.gif'; } else { $bgimg = 'tableHeader_gr.gif'; } $tbg = 'background="' . $root_path . 'gui/img/common/' . $theme_com_icon . '/' . $bgimg . '"'; if ($mode == 'search' || $mode == 'paginate') { if ($linecount) { $this->smarty->assign('LDSearchFound', str_replace("~nr~", $totalcount, $LDSearchFound) . ' ' . $LDShowing . ' ' . $pagen->BlockStartNr() . ' ' . $LDTo . ' ' . $pagen->BlockEndNr() . '.'); } else { $this->smarty->assign('LDSearchFound', str_replace('~nr~', '0', $LDSearchFound)); } } if ($linecount) { $this->smarty->assign('bShowResult', TRUE); $img_male = createComIcon($root_path, 'spm.gif', '0'); $img_female = createComIcon($root_path, 'spf.gif', '0'); $this->smarty->assign('LDRegistryNr', $pagen->makeSortLink($LDRegistryNr, 'pid', $oitem, $odir, $this->targetappend)); $this->smarty->assign('LDSex', $pagen->makeSortLink($LDSex, 'sex', $oitem, $odir, $this->targetappend)); $this->smarty->assign('LDLastName', $pagen->makeSortLink($LDLastName, 'name_last', $oitem, $odir, $this->targetappend)); $this->smarty->assign('LDFirstName', $pagen->makeSortLink($LDFirstName, 'name_first', $oitem, $odir, $this->targetappend)); $this->smarty->assign('LDBday', $pagen->makeSortLink($LDBday, 'date_birth', $oitem, $odir, $this->targetappend)); $this->smarty->assign('LDZipCode', $pagen->makeSortLink($LDZipCode, 'addr_zip', $oitem, $odir, $this->targetappend)); if (!empty($this->targetfile)) { $this->smarty->assign('LDOptions', $LDOptions); } # # Generate the resulting list rows using the reg_search_list_row.tpl template # $sTemp = ''; $toggle = 0; while ($zeile = $ergebnis->FetchRow()) { if ($zeile['status'] == '' || $zeile['status'] == 'normal') { $this->smarty->assign('toggle', $toggle); $toggle = !$toggle; $this->smarty->assign('sRegistryNr', $zeile['pid']); switch (strtolower($zeile['sex'])) { case 'f': $this->smarty->assign('sSex', '<img ' . $img_female . '>'); break; case 'm': $this->smarty->assign('sSex', '<img ' . $img_male . '>'); break; default: $this->smarty->assign('sSex', ' '); break; } $this->smarty->assign('sLastName', ucfirst($zeile['name_last'])); $this->smarty->assign('sFirstName', ucfirst($zeile['name_first'])); # # If person is dead show a black cross # if ($zeile['death_date'] && $zeile['death_date'] != $dbf_nodate) { $this->smarty->assign('sCrossIcon', '<img ' . createComIcon($root_path, 'blackcross_sm.gif', '0', 'absmiddle') . '>'); } else { $this->smarty->assign('sCrossIcon', ''); } $this->smarty->assign('sBday', formatDate2Local($zeile['date_birth'], $date_format)); $this->smarty->assign('sZipCode', $zeile['addr_zip']); if ($withtarget) { $sTarget = "<a href=\"{$this->targetfile}" . URL_APPEND . "&pid=" . $zeile['pid'] . "&edit=1&status=" . $status . "&target=" . $target . "&user_origin=" . $user_origin . "&noresize=1&mode=\">"; $sTarget = $sTarget . '<img ' . createLDImgSrc($root_path, 'ok_small.gif', '0') . ' title="' . $LDShowDetails . '"></a>'; $this->smarty->assign('sOptions', $sTarget); } if (!file_exists($root_path . 'cache/barcodes/pn_' . $zeile['pid'] . '.png')) { $this->smarty->assign('sHiddenBarcode', "<img src='" . $root_path . "classes/barcode/image.php?code=" . $zeile['pid'] . "&style=68&type=I25&width=180&height=50&xres=2&font=5&label=2' border=0 width=0 height=0>"); } # # Generate the row in buffer and append as string # ob_start(); $this->smarty->display('registration_admission/reg_search_list_row.tpl'); $sTemp = $sTemp . ob_get_contents(); ob_end_clean(); } } # # Assign the rows string to template # $this->smarty->assign('sResultListRows', $sTemp); $this->smarty->assign('sPreviousPage', $pagen->makePrevLink($LDPrevious, $this->targetappend)); $this->smarty->assign('sNextPage', $pagen->makeNextLink($LDNext, $this->targetappend)); } # # Add eventual appending text block # if (!empty($this->posttext)) { $this->smarty->assign('sPostText', $this->posttext); } # # Displays the search page # if ($this->bReturnOnly) { ob_start(); $this->smarty->display('registration_admission/reg_search_main.tpl'); $sTemp = ob_get_contents(); ob_end_clean(); return $sTemp; } else { # show Template $this->smarty->display('registration_admission/reg_search_main.tpl'); } }
?> <ul> <?php if ($rows) { ?> <table border=0> <tr> <td><img <?php echo createMascot($root_path, 'mascot1_r.gif', '0', 'bottom'); ?> align="absmiddle"></td> <td class="prompt"> <?php echo "{$LDSearchKeyword} <font color=#0000ff>\"{$searchkey}\"</font> " . str_replace("~rows~", $totalcount, $LDWasFound) . ' ' . $LDShowing . ' ' . $pagen->BlockStartNr() . ' ' . $LDTo . ' ' . $pagen->BlockEndNr() . '.'; ?> <br> <?php echo $LDPlsClk; ?> </td> </tr> </table> <table border=0 cellpadding=0 cellspacing=0> <tr class="adm_item"> <?php $bgimg = 'tableHeaderbg3.gif'; //$bgimg='tableHeader_gr.gif';