/**
* log data removal
* @param: $query
*/
function logDataRemoval($query) {
	global $datetime,$trailSessionUser;
	if(!isQuery("select * from vl_logs_removals where query='".preg_replace("/'/s","\'",$query)."' and createdby='$trailSessionUser'")) {
		//log the removal
		mysqlquery("insert into vl_logs_removals 
						(sqlQuery,removedData,created,createdby) 
						values 
						('".preg_replace("/'/s","\'",$query)."','".getRemovedData($query)."','$datetime','$trailSessionUser')");
	}
}
Exemple #2
0
				logTableChange("vl_admins","username",$id,getDetailedTableInfo2("vl_admins","id='$id'","username"),$username);
				logTableChange("vl_admins","email",$id,getDetailedTableInfo2("vl_admins","id='$id'","email"),$email);
				logTableChange("vl_admins","phone",$id,getDetailedTableInfo2("vl_admins","id='$id'","phone"),$phone);
				logTableChange("vl_admins","password",$id,"old password","new password");
				//update vl_admins
				mysqlquery("update vl_admins set 
								username='******',
								email='$email',
								".($password?"password='******',":"")."
								phone='$phone' 
								where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_admins where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_admins where id='$id'");
					mysqlquery("delete from vl_admins where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
				mysqlquery("update vl_facilities set 
									facility='$facility',
									phone='$phone',
									email='$email',
									contactPerson='$contactPerson',
									physicalAddress='$physicalAddress',
									returnAddress='$returnAddress',
									districtID='$districtID', 
									active='$active'
									where 
									id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_facilities where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_facilities where id='$id'");
					mysqlquery("delete from vl_facilities where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
						$error.="<br>The supplied District <strong>$district</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_districts","regionID",$id,getDetailedTableInfo2("vl_districts","id='$id'","regionID"),$formRegionID);
				logTableChange("vl_districts","district",$id,getDetailedTableInfo2("vl_districts","id='$id'","district"),$district);
				//update vl_districts
				mysqlquery("update vl_districts set district='$district',regionID='$formRegionID' where id='$id'");

				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_districts where id='$id'")) {
					//remove dependencies
					logDataRemoval("delete from vl_facilities where districtID='$id'");
					mysqlquery("delete from vl_facilities where districtID='$id'");
					//remove
					logDataRemoval("delete from vl_districts where id='$id'");
					mysqlquery("delete from vl_districts where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
Exemple #5
0
						$added=1;
					} else {
						$error.="<br>The supplied Region <strong>$region</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_regions","region",$id,getDetailedTableInfo2("vl_regions","id='$id'","region"),$region);
				//update vl_regions
				mysqlquery("update vl_regions set region='$region' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_regions where id='$id'")) {
					$query=0;
					$query=mysqlquery("select * from vl_districts where regionID='$id'");
					if(mysqlnumrows($query)) {
						while($q=mysqlfetcharray($query)) {
							//remove dependencies
							logDataRemoval("delete from vl_facilities where districtID='$q[id]'");
							mysqlquery("delete from vl_facilities where districtID='$q[id]'");
						}
					}
					//remove dependencies
					logDataRemoval("delete from vl_districts where regionID='$id'");
					mysqlquery("delete from vl_districts where regionID='$id'");
					//remove
					logDataRemoval("delete from vl_regions where id='$id'");
					mysqlquery("delete from vl_regions where id='$id'");
/**
* function to identify and return hyperlinked keywords
* @param: $string
*/
function identifyKeywords($string) {
	//start with preselected key words
	$newstring=0;
	$newstring=$string;
	if(isQuery("select * from vl_searchablb_keywords")) {
		$j=array();
		foreach(queryTableID("select * from vl_searchablb_keywords") as $j) {
			//replace as may be required
			$keyword=0;
			$keyword=trim(getDetailedTableInfo2("vl_searchablb_keywords","id='$j'","keywords"));
			$replacement=0;
			$replacement="<a href=\"?p=MyNetwork&op=mynetwork&myoptions=qualifications&keyword=".trim(getDetailedTableInfo2("vl_searchablb_keywords","id='$j'","keywords"))."\">".trim(getDetailedTableInfo2("vl_searchablb_keywords","id='$j'","keywords"))."</a>";
			$newstring=preg_replace("/$keyword/is",$replacement,$newstring);
		}
	}

	//progress
	if(isQuery("select * from vl_services_main")) {
		$j=array();
		foreach(queryTableID("select * from vl_services_main") as $j) {
			if(getDetailedTableInfo2("vl_services_main","id='$j'","companyname")) {
				//replace as may be required
				$keyword=0;
				$keyword=trim(getDetailedTableInfo2("vl_services_main","id='$j'","companyname"));
				$replacement=0;
				$replacement="<a href=\"?p=MyNetwork&op=mynetwork&myoptions=staff&keyword=".trim(getDetailedTableInfo2("vl_services_main","id='$j'","companyname"))."\">".trim(getDetailedTableInfo2("vl_services_main","id='$j'","companyname"))."</a>";
				$newstring=preg_replace("/$keyword/is",$replacement,$newstring);
			}
		}
	}
	return $newstring;
}
/**
* function to check if this client was accepted or rejected based on output files
* @param: $clientnumber
* @param: $version
*/
function getUserCRBStatus($clientNumber,$dataTable,$headerID,$file,$version) {
	//work out the headerID for this output file
	$outputHeaderID=0;
	$outputHeaderID=getDetailedTableInfo2("vl_header","inputoutput='output' and SubmissionEndDate='".getDetailedTableInfo2("vl_header","id='$headerID'","SubmissionEndDate")."' and File='$file' and Version='$version' order by id desc limit 1","id");
	//is there an output file matching this $dataTable
	if($outputHeaderID) {
		if(isQuery("SELECT $dataTable.* 
						FROM $dataTable,vl_rules,vl_datacodes,vl_header 
						WHERE 
						vl_rules.ruleName = vl_datacodes.code AND 
						vl_datacodes.dataID = $dataTable.id AND 
						vl_datacodes.headerID = vl_header.id AND 
						vl_header.id = '$outputHeaderID' AND 
						vl_rules.file = '$file' AND 
						vl_rules.rejectRule = 'Yes' AND 
						vl_rules.version = '$version' AND 
						$dataTable.ClientNumber = '$clientNumber'")) {
			//rejected
			return "<font class=\"vl_red\">Rejected</a>";
		} else {
			//accepted
			return "<font class=\"vl_green\">Accepted</a>";
		}
	} else {
		//unknown
		return "<font class=\"vl_grey\">Unknown</a>";
	}
}
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_failurereason","appendix",$id,getDetailedTableInfo2("vl_appendix_failurereason","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_failurereason","position",$id,getDetailedTableInfo2("vl_appendix_failurereason","id='$id'","position"),$position);
				//update vl_appendix_failurereason
				mysqlquery("update vl_appendix_failurereason set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_failurereason where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_failurereason where id='$id'");
					mysqlquery("delete from vl_appendix_failurereason where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_viralloadtesting","appendix",$id,getDetailedTableInfo2("vl_appendix_viralloadtesting","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_viralloadtesting","position",$id,getDetailedTableInfo2("vl_appendix_viralloadtesting","id='$id'","position"),$position);
				//update vl_appendix_viralloadtesting
				mysqlquery("update vl_appendix_viralloadtesting set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_viralloadtesting where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_viralloadtesting where id='$id'");
					mysqlquery("delete from vl_appendix_viralloadtesting where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_regimen","appendix",$id,getDetailedTableInfo2("vl_appendix_regimen","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_regimen","position",$id,getDetailedTableInfo2("vl_appendix_regimen","id='$id'","position"),$position);
				logTableChange("vl_appendix_regimen","treatmentStatusID",$id,getDetailedTableInfo2("vl_appendix_regimen","id='$id'","treatmentStatusID"),$treatmentLineStatusID);
				//update vl_appendix_regimen
				mysqlquery("update vl_appendix_regimen set appendix='$appendix',position='$position',treatmentStatusID='$treatmentLineStatusID' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_regimen where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_regimen where id='$id'");
					mysqlquery("delete from vl_appendix_regimen where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_treatmentstatus","appendix",$id,getDetailedTableInfo2("vl_appendix_treatmentstatus","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_treatmentstatus","position",$id,getDetailedTableInfo2("vl_appendix_treatmentstatus","id='$id'","position"),$position);
				//update vl_appendix_treatmentstatus
				mysqlquery("update vl_appendix_treatmentstatus set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_treatmentstatus where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_treatmentstatus where id='$id'");
					mysqlquery("delete from vl_appendix_treatmentstatus where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_treatmentinitiation","appendix",$id,getDetailedTableInfo2("vl_appendix_treatmentinitiation","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_treatmentinitiation","position",$id,getDetailedTableInfo2("vl_appendix_treatmentinitiation","id='$id'","position"),$position);
				//update vl_appendix_treatmentinitiation
				mysqlquery("update vl_appendix_treatmentinitiation set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_treatmentinitiation where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_treatmentinitiation where id='$id'");
					mysqlquery("delete from vl_appendix_treatmentinitiation where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_arvadherence","appendix",$id,getDetailedTableInfo2("vl_appendix_arvadherence","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_arvadherence","position",$id,getDetailedTableInfo2("vl_appendix_arvadherence","id='$id'","position"),$position);
				//update vl_appendix_arvadherence
				mysqlquery("update vl_appendix_arvadherence set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_arvadherence where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_arvadherence where id='$id'");
					mysqlquery("delete from vl_appendix_arvadherence where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system for the Sample Type: ".getDetailedTableInfo2("vl_appendix_sampletype","id='$sampleTypeID'","appendix");
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_sampleTypeID_samplerejectionreason","sampleTypeID",$id,getDetailedTableInfo2("vl_sampleTypeID_samplerejectionreason","id='$id'","sampleTypeID"),$sampleTypeID);
				logTableChange("vl_appendix_samplerejectionreason","appendix",$id,getDetailedTableInfo2("vl_appendix_samplerejectionreason","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_samplerejectionreason","position",$id,getDetailedTableInfo2("vl_appendix_samplerejectionreason","id='$id'","position"),$position);
				//update vl_appendix_samplerejectionreason
				mysqlquery("update vl_appendix_samplerejectionreason set sampleTypeID='$sampleTypeID',appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_samplerejectionreason where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_samplerejectionreason where id='$id'");
					mysqlquery("delete from vl_appendix_samplerejectionreason where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_tbtreatmentphase","appendix",$id,getDetailedTableInfo2("vl_appendix_tbtreatmentphase","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_tbtreatmentphase","position",$id,getDetailedTableInfo2("vl_appendix_tbtreatmentphase","id='$id'","position"),$position);
				//update vl_appendix_tbtreatmentphase
				mysqlquery("update vl_appendix_tbtreatmentphase set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_tbtreatmentphase where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_tbtreatmentphase where id='$id'");
					mysqlquery("delete from vl_appendix_tbtreatmentphase where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task
Exemple #16
0
				mysqlquery("update vl_users set active='1' where id='$id'");
				//flag
				$id=0;
				$activated=1;
            break;
            case deactivate:
				//log table change
				logTableChange("vl_users","activate",$id,getDetailedTableInfo2("vl_users","id='$id'","activate"),"0");
				//update vl_users
				mysqlquery("update vl_users set active='0' where id='$id'");
				//flag
				$id=0;
				$deactivated=1;
            break;
            case remove:
				if(isQuery("select * from vl_users where id='$id'")) {
					//remove
					if(is_file(getDetailedTableInfo2("vl_users","id='$id'","signaturePATH"))) {
						unlink(getDetailedTableInfo2("vl_users","id='$id'","signaturePATH"));
					}
					logDataRemoval("delete from vl_users where id='$id'");
					mysqlquery("delete from vl_users where id='$id'");
					logDataRemoval("delete from vl_users_history where userID='$id'");
					mysqlquery("delete from vl_users_history where userID='$id'");
					logDataRemoval("delete from vl_users_permissions where userID='$id'");
					mysqlquery("delete from vl_users_permissions where userID='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
					} else {
						$error.="<br>The supplied Appendix <strong>$appendix</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_appendix_sampletype","appendix",$id,getDetailedTableInfo2("vl_appendix_sampletype","id='$id'","appendix"),$appendix);
				logTableChange("vl_appendix_sampletype","position",$id,getDetailedTableInfo2("vl_appendix_sampletype","id='$id'","position"),$position);
				//update vl_appendix_sampletype
				mysqlquery("update vl_appendix_sampletype set appendix='$appendix',position='$position' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_appendix_sampletype where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_appendix_sampletype where id='$id'");
					mysqlquery("delete from vl_appendix_sampletype where id='$id'");
					//remove
					logDataRemoval("delete from vl_appendix_samplerejectionreason where sampleTypeID='$id'");
					mysqlquery("delete from vl_appendix_samplerejectionreason where sampleTypeID='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
Exemple #18
0
						$added=1;
					} else {
						$error.="<br>The supplied Hub <strong>$hub</strong> is already within the system";
					}
				}
            break;
            case modify:
				//log table change
				logTableChange("vl_hubs","hub",$id,getDetailedTableInfo2("vl_hubs","id='$id'","hub"),$hub);
				//update vl_hubs
				mysqlquery("update vl_hubs set hub='$hub' where id='$id'");
				//flag
				$modified=1;
            break;
            case remove:
				if(isQuery("select * from vl_hubs where id='$id'")) {
					//remove
					logDataRemoval("delete from vl_hubs where id='$id'");
					mysqlquery("delete from vl_hubs where id='$id'");
					//flag
					$removed=1;
				}
            break;
            default:
                if($modify) {
                    $task="modify";
                }
            break;
		}
		
		//set task