Beispiel #1
0
<?php

# Returns a JSON list of test types for a site location via Ajax
# Called from pages where site/location drop down box is used
include "../includes/db_lib.php";
function list_to_json($value_list, $json_params)
{
    $count = 0;
    $return_string = "";
    $return_string .= "[";
    foreach ($value_list as $key => $value) {
        $return_string .= "{" . $json_params[0] . ": " . $key . ", " . $json_params[1] . ": '" . $value . "'}";
        $count += 1;
        if ($count != count($value_list)) {
            $return_string .= ", ";
        }
    }
    $return_string .= "]";
    return $return_string;
}
$test_list = get_test_types_by_site_map($_REQUEST['site']);
$json_params = array('optionValue', 'optionDisplay');
echo list_to_json($test_list, $json_params);
Beispiel #2
0
	public function getLabConfigStatus($lab_config_id)
	{
		$lab_config = get_lab_config_by_id($lab_config_id);
		if($lab_config == null)
		{
			# Error
			?>
			<div class='sidetip_nopos'>
			<?php echo LangUtil::$generalTerms['MSG_NOTFOUND']; ?>
			</div>
			<?php
			return;
		}
		# TODO:
		$test_counts = get_tests_done_this_month($lab_config);
		?>
		<table class='hor-minimalist-b'>
			<thead>
				<tr>
					<th><b><?php echo $lab_config->getSiteName(); ?></b></th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td><?php echo LangUtil::$generalTerms['PENDING_RESULTS']; ?></td>
					<td><?php echo get_lab_config_num_tests_pending($lab_config_id); ?></td>
				</tr>
				
				<?php
				$test_list = get_test_types_by_site_map($lab_config_id);
				foreach($test_list as $test_type_id=>$test_name)
				{
					?>
					<tr>
						<td>&nbsp;&nbsp;&nbsp;<?php echo $test_name; ?></td>
						<td><?php echo get_lab_config_num_tests_pending($lab_config_id, $test_type_id); ?></td>
					</tr>
					<?php
				}
				?>
			</tbody>
		</table>
		<?php
	}