Exemple #1
0
	public function getMeasureCheckboxes($lab_config_id="")
	{
		# Returns a set of checkboxes with existing test types checked
		$lab_config = get_lab_config_by_id($lab_config_id);
		if($lab_config == null && $lab_config_id != "")
		{
			?>
			<div class='sidetip_nopos'>
			ERROR: Lab configuration not found
			</div>
			<?php
			return;
		}
		# Fetch all specimen types
		$measure_list = get_measures_catalog();
		# For each measure, create a check box.
		?>
		<table class='hor-minimalist-b' style='width:700px;'>
			<tbody>
			<tr>
			<?php
			$count = 0;
			foreach($measure_list as $key=>$value)
			{
				$measure_id = $key;
				$measure_name = $value;
				$count++;
				?>
				<td><input type='checkbox' class='m_entry' name='m_<?php echo $key; ?>' id='m_<?php echo $key; ?>'
				<?php
				/*
				if(in_array($test_type_id, $current_test_list))
				{
					echo " checked ";
				}
				*/
				?>
				>
				<?php 
				/*
				if(in_array($test_type_id, $current_test_list))
				{
					?>
					<span class='clean-ok'><?php echo $test_name; ?></span>
					<?php
				}
				else
				*/
				echo $measure_name;
				?>
				</input></td>
				
				<?php
				if($count % 2 == 0)
					echo "</tr><tr>";
			}
			?>
			</tbody>
		</table>
		<?php
	}
    $new_cat_name = $_REQUEST['new_category'];
    $new_cat_id = add_test_category($new_cat_name);
    $cat_code = $new_cat_id;
}
$updated_entry = new TestType();
$updated_entry->testTypeId = $_REQUEST['tid'];
$updated_entry->name = $_REQUEST['name'];
$updated_entry->description = $_REQUEST['description'];
$updated_entry->testCategoryId = $cat_code;
# Update tests measures and ranges
$is_panel = false;
$added_measures_list = array();
if ($_REQUEST['ispanel'] == 1) {
    # Panel test. Collect all selected measures
    $is_panel = true;
    $measure_list = get_measures_catalog();
    foreach ($measure_list as $measure_id => $measure_name) {
        if (isset($_REQUEST['m_' . $measure_id])) {
            # Track the measure ID (key)
            $added_measures_list[] = $measure_id;
        }
    }
} else {
    # Non-panel test. Collect all modified measures
    $measure_ids = $_REQUEST['m_id'];
    $measure_names = $_REQUEST['measure'];
    $measure_types = $_REQUEST['mtype'];
    $units = $_REQUEST['unit'];
    for ($i = 0; $i < count($measure_names); $i++) {
        if ($measure_names[$i] == "") {
            # Mark for deletion