echo "tblnoborder"; } ?> '> <tbody> <?php $combined_fields = $SYSTEM_PATIENT_FIELDS; $lab_config = LabConfig::getById($_SESSION['lab_config_id']); if ($lab_config) { $custom_field_list = $lab_config->getPatientCustomFields(); foreach ($custom_field_list as $custom_field) { $custom_array = array("p_custom_{$custom_field->id}" => $custom_field->fieldName); $combined_fields = array_merge($combined_fields, $custom_array); } } $ordered_fields = Patient::getReportfieldsOrder(); $column_size = $report_config->rowItems; if (is_array($ordered_fields)) { $ordered = explode(",", $ordered_fields['o_fields']); $pfields = explode(",", $report_config->patientFields); $c = 0; foreach ($ordered as $field) { if ($c == 0) { echo "<tr valign='top'>"; } $c++; /*if($c == 0) { echo "<tr valign='top'>"; $c=1; }
public function getPatientFieldsOrderForm() { global $SYSTEM_PATIENT_FIELDS; ?> <table cellspacing='5px' class='smaller_font'> <tr valign='top'> <td><b><?php echo LangUtil::$generalTerms['PATIENT_FIELDS']?></b></td> <td></td> <td><b><?php echo LangUtil::$generalTerms['PATIENT_ORDERED_FIELDS']?></b></td> <td></td> </tr> <?php # Patient main fields ?> <tr valign='top'> <td> <input type="hidden" id="p_fields_left" name="p_fields_left" /> <input type="hidden" id="o_fields_left" name="o_fields_left" /> <select id="p_fields" name="p_fields" size="15" onchange="javascript:setSel(this);"> <?php $combined_fields =$SYSTEM_PATIENT_FIELDS; $lab_config = LabConfig::getById($_SESSION['lab_config_id']); if( $lab_config ) { $custom_field_list = $lab_config->getPatientCustomFields(); foreach($custom_field_list as $custom_field) { $custom_array = array ("p_custom_$custom_field->id" => $custom_field->fieldName); $combined_fields = array_merge($combined_fields,$custom_array); } } $record=Patient::getReportfieldsOrder(); if(!is_array($record)) { foreach ($combined_fields as $field=>$text) {?> <option value="<?php echo $field ?>"><?php if(!stristr($field,"custom")) echo LangUtil::$generalTerms[$text]; else echo $text;?></option> <?php } } else { $unordered=explode(",",$record['p_fields']); foreach( $unordered as $field) { ?> <option value="<?php echo $field ?>"><?php if(!stristr($field,"custom")) echo LangUtil::$generalTerms[$combined_fields[$field]]; else echo $combined_fields[$field];?></option> <?php } } ?> </select> </td> <td valign="middle"> <input type="button" name="AddOrder" id="AddOrder" value=">" disabled="disabled" onclick="javascript:setOrder();"/> <input type="button" name="RemOrder" id="RemOrder" value="<" disabled="disabled" onclick="javascript:remOrder();" /> </td> <td><select id="o_fields" name="o_fields" size="15" onchange="javascript:setSel(this);"> <?php if(is_array($record)) { $ordered=explode(",",$record['o_fields']); foreach( $ordered as $field) { ?> <option value="<?php echo $field ?>"><?php if(!stristr($field,"custom")) echo LangUtil::$generalTerms[$combined_fields[$field]]; else echo $combined_fields[$field];?></option> <?php } } ?> </select> </td> <td valign="middle"> <input type="button" id="o_up" name="o_up" value="ʌ" onclick="javascript:reorder('up');"/><br /> <input type="button" id="o_down" name="o_down" value="v" onclick="javascript:reorder('down');" /> </td> </tr> <tr> <td> <br /> <input type='button' value='<?php echo LangUtil::$generalTerms['CMD_SUBMIT']; ?>' id='ordered_fields_submit' onclick='javascript:submit_ordered_fields_form();'> </input><small> <a href='lab_config_home.php?id=<?php echo $lab_config->id; ?>'> <?php echo LangUtil::$generalTerms['CMD_CANCEL']; ?> </a> </small> </td> <td> <span id='ordered_fields_submit_progress' style='display:none;'> <?php $this->getProgressSpinner(LangUtil::$generalTerms['CMD_SUBMITTING']); ?> </span></td> <td></td> </tr> </table> <script type='text/javascript'> var selvalue; var seltext; var selIndex; function setSel(sel) { selvalue=sel.options[sel.selectedIndex].value; seltext=sel.options[sel.selectedIndex].text; selIndex=sel.selectedIndex; if($(sel).attr("name")=="p_fields") { document.getElementById("AddOrder").disabled=false; document.getElementById("RemOrder").disabled=true; } else { document.getElementById("RemOrder").disabled=false; document.getElementById("AddOrder").disabled=true; } } function setOrder() { var opt = document.createElement("option"); document.getElementById("o_fields").options.add(opt); opt.text = seltext; opt.value = selvalue; document.getElementById("p_fields").options.remove(selIndex); document.getElementById("AddOrder").disabled=true; } function remOrder() { var opt = document.createElement("option"); document.getElementById("p_fields").options.add(opt); opt.text = seltext; opt.value = selvalue; document.getElementById("o_fields").options.remove(selIndex); document.getElementById("RemOrder").disabled=true; } function reorder(direction) { var o_fields=document.getElementById("o_fields"); var newIndex=0; if(direction=="up") newIndex=selIndex-1; else newIndex=selIndex+1; if(newIndex >=o_fields.options.length || newIndex < 0) return; var keys = new Array(); var texts = new Array(); var tempkey=""; var temptext=""; for(var i=0;i<o_fields.options.length;i++) { keys[i] = o_fields.options[i].value; texts[i] = o_fields.options[i].text; } while(o_fields.options.length>0) { o_fields.options.remove(0); } tempkey=keys[newIndex]; temptext=texts[newIndex]; keys[newIndex]=keys[selIndex]; texts[newIndex]=texts[selIndex]; keys[selIndex]=tempkey; texts[selIndex]=temptext; for(var i=0;i<keys.length;i++) { var opt = document.createElement("option"); o_fields.options.add(opt); opt.text = texts[i]; opt.value = keys[i]; } o_fields.selectedIndex=newIndex; selIndex=newIndex; } </script> <?php }