public function getTestTypeCheckboxes_dir($lab_config_id=null, $allCompatibleCheckingOn=true) { # Returns a set of checkboxes with existing test types checked, if allCompatibleCheckingOn is set to true, # else only returns checkboxes with available test tpe names $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 test types //if($lab_config_id == "") //{ //$test_list = get_test_types_catalog(true); // $reff = 1; // $test_list = get_test_types_catalog($lab_config_id, $reff); //} // else //{ //NC3065 $reff = 2; $test_list = get_test_types_catalog($lab_config_id, $reff ); //-NC3065 // } $current_test_list = array(); if($lab_config_id != "") $current_test_list = get_lab_config_test_types($lab_config_id) # For each test type, create a check box. Check it if test already in lab configuration ?> <table class='hor-minimalist-b' style='width:700px;'> <tbody> <tr> <?php $count = 0; foreach($test_list as $key=>$value) { $test_type_id = $key; $test_name = $value; $count++; ?> <td><input type='checkbox' class='ttype_entry' name='t_type_<?php echo $key; ?>' id='t_type_<?php echo $key; ?>' <?php if($allCompatibleCheckingOn==true) { if(in_array($test_type_id, $current_test_list)) { echo " checked ><span class='clean-ok'>$test_name</span>"; } else echo ">$test_name"; } else echo ">$test_name"; ?> </input></td> <?php if($count % 3 == 0) echo "</tr><tr>"; } ?> </tbody> </table> <?php }
<?php # # (c) C4G, Santosh Vempala, Ruban Monu and Amol Shintre # Updates specimen and tests added to a lab configuration # Called via Ajax from lab_config_home.php # include "../users/accesslist.php"; if (!(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) && !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) && !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList))) { displayForbiddenMessage(); } $lab_config_id = $_REQUEST['lid']; $specimen_type_list = get_specimen_types_catalog($lab_config_id); $test_type_list = get_test_types_catalog($lab_config_id); $updated_specimen_list = array(); $updated_test_list = array(); $lab_config = LabConfig::getById($lab_config_id); if ($lab_config == null) { return; } foreach ($specimen_type_list as $key => $value) { $field_tocheck = "s_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $updated_specimen_list[] = $key; } } foreach ($test_type_list as $key => $value) { $field_tocheck = "t_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $updated_test_list[] = $key; }
<?php # # Main page for updating specimen type info # Called via Ajax from specimen_type_edit.php # include "../includes/db_lib.php"; include "../lang/lang_xml2php.php"; $updated_entry = new SpecimenType(); $updated_entry->specimenTypeId = $_REQUEST['sid']; $updated_entry->name = $_REQUEST['name']; $updated_entry->description = $_REQUEST['description']; $test_type_list = get_test_types_catalog(); $updated_test_list = array(); foreach ($test_type_list as $key => $value) { $field_tocheck = "t_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $updated_test_list[] = $key; } } update_specimen_type($updated_entry, $updated_test_list); # Update locale XML and generate PHP list again. if ($CATALOG_TRANSLATION === true) { update_specimentype_xml($updated_entry->specimenTypeId, $updated_entry->name); }
<?php # # Adds a new specimen type to catalog in DB # include "redirect.php"; include "includes/db_lib.php"; include "lang/lang_xml2php.php"; $specimen_name = $_REQUEST['specimen_name']; $specimen_descr = $_REQUEST['specimen_descr']; $reff = 1; $test_type_list = get_test_types_catalog($lab_conifg_id, $reff); $added_test_list = array(); foreach ($test_type_list as $key => $value) { $field_tocheck = "t_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $added_test_list[] = $key; } } $specimen_type_id = ""; if (count($added_test_list) == 0) { # No tests selected $specimen_type_id = add_specimen_type($specimen_name, $specimen_descr); } else { # Compatible tests selected $specimen_type_id = add_specimen_type($specimen_name, $specimen_descr, $added_test_list); } # Update locale XML and generate PHP list again. if ($CATALOG_TRANSLATION === true) { update_specimentype_xml($specimen_type_id, $specimen_name); }