Exemplo n.º 1
0
 public static function getById($worksheet_id, $lab_config)
 {
     global $con;
     $worksheet_id = mysql_real_escape_string($worksheet_id, $con);
     if ($worksheet_id == null || $lab_config == null) {
         return null;
     }
     $saved_db = DbUtil::switchToLabConfig($lab_config->id);
     $query_string = "SELECT * FROM worksheet_custom WHERE id={$worksheet_id}";
     $record = query_associative_one($query_string);
     $retval = CustomWorksheet::getObject($record);
     DbUtil::switchRestore($saved_db);
     return $retval;
 }
Exemplo n.º 2
0
	public function getEditCustomWorksheetForm($worksheet_id, $lab_config)
	{
		if($lab_config == null)
		{
			echo LangUtil::$generalTerms['MSG_NOTFOUND'];
			return;
		}
		$worksheet = CustomWorksheet::getById($worksheet_id, $lab_config);
		if($worksheet == null)
		{
			echo LangUtil::$generalTerms['MSG_NOTFOUND'];
			return;
		}
		?>
		<input type='hidden' name='location' value='<?php echo $lab_config->id; ?>'></input>
		<input type='hidden' name='wid' value='<?php echo $worksheet_id; ?>'></input>
		<table class='hor-minimalist-b' style='width:auto;'>
			<tbody>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['NAME']; ?></td>
				<td><input type='text' name='wname' id='wname' value='<?php echo $worksheet->name; ?>' class='uniform_width_more'></input></td>
			</tr>
			<tr valign='top'>
				<td>Header</td>
				<td><input type='text' name='header' id='header' value='<?php echo $worksheet->headerText; ?>' class='uniform_width_more'></td>
			</tr>
			<tr valign='top'>
				<td>Title</td>
				<td><input type='text' name='title' id='title' value='<?php echo $worksheet->titleText; ?>' class='uniform_width_more'></td>
			</tr>
			<tr valign='top'>
				<td>Footer</td>
				<td><input type='text' name='footer' id='footer' value='<?php echo $worksheet->footerText; ?>' class='uniform_width_more'></td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$pageTerms['MARGINS']; ?> (%)</td>
				<td>
					<?php echo LangUtil::$pageTerms['TOP'];?>
					&nbsp;
					<input type='text' name='margin_top' id='margin_top' value='<?php echo $worksheet->margins[ReportConfig::$TOP]; ?>' size='2'></input>
					&nbsp;&nbsp;&nbsp;
					<?php echo LangUtil::$pageTerms['BOTTOM'];?>
					&nbsp;
					<input type='text' name='margin_bottom' id='margin_bottom' value='<?php echo $worksheet->margins[ReportConfig::$BOTTOM]; ?>' size='2'></input>
					&nbsp;&nbsp;&nbsp;
					<?php echo LangUtil::$pageTerms['LEFT'];?>
					&nbsp;
					<input type='text' name='margin_left' id='margin_left' value='<?php echo $worksheet->margins[ReportConfig::$LEFT]; ?>' size='2'></input>
					&nbsp;&nbsp;&nbsp;
					<?php echo LangUtil::$pageTerms['RIGHT'];?>
					&nbsp;
					<input type='text' name='margin_right' id='margin_right' value='<?php echo $worksheet->margins[ReportConfig::$RIGHT]; ?>' size='2'></input>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></td>
				<td>
					<input type='radio' name='is_pid' value='Y' id='is_pid'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_PID] == 1)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['YES']; ?></input>
					<input type='radio' name='is_pid' value='N'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_PID] == 0)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['NO']; ?></input>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?></td>
				<td>
					<input type='radio' name='is_dnum' value='Y' id='is_dnum'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_DNUM] == 1)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['YES']; ?></input>
					<input type='radio' name='is_dnum' value='N'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_DNUM] == 0)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['NO']; ?></input>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['ADDL_ID']; ?></td>
				<td>
					<input type='radio' name='is_addlid' value='Y' id='is_addlid'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_ADDLID] == 1)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['YES']; ?></input>
					<input type='radio' name='is_addlid' value='N'<?php
					if($worksheet->idFields[CustomWorksheet::$OFFSET_ADDLID] == 0)
					{
						echo " checked ";
					}?>><?php echo LangUtil::$generalTerms['NO']; ?></input>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$pageTerms['CUSTOMFIELDS']; ?></td>
				<td>
					<span id='uf_list_box'>
					<?php echo LangUtil::$generalTerms['NAME']; ?>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<?php echo LangUtil::$pageTerms['COLUMN_WIDTH']; ?>
					<br>
					<?php
					if($worksheet->userFields == null || count($worksheet->userFields) == 0)
					{
						//echo LangUtil::$generalTerms['NO']."<br>";
					}
					foreach($worksheet->userFields as $field_entry)
					{
						$field_id = $field_entry[0];
						$field_name = $field_entry[1];
						$field_width = $field_entry[2];
						?>
						<input type='hidden' name='existing_uf_id[]' value='<?php echo $field_id; ?>'></input>
						<input type='text' name='existing_uf_name[]' value='<?php echo $field_name; ?>' class='uniform_width'></input>
						<input type='text' name='existing_uf_width[]' size='2' value='<?php echo $field_width; ?>'></input>
						<br>
						<?php
					}
					?>
					</span>
					<small><a href='javascript:add_another_uf();'><?php echo LangUtil::$generalTerms['ADDNEW']; ?>&raquo;</a></small>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['LAB_SECTION']; ?></td>
				<td>
					<?php
					$test_type_id = $worksheet->testTypes[0];
					$saved_db = DbUtil::switchToGlobal();
					$query_string = "SELECT test_category_id FROM test_type WHERE test_type_id=$test_type_id";
					$record = query_associative_one($query_string);
					$cat_code = $record['test_category_id'];
					$cat_name = get_test_category_name_by_id($cat_code);
					DbUtil::switchRestore($saved_db);				
					echo $cat_name;
					?>
				</td>
			</tr>
		</table>
		<br>
		<div id='test_boxes' class='smaller_font' style='width:auto;'>
		<?php
		$test_type_list = get_test_types_by_site_category($lab_config->id, $cat_code);
		foreach($test_type_list as $test_type)
		{
			$measure_list = $test_type->getMeasures();
			?>
			<div>
			<input type='checkbox' class='test_type_checkbox' name='ttype_<?php echo $test_type->testTypeId; ?>' id='ttype_<?php echo $test_type->testTypeId; ?>' <?php
			if(in_array($test_type->testTypeId, $worksheet->testTypes))
				echo " checked ";
			?>>
			<?php echo $test_type->getName(); ?>
			</input>
			<br>
				<div id='ttype_<?php echo $test_type->testTypeId; ?>_mlist' style='position:relative; margin-left:15px;<?php
				if(in_array($test_type->testTypeId, $worksheet->testTypes) === false)
					echo "display:none;";
				?>'>
				<table class='hor-minimalist-b'>
					<thead>
					<tr>
						<th style='width:200px;'><?php echo LangUtil::$generalTerms['MEASURES']; ?></th>
						<th><?php echo LangUtil::$pageTerms['COLUMN_WIDTH']; ?> (%)</th>
					</tr>
					<?php
					foreach($measure_list as $measure)
					{
						if(in_array($test_type->testTypeId, $worksheet->testTypes))
							$width_val = $worksheet->columnWidths[$test_type->testTypeId][$measure->measureId];
						else
							$width_val = "";
						?>
						<tr>
							<td>
								<?php echo $measure->getName(); ?>
							</td>
							<td>
								<input type='text' value='<?php echo $width_val; ?>' size='2' name='width_<?php echo $test_type->testTypeId."_".$measure->measureId; ?>'>
								</input>
							</td>
						</tr>
						<?php
					}
					?>
					</thead>
					<tbody>
					</tbody>
				</table>
				</div>
			</div>
			<br>
			<?php
		}
		?>
		<input type='button' value='<?php echo LangUtil::$generalTerms['CMD_SUBMIT']; ?>' id='worksheet_submit_button' onclick='javascript:submit_worksheet_form();'>
		</input>
		&nbsp;&nbsp;&nbsp;
		<small>
		<a href='lab_config_home.php?id=<?php echo $lab_config->id; ?>'>
			<?php echo LangUtil::$generalTerms['CMD_CANCEL']; ?>
		</a>
		</small>
		&nbsp;&nbsp;&nbsp;
		<span id='worksheet_submit_progress' style='display:none;'>
			<?php $this->getProgressSpinner(LangUtil::$generalTerms['CMD_SUBMITTING']); ?>
		</span>
		<script type='text/javascript'>
		$(document).ready(function(){
			$('.test_type_checkbox').change( function() {
				toggle_mlist(this);
			});
		});
		
		function toggle_mlist(elem)
		{
			var target_div = elem.name+"_mlist";
			if(elem.checked == true)
			{
				$('#'+target_div).show();
			}
			else
			{
				$('#'+target_div).hide();
			}
		}
		</script>
		<?php
	}
Exemplo n.º 3
0
            $measure_id = $measure->measureId;
            $width_param = $_REQUEST["width_" . $test_type_id . "_" . $measure_id];
            $width_val = $DEFAULT_COLUMN_WIDTH;
            if (is_nan($width_param)) {
                $width_val = $DEFAULT_COLUMN_WIDTH;
            } else {
                $width_val = intval($width_param);
            }
            $worksheet->columnWidths[$test_type_id][$measure_id] = $width_val;
        }
    }
}
$worksheet->userFields = array();
$count = 0;
$width_list = $_REQUEST['uf_width'];
foreach ($_REQUEST['uf_name'] as $field_name) {
    if (trim($field_name) == "") {
        $count++;
        continue;
    }
    $field_width = $width_list[$count];
    if (trim($field_width) == "" || is_nan($field_width)) {
        $field_width = CustomWorksheet::$DEFAULT_WIDTH;
    }
    $field_entry = array(0, $field_name, $field_width);
    $worksheet->userFields[] = $field_entry;
    $count++;
}
$worksheet_id = CustomWorksheet::addToDb($worksheet, $lab_config);
SessionUtil::restore($saved_session);
header("location:worksheet_custom_added.php?wid={$worksheet_id}&lid={$lab_config->id}");
Exemplo n.º 4
0
LangUtil::setPageId("results_entry");
include "includes/script_elems.php";
include "includes/page_elems.php";
$page_elems = new PageElems();
$script_elems = new ScriptElems();
$script_elems->enableJQuery();
$script_elems->enableDragTable();
$saved_session = SessionUtil::save();
$worksheet_id = $_REQUEST['id'];
$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
if ($lab_config == null) {
    echo LangUtil::$generalTerms['MSG_NOTFOUND'];
    SessionUtil::restore($saved_session);
    return;
}
$worksheet = CustomWorksheet::getById($worksheet_id, $lab_config);
if ($worksheet == null) {
    echo LangUtil::$generalTerms['MSG_NOTFOUND'];
    SessionUtil::restore($saved_session);
    return;
}
$num_rows = 10;
if (!isset($_REQUEST['bn']) || is_nan($_REQUEST['bn'])) {
    $num_rows = 10;
} else {
    $num_rows = intval($_REQUEST['bn']);
}
$margin_list = $worksheet->margins;
for ($i = 0; $i < count($margin_list); $i++) {
    $margin_list[$i] = $SCREEN_WIDTH * $margin_list[$i] / 100;
}
Exemplo n.º 5
0
        }
        $field_width = $width_list[$count];
        if (trim($field_width) == "" || is_nan($field_width)) {
            $field_width = CustomWorksheet::$DEFAULT_WIDTH;
        }
        $field_entry = array(0, $field_name, $field_width);
        $worksheet->userFields[] = $field_entry;
        $count++;
    }
}
# Append changes to existing user fields
$count = 0;
$width_list = $_REQUEST['existing_uf_width'];
$id_list = $_REQUEST['existing_uf_id'];
foreach ($_REQUEST['existing_uf_name'] as $field_name) {
    if (trim($field_name) == "") {
        $count++;
        continue;
    }
    $field_width = $width_list[$count];
    if (trim($field_width) == "" || is_nan($field_width)) {
        $field_width = CustomWorksheet::$DEFAULT_WIDTH;
    }
    $field_entry = array($id_list[$count], $field_name, $field_width);
    $worksheet->userFields[] = $field_entry;
    $count++;
}
print_r($worksheet->userFields);
CustomWorksheet::updateToDb($worksheet, $lab_config);
SessionUtil::restore($saved_session);
header("location:worksheet_custom_updated.php?wid={$worksheet_id}&lid={$lab_config->id}");