예제 #1
0
파일: admin.php 프로젝트: pmolfese/nidb
function DisplayAdminList()
{
    $urllist['Administration'] = "admin.php";
    NavigationBar("Admin", $urllist);
    ?>
		<ul>
		<li><a href="adminusers.php">Users</a>
		<li><a href="adminprojects.php">Projects</a>
		<li><a href="adminassessmentforms.php">Assessment Forms</a>
		<li><a href="adminmodules.php">Modules</a>
		<li><a href="adminmodalities.php">Modalities</a>
		<li><a href="adminsites.php">Sites</a>
		<li><a href="reports.php">Reports</a>
		<li><a href="adminqc.php">QC</a>
		<li><a href="importlog.php">Import Logs</a>
		<li><a href="admininstances.php">Instances</a>
		<li><a href="adminaudits.php">Audits</a>
		<li><a href="cleanup.php">Clean-up</a>
		<li><a href="system.php">System info</a>
		<li><a href="stats.php">Usage stats</a>
		<li><a href="longqc.php">Longitudinal QC</a>
		<li><a href="adminemail.php">Mass email</a>
		</ul>
		<?php 
}
예제 #2
0
function DisplayMenu()
{
    $urllist['Administration'] = "adminaudits.php";
    $urllist['Audits'] = "adminaudits.php";
    NavigationBar("Admin", $urllist);
    ?>
		<br><br>
		<?php 
}
예제 #3
0
파일: importlog.php 프로젝트: pmolfese/nidb
function DisplayMenu()
{
    $urllist['Administration'] = "importlog.php";
    $urllist['Import Log'] = "importlog.php";
    NavigationBar("Admin", $urllist);
    ?>
		View import <a href="importlog.php?action=viewtransactions">transactions</a><br>
		<!--View <a href="importlog.php?action=viewreceived">received</a><br>
		View <a href="importlog.php?action=viewimported">imported</a><br>-->
		<br><br>
		<?php 
}
예제 #4
0
파일: about.php 프로젝트: pmolfese/nidb
function DisplayAbout()
{
    $urllist['Home'] = "index.php";
    $urllist['About'] = "about.php";
    NavigationBar("About", $urllist);
    ?>
		<p><i>Neuroinformatics Database</i> (NiDB) was developed at the Olin Neuropsychiatry Research Center at Hartford Hospital. This system is open source, released under the <a href="http://www.gnu.org/copyleft/gpl.html">GPLv3</a> license.</p>
		
		<p>Visit the NiDB website at <a href="http://nidb.sourceforge.net">http://nidb.sourceforge.net</a></p>
		
		<p>Problems, compliments, or suggestions should be directed to <a href="mailto:gregory.book@hhchealth.org">gregory.book@hhchealth.org</a></p>
		<?php 
}
예제 #5
0
	function DisplayMenu() {
		$urllist['Administration'] = "cleanup.php";
		$urllist['Cleanup'] = "cleanup.php";
		NavigationBar("Admin", $urllist);
		
		?>
		View empty <a href="cleanup.php?action=viewemptysubjects">subjects</a><br>
		View empty <a href="cleanup.php?action=viewemptyenrollments">enrollments</a><br>
		<!--View empty <a href="cleanup.php?action=viewemptystudies">studies</a><br>-->
		<!--View empty <a href="cleanup.php?action=viewemptyseries">series</a><br>-->
		<br><br>
		<?
	}
예제 #6
0
function DisplayEmailForm()
{
    $urllist['Administration'] = "cleanup.php";
    $urllist['Cleanup'] = "cleanup.php";
    NavigationBar("Admin", $urllist);
    ?>
		<form action="adminemail.php" method="post" name="theform">
		<input type="hidden" name="action" value="sendemail">
		<input type="text" name="emailsubject" size="60" placeholder="Subject">
		<br><br>
		<textarea name="emailbody" rows="10" cols="60" placeholder="Body"></textarea>
		<br>
		<input type="submit" value="Send email">
		</form>
		<?php 
}
예제 #7
0
파일: projects.php 프로젝트: pmolfese/nidb
function DisplayProjectList()
{
    $urllist['Project List'] = "projects.php";
    NavigationBar("Projects for " . $_SESSION['instancename'], $urllist, 0, '', '', '', '');
    ?>
		View <a href="projects.php?action=viewinstancesummary&id=<?php 
    echo $_SESSION['instanceid'];
    ?>
">instance summary</a>
		<br><br>
		<table class="graydisplaytable" width="100%">
			<thead>
				<tr>
					<th>Name</th>
					<th>UID</th>
					<th>Cost Center</th>
					<th>Admin</th>
					<th>PI</th>
					<th>View report</th>
					<th>Group Protocols</th>
					<th>Studies</th>
				</tr>
			</thead>
			<tbody>
				<?php 
    $sqlstring = "select a.*, b.username 'adminusername', b.user_fullname 'adminfullname', c.username 'piusername', c.user_fullname 'pifullname' from projects a left join users b on a.project_admin = b.user_id left join users c on a.project_pi = c.user_id where a.project_status = 'active' and a.instance_id = " . $_SESSION['instanceid'] . " order by a.project_name";
    //PrintSQL($sqlstring);
    //exit(0);
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['project_id'];
        $name = $row['project_name'];
        $adminusername = $row['adminusername'];
        $adminfullname = $row['adminfullname'];
        $piusername = $row['piusername'];
        $pifullname = $row['pifullname'];
        $projectuid = $row['project_uid'];
        $costcenter = $row['project_costcenter'];
        $sqlstringA = "select * from user_project where user_id in (select user_id from users where username = '******'username'] . "') and project_id = {$id}";
        //PrintSQL($sqlstringA);
        $resultA = mysql_query($sqlstringA) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
        $rowA = mysql_fetch_array($resultA, MYSQL_ASSOC);
        $view_data = $rowA['view_data'];
        $view_phi = $rowA['view_phi'];
        if ($view_data) {
            ?>
							<tr valign="top">
								<td><a href="projects.php?action=displayproject&id=<?php 
            echo $id;
            ?>
"><?php 
            echo $name;
            ?>
</td>
								<td><?php 
            echo $projectuid;
            ?>
</td>
								<td><?php 
            echo $costcenter;
            ?>
</td>
								<td><?php 
            echo $adminfullname;
            ?>
</td>
								<td><?php 
            echo $pifullname;
            ?>
</td>
								<td><a href="projectreport.php?action=viewprojectreport&projectid=<?php 
            echo $id;
            ?>
">Report</a></td>
								<td><a href="projects.php?action=viewuniqueseries&id=<?php 
            echo $id;
            ?>
">Edit</a> | <a href="projects.php?action=viewaltseriessummary&id=<?php 
            echo $id;
            ?>
">Summary</a></td>
								<td align="right">
									<table cellpadding="0" cellspacing="0" border="0">
								<?php 
            $sqlstring = "SELECT a.study_modality, b.project_id, count(b.project_id) 'count' FROM `studies` a left join enrollment b on a.enrollment_id = b.enrollment_id left join subjects c on b.subject_id = c.subject_id where b.project_id = {$id} and c.isactive = 1 group by b.project_id,a.study_modality";
            //PrintSQL($sqlstring);
            $result2 = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
            while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
                $modality = $row2['study_modality'];
                $count = $row2['count'];
                $projectModalitySize = 0;
                if ($modality != "") {
                    $sqlstring3 = "select sum(series_size) 'modalitysize' from " . strtolower($modality) . "_series where study_id in (SELECT a.study_id FROM `studies` a left join enrollment b on a.enrollment_id = b.enrollment_id left join subjects c on b.subject_id = c.subject_id where b.project_id = {$id} and c.isactive = 1 and a.study_modality = '{$modality}')";
                    //$result3 = mysql_query($sqlstring3) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring3</i><br>");
                    //$row3 = mysql_fetch_array($result3, MYSQL_ASSOC);
                    $projectModalitySize = $row3['modalitysize'];
                }
                if ($modality == "") {
                    $modality = "(blank)";
                }
                ?>
									<tr>
									<td align="right" style="font-size:10pt; border: none; color: darkblue; padding: 0px 3px"><b><?php 
                echo $modality;
                ?>
</b></td>
									<td style="font-size:10pt; border: none; padding: 0px 3px"><?php 
                echo $count;
                ?>
 <!--<span class="tiny"><?php 
                echo number_format($projectModalitySize / 1024 / 1024 / 1024, 1);
                ?>
 GB</span>--></td>
									</tr>
									<?php 
            }
            ?>
									</table>
								</td>
							</tr>
							<?php 
        } else {
            ?>
							<tr>
								<td colspan="5">
									No access to <?php 
            echo $name;
            ?>
								</td>
							</tr>
						<?php 
        }
    }
    ?>
			</tbody>
		</table>
		<?php 
}
예제 #8
0
	function DisplaySearchForm($searchvars, $action) {
	
		$urllist['New Search'] = "search.php";
		NavigationBar("Search", $urllist);
		
	?>
	<script type="text/javascript">
	$(function() {
		$(".datepick").datepicker({changeMonth: true, changeYear: true, dateFormat: 'yy-mm-dd', minDate: '-130y', maxDate: '+130y'});
	});
	</script>

	<style>
		.sidelabel {
			font-weight: bold;
			font-size: 12pt;
			border-right: solid 1px #CCC;
			border-bottom: solid 1px #CCC;
			padding-right: 15px;
			padding-left: 10px;
			text-align: right;
		}
		.toplabel {
			color: white;
			font-weight: bold;
			font-size: 14pt;
			padding-top: 5px;
			padding-bottom: 5px;
			text-align: center;
			/*border-top-right-radius: 5px;*/
			background-color: #3B5998;
		}
		.tiny {
			font-size: 8pt;
			color: gray;
		}
		.fieldlabel {
			color: darkblue;
			text-align: right;
			vertical-align: top;
		}
		.importantfield {
			border: 1pt solid darkblue;
			background-color: lightyellow;
		}
		.fakelink {
			background-color: #DDD;
			border-right: solid 2px #777
			/*border-top: 2px solid #999;
			border-left: 2px solid #444;
			border-bottom: 2px solid #444;
			border-radius:3px; */
			padding: 1px 4px;
			font-size:9pt;
			font-weight: normal;
			color: black;
			cursor: pointer;
			-moz-transform: rotate(-90deg);
			-o-transform: rotate(-90deg);
			-webkit-transform: rotate(-90deg);
		}
		.advancedhover:hover {
			max-width: 25px;
			background-color: #DDD;
			color: #000;
			border-right: 1px solid #444;
			cursor: pointer;
			align: center;
			vertical-align: middle;
			/*border-top-left-radius: 5px;
			border-bottom-left-radius: 5px;*/
		}
		.advancedhover {
			max-width: 25px;
			background-color: #EEE;
			color: #AAA;
			border-right: 1px solid #AAA;
			cursor: pointer;
			align: center;
			vertical-align: middle;
			/*border-top-left-radius: 5px;
			border-bottom-left-radius: 5px;*/
		}
	</style>
	<script type="text/javascript">
	<!--
		$(document).ready(function() {
			/* default action */
			$('tr.advanced').hide();
			
			$('#searchtoggle').click(function(){
				$('tr.advanced').toggle();
			});
		});
	-->
	</script>
	<script>
		$(function() {
			$( "#s_studyinstitution" ).autocomplete({
				source: "autocomplete_institution.php",
				minLength: 1,
				autoFocus: true
			});
		});
		
		$(document).ready(function(){
			$('#pageloading').hide();
		});
		
		/* changed the results/view output type when a search element is clicked */
		function SwitchOption(option) {
			switch (option) {
				case 'viewpipeline':
					document.getElementById('viewpipeline').checked = true;
					break;
			}
		}
		
	</script>
	
	<? if ($action == "search") { ?>
	<div id="pageloading" align="center" style="font-size:11pt; color:darkblue">
		Searching... <img src="images/loading.gif">
	</div>
	<br>
	<? } ?>
	<div style="padding-left:30px">
	<form action="search.php" method="post" name="searchform">
	<input type="hidden" name="action" value="search">
	
	<table>
		<tr>
			<td>
	<table cellspacing="0" cellpadding="3" style="border: 1px solid #ccc;">
		<tr>
			<td rowspan="9" id="searchtoggle" class="advancedhover" onMouseOver="this.classname='advancedhover';" onMouseOut="this.classname='advancednohover';">
				<span style="display: block; -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); writing-mode: rl-bt;">Toggle&nbsp;advanced&nbsp;search</span>
			</td>
		</tr>
		<tr>
			<td class="toplabel" colspan="2">Search</td>

		</tr>
		<tr>
			<td class="sidelabel">Subject</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr title="<b>Subject UID(s)</b><br><br>Can be a list of UIDs, separated by commas, spaces, semi-colons, tabs, or Copy&Paste from Excel">
						<td class="fieldlabel">UID(s)</td>
						<td><input type="text" name="s_subjectuid" value="<?php 
echo $searchvars['s_subjectuid'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr title="<b>Alternate Subject UID(s)</b><br><br>Can be a list of UIDs, separated by commas, spaces, semi-colons, tabs, or Copy&Paste from Excel">
						<td class="fieldlabel">Alternate UID(s)</td>
						<td><input type="text" name="s_subjectaltuid" value="<?php 
echo $searchvars['s_subjectaltuid'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Name</td>
						<td><input type="text" name="s_subjectname" value="<?php 
echo $searchvars['s_subjectname'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">DOB</td>
						<td>
							<input type="date" name="s_subjectdobstart" value="<?php 
echo $searchvars['s_subjectdobstart'];
?>
" size="12"> to <input type="date" name="s_subjectdobend" value="<?php 
echo $searchvars['s_subjectdobend'];
?>
" size="12">
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">Gender</td>
						<td>
							<input type="text" name="s_subjectgender" size="1" maxlength="1" value="<?php 
echo $searchvars['s_subjectgender'];
?>
"> <span class="tiny">&nbsp;F, M, O, U</span>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Group</td>
						<td>
						<select name="s_subjectgroupid">
							<option value="">Select a group</option>
						<?
							$sqlstring = "select * from groups where group_type = 'subject' order by group_name";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$groupid = $row['group_id'];
								$groupname = $row['group_name'];
								$groupowner = $row['group_owner'];
								
								echo "[[$groupid -- [" . $searchvars['s_subjectgroupid'] . "]]]";
								if ($groupid == $searchvars['s_subjectgroupid']) {
									$selected = "selected";
								}
								else {
									$selected = "";
								}
								?>
								<option value="<?php 
echo $groupid;
?>
" <?php 
echo $selected;
?>
><?php 
echo $groupname;
?>
</option>
								<?
							}
						?>
						</select>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="sidelabel">Enrollment</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr>
						<td class="fieldlabel" width="150px">Project</td>
						<td>
						<select name="s_projectid" class="importantfield">
							<option value="all">All Projects</option>
							<?
								$sqlstring = "select * from projects where instance_id = '" . $_SESSION['instanceid'] . "' order by project_name";
								$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									$project_id = $row['project_id'];
									$project_name = $row['project_name'];
									$project_costcenter = $row['project_costcenter'];
									if ($project_id == $searchvars['s_projectid']) { $selected = "selected"; } else { $selected = ""; }
									?>
									<option value="<?php 
echo $project_id;
?>
" <?php 
echo $selected;
?>
><?php 
echo $project_name;
?>
 (<?php 
echo $project_costcenter;
?>
)</option>
									<?
								}
							?>
						</select>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Enrollment sub-group</td>
						<td>
						<input type="text" name="s_enrollsubgroup" id="s_enrollsubgroup" list="s_enrollsubgroup" value="<?php 
echo $searchvars['s_enrollsubgroup'];
?>
" size="50"></td>
						<datalist id="s_enrollsubgroup">
						<?
							$sqlstring = "select distinct(enroll_subgroup) from enrollment order by enroll_subgroup";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								?><option value="<?php 
echo $row['enroll_subgroup'];
?>
"><?
							}
						?>
						</datalist>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<? if ($_SESSION['enablebeta']) { ?>
		<tr class="advanced">
			<td class="sidelabel">Phenotype <?php 
echo PrintBeta();
?>
</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Measure Search<br><span class="tiny">Search based on these critera</span></td>
						<td>
							<table style="font-size: 10pt" cellspacing="0" cellpadding="1">
								<tr>
									<td>
									<?
										$sqlstring = "select measure_name from measurenames order by measure_name";
										$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
										while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
											$tags[] = '"' . $row['measure_name'] . '"';
										}
									?>
									<script>
										$(function() {
											var availableTags = [<?php 
echo implode2(',', $tags);
?>
];
											function split( val ) {
												return val.split( /,\s*/ );
											}
											function extractLast( term ) {
												return split( term ).pop();
											}

											$( "#s_measure1" )
												// don't navigate away from the field on tab when selecting an item
												.bind( "keydown", function( event ) {
													if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "ui-autocomplete" ).menu.active ) {
														event.preventDefault();
													}
											})
											$( "#s_measure2" )
												// don't navigate away from the field on tab when selecting an item
												.bind( "keydown", function( event ) {
													if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "ui-autocomplete" ).menu.active ) {
														event.preventDefault();
													}
											})											.autocomplete({
												minLength: 0,
												source: function( request, response ) {
													// delegate back to autocomplete, but extract the last term
													response( $.ui.autocomplete.filter(
													availableTags, extractLast( request.term ) ) );
												},
												focus: function() {
													// prevent value inserted on focus
													return false;
												},
												select: function( event, ui ) {
													var terms = split( this.value );
													// remove the current input
													terms.pop();
													// add the selected item
													terms.push( ui.item.value );
													// add placeholder to get the comma-and-space at the end
													terms.push( "" );
													this.value = terms.join( ", " );
													return false;
												}
											});
										});
									</script>
										<input type="text" id="s_measure1" name="s_measuresearch" value="<?php 
echo $searchvars['s_measuresearch'];
?>
" size="50" maxlength="255"><br><span class="tiny">Example: meas1=4;meas*&lt;50;meas3~value</span>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Measure Columns<br><span class="tiny">Show these columns in results</span></td>
						<td>
							<table style="font-size: 10pt" cellspacing="0" cellpadding="1">
								<tr>
									<td>
										<input type="text" id="s_measure2" name="s_measurelist" value="<?php 
echo $searchvars['s_measurelist'];
?>
" size="50" maxlength="255">
										<br><span class="tiny">Example: meas1,meas2,meas3<br>Or * for all measures</span>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<? } ?>
		<tr>
			<td class="sidelabel">Study</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Institution</td>
						<td>
						<input type="text" name="s_studyinstitution" id="s_studyinstitution" list="s_studyinstitution" value="<?php 
echo $searchvars['s_studyinstitution'];
?>
" size="50"></td>
						<datalist id="s_studyinstitution">
						<?
							$sqlstring = "select distinct(study_institution) from studies order by study_institution";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								?><option value="<?php 
echo $row['study_institution'];
?>
"><?
							}
						?>
						</datalist>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Equipment</td>
						<td>
						<select name="s_studyequipment">
							<option value="">Select equipment</option>
						<?
							$sqlstring = "select distinct(study_site) from studies order by study_site";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$study_site = $row['study_site'];
								
								if ($study_site != "") {
									if ($study_site == $searchvars['s_studyequipment']) {
										$selected = "selected";
									}
									else {
										$selected = "";
									}
									?>
									<option value="<?php 
echo $study_site;
?>
" <?php 
echo $selected;
?>
><?php 
echo $study_site;
?>
</option>
									<?
								}
							}
						?>
						</select>
						</td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Alternate Scan ID(s)</td>
						<td><input type="text" name="s_studyaltscanid" value="<?php 
echo $searchvars['s_studyaltscanid'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr title="<b>Study date</b><br><br>Leave first date blank to search for anything earlier than the second date. Leave the second date blank to search for anything later than the first date">
						<td class="fieldlabel">Date</td>
						<td><input type="date" name="s_studydatestart" value="<?php 
echo $searchvars['s_studydatestart'];
?>
" size="12" class="importantfield"> to <input type="date" name="s_studydateend" value="<?php 
echo $searchvars['s_studydateend'];
?>
" size="12" class="importantfield"></td>
					</tr>
					<tr>
						<td class="fieldlabel">Modality</td>
						<td>
						<select name="s_studymodality" class="importantfield">
						<?
							$sqlstring = "select * from modalities order by mod_desc";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$mod_code = $row['mod_code'];
								$mod_desc = $row['mod_desc'];
								
								/* check if the modality table exists */
								$sqlstring2 = "show tables from " . $GLOBALS['cfg']['mysqldatabase'] . " like '" . strtolower($mod_code) . "_series'";
								$result2 = MySQLQuery($sqlstring2,__FILE__,__LINE__);
								if (mysql_num_rows($result2) > 0) {
								
									/* if the table does exist, allow the user to search on it */
									if (($mod_code == "MR") && ($searchvars['s_studymodality'] == "")) {
										$selected = "selected";
									}
									else {
										if ($mod_code == $searchvars['s_studymodality']) {
											$selected = "selected";
										}
										else {
											$selected = "";
										}
									}
									?>
									<option value="<?php 
echo $mod_code;
?>
" <?php 
echo $selected;
?>
><?php 
echo $mod_desc;
?>
</option>
									<?
								}
							}
						?>
						</select>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">Description</td>
						<td>
							<input type="text" name="s_studydesc" list="s_studydesc" value="<?php 
echo $searchvars['s_studydesc'];
?>
" size="50">
							<datalist id="s_studydesc">
							<?
								$sqlstring = "select distinct(study_desc) from studies where study_desc <> '' order by study_desc";
								$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									?><option value="<?php 
echo trim($row['study_desc']);
?>
"><?
								}
							?>
							</datalist>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">Performing&nbsp;Physician</td>
						<td>
							<input type="text" name="s_studyphysician" list="s_studyphysician" value="<?php 
echo $searchvars['s_studyphysician'];
?>
" size="50">
							<datalist id="s_studyphysician">
							<?
								$sqlstring = "select distinct(study_performingphysician) from studies where study_performingphysician <> '' order by study_performingphysician";
								$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									?><option value="<?php 
echo trim($row['study_performingphysician']);
?>
"><?
								}
							?>
							</datalist>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">Operator</td>
						<td>
							<input type="text" name="s_studyoperator" list="s_studyoperator" value="<?php 
echo $searchvars['s_studyoperator'];
?>
" size="50">
							<datalist id="s_studyoperator">
							<?
								$sqlstring = "select distinct(study_operator) from studies where study_operator <> '' order by study_operator";
								$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									?><option value="<?php 
echo trim($row['study_operator']);
?>
"><?
								}
							?>
							</datalist>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel">Visit type</td>
						<td>
							<input type="text" name="s_studytype" list="s_studytype" value="<?php 
echo $searchvars['s_studytype'];
?>
" size="50">
							<datalist id="s_studytype">
							<?
								$sqlstring = "select distinct(study_type) from studies where study_type <> '' order by study_type";
								$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									?><option value="<?php 
echo trim($row['study_type']);
?>
"><?
								}
							?>
							</datalist>
						</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Group</td>
						<td>
						<select name="s_studygroupid">
							<option value="">Select a group</option>
						<?
							$sqlstring = "select * from groups where group_type = 'study' order by group_name";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$groupid = $row['group_id'];
								$groupname = $row['group_name'];
								$groupowner = $row['group_owner'];
								
								if ($groupid == $searchvars['s_studygroupid']) {
									$selected = "selected";
								}
								else {
									$selected = "";
								}
								?>
								<option value="<?php 
echo $groupid;
?>
" <?php 
echo $selected;
?>
><?php 
echo $groupname;
?>
</option>
								<?
							}
						?>
						</select>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="sidelabel">Series</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr title="<b>Comma separated</b> protocols: search will be an AND<br><b>Semi-colon separated</b> protocols: search will be an OR">
						<td class="fieldlabel" width="150px">Protocol</td>
						<td><input type="text" name="s_seriesdesc" value="<?php 
echo $searchvars['s_seriesdesc'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr title="Perform the search using the alternate protocol name, and return the results using the alternate protocol name. The alternate protocol name often groups together series with similar names into one protocol. For example 'MPRAGE', 'Axial T1', and 'T1w_SPC' would all be labeled 'T1'">
						<td class="fieldlabel" width="150px"></td>
						<td><input type="checkbox" name="s_usealtseriesdesc" value="1" class="importantfield" <? if ($searchvars['s_usealtseriesdesc']) { echo "checked"; } ?>>Use alternate protocol name</td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Sequence</td>
						<td><input type="text" name="s_seriessequence" value="<?php 
echo $searchvars['s_seriessequence'];
?>
" size="50"></td>
					</tr>
					<tr class="advanced" title="Comma separated. Use * to indicate wildcards">
						<td class="fieldlabel" width="150px">Image Type</td>
						<td><input type="text" name="s_seriesimagetype" value="<?php 
echo $searchvars['s_seriesimagetype'];
?>
" size="50"></td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Image Comments</td>
						<td><input type="text" name="s_seriesimagecomments" value="<?php 
echo $searchvars['s_seriesimagecomments'];
?>
" size="50"></td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">TR</td>
						<td><input type="text" name="s_seriestr" value="<?php 
echo $searchvars['s_seriestr'];
?>
" title="Repetition time in milliseconds" size="10"> <span class="tiny">ms</span></td>
					</tr>
					<tr class="advanced" title="<b>Must be an integer or a criteria:</b><ul><li>> <i>N</i> (greater than)<li>>= <i>N</i> (greater than or equal to)<li>< <i>N</i> (less than)<li><= <i>N</i> (less than or equal to)<li>~ <i>N</i> (not)</ul>">
						<td class="fieldlabel" width="150px">Series number</td>
						<td><input type="text" name="s_seriesnum" value="<?php 
echo $searchvars['s_seriesnum'];
?>
" size="10"></td>
					</tr>
					<tr class="advanced" title="<b>Must be an integer or a criteria:</b><ul><li>> <i>N</i> (greater than)<li>>= <i>N</i> (greater than or equal to)<li>< <i>N</i> (less than)<li><= <i>N</i> (less than or equal to)<li>~ <i>N</i> (not)</ul>">
						<td class="fieldlabel" width="150px">Number of files</td>
						<td><input type="text" name="s_seriesnumfiles" value="<?php 
echo $searchvars['s_seriesnumfiles'];
?>
" size="10"></td>
					</tr>
					<tr class="advanced">
						<td class="fieldlabel" width="150px">Group</td>
						<td>
						<select name="s_seriesgroupid">
							<option value="">Select a group</option>
						<?
							$sqlstring = "select * from groups where group_type = 'series' order by group_name";
							$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$groupid = $row['group_id'];
								$groupname = $row['group_name'];
								$groupowner = $row['group_owner'];
								
								if ($groupid == $searchvars['s_seriesgroupid']) {
									$selected = "selected";
								}
								else {
									$selected = "";
								}
								?>
								<option value="<?php 
echo $groupid;
?>
" <?php 
echo $selected;
?>
><?php 
echo $groupname;
?>
</option>
								<?
							}
						?>
						</select>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="advanced">
			<td class="sidelabel">Analysis</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr>
						<td class="fieldlabel" width="150px">Pipeline</td>
						<td>
						<select name="s_pipelineid" onClick="SwitchOption('viewpipeline')">
							<option value="">Select pipeline</option>
						<?
							$sqlstring2 = "select pipeline_id, pipeline_name from pipelines order by pipeline_name";
							$result2 = MySQLQuery($sqlstring2,__FILE__,__LINE__);
							while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
								$pipelineid = $row2['pipeline_id'];
								$pipelinename = $row2['pipeline_name'];
								?>
								<option value="<?php 
echo $pipelineid;
?>
" <? if ($searchvars['s_pipelineid'] == $pipelineid) { echo "selected"; } ?>><?php 
echo $pipelinename;
?>
</option>
								<?
							}
						?>
						</select>
						</td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Result name</td>
						<td><input type="text" name="s_pipelineresultname" onClick="SwitchOption('viewpipeline')" value="<?php 
echo $searchvars['s_pipelineresultname'];
?>
" size="50" class="importantfield"></td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Result unit</td>
						<td><input type="text" name="s_pipelineresultunit" onClick="SwitchOption('viewpipeline')" value="<?php 
echo $searchvars['s_pipelineresultunit'];
?>
" size="20" maxsize="20" class="importantfield"></td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Result type</td>
						<td>
							<input type="radio" name="s_pipelineresulttype" value="" onClick="SwitchOption('viewpipeline')" <? if ($searchvars['s_pipelineresulttype'] == '') { echo "checked"; } ?>>None<br>
							<input type="radio" name="s_pipelineresulttype" value="v" onClick="SwitchOption('viewpipeline')" <? if ($searchvars['s_pipelineresulttype'] == 'v') { echo "checked"; } ?>>Value<br>
							<input type="radio" name="s_pipelineresulttype" value="i" onClick="SwitchOption('viewpipeline')" <? if ($searchvars['s_pipelineresulttype'] == 'i') { echo "checked"; } ?>>Image<br>
							<input type="radio" name="s_pipelineresulttype" value="f" onClick="SwitchOption('viewpipeline')" <? if ($searchvars['s_pipelineresulttype'] == 'f') { echo "checked"; } ?>>File<br>
							<input type="radio" name="s_pipelineresulttype" value="h" onClick="SwitchOption('viewpipeline')" <? if ($searchvars['s_pipelineresulttype'] == 'h') { echo "checked"; } ?>>HTML<br>
						</td>
					</tr>
					<tr>
						<td class="fieldlabel" width="150px">Result value</td>
						<td valign="top">
							<select name="s_pipelineresultcompare" onClick="SwitchOption('viewpipeline')">
								<option value="=" <? if ($searchvars['s_pipelineresultcompare'] == '=') { echo "selected"; } ?>>=
								<option value=">" <? if ($searchvars['s_pipelineresultcompare'] == '>') { echo "selected"; } ?>>&gt;
								<option value=">=" <? if ($searchvars['s_pipelineresultcompare'] == '>=') { echo "selected"; } ?>>&gt;=
								<option value="<" <? if ($searchvars['s_pipelineresultcompare'] == '<') { echo "selected"; } ?>>&lt;
								<option value="<=" <? if ($searchvars['s_pipelineresultcompare'] == '<=') { echo "selected"; } ?>>&lt;=
							</select>
							<input type="text" name="s_pipelineresultvalue" onClick="SwitchOption('viewpipeline')" value="<?php 
echo $searchvars['s_pipelineresultvalue'];
?>
" size="15" class="smallsearchbox"><br>
							<input type="checkbox" name="s_pipelinecolorize" onClick="SwitchOption('viewpipeline')" value="1" <? if ($searchvars['s_pipelinecolorize'] == 1) { echo "checked"; } ?>>Colorize <span class="tiny">low <img src="images/colorbar.png"> high</span>
							<br>
							<input type="checkbox" name="s_pipelinecormatrix" onClick="SwitchOption('viewpipeline')" value="1" <? if ($searchvars['s_pipelinecormatrix'] == 1) { echo "checked"; } ?>>Display correlation matrix <span class="tiny">Slow for large result sets</span>
							<br>
							<input type="checkbox" name="s_pipelineresultstats" onClick="SwitchOption('viewpipeline')" value="1" <? if ($searchvars['s_pipelineresultstats'] == 1) { echo "checked"; } ?>>Display result statistics
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="sidelabel" style="color: gray">Results</td>
			<td style="border-bottom: 1pt solid #CCC">
				<table width="100%" cellspacing="0" cellpadding="3">
					<tr>
						<td class="fieldlabel" width="150px"><!--Results format--></td>
						<td>
							<span style="font-size:10pt; color: darkblue">Download/Export</span><br>
							
							<? if (($searchvars['s_resultorder'] == "subject") || ($action == "")) { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="downloadsubject" value="subject" <?php 
echo $checked;
?>
> Enrollment List<br>
							
							<? if (($searchvars['s_resultorder'] == "uniquesubject") || ($action == "")) { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="downloaduniquesubject" value="uniquesubject" <?php 
echo $checked;
?>
> Subject List<br>
							
							<? if (($searchvars['s_resultorder'] == "study") || ($action == "")) { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="downloadstudy" value="study" <?php 
echo $checked;
?>
> Group by <b>study</b><br>
							
							<? if ($searchvars['s_resultorder'] == "series") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="downloadseries" value="series" <?php 
echo $checked;
?>
> Series List
							
							<br><br>

							<span style="font-size:10pt; color: darkblue">View</span><br>
							<? if ($searchvars['s_resultorder'] == "table") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewtable" value="table" <?php 
echo $checked;
?>
> Table<br>
							
							<? if ($searchvars['s_resultorder'] == "csv") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewcsv" value="csv" <?php 
echo $checked;
?>
> Spreadsheet <span class="tiny">.csv</span><br>
							
							<? if ($searchvars['s_resultorder'] == "pipeline") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewpipeline" value="pipeline" <?php 
echo $checked;
?>
> Pipeline results<br>
							
							<? if ($searchvars['s_resultorder'] == "pipelinecsv") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewpipelinecsv" value="pipelinecsv" <?php 
echo $checked;
?>
> Pipeline results <span class="tiny">.csv</span><br>
							
							<? if ($searchvars['s_resultorder'] == "long") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewlong" value="long" <?php 
echo $checked;
?>
> Longitudinal<br>

							<? if ($searchvars['s_resultorder'] == "debug") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewdebug" value="debug" <?php 
echo $checked;
?>
> Debug <span class="tiny">SQL</span><br>
							
							<? if ($GLOBALS['isadmin']) { ?>
							<? if ($searchvars['s_resultorder'] == "operations") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="radio" name="s_resultorder" id="viewoperations" value="operations" <?php 
echo $checked;
?>
> File operations
							<? } ?>
							
							<br>
							<br>
							
							<? if ($searchvars['s_audit'] == "1") { $checked = "checked"; } else { $checked = ""; }?>
							<input type="checkbox" name="s_audit" value="1" <?php 
echo $checked;
?>
> Audit <span class="tiny">files</span>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center" style="padding-top: 15px;">
				<input type="submit" value="Search">
			</td>
		</tr>
	</table>
			</td>
			<td rowspan="5" width="300px" valign="top" style="padding-left: 150px; color: darkblue; font-size:10pt">
				<details>
				<summary><b>Search Tips:</b></summary>
				<ul>
					<li>Enter as much or as little information as you want
					<li>Put commas between items to search for lists of names, scanids, study descriptions, physicians, operators or protocols
					<li>Use the <a href="http://www.google.com/chrome" class="link">Google Chrome</a> browser if possible
				</ul>
				</details>
			</td>
		</tr>
	</table>
	
	</form>
	</div>
	<?
	}
예제 #9
0
파일: common.php 프로젝트: pmolfese/nidb
function DisplayCommonList()
{
    $urllist['Common objects'] = "common.php";
    NavigationBar("Common objects", $urllist);
    ?>
		<SCRIPT LANGUAGE="Javascript">
		<!---
			function decision(message, url){
				if(confirm(message)) location.href = url;
			}
		// --->
		</SCRIPT>
		
		<table class="smalldisplaytable">
			<thead>
				<tr>
					<th>Group</th>
					<th>Name</th>
					<th>Description</th>
					<th>Type</th>
					<th>Value</th>
					<th>Size</th>
					<th>Upload <?php 
    echo strtoupper($modality);
    ?>
 file<br><span class="tiny">Click button or Drag & Drop</span></th>
					<th>Delete</th>
				</tr>
			</thead>
			<tbody>
				<form action="common.php" method="post" enctype="multipart/form-data">
				<input type="hidden" name="action" value="addobject">
				<input type="hidden" name="modality" value="<?php 
    echo strtoupper($modality);
    ?>
">
				<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
				<tr>
					<td><input type="text" name="common_group" size="15"></td>
					<td><input type="text" name="common_name"></td>
					<td><input type="text" name="common_desc"></td>
					<td>
						<select name="common_type">
							<option value="file">File</option>
							<option value="text">Text</option>
							<option value="number">Number</option>
						</select>
					</td>
					<td><input type="text" name="common_value"></td>
					<td></td>
					<td>
						<input type="file" name="file">
					</td>
					<td><input type="submit" value="Create"></td>
				</tr>
				</form>
				<?php 
    $sqlstring = "select * from common order by common_group, common_name";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><b>{$sqlstring}</b><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $common_id = $row['common_id'];
        $type = $row['common_type'];
        $group = $row['common_group'];
        $name = $row['common_name'];
        $desc = $row['common_desc'];
        $number = $row['common_number'];
        $text = $row['common_text'];
        $file = $row['common_file'];
        $size = $row['common_size'];
        switch ($type) {
            case 'number':
                $value = $number;
                break;
            case 'file':
                $value = $file;
                break;
            case 'text':
                $value = $text;
                break;
        }
        ?>
						<script type="text/javascript">
							$(document).ready(function(){
								$(".edit_inline<?php 
        echo $common_id;
        ?>
").editInPlace({
									url: "common_inlineupdate.php",
									params: "action=editinplace&id=<?php 
        echo $series_id;
        ?>
",
									default_text: "<i style='color:#AAAAAA'>Edit here...</i>",
									bg_over: "white",
									bg_out: "lightyellow",
								});
							});
						</script>
						<tr>
							<td><?php 
        echo $group;
        ?>
</td>
							<td><?php 
        echo $name;
        ?>
</td>
							<td><?php 
        echo $desc;
        ?>
</td>
							<td><?php 
        echo $type;
        ?>
</td>
							<td><?php 
        echo $value;
        ?>
</td>
							<td><?php 
        echo HumanReadableFilesize($size);
        ?>
</td>
							<td nowrap><?php 
        echo $series_size;
        ?>
 <a href="download.php?modality=<?php 
        echo $modality;
        ?>
&seriesid=<?php 
        echo $series_id;
        ?>
" border="0"><img src="images/download16.png" title="Download <?php 
        echo $modality;
        ?>
 data"></a></td>
							<td align="right">
								<a href="javascript:decision('Are you sure you want to delete this object?', 'common.php?action=deleteobject&id=<?php 
        echo $common_id;
        ?>
')" style="color: red">X</a>
							</td>
						</tr>
					<?php 
    }
    ?>
			</tbody>
		</table>
		<?php 
}
예제 #10
0
파일: cluster.php 프로젝트: pmolfese/nidb
function DisplayGraph()
{
    $urllist['Cluster Stats'] = "cluster.php";
    NavigationBar("Cluster Stats", $urllist);
    list($statsoutput, $report, $queues, $hostnames) = GetClusterStats();
    DisplayStatsMenu();
    $slotsusedcolor = "FF4500";
    $slotsunusedcolor = "EEEEEE";
    ?>

		<table>
			<tr>
				<td valign="top">
					<table border="0">
						<tr>
							<td>Queue</td>
						<?php 
    foreach ($queues as $queue) {
        $slotsused = 0;
        $slotsunused = 0;
        foreach ($hostnames as $hostname) {
            if (isset($report[$hostname]['queues'][$queue])) {
                echo "<pre>";
                //print_r($report[$hostname]['queues'][$queue]['jobs']);
                $slotsused += $report[$hostname]['queues'][$queue]['slotsused'];
                $slotsunused += $report[$hostname]['queues'][$queue]['slotsavailable'];
                echo "</pre>";
            }
        }
        ?>
								<tr>
									<td><b><?php 
        echo $queue;
        ?>
</b> &nbsp;</td>
									<td>
										<img src="horizontalchart.php?b=yes&w=600&h=25&v=<?php 
        echo $slotsused;
        ?>
,<?php 
        echo $slotsunused - $slotsused;
        ?>
&c=<?php 
        echo $slotsusedcolor;
        ?>
,<?php 
        echo $slotsunusedcolor;
        ?>
">
										<?php 
        if ($slotsused == 0 && $slotsunused == 0) {
            echo "Idle";
        } else {
            echo "{$slotsused} of {$slotsunused}";
        }
        ?>
									</td>
								</tr>
								<?php 
    }
    ?>
					</table>
				</td>
				<td valign="top">
				</td>
			</tr>
		</table>
	<?php 
}
예제 #11
0
	function DisplaySubjectForm($type, $id) {

		/* populate the fields if this is an edit */
		if ($type == "edit") {
			$sqlstring = "select * from subjects where subject_id = $id";
			$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
			$row = mysql_fetch_array($result, MYSQL_ASSOC);
			$name = $row['name'];
			$dob = $row['birthdate'];
			$gender = $row['gender'];
			$ethnicity1 = $row['ethnicity1'];
			$ethnicity2 = $row['ethnicity2'];
			$handedness = $row['handedness'];
			$education = $row['education'];
			$phone1 = $row['phone1'];
			$email = $row['email'];
			$maritalstatus = $row['marital_status'];
			$smokingstatus = $row['smoking_status'];
			$uid = $row['uid'];
			$guid = $row['guid'];
			$cancontact = $row['cancontact'];
			
			list($lastname, $firstname) = explode("^",$name);
		
			/* get privacy information */
			$username = $_SESSION['username'];
			$sqlstring = "select user_id from users where username = '******'";
			$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
			$row = mysql_fetch_array($result, MYSQL_ASSOC);
			$userid = $row['user_id'];
			
			$sqlstring = "select c.*, d.*  from subjects a left join enrollment b on a.subject_id = b.subject_id left join user_project c on b.project_id = c.project_id left join projects d on d.project_id = c.project_id where a.subject_id = '$id' and c.user_id = $userid and c.view_phi = 1";
			//PrintSQL($sqlstring);
			$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
			if (mysql_num_rows($result) > 0) {
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					$projectname = $row['project_name'];
					$projectcostcenter = $row['project_costcenter'];
					$phiprojectlist[] = "$projectname ($projectcostcenter)";
				}
				$phiaccess = 1;
			}
			else {
				$phiaccess = 0;
			}
			
			$sqlstring = "select c.*, d.*  from subjects a left join enrollment b on a.subject_id = b.subject_id left join user_project c on b.project_id = c.project_id left join projects d on d.project_id = c.project_id where a.subject_id = '$id' and c.user_id = $userid and c.view_data = 1";
			//PrintSQL($sqlstring);
			$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
			if (mysql_num_rows($result) > 0) {
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					$projectname = $row['project_name'];
					$projectcostcenter = $row['project_costcenter'];
					$dataprojectlist[] = "$projectname ($projectcostcenter)";
				}
				$dataaccess = 1;
			}
			else {
				$dataaccess = 0;
			}			
			$formaction = "confirmupdate";
			$formtitle = "Updating &nbsp;<span class='uid'>" . FormatUID($uid) . "</span>";
			$submitbuttonlabel = "Update";
		}
		else {
			$formaction = "confirmadd";
			$formtitle = "Add new subject";
			$submitbuttonlabel = "Add";
			$dob = "1900-01-01";
			$phiaccess = 1;
		}

		$urllist['Subject List'] = "subjects.php";
		$urllist[$uid] = "subjects.php?action=display&id=$id";
		NavigationBar("Subjects", $urllist, 1, $phiaccess, $dataaccess, $phiprojectlist, $dataprojectlist);
		
		/* kick them out if they shouldn't be seeing anything on this page */
		if ((!$phiaccess) && (!$dataaccess)) {
			return;
		}
	?>
		<script type="text/javascript">
			$(document).ready(function() {
				$("#form1").validate();
			});
		</script>
		<div align="center">
		<table class="entrytable">
			<form method="post" id="form1" action="subjects.php">
			<input type="hidden" name="action" value="<?php 
echo $formaction;
?>
">
			<input type="hidden" name="id" value="<?php 
echo $id;
?>
">
			<input type="hidden" name="uid" value="<?php 
echo $uid;
?>
">
			<tr>
				<td colspan="2" align="center">
					<br><b><?php 
echo $formtitle;
?>
</b><br><br>
				</td>
			</tr>
			<? if ($type == "add") { ?>
			<tr title="This will encrypt the name and alternate UIDs.<br>It will also change the DOB to year only (ex. 1980-00-00)">
				<td class="label">Encrypt</td>
				<td><input type="checkbox" name="encrypt" value="1"></td>
			</tr>
			<? } ?>
			<tr>
				<td class="requiredlabel">First name</td>
				<td>
					<? if ($phiaccess) { ?>
					<input type="text" size="50" name="firstname" value="<?php 
echo $firstname;
?>
" style="background-color: lightyellow; border: 1px solid gray">
					<? } else { ?>
					<input type="text" size="50" name="firstname" value="" disabled style="background-color: lightgray; border: 1px solid gray">
					<? } ?>
				</td>
			</tr>
			<tr>
				<td class="requiredlabel">Last name</td>
				<td>
					<? if ($phiaccess) { ?>
					<input type="text" size="50" name="lastname" value="<?php 
echo $lastname;
?>
" required style="background-color: lightyellow; border: 1px solid gray">
					<? } else { ?>
					<input type="text" size="50" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
					<? } ?>
				</td>
			</tr>
			<tr>
				<td class="requiredlabel">Date of birth</td>
				<td>
					<? if ($phiaccess) { ?>
					<input type="date" name="dob" value="<?php 
echo $dob;
?>
" required style="background-color: lightyellow; border: 1px solid gray"><!--&nbsp;<span class="subtlemessage">YYYY-MM-DD</span>-->
					<? } else { ?>
					<input type="text" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
					<? } ?>
				</td>
			</tr>
			<tr>
				<td class="requiredlabel">IDs<br><span class="tiny">comma separated list</span></td>
				<td>
					<table style="border: 1px solid #ddd; border-radius:3px; color: #555; font-size: 11pt">
						<thead>
							<tr>
								<th align="right" style="padding-right: 8px"><b>Project</b></th>
								<th align="left" title="Use asterisk next to primary ID (Example *PrimaryID1, otherID1, otherID23)"><b>IDs</b></th>
							</tr>
						</thead>
						<tr>
							<td align="right" style="padding-right: 8px">All projects</td>
							<td><input type="text" size="50" name="altuids[]" value="<?php 
echo implode2(',', GetAlternateUIDs($id, ''));
?>
" style="background-color: lightyellow; border: 1px solid gray"></td>
							<input type="hidden" name="enrollmentids[]" value="">
						</tr>
						<?
						if ($id != "") {
							$sqlstring = "select a.enrollment_id, b.project_name from enrollment a left join projects b on a.project_id = b.project_id where a.subject_id = '$id'";
							$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
							while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
								$enrollmentid = $row['enrollment_id'];
								$projectname = $row['project_name'];
								?>
								<tr>
									<td align="right" style="padding-right: 8px"><?php 
echo $projectname;
?>
</td>
									<td><input type="text" size="50" name="altuids[]" value="<?php 
echo implode2(',', GetAlternateUIDs($id, $enrollmentid));
?>
" style="background-color: lightyellow; border: 1px solid gray"></td>
									<input type="hidden" name="enrollmentids[]" value="<?php 
echo $enrollmentid;
?>
">
								</tr>
								<?
							}
						}
						?>
					</table>
				</td>
			</tr>
			<tr>
				<td class="requiredlabel">Sex</td>
				<td>
					<select name="gender" style="background-color: lightyellow; border: 1px solid gray">
						<option value="" <? if ($gender == "") echo "selected"; ?>>(Select sex)</option>
						<option value="U" <? if ($gender == "U") echo "selected"; ?>>Unknown</option>
						<option value="F" <? if ($gender == "F") echo "selected"; ?>>Female</option>
						<option value="M" <? if ($gender == "M") echo "selected"; ?>>Male</option>
						<option value="O" <? if ($gender == "O") echo "selected"; ?>>Other</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Ethnicity</td>
				<td>
					<select name="ethnicity1">
						<option value="" <? if ($ethnicity1 == "") echo "selected"; ?>>(Select ethnicity)</option>
						<option value="hispanic" <? if ($ethnicity1 == "hispanic") echo "selected"; ?>>Hispanic/Latino</option>
						<option value="nothispanic" <? if ($ethnicity1 == "nothispanic") echo "selected"; ?>>Not hispanic/latino</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Race</td>
				<td>
					<select name="ethnicity2">
						<option value="" <? if ($ethnicity2 == "") echo "selected"; ?>>(Select race)</option>
						<option value="indian" <? if ($ethnicity2 == "indian") echo "selected"; ?>>American Indian/Alaska Native</option>
						<option value="asian" <? if ($ethnicity2 == "asian") echo "selected"; ?>>Asian</option>
						<option value="black" <? if ($ethnicity2 == "black") echo "selected"; ?>>Black/African American</option>
						<option value="islander" <? if ($ethnicity2 == "islander") echo "selected"; ?>>Hawaiian/Pacific Islander</option>
						<option value="white" <? if ($ethnicity2 == "white") echo "selected"; ?>>White</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Handedness</td>
				<td>
					<select name="handedness">
						<option value="" <? if ($handedness == "") echo "selected"; ?>>(Select a status)</option>
						<option value="U" <? if ($handedness == "U") echo "selected"; ?>>Unknown</option>
						<option value="R" <? if ($handedness == "R") echo "selected"; ?>>Right</option>
						<option value="L" <? if ($handedness == "L") echo "selected"; ?>>Left</option>
						<option value="A" <? if ($handedness == "A") echo "selected"; ?>>Ambidextrous</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Education<br><span class="tiny">highest level completed</span></td>
				<td>
					<select name="education">
						<option value="" <? if ($education == "") echo "selected"; ?>>(Select a status)</option>
						<option value="0" <? if ($education == "0") echo "selected"; ?>>Unknown</option>
						<option value="1" <? if ($education == "1") echo "selected"; ?>>Grade School</option>
						<option value="2" <? if ($education == "2") echo "selected"; ?>>Middle School</option>
						<option value="3" <? if ($education == "3") echo "selected"; ?>>High School/GED</option>
						<option value="4" <? if ($education == "4") echo "selected"; ?>>Trade School</option>
						<option value="5" <? if ($education == "5") echo "selected"; ?>>Associates Degree</option>
						<option value="6" <? if ($education == "6") echo "selected"; ?>>Bachelors Degree</option>
						<option value="7" <? if ($education == "7") echo "selected"; ?>>Masters Degree</option>
						<option value="8" <? if ($education == "8") echo "selected"; ?>>Doctoral Degree</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label">Phone</td>
				<td>
					<? if ($phiaccess) { ?>
					<input type="text" name="phone" value="<?php 
echo $phone1;
?>
"> <?php 
echo $phone1;
?>
					<? } else { ?>
					<input type="text" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
					<? } ?>
				</td>
			</tr>
			<tr>
				<td class="label">E-mail</td>
				<td>
				<? if ($phiaccess) { ?>
				<input type="text" name="email" value="<?php 
echo $email;
?>
">
				<? } else { ?>
				<input type="text" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
				<? } ?>
				</td>
			</tr>
			<tr>
				<td class="label">Marital Status</td>
				<td>
				<? if ($phiaccess) { ?>
					<select name="maritalstatus">
						<option value="" <? if ($maritalstatus == "") echo "selected"; ?>>(Select a status)</option>
						<option value="unknown" <? if ($maritalstatus == "unknown") echo "selected"; ?>>Unknown</option>
						<option value="single" <? if ($maritalstatus == "single") echo "selected"; ?>>Single</option>
						<option value="married" <? if ($maritalstatus == "married") echo "selected"; ?>>Married</option>
						<option value="divorced" <? if ($maritalstatus == "divorced") echo "selected"; ?>>Divorced</option>
						<option value="separated" <? if ($maritalstatus == "separated") echo "selected"; ?>>Separated</option>
						<option value="civilunion" <? if ($maritalstatus == "civilunion") echo "selected"; ?>>Civil Union</option>
						<option value="cohabitating" <? if ($maritalstatus == "cohabitating") echo "selected"; ?>>Cohabitating</option>
						<option value="widowed" <? if ($maritalstatus == "widowed") echo "selected"; ?>>Widowed</option>
					</select>
				<? } else { ?>
				<input type="text" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
				<? } ?>
				</td>
			</tr>
			<tr>
				<td class="label">Smoking Status</td>
				<td>
				<? if ($phiaccess) { ?>
					<select name="smokingstatus">
						<option value="" <? if ($maritalstatus == "") echo "selected"; ?>>(Select a status)</option>
						<option value="unknown" <? if ($maritalstatus == "unknown") echo "selected"; ?>>Unknown</option>
						<option value="never" <? if ($maritalstatus == "never") echo "selected"; ?>>Never</option>
						<option value="past" <? if ($maritalstatus == "past") echo "selected"; ?>>Past</option>
						<option value="current" <? if ($maritalstatus == "current") echo "selected"; ?>>Current</option>
					</select>
				<? } else { ?>
				<input type="text" name="" value="" disabled style="background-color: lightgray; border: 1px solid gray">
				<? } ?>
				</td>
			</tr>
			<tr>
				<td class="label">GUID<br><span class="tiny">NDAR format</span></td>
				<td><input type="text" name="guid" value="<?php 
echo $guid;
?>
"></td>
			</tr>
			<tr>
				<td class="label">Can contact?</td>
				<td><input type="checkbox" name="cancontact" value="1" <? if ($cancontact) echo "checked"; ?>></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="reset" title="Reset the form the original values"> &nbsp; <input type="submit" value="<?php 
echo $submitbuttonlabel;
?>
">
				</td>
			</tr>
			</form>
		</table>
		</div>
	<?
	}
예제 #12
0
	function DisplayGroupList() {
	
		$urllist['Groups'] = "groups.php";
		$urllist['Add Group'] = "groups.php?action=addform";
		NavigationBar("Groups", $urllist,0,'','','','');
		
	?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Name</th>
				<th>Type</th>
				<th>Owner</th>
				<th>Group size</th>
				<th></th>
			</tr>
		</thead>
		<tbody>
			<form action="groups.php" method="post">
			<input type="hidden" name="action" value="add">
			<tr>
				<td style="border-bottom: 2pt solid gray"><input type="text" name="groupname"></td>
				<td style="border-bottom: 2pt solid gray">
					<select name="grouptype">
						<option value="subject">Subject
						<option value="study">Study
						<option value="series">Series
					</select>
				</td>
				<td style="border-bottom: 2pt solid gray"><?php 
echo $GLOBALS['username'];
?>
</td>
				<td style="border-bottom: 2pt solid gray"><input type="submit" value="Create group"></td>
				<td style="border-bottom: 2pt solid gray">Delete group</td>
			</tr>
			</form>
			<?
				$sqlstring = "select a.*, b.username 'ownerusername', b.user_fullname 'ownerfullname' from groups a left join users b on a.group_owner = b.user_id order by a.group_name";
				$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					$id = $row['group_id'];
					$name = $row['group_name'];
					$ownerusername = $row['ownerusername'];
					$grouptype = $row['group_type'];
					
					$sqlstring2 = "select count(*) 'count' from group_data where group_id = $id";
					$result2 = mysql_query($sqlstring2) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring2</i><br>");
					$row2 = mysql_fetch_array($result2, MYSQL_ASSOC);
					$count = $row2['count'];
			?>
			<tr style="<?php 
echo $style;
?>
">
				<td><a href="groups.php?action=viewgroup&id=<?php 
echo $id;
?>
"><?php 
echo $name;
?>
</a></td>
				<td><?php 
echo $grouptype;
?>
</td>
				<td><?php 
echo $ownerusername;
?>
</td>
				<td><?php 
echo $count;
?>
</td>
				<td align="right">
					<? if ($ownerusername == $GLOBALS['username']) { ?>
					<a href="groups.php?action=delete&id=<?php 
echo $id;
?>
" style="color:red">X</a>
					<? } ?>
				</td>
			</tr>
			<? 
				}
			?>
		</tbody>
	</table>
	<?
	}
예제 #13
0
        echo htmlspecialchars($session);
        ?>
">
    Do you really want to delete the category?
    <input type="submit" name="submit" value="Delete">
</form>
<?php 
    }
}
/*
 * ########################################################################################
 * Edit a category
 * ########################################################################################
 */
if ('category-edit' == $action) {
    NavigationBar($action);
    print "<h3>Edit Category</h3>";
    if (isset($_POST['submit'])) {
        if (empty($_POST['category-name'])) {
            print "The category name can't be empty";
        } else {
            $categoryName = addslashes(fix_umlauts($_POST['category-name']));
            $result = mysql_query(<<<SQL
SELECT
    COUNT(categoryid)
FROM
    {$pref}category
WHERE
    categoryname = '{$categoryName}'
SQL
);
예제 #14
0
	function PrintForm($experimentid) {
	
		$sqlstring = "select * from assessments where experiment_id = $experimentid";
		$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$enrollmentid = $row['enrollment_id'];
		$formid = $row['form_id'];
		$experimentor = $row['experimentor'];
		$exp_admindate = $row['exp_admindate'];
		$iscomplete = $row['iscomplete'];
		$lastupdate = date("M n, Y g:i a",strtotime($row['lastupdate']));

		$sqlstring = "select * from assessment_forms where form_id = $formid";
		$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$title = $row['form_title'];
		$desc = $row['form_desc'];
		
		$sqlstring = "select a.* from subjects a left join enrollment b on a.subject_id = b.subject_id where b.enrollment_id = $enrollmentid";
		$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$uid = $row['uid'];
		$id = $row['subject_id'];
		
		$urllist['Subject List'] = "subjects.php";
		$urllist[$uid] = "subjects.php?action=display&id=$id";
		NavigationBar("Subjects", $urllist);
		
		if ($viewtype == "view") {
			$readonly = "readonly";
		}
		if ($viewtype == "print") $print = 1; else $print = 0;
		
		if ($iscomplete) {
			$formstatusclass = "completeform";
			$formstatus = "Complete";
		}
		else {
			$formstatusclass = "incompleteform";
			$formstatus = "Incomplete";
		}
		
	?>
		<div align="center">
		<br><br>
		<table>
			<tr>
				<td align="right" style="font-weight: bold; font-size: 11pt; color: #444444">Experimentor</td>
				<td><?php 
echo $experimentor;
?>
</td>
			</tr>
			<tr>
				<td align="right" style="font-weight: bold; font-size: 11pt; color: #444444">Experiment date</td>
				<td><?php 
echo $exp_admindate;
?>
</td>
			</tr>
		</table>
		<br><br>
		
		<table class="formentrytable">
			<tr>
				<td class="title" colspan="3"><?php 
echo $title;
?>
</td>
				<td rowspan="2"><div class="<?php 
echo $formstatusclass;
?>
"><?php 
echo $formstatus;
?>
<br><span style="font-size:8pt; font-weight: normal"><?php 
echo $lastupdate;
?>
</span></div></td>
			</tr>
			<tr>
				<td class="desc" colspan="3"><?php 
echo $desc;
?>
</td>
			</tr>
			<tr>
				<td colspan="3">&nbsp;</td>
			</tr>
			<?
				/* display all other rows, sorted by order */
				$sqlstring = "SELECT a.*, b.value_text, b.value_number, b.value_string, b.value_binary, b.value_date, b.update_username FROM assessment_formfields a left outer join assessment_data b on a.formfield_id = b.formfield_id where a.form_id = $formid and (b.experiment_id = $experimentid or b.experiment_id is NULL) order by a.formfield_order + 0";
				//echo $sqlstring;
				$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					//print_r($row);
					$formfield_id = $row['formfield_id'];
					$formfield_desc = $row['formfield_desc'];
					$formfield_values = $row['formfield_values'];
					$formfield_datatype = $row['formfield_datatype'];
					$formfield_order = $row['formfield_order'];
					$formfield_scored = $row['formfield_scored'];
					$formfield_haslinebreak = $row['formfield_haslinebreak'];
					
					$value_text = $row['value_text'];
					$value_number = $row['value_number'];
					$value_string = $row['value_string'];
					$value_binary = $row['value_binary'];
					$value_date = $row['value_date'];
					$update_username = $row['update_username'];
					
					?>
					<tr>
						<? if ($formfield_datatype == "header") { ?>
							<td colspan="2" class="sectionheader"><?php 
echo $formfield_desc;
?>
</td>
						<? } else { ?>
							<td class="field"><?php 
echo $formfield_desc;
?>
</td>
							<td class="value">
							<?
								switch ($formfield_datatype) {
									case "binary": ?><input type="file" name="file-<?php 
echo $formfield_id;
?>
[]" <?php 
echo $readonly;
?>
><? break;
									case "multichoice":
										echo str_replace(",", "<br>", $value_text);
										break;
									case "singlechoice":
										if ($viewtype == "print") {
											echo $value_string;
										}
										else {
											$values = explode(",", $formfield_values);
											foreach ($values as $value) {
												if ($value == $value_string) { $checked = "checked"; } else { $checked = "";}
												?>
												<input type="radio"  name="text-<?php 
echo $formfield_id;
?>
[]" value="<?php 
echo $value;
?>
" <?php 
echo $checked;
?>
 <?php 
echo $readonly;
?>
><?php 
echo $value;
?>
 &nbsp;
												<?
											}
										}
										break;
									case "date":
										if ($viewtype == "print") {
											echo $value_date;
										}
										else {
										?>
											<input type="date" name="date-<?php 
echo $formfield_id;
?>
[]" value="<?php 
echo $value_date;
?>
" <?php 
echo $readonly;
?>
><span class="tiny">date</span>
										<?
										}
										break;
									case "number":
										if ($viewtype == "print") {
											echo $value_number;
										}
										else {
										?>
											<input type="text" name="number-<?php 
echo $formfield_id;
?>
[]" value="<?php 
echo $value_number;
?>
" <?php 
echo $readonly;
?>
><span class="tiny">number</span>
										<?
										}
										break;
									case "string":
										if ($viewtype == "print") {
											echo $value_string;
										}
										else {
										?>
											<input type="text" name="string-<?php 
echo $formfield_id;
?>
[]" value="<?php 
echo $value_string;
?>
" <?php 
echo $readonly;
?>
><span class="tiny">string</span>
										<?
										}
										break;
									case "text":
										if ($viewtype == "print") {
											echo $value_text;
										}
										else {
										?>
											<textarea name="text-<?php 
echo $formfield_id;
?>
[]" <?php 
echo $readonly;
?>
><?php 
echo $value_text;
?>
</textarea>
										<?
										}
										break;
								}
							?>
						<? } ?>
						</td>
						<? if ($formfield_scored) {?>
						<td><input type="text" size="2"></td>
						<? } ?>
						<td class="order"><?php 
echo $formfield_order;
?>
</td>
						<td class="rater"><?php 
echo $update_username;
?>
</td>
					</tr>
					<?
				}
				
				if (!$iscomplete) {
			?>
			<tr>
				<td colspan="3" align="center">
					<input type="submit" value="Update">
				</td>
			</tr>
			<? } ?>
		</table>
		</form>
		<br><br>
		
		</div>
	<?
	}
예제 #15
0
	function DisplayModalityList() {
	
		$urllist['Administration'] = "admin.php";
		$urllist['Modalities'] = "adminmodalities.php";
		NavigationBar("Admin", $urllist);
		
	?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Name<br><span class="tiny">View table schema</span></th>
				<th>Protocol groups</th>
				<th>Description</th>
				<th>Rows</th>
				<th>Table size<br><span class="tiny">(data + index)</span></th>
				<th>Enable/Disable</th>
			</tr>
		</thead>
		<tbody>
			<?
				$sqlstring = "select * from modalities order by mod_code";
				$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					$id = $row['mod_id'];
					$name = $row['mod_code'];
					$desc = $row['mod_desc'];
					$enabled = $row['mod_enabled'];
					
					/* calculate the status color */
					if (!$enabled) { $color = "gray"; }
					else { $color = "black"; }
					
					/* get information about the modality table */
					$sqlstringA = "show table status like '" . strtolower($name) . "_series'";
					$resultA = MySQLQuery($sqlstringA,__FILE__,__LINE__);
					$rowA = mysql_fetch_array($resultA, MYSQL_ASSOC);
					$rows = $rowA['Rows'];
					$tablesize = $rowA['Data_length'];
					$indexsize = $rowA['Index_length'];

					/* get info about the modality protocol group */
					//$sqlstringB = "select count(*) 'count' from modality_protocolgroup where modality = '$name'";
					//$resultB = mysql_query($sqlstringB) or die("Query failed: " . mysql_error() . "<br><i>$sqlstringB</i><br>");
					//$rowB = mysql_fetch_array($resultB, MYSQL_ASSOC);
					//$grouprowcount = $rowB['count'];
					
					?>
					<tr style="color: <?php 
echo $color;
?>
">
						<td><a href="adminmodalities.php?action=edit&id=<?php 
echo $id;
?>
"><?php 
echo $name;
?>
</a></td>
						<td><a href="adminmodalities.php?action=editprotocolgroups&id=<?php 
echo $id;
?>
">View</a></td>
						<td><?php 
echo $desc;
?>
</td>
						<td align="right"><?php 
echo number_format($rows, 0);
?>
</td>
						<td align="right"><?php 
echo number_format($tablesize + $indexsize);
?>
</td>
						<td>
							<?
								if ($enabled) {
									?><a href="adminmodalities.php?action=disable&id=<?php 
echo $id;
?>
"><img src="images/checkedbox16.png"></a><?
								}
								else {
									?><a href="adminmodalities.php?action=enable&id=<?php 
echo $id;
?>
"><img src="images/uncheckedbox16.png"></a><?
								}
							?>
						</td>
					</tr>
					<? 
				}
			?>
		</tbody>
	</table>
	<?
	}
예제 #16
0
	function DisplayStudy($id, $audit, $fix, $search_pipelineid, $search_name, $search_compare, $search_value, $search_type, $search_swversion, $imgperline) {
	
		$id = mysql_real_escape_string($id);
		
		$sqlstring = "select a.*, c.uid, d.project_costcenter, d.project_id, c.subject_id from studies a left join enrollment b on a.enrollment_id = b.enrollment_id left join subjects c on b.subject_id = c.subject_id left join projects d on b.project_id = d.project_id where a.study_id = '$id'";
		$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
		if (mysql_num_rows($result) > 0) {
			$row = mysql_fetch_array($result, MYSQL_ASSOC);
			$study_id = $row['study_id'];
			$enrollmentid = $row['enrollment_id'];
			//$equipmentid = $row['equipment_id'];
			$study_num = $row['study_num'];
			$study_alternateid = $row['study_alternateid'];
			$study_modality = $row['study_modality'];
			$study_datetime = $row['study_datetime'];
			$study_ageatscan = $row['study_ageatscan'];
			$study_height = $row['study_height'];
			$study_weight = $row['study_weight'];
			$study_type = $row['study_type'];
			$study_operator = $row['study_operator'];
			$study_physician = $row['study_performingphysician'];
			$study_site = $row['study_site'];
			$study_notes = $row['study_notes'];
			$study_doradread = $row['study_doradread'];
			$study_radreaddate = $row['study_radreaddate'];
			$study_radreadfindings = $row['study_radreadfindings'];
			$study_etsnellenchart = $row['study_etsnellenchart'];
			$study_etvergence = $row['study_etvergence'];
			$study_ettracking = $row['study_ettracking'];
			$study_snpchip = $row['study_snpchip'];
			$study_status = $row['study_status'];
			$study_alternateid = $row['study_alternateid'];
			$study_experimenter = $row['study_experimenter'];
			$study_desc = $row['study_desc'];
			$study_createdby = $row['study_createdby'];
			$uid = $row['uid'];
			$subjectid = $row['subject_id'];
			$costcenter = $row['project_costcenter'];
			$projectid = $row['project_id'];
			
			$ft1 = floor($study_height/0.3048);
			$ft2 = (($study_height/0.3048)-$ft1)*12;
			$in = number_format($ft2,1);
			
			if (($study_height == 0) || ($study_weight == 0)) {
				$bmi = 0;
			}
			else {
				$bmi = $study_weight / ( $study_height * $study_height);
			}
			
			$study_heightft = "$ft1' $in\"";
		}
		else {
			?>
			Study [<?php 
echo $id;
?>
] does not exist
			<?
			return;
		}
		
		if ($study_modality == "") { $study_modality = "Missing modality"; $class="missing"; }
		else { $class = "value"; }

		$study_datetime = date("F j, Y g:ia",strtotime($study_datetime));
		$study_radreaddate = date("F j, Y g:ia",strtotime($study_radreaddate));

		
		/* get privacy information */
		$username = $_SESSION['username'];
		$sqlstring = "select user_id from users where username = '******'";
		$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$userid = $row['user_id'];

		$sqlstring = "select b.* from user_project a left join projects b on a.project_id = b.project_id where a.project_id = $projectid and a.view_data = 1 and a.user_id = '$userid'";
		//PrintSQL($sqlstring);
		$result = MySQLQuery($sqlstring, __FILE__, __LINE__);
		if (mysql_num_rows($result) > 0) {
			while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
				$projectname = $row['project_name'];
				$projectcostcenter = $row['project_costcenter'];
				$dataprojectlist[] = "$projectname ($projectcostcenter)";
			}
			$dataaccess = 1;
		}
		else {
			$dataaccess = 0;
		}
		
		$urllist['Subject List'] = "subjects.php";
		$urllist[$uid] = "subjects.php?action=display&id=$subjectid";
		$urllist["Study " . $study_num] = "studies.php?id=$id";
		NavigationBar("Studies", $urllist, 1, null, $dataaccess, null, $dataprojectlist);

		if (!$dataaccess) {
			echo "You do not have data access to this project. Consult your NiDB administrator";
			return;
		}
		
		/* update the mostrecent table */
		UpdateMostRecent($userid, '', $id);

		?>
		<div align="center">
		<span class="uid"><?php 
echo FormatUID($uid);
?>
</span>
		</div>
		<br>
		
		<style>
		#preview{
			position:absolute;
			border:1px solid #ccc;
			background:gray;
			padding:0px;
			display:none;
			color:#fff;
			}
		</style>
		<script type="text/javascript">
			$(document).ready(function() {
				//$('a.basic').cluetip({width: 275});
				//$('a.wide').cluetip({width: 800, clickThrough:true});
				//$('a.iframe').fancybox({width:1100, height: 1000, transitionIn: 'none', transitionOut: 'none', speedIn: 0, speedOut: 0, type: 'iframe'});
			});
		</script>

		<table class="bluerounded">
			<tr>
				<td class="title"><span style="margin-left:15px">Study Information</span>
				</td>
			</tr>
			<tr>
				<td class="body">
					<table class="reviewtable" width="100%">
						<tr>
							<td colspan="2" align="center">
							</td>
						</tr>
						<tr>
							<td class="label">Study number</td>
							<td class="value"><?php 
echo $study_num;
?>
</td>
						</tr>
						<tr>
							<td class="label">Study ID</td>
							<td class="value"><tt><?php 
echo $uid;
echo $study_num;
?>
</tt></td>
						</tr>
						<tr>
							<td class="label">Alternate Study ID</td>
							<td class="value"><tt><?php 
echo $study_alternateid;
?>
</tt></td>
						</tr>
						<tr>
							<td class="label">Modality</td>
							<td class="<?php 
echo $class;
?>
"><?php 
echo $study_modality;
?>
</td>
						</tr>
						<tr>
							<td class="label">Date/time</td>
							<td class="value"><?php 
echo $study_datetime;
?>
</td>
						</tr>
						<tr>
							<td class="label">Age at scan</td>
							<td class="value"><?php 
echo number_format($study_ageatscan, 1);
?>
 y</td>
						</tr>
						<tr>
							<td class="label">Height</td>
							<td class="value"><?php 
echo number_format($study_height, 2);
?>
 m <span class="tiny">(<?php 
echo $study_heightft;
?>
)</span></td>
						</tr>
						<tr>
							<td class="label">Weight</td>
							<td class="value"><?php 
echo number_format($study_weight, 1);
?>
 kg <span class="tiny">(<?php 
echo number_format($study_weight * 2.20462, 1);
?>
 lbs)</span></td>
						</tr>
						<tr>
							<td class="label">BMI</td>
							<td class="value"><?php 
echo number_format($bmi, 1);
?>
 <span class="tiny">kg/m<sup>2</sup></span></td>
						</tr>
						<tr>
							<td class="label">Visit type</td>
							<td class="value"><?php 
echo $study_type;
?>
</td>
						</tr>
						<tr>
							<td class="label">Description</td>
							<td class="value"><?php 
echo $study_desc;
?>
</td>
						</tr>
						<tr>
							<td class="label">Operator</td>
							<td class="value"><?php 
echo $study_operator;
?>
</td>
						</tr>
						<tr>
							<td class="label">Performing physician</td>
							<td class="value"><?php 
echo $study_physician;
?>
</td>
						</tr>
						<tr>
							<td class="label">Site</td>
							<td class="value"><?php 
echo $study_site;
?>
</td>
						</tr>
						<tr>
							<td class="label">Notes</td>
							<td class="value"><?php 
echo $study_notes;
?>
</td>
						</tr>
						<? if (strtolower($study_modality) == "mr") { ?>
							<tr>
								<td class="label">Radiological read?</td>
								<td class="value"><? if ($study_doradread) { echo "Yes"; } else { echo "No"; } ?></td>
							</tr>
							<tr>
								<td class="label">Rad. read date</td>
								<td class="value"><?php 
echo $study_radreaddate;
?>
</td>
							</tr>
							<tr>
								<td class="label">Rad. read findings</td>
								<td class="value"><?php 
echo $study_radreadfindings;
?>
</td>
							</tr>
						<? } elseif (strtolower($study_modality) == "et") { ?>
							<tr>
								<td class="label">Snellen chart</td>
								<td class="value"><?php 
echo $study_etsnellenchart;
?>
</td>
							</tr>
							<tr>
								<td class="label">Vergence</td>
								<td class="value"><?php 
echo $study_etvergence;
?>
</td>
							</tr>
							<tr>
								<td class="label">Tracking</td>
								<td class="value"><?php 
echo $study_ettracking;
?>
</td>
							</tr>
						<? } elseif (strtolower($study_modality) == "snp") { ?>
							<tr>
								<td class="label">SNP chip</td>
								<td class="value"><?php 
echo $study_snpchip;
?>
</td>
							</tr>
						<? } ?>
						<tr>
							<td class="label">Status</td>
							<td class="value"><?php 
echo $study_status;
?>
</td>
						</tr>
						<tr>
							<td class="label">Created by</td>
							<td class="value"><?php 
echo $study_createdby;
?>
</td>
						</tr>
						<tr>
							<td class="label">Experimenter</td>
							<td class="value"><?php 
echo $study_experimenter;
?>
</td>
						</tr>
						<tr>
							<td colspan="2" align="center">
								<br>
								<a href="studies.php?action=editform&id=<?php 
echo $id;
?>
">Edit</a>
							</td>
						</tr>
					</table>

					<? if ($GLOBALS['isadmin']) { ?>
						<details>
							<summary style="color:darkred" class="tiny">Admin Functions</summary>
							<br><br>
						
							<span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Delete this study:</span> <a href="studies.php?action=deleteconfirm&id=<?php 
echo $id;
?>
"><span class="adminbutton" style="padding: 3px; margin; 3px;">X</span></a>
						
							<script>
							$(function() {
								$( "#newuid" ).autocomplete({
									source: "subjectlist.php",
									minLength: 2,
									autoFocus: true
								});
							});
							</script>
							<style>
							.ui-autocomplete {
								max-height: 100px;
								overflow-y: auto;
								/* prevent horizontal scrollbar */
								overflow-x: hidden;
								/* add padding to account for vertical scrollbar */
								padding-right: 20px;
							}
							/* IE 6 doesn't support max-height
							 * we use height instead, but this forces the menu to always be this tall
							 */
							* html .ui-autocomplete {
								height: 100px;
							}
							</style>									
							<form action="studies.php" method="post">
							<input type="hidden" name="studyid" value="<?php 
echo $study_id;
?>
">
							<input type="hidden" name="action" value="movestudytosubject">
							<input type="hidden" name="enrollmentid" value="<?php 
echo $enrollmentid;
?>
">
							<br>
							<span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Move study to subject:</span> <input type="text" size="10" name="newuid" id="newuid"/>
							<input type="submit" value="Move">
							</form>
							<form action="studies.php" method="post">
							<input type="hidden" name="studyid" value="<?php 
echo $study_id;
?>
">
							<input type="hidden" name="action" value="movestudytoproject">
							<input type="hidden" name="enrollmentid" value="<?php 
echo $enrollmentid;
?>
">
							<input type="hidden" name="subjectid" value="<?php 
echo $subjectid;
?>
">
							<br>
							<span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Move study to project:</span>
							<select name="newprojectid">
							<?
								$sqlstringB = "select a.project_id, b.project_name, b.project_costcenter from enrollment a left join projects b on a.project_id = b.project_id where a.subject_id = $subjectid";
								echo $sqlstringB;
								$resultB = MySQLQuery($sqlstringB, __FILE__, __LINE__);
								while ($rowB = mysql_fetch_array($resultB, MYSQL_ASSOC)) {
									$project_id = $rowB['project_id'];
									$project_name = $rowB['project_name'];
									$project_costcenter = $rowB['project_costcenter'];
									?>
									<option value="<?php 
echo $project_id;
?>
"><?php 
echo $project_name;
?>
 (<?php 
echo $project_costcenter;
?>
)</option>
									<?
								}
							?>
							</select>
							<input type="submit" value="Move">
							</form>
							
							<br>
							
							<? if (!$audit) { ?>
							<a href="studies.php?id=<?php 
echo $id;
?>
&audit=1">Perform file audit</a> - compares all dicom files to the nidb database entries. Can be very slow<br><br>
							<? } else { ?>
							<a href="studies.php?id=<?php 
echo $id;
?>
&audit=1&fix=1">Fix file errors</a> - Removes duplicates and errant files, resets file count in nidb database. Can be very slow<br><br>
						</details>
					<? } ?>
					
					<? } ?>				
				</td>
			</tr>
		</table>


		<br><br>

		<?
			if ($study_modality == "MR") {
				DisplayMRSeries($id, $study_num, $uid, $audit, $fix);
			}
			elseif ($study_modality == "CT") {
				DisplayCTSeries($id, $study_num, $uid, $audit, $fix);
			}
			else {
				DisplayGenericSeries($id, $study_modality);
			}
		?>
		<br><br><br><br><br><br>
		<?
			DisplayAnalyses($id, $search_pipelineid, $search_name, $search_compare, $search_value, $search_type, $search_swversion, $imgperline);
		?>
		<br><br><br><br><br><br>
		<?
	}
예제 #17
0
	function DisplayStatus() {
	
		$urllist['System Status'] = "status.php";
		NavigationBar("System", $urllist);

		# connect to DB and get status
		$dbconnect = true;
		$devdbconnect = true;
		$L = mysqli_connect($GLOBALS['cfg']['mysqlhost'],$GLOBALS['cfg']['mysqluser'],$GLOBALS['cfg']['mysqlpassword'],$GLOBALS['cfg']['mysqldatabase']) or $dbconnect = false;
		$dbStatus = explode("  ", mysql_stat());
		
		# get number of fileio operations pending
		$sqlstring = "select count(*) 'numiopending' from fileio_requests where request_status in ('pending','')";
		$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numiopending = $row['numiopending'];
		
		# get number of directories in dicomincoming directory
		$dirs = glob($GLOBALS['cfg']['incomingdir'].'/*', GLOB_ONLYDIR);
		$numdicomdirs = count($dirs);
		
		# get number of files in dicomincoming directory
		$files = glob($GLOBALS['cfg']['incomingdir'].'/*');
		$numdicomfiles = count($files);
		
		# get number of import requests
		$sqlstring = "select count(*) 'numimportpending' from import_requests where import_status in ('pending','')";
		$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numimportpending = $row['numimportpending'];
		
		# get number of directories in dicomincoming directory
		$dirs = glob($GLOBALS['cfg']['uploadedpath'].'/*', GLOB_ONLYDIR);
		$numimportdirs = count($dirs);
		
		?>
		<table class="entrytable">
			<tr>
				<td class="label">Uptime</td>
				<td><pre><?php 
echo trim(`uptime`);
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Memory (GB)</td>
				<td><pre><?php 
echo trim(`free -g`);
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Disk usage</td>
				<td><pre><?php 
echo system('df -lh');
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Database</td>
				<td><pre><?
				foreach ($dbStatus as $value){
echo $value . "\n";
				}
				?></pre></td>
			</tr>
			<tr>
				<td class="label">Parse DICOM module<br><span class="tiny"><?php 
echo $GLOBALS['cfg']['incomingdir'];
?>
</span></td>
				<td>
					<?php 
echo $numdicomfiles;
?>
 queued files<br>
					<?php 
echo $numdicomdirs;
?>
 queued directories<br>
				</td>
			</tr>
			<tr>
				<td class="label">Import module<br><span class="tiny"><?php 
echo $GLOBALS['cfg']['uploadedpath'];
?>
</span></td>
				<td>
					<?php 
echo $numimportpending;
?>
 requests pending<br>
					<?php 
echo $numimportdirs;
?>
 queued directories<br>
				</td>
			</tr>
			<tr>
				<td class="label">File IO module</td>
				<td><?php 
echo $numiopending;
?>
 operations pending</td>
			</tr>
			<tr>
				<td class="label">Pipeline module</td>
				<td>
					<table class="smallgraydisplaytable">
					<thead>
						<tr>
							<th>Process ID</th>
							<th>Status</th>
							<th>Startdate</th>
							<th>Last checkin</th>
							<th>Current pipeline</th>
							<th>Current study</th>
						</tr>
					</thead>
					<tbody>
					<?
						$sqlstring = "select a.*, b.pipeline_name from pipeline_procs a left join pipelines b on a.pp_currentpipeline = b.pipeline_id order by a.pp_lastcheckin";
						$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
						while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
							$pp_processid = $row['pp_processid'];
							$pp_status = $row['pp_status'];
							$pp_startdate = $row['pp_startdate'];
							$pp_lastcheckin = $row['pp_lastcheckin'];
							$pp_currentpipeline = $row['pp_currentpipeline'];
							$pipelinename = $row['pipeline_name'];
							$pp_currentsubject = $row['pp_currentsubject'];
							$pp_currentstudy = $row['pp_currentstudy'];
							?>
							<tr>
								<td><?php 
echo $pp_processid;
?>
</td>
								<td><?php 
echo $pp_status;
?>
</td>
								<td><?php 
echo $pp_startdate;
?>
</td>
								<td><?php 
echo $pp_lastcheckin;
?>
</td>
								<td><?php 
echo $pipelinename;
?>
</td>
								<td><?php 
echo $pp_currentstudy;
?>
</td>
							</tr>
							<?
						}
					?>
					</tbody>
					</table>
				</td>
			</tr>
		</table>
		<?
	}
예제 #18
0
	function DisplayImportForm() {
	
		$urllist['Home'] = "index.php";
		$urllist['About'] = "about.php";
		NavigationBar("About", $urllist);

		//$str1 = "$subjectids,999999,$formid,$dsmquestionid,$groupid,$code,$rater,$date,$notes,$visit";

		?>
		Paste CSV style data here using this format: <tt>subjectID(s), projectCostCenter, formID, questionID, groupID, value(s), rater, datetime, notes, visit</tt>
		<span class="tiny">
		<ul>
			<li>There can be multiple subjectIDs, which should be separated by the pipe | character. Only the first found subjectID will be used
			<li>There can be multiple values, which should be separated by a pipe |
			<li>Group ID only needs to be unique among the rows in this import, however groupids must be consecutive
		</ul>
		</span>
		<br>
		<form method="post" action="importexperiment.php">
		<input type="hidden" name="action" value="import">
		<textarea style="width:100%; height: 60%" name="data"></textarea>
		<input type="submit" value="Import!">
		</form>
		<?
	}
예제 #19
0
function DisplaySiteList()
{
    $urllist['Administration'] = "admin.php";
    $urllist['Sites'] = "adminsites.php";
    $urllist['Add Site'] = "adminsites.php?action=addform";
    NavigationBar("Admin", $urllist);
    ?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Name</th>
				<th>Site ID</th>
				<th>Address</th>
				<th>Contact Info</th>
				<th>UUID</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $sqlstring = "select * from nidb_sites order by site_name";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['site_id'];
        $uuid = $row['site_uuid'];
        $name = $row['site_name'];
        $address = $row['site_address'];
        $contact = $row['site_contact'];
        ?>
			<tr>
				<td><a href="adminsites.php?action=editform&id=<?php 
        echo $id;
        ?>
"><?php 
        echo $name;
        ?>
</td>
				<td><?php 
        echo $id;
        ?>
</td>
				<td><?php 
        echo $address;
        ?>
</td>
				<td><?php 
        echo $contact;
        ?>
</td>
				<td class="tiny"><?php 
        echo strtoupper($uuid);
        ?>
</td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}
예제 #20
0
파일: pipelines.php 프로젝트: pmolfese/nidb
function DisplayPipelineTree($viewname, $viewlevel, $viewowner, $viewstatus, $viewenabled, $viewall)
{
    MarkTime("DisplayPipelineTree()");
    $urllist['Pipelines'] = "pipelines.php";
    $urllist['New Pipeline'] = "pipelines.php?action=addform";
    NavigationBar("Analysis", $urllist);
    $username = $GLOBALS['username'];
    ?>
	<style>
		.ui-tooltip { padding: 7px 7px; border-radius: 5px; font-size: 10px; border: 1px solid black; }
		a { color: #224ea5; }
	</style>
	<span style="font-size:10pt">View: <a href="pipelines.php?viewall=1">All</a> | <a href="pipelines.php?viewall=1" title="Does not display hidden pipelines">Normal</a></span>
	<br>
	<!--<details>-->
	<!-- display the cluster load -->
	<!--<summary style="font-size:10pt; color:#666">View cluster load</summary>
		<?php 
    list($statsoutput, $report, $queues, $hostnames) = GetClusterStats();
    $slotsusedcolor = "FF4500";
    $slotsunusedcolor = "EEEEEE";
    ?>

		<table border="0" cellspacing="0" cellpadding="0" style="font-size:8pt">
			<?php 
    foreach ($queues as $queue) {
        $slotsused = 0;
        $slotsunused = 0;
        foreach ($hostnames as $hostname) {
            if (isset($report[$hostname]['queues'][$queue])) {
                //echo "<pre>";
                //print_r($report[$hostname]['queues'][$queue]['jobs']);
                $slotsused += $report[$hostname]['queues'][$queue]['slotsused'];
                $slotsunused += $report[$hostname]['queues'][$queue]['slotsavailable'];
                //echo "</pre>";
            }
        }
        ?>
					<tr>
						<td><?php 
        echo $queue;
        ?>
 &nbsp;</td>
						<td>
							<img src="horizontalchart.php?b=yes&w=200&h=12&v=<?php 
        echo $slotsused;
        ?>
,<?php 
        echo $slotsunused - $slotsused;
        ?>
&c=<?php 
        echo $slotsusedcolor;
        ?>
,<?php 
        echo $slotsunusedcolor;
        ?>
">
							<?php 
        if ($slotsused == 0) {
            echo "Idle";
        } else {
            echo "{$slotsused} of {$slotsunused}";
        }
        ?>
						</td>
					</tr>
					<?php 
    }
    ?>
		</table>
		<br><br>
	</details> -->
	
	<table class="smallgraydisplaytable" width="100%">
		<thead>
			<tr style="vertical-align: top;text-align:left">
				<th style="font-size:12pt">Pipeline Group</th>
				<th style="font-size:12pt">Name <span class="tiny">Mouseover for description</span></th>
				<th style="font-size:12pt" align="right">Level</th>
				<!--<th style="font-size:12pt">Study Group(s)</th>-->
				<th style="font-size:12pt">Owner<br>
					<!--<span style="font-weight: normal; font-size:8pt">
					<a class="linkhighlight" href="pipelines.php?action=viewpipelinelist&viewname=<?php 
    echo $viewname;
    ?>
&viewlevel=<?php 
    echo $viewlevel;
    ?>
&viewowner=all&viewstatus=<?php 
    echo $viewstatus;
    ?>
&viewenabled=<?php 
    echo $viewenabled;
    ?>
">All</a><br>
					<a class="linkhighlight" href="pipelines.php?action=viewpipelinelist&viewname=<?php 
    echo $viewname;
    ?>
&viewlevel=<?php 
    echo $viewlevel;
    ?>
&viewowner=mine&viewstatus=<?php 
    echo $viewstatus;
    ?>
&viewenabled=<?php 
    echo $viewenabled;
    ?>
">Mine</a>
					</span>-->
				</th>
				<th style="font-size:12pt">Status</th>
				<th style="font-size:12pt" align="right" title="processing / complete">Analyses</th>
				<th style="font-size:12pt" align="right">Disk size</th>
				<th style="font-size:12pt" align="left">Path</th>
				<th style="font-size:12pt">Queue</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $pipelinetree = GetPipelineTree($viewall);
    global $imgdata;
    /* create the graphs for each pipeline group */
    $sqlstring = "select distinct(pipeline_group) 'pipeline_group' from pipelines where pipeline_group <> ''";
    $result = MySQLiQuery($sqlstring, __FILE__, __LINE__);
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $group = $row['pipeline_group'];
        //$imgdata[$group] = CreatePipelineGraph($group);
    }
    GetPipelineInfo();
    PrintTree($pipelinetree, 0);
    ?>
		</tbody>
	</table>
	
	<br><br><br><br><br>
	<?php 
}
예제 #21
0
	function DisplayFormList() {
	
		$urllist['Administration'] = "admin.php";
		$urllist['Forms'] = "adminforms.php";
		$urllist['Add Form'] = "adminforms.php?action=addform";
		NavigationBar("Admin", $urllist);
		
	?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Title</th>
				<th>Description</th>
				<th>Creator</th>
				<th>Create Date</th>
				<th>Published</th>
			</tr>
		</thead>
		<tbody>
			<?
				$sqlstring = "select a.*, b.username 'creatorusername', b.user_fullname 'creatorfullname' from forms a left join users b on a.form_creator = b.user_id order by a.form_title";
				$result = mysql_query($sqlstring) or die("Query failed [" . __FILE__ . "(line " . __LINE__ . ")]: " . mysql_error() . "<br><i>$sqlstring</i><br>");
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
					$id = $row['form_id'];
					$title = $row['form_title'];
					$desc = $row['form_desc'];
					$creatorusername = $row['creatorusername'];
					$creatorfullname = $row['creatorfullname'];
					$createdate = $row['form_createdate'];
					$ispublished = $row['form_ispublished'];
			?>
			<tr>
				<td>
					<? if ($ispublished) { ?>
					<a href="adminforms.php?action=viewform&id=<?php 
echo $id;
?>
"><?php 
echo $title;
?>
</a>
					<? } else { ?>
					<a href="adminforms.php?action=editform&id=<?php 
echo $id;
?>
"><?php 
echo $title;
?>
</a>
					<? } ?>
				</td>
				<td><?php 
echo $desc;
?>
</td>
				<td><?php 
echo $creatorfullname;
?>
</td>
				<td><?php 
echo $createdate;
?>
</td>
				<td><? if ($ispublished) { echo "&#10004;"; } ?></td>
			</tr>
			<? 
				}
			?>
		</tbody>
	</table>
	<?
	}
예제 #22
0
function DisplayPrescriptionList($enrollmentid)
{
    /* get subject's info for the breadcrumb list */
    $sqlstring = "select * from enrollment a left join subjects b on a.subject_id = b.subject_id left join projects c on a.project_id = c.project_id where a.enrollment_id = {$enrollmentid}";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><b>{$sqlstring}</b><br>");
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $uid = $row['uid'];
    $subjectid = $row['subject_id'];
    $projectname = $row['project_name'];
    $urllist['Subject List'] = "subjects.php";
    $urllist[$uid] = "subjects.php?action=display&id={$subjectid}";
    $urllist["{$projectname} prescriptions"] = "prescriptions.php?enrollmentid={$enrollmentid}";
    NavigationBar("Prescriptions", $urllist);
    ?>
		<SCRIPT LANGUAGE="Javascript">
			function decision(message, url){
				if(confirm(message)) location.href = url;
			}
		</SCRIPT>
		
		<table class="smalldisplaytable">
			<thead>
				<tr>
					<th>Prescription</th>
					<th>Dose</th>
					<th>Route</th>
					<th>Dates</th>
				</tr>
			</thead>
			<tbody>
				<form action="prescriptions.php" method="post">
				<input type="hidden" name="action" value="addrx">
				<input type="hidden" name="enrollmentid" value="<?php 
    echo $enrollmentid;
    ?>
">
				<tr>
					<td><input type="text" name="rx_name" size="15" placeholder="Prescription"></td>
					<td><input type="text" name="rx_dose" placeholder="Dose"> <input type="text" name="rx_freq" placeholder="Dose frequency"></td>
					<td><input type="text" name="rx_route" placeholder="Route"></td>
					<td><input type="date" name="rx_datestart"> to <input type="date" name="rx_dateend"></td>
					<td><input type="text" name="rx_rater" value="<?php 
    echo $GLOBALS['username'];
    ?>
"></td>
					<td><input type="submit" value="Add"></td>
				</tr>
				</form>
				<?php 
    $sqlstring = "select * from prescriptions a left join prescriptionnames b on a.rxname_id = b.rxname_id where enrollment_id = {$enrollmentid} order by rx_name";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><b>{$sqlstring}</b><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $rxid = $row['rx_id'];
        $rx_name = $row['rx_name'];
        $rx_route = $row['rx_route'];
        $rx_startdate = $row['rx_startdate'];
        $rx_enddate = $row['rx_enddate'];
        $rx_dose = $row['rx_doseamount'];
        $rx_dosefreq = $row['rx_dosefrequency'];
        ?>
						<tr>
							<td><?php 
        echo $rx_name;
        ?>
</td>
							<td><?php 
        echo $rx_route;
        ?>
<br><?php 
        echo $rx_dateentered2;
        ?>
</td>
							<td><?php 
        echo $rx_rater;
        ?>
<br><?php 
        echo $rx_rater2;
        ?>
</td>
							<td align="right" class="delete">
								<a href="javascript:decision('Are you sure you want to delete this rx?', 'prescriptions.php?action=deleterx&rxid=<?php 
        echo $rxid;
        ?>
&enrollmentid=<?php 
        echo $enrollmentid;
        ?>
')" class="delete">X</a>
							</td>
						</tr>
					<?php 
    }
    ?>
			</tbody>
		</table>
		<?php 
}
예제 #23
0
	function DisplayStats() {
	
		$urllist['Statistics'] = "stats.php";
		NavigationBar("Stats", $urllist);

		$currentyear = date("Y");
		
		$sqlstring = "select count(*) count from subjects where isactive = 1";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numsubjects = number_format($row['count']);
		$numtotalsubjects = $row['count'];

		$sqlstring = "select count(*) count from studies";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numstudies = $row['count'];

		$totalseries = 0;
		$totalsize = 0;
		$sqlstring = "show tables from " . $GLOBALS['cfg']['mysqldatabase'] . " like '%\_series'";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
			//print_r($row);
			$tablename = $row['Tables_in_' . $GLOBALS['cfg']['mysqldatabase'] . ' (%\_series)'];
			//echo $tablename;
			$parts = explode("_", $tablename);
			$modality = $parts[0];
			
			$sqlstring2 = "select count(*) 'count', sum(series_size) 'size' from $modality" . "_series";
			$result2 = MySQLQuery($sqlstring2,__LINE__,__FILE__);
			$row2 = mysql_fetch_array($result2, MYSQL_ASSOC);
			$totalseries += $row2['count'];
			$totalsize += $row2['size'];
			$seriescounts[$modality] = number_format($row2['count']);
			$seriessize[$modality] = HumanReadableFilesize($row2['size']);

			$sqlstring2 = "select sum(b.series_size) 'totalbytes' from data_requests a left join $modality" . "_series b on a.req_seriesid = b.$modality" . "series_id";
			//PrintSQL($sqlstring);
			$result2 = MySQLQuery($sqlstring2,__LINE__,__FILE__);
			$row2 = mysql_fetch_array($result2, MYSQL_ASSOC);
			$seriesreqsize[$modality] = HumanReadableFilesize($row2['totalbytes']);
			$totalreqbytes += $row2['totalbytes'];
		}
		//print_r($seriescounts);
		
		/* total series qa time */
		$sqlstring = "select sum(cputime) totalcpu from mr_qa";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalcpu'];
		$totalseriesqacpu = FormatCountdown($diff);

		/* total study qa time */
		$sqlstring = "select sum(cputime) totalcpu from mr_studyqa";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalcpu'];
		$totalstudyqacpu = FormatCountdown($diff);
		
		/* total request processing time */
		$sqlstring = "select sum(req_cputime) totalrequestcpu from data_requests";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalrequestcpu'];
		$totalrequestcpu = FormatCountdown($diff);
		
		/* mean request time */
		$sqlstring = "SELECT avg(time_to_sec(timediff(req_completedate, req_date))) avgtime FROM `data_requests` where req_completedate > '000-00-00 00:00:00'";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['avgtime'];
		$avgrequesttime = FormatCountdown($diff);

		/* median request time */
		$sqlstring = "SELECT * FROM `data_requests` where req_completedate > '0000-00-00 00:00:00'";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$numrows = mysql_num_rows($result);
		$med = round($numrows/2);
		
		$sqlstring = "SELECT time_to_sec(timediff(req_completedate, req_date)) avgtime FROM `data_requests` where req_completedate > '0000-00-00 00:00:00' order by avgtime limit $med,1";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['avgtime'];
		$medianrequesttime = FormatCountdown($diff);
		
		$uptime = shell_exec('uptime');
		
		/* subject demographics */
		$sqlstring = "select (select count(*) from subjects where gender = 'F') 'numfemales', (select count(*) from subjects where gender = 'M') 'nummales', (select count(*) from subjects where gender = 'O') 'numother', (select count(*) from subjects where gender = 'U') 'numunknown', (select count(*) from subjects where gender not in ('F','M','O','U')) 'numnotspec'";
		$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numfemales = $row['numfemales'];
		$nummales = $row['nummales'];
		$numother = $row['numother'];
		$numunknown = $row['numunknown'];
		$numnotspec = $row['numnotspec'];
		
		?>
		
		<table width="100%">
			<tr>
				<td valign="top" width="50%">
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Series Info</td>
						</tr>
						<tr>
							<td class="body">
								<span style="font-size:10pt;">
								<b>Available Data:</b><br>
								<?php 
echo $numsubjects;
?>
 subjects<br>
								<?php 
echo number_format($numstudies);
?>
 studies<br>
								<br>
								<table class="smalldisplaytable">
									<tr>
										<th><b>Series</b></th>
										<th align="right"><b>Count</b></th>
										<th align="right"><b>Size</b></th>
										<th align="right"><b>Request Data</b></th>
									</tr>
								<?
									foreach ($seriescounts as $modality => $count) {
										?>
										<tr>
											<td><?php 
echo strtoupper($modality);
?>
</td>
											<td align="right"><?php 
echo $count;
?>
</td>
											<td align="right"><?php 
echo $seriessize[$modality];
?>
</td>
											<td align="right"><?php 
echo $seriesreqsize[$modality];
?>
</td>
										</tr>
										<?
									}
								?>
									<tr style="color: #5882FA; font-weight: bold">
										<td>Total</td>
										<td align="right"><?php 
echo number_format($totalseries);
?>
</td>
										<td align="right"><?php 
echo HumanReadableFilesize($totalsize);
?>
</td>
										<td align="right"><?php 
echo HumanReadableFilesize($totalreqbytes);
?>
</td>
									</tr>
								</table>
								</span>
							</td>
						</tr>
					</table>
					
					<br>
					
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">System Info</td>
						</tr>
						<tr>
							<td class="body">
								<span class="header">Uptime</span><br>
								<?php 
echo $uptime;
?>
								<br><bR>
								<span class="header">Data Requests</span><br>
								<b>CPU time:</b> <?php 
echo $totalrequestcpu;
?>
<br>
								<b>Mean request time:</b> <?php 
echo $avgrequesttime;
?>
<br>
								<b>Median request time:</b> <?php 
echo $medianrequesttime;
?>
<br>
							</td>
						</tr>
					</table>
					
					<br>
					
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Subject Demographics</td>
						</tr>
						<tr>
							<td class="body">
								<table class="reviewtable">
									<tr>
										<td class="label"># females</td>
										<td class="value"><?php 
echo $numfemales;
?>
 (<?php 
echo number_format($numfemales / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># males</td>
										<td class="value"><?php 
echo $nummales;
?>
 (<?php 
echo number_format($nummales / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># other</td>
										<td class="value"><?php 
echo $numother;
?>
 (<?php 
echo number_format($numother / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># unknown</td>
										<td class="value"><?php 
echo $numunknown;
?>
 (<?php 
echo number_format($numunknown / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># not specified</td>
										<td class="value"><?php 
echo $numnotspec;
?>
 (<?php 
echo number_format($numnotspec / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>					
				</td>
				<td valign="top" width="50%">
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">MR</td>
						</tr>
						<tr>
							<td class="body">
								<span class="header">CPU time</span><br>
								<b>Total series QA CPU time:</b> <?php 
echo $totalseriesqacpu;
?>
<br>
								<b>Total study QA CPU time:</b> <?php 
echo $totalstudyqacpu;
?>
<br>
							</td>
						</tr>
						<tr>
							<td class="body">
								<table cellspacing="0" cellpadding="2" style="font-size:10pt">
									<tr>
										<td colspan="24" align="center"><span class="header">Total # MR studies starting at time...</span></td>
									</tr>
									<tr>
										<td colspan="12" align="center" style="border-bottom: 1px solid gray; border-right: 1pt solid gray">AM</td>
										<td colspan="12" align="center" style="border-bottom: 1px solid gray">PM</td>
									</tr>
									<tr style="font-size:10pt">
										<?
											for ($hour=0;$hour<24;$hour++) {
												if ($hour == 0){
													?><td align="center" style="border-left: solid 1px #CCCCCC; border-right: solid 1px #CCCCCC;">12</td><?
												}
												else {
													if ($hour < 12) {
														?><td align="center" style="border-right: solid 1px #CCCCCC;"><?php 
echo $hour;
?>
</td><?
													}
													else {
														$hr = $hour;
														if ($hour != 12) {
															$hr = $hr - 12;
														}
														?><td align="center" style="border-right: solid 1px #CCCCCC;"><?php 
echo $hr;
?>
</td><?
													}
												}
											}
										?>
									</tr>
									<tr>
								<?
									for ($hour=0;$hour<24;$hour++) {
										$sqlstring = "select count(*) count from studies where hour(study_datetime) = $hour and study_modality = 'MR'";
										#echo "$sqlstring<br>";
										$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
										$row = mysql_fetch_array($result, MYSQL_ASSOC);
										$count = $row['count'];
										$percent = round(($count/$numstudies)*100);
										$counts[$hour] = $count;
										//echo "[$count] [$numstudies] [$percent]";
										#echo "<td align=right>$percent%&nbsp;</td>";
										?>
										<td valign="bottom" align="center" style="border-right: solid 1px #CCCCCC;">
											<table height="<? echo $percent*2; ?>px" cellpadding=0 cellspacing=0 width="15px">
												<tr>
													<td bgcolor="red" style="font-size: 0px">&nbsp;</td>
												</tr>
											</table>
										</td>
										<?
									}
									?> </tr><tr style="font-size:8pt"> <?
									for ($hour=0;$hour<24;$hour++) {
										echo "<td align=center>$counts[$hour]</td>";
									}
								?>
									</tr>
								</table>
								<br><br>
								<table cellspacing="0" cellpadding="2" style="font-size:10pt">
									<tr>
										<td colspan="13" align="center" style="border-bottom: 1pt solid darkgray"><span class="header">Scan History (# sessions per month)</span></td>
									</tr>
									<tr>
										<td>Year</td>
										<td>Jan</td>
										<td>Feb</td>
										<td>Mar</td>
										<td>Apr</td>
										<td>May</td>
										<td>Jun</td>
										<td>Jul</td>
										<td>Aug</td>
										<td>Sep</td>
										<td>Oct</td>
										<td>Nov</td>
										<td>Dec</td>
									</tr>
								<?
								
									$sqlstring = "select year(min(study_datetime)) firstyear from studies where study_datetime > '0000-00-00 00:00:01' and study_modality = 'MR'";
									$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
									$row = mysql_fetch_array($result, MYSQL_ASSOC);
									$firstyear = $row['firstyear'];
									
									$numyears = $currentyear - $firstyear;
									
									for ($year=$firstyear;$year<=$currentyear;$year++) {
										?>
										<tr>
											<td>
												<a href="reports.php?action=yearstudy&year=<?php 
echo $year;
?>
&modality=MR"><b><?php 
echo $year;
?>
</b></a>
											</td>
										<?
										for ($month=1;$month<=12;$month++) {
											$sqlstring = "select count(*) count from studies where year(study_datetime) = $year and month(study_datetime) = $month and study_modality = 'MR'";
											#echo "$sqlstring<br>";
											$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
											$row = mysql_fetch_array($result, MYSQL_ASSOC);
											$count = $row['count'];
											echo "<td align=right>$count &nbsp;</td>";
										}
										?>
										</tr>
										<?
									}
								?>
								</table>
								
							</td>
						</tr>
						<tr>
							<td class="body">
							<?
								$sqlstring = "SELECT (move_maxx-move_minx + move_maxy-move_miny + move_maxz-move_minz) 'totalmovement', datediff(c.study_datetime, e.birthdate) 'ageatscan', e.gender FROM mr_qa a left join mr_series b on a.mrseries_id = b.mrseries_id left join studies c on b.study_id = c.study_id left join enrollment d on c.enrollment_id = d.enrollment_id left join subjects e on d.subject_id = e.subject_id where datediff(c.study_datetime, e.birthdate) < 45656 and e.gender in ('M','F')";
								$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
								$i=0;
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									if (($row['totalmovement'] > 0) && ($row['totalmovement'] < 50)) {
										//print_r($row);
										$y[] = number_format($row['totalmovement'],2);
										$x[] = number_format($row['ageatscan']/365.25,2);
										if ($row['gender'] == 'F')
											$c[] = 'FF0000'; //$c[] = 'FFC0CB';
										elseif ($row['gender'] == 'M')
											$c[] = '0000FF'; //$c[] = '4169E1';
										else
											$c[] = '888888';
										$i++;
									}
									//if ($i>100) break;
								}
								//print_r($x);
								$chd = implode(",",$x) . "|" . implode(",",$y);
								$chco = implode("|",$c);
								
								$x = implode(",",$x);
								$y = implode(",",$y);
								$c = implode(",",$c);
								
								$chartfilename = DrawScatterPlot(600,300,$x,$y,$c);
							?>
							<b>Age vs movement</b><br>
							<img src="data:image/png;base64,<?php 
echo base64_encode(file_get_contents($chartfilename));
?>
">
							<?
								/* image data should've been sent to the browser, so delete the temp image */
								unlink($chartfilename);
							?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Cumulative Data Storage by Site</td>
						</tr>
						<tr>
							<td class="body">
								<?
									unset($sites);
									/* get the list of possible study sites (equipments) */
									//$sqlstring = "select distinct(study_site) 'site' from studies";
									$sqlstring = "select distinct(study_site) 'site' from studies where study_site in ('hhntMRC20107','AWP45351','WHSKYRA-01')";
									$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
									while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
										$sites[] = $row['site'];
									}
									
									natcasesort($sites);
									//PrintVariable($sites,'sites');
									
								?>
								<script>
									$(function() {
											var data2 = [
									<?
										foreach ($sites as $site) {
											unset($jsonstrings);
											$cumtotal = 0;
											?>
												{
												label: "<?php 
echo $site;
?>
",
												data: [<?
											$sqlstring = "SELECT unix_timestamp(DATE(a.study_datetime)) Date, a.study_site, COUNT(DISTINCT a.study_datetime) totalCount, sum(b.series_size) 'totalsize' FROM studies a left join mr_series b on a.study_id = b.study_id where a.study_site = '$site' GROUP BY DATE(a.study_datetime) order by Date";
											$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
											while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
											//$row = mysql_fetch_array($result, MYSQL_ASSOC);
												$date = $row['Date']*1000;
												if ($date > 0) {
													$totalsize = $row['totalsize']/1000/1000/1000;
													$totalcount = $row['totalCount'];
													$cumtotal += $totalsize;
													//$studysites[$site][$date]['size'] = $totalsize;
													//$studysites[$site][$date]['count'] = $totalcount;
													
													//$jsonstrings[] .= "['$date', $totalsize]";
													$jsonstrings[] .= "['$date', " . number_format($cumtotal,1,'.','') . "]";
												}
											}
											?><?php 
echo implode2(',', $jsonstrings);
?>
]
												},
											<?
											
										}
										//PrintVariable($studysites,'StudySites');
									?>
										];
									
										var options2 = {
											series: {
												lines: {
													show: true,
													fill: true
												},
												points: {
													show: false
												}
											},
											legend: {
												noColumns: 6
											},
											xaxis: {
												mode: "time",
												timeformat: "%Y-%m-%d"
											},
											yaxis: {
												min: 0,
												tickDecimals: 1
											},
											selection: {
												mode: "x"
											}
										};

										var placeholder2 = $("#placeholder2");

										var plot2 = $.plot(placeholder2, data2, options2);
									});
								</script>
								
								<div class='flot-y-axis'>
									<div class='flot-tick-label'>GB</div>
								</div>
								<div id="placeholder2" style="width:1100px;height:600px;"></div>
							</td>
						</tr>
					</table>
					<br><Br>
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Data Storage by Day by Site</td>
						</tr>
						<tr>
							<td class="body">
								<?
									unset($sites);
									/* get the list of possible study sites (equipments) */
									$sqlstring = "select distinct(study_site) 'site' from studies where study_site in ('hhntMRC20107','AWP45351','WHSKYRA-01')";
									$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
									while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
										$sites[] = $row['site'];
									}
									
									natcasesort($sites);
									//PrintVariable($sites,'sites');
									
								?>
								<script>
									$(function() {
											var data = [
									<?
										foreach ($sites as $site) {
											unset($jsonstrings);
											?>
												{
												label: "<?php 
echo $site;
?>
",
												data: [<?
											$sqlstring = "SELECT unix_timestamp(DATE(a.study_datetime)) Date, a.study_site, COUNT(DISTINCT a.study_datetime) totalCount, sum(b.series_size) 'totalsize' FROM studies a left join mr_series b on a.study_id = b.study_id where a.study_site = '$site' GROUP BY DATE(a.study_datetime) order by Date";
											$result = MySQLQuery($sqlstring,__LINE__,__FILE__);
											while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
											//$row = mysql_fetch_array($result, MYSQL_ASSOC);
												$date = $row['Date']*1000;
												if ($date > 0) {
													$totalsize = $row['totalsize']/1000/1000/1000;
													$totalcount = $row['totalCount'];
													//$cumtotal += $totalsize;
													//$studysites[$site][$date]['size'] = $totalsize;
													//$studysites[$site][$date]['count'] = $totalcount;
													
													$jsonstrings[] .= "['$date', " . number_format($totalsize,1,'.','') . "]";
													//$jsonstrings[] .= "['$date', $cumtotal]";
												}
											}
											?><?php 
echo implode2(',', $jsonstrings);
?>
]
												},
											<?
											
										}
										//PrintVariable($studysites,'StudySites');
									?>
										];
									
										var options = {
											series: {
												lines: {
													show: true,
													fill: true
												},
												points: {
													show: false
												}
											},
											legend: {
												noColumns: 6
											},
											xaxis: {
												mode: "time",
												timeformat: "%Y-%m-%d"
											},
											yaxis: {
												min: 0,
												tickDecimals: 1
											},
											selection: {
												mode: "x"
											}
										};

										var placeholder = $("#placeholder");

										var plot = $.plot(placeholder, data, options);									
									});
								</script>
								
								<div class='flot-y-axis'>
									<div class='flot-tick-label'>GB</div>
								</div>
								<div id="placeholder" style="width:1100px;height:600px;"></div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<?
	}
예제 #24
0
function DisplayModuleList()
{
    $urllist['Administration'] = "admin.php";
    $urllist['Modules'] = "adminmodules.php";
    NavigationBar("Admin", $urllist);
    ?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Name</th>
				<th>&nbsp;</th>
				<th>Status</th>
				<th>Instances</th>
				<th>Last finish</th>
				<th>Run time</th>
				<th>Enable/Disable</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $sqlstring = "select * from modules order by module_name";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['module_id'];
        $module_name = $row['module_name'];
        $module_status = $row['module_status'];
        $module_numrunning = $row['module_numrunning'];
        $module_laststart = $row['module_laststart'];
        $module_laststop = $row['module_laststop'];
        $module_isactive = $row['module_isactive'];
        /* calculate the status color */
        if (!$module_isactive) {
            $color = "gray";
        } else {
            if ($module_status == "running") {
                $color = "green";
            }
            if ($module_status == "stopped") {
                $color = "darkblue";
            }
        }
        /* calculate and format the run time */
        if ($module_status == "stopped") {
            $runtime = strtotime($module_laststop) - strtotime($module_laststart);
            if ($runtime > 3600) {
                $runtime = number_format($runtime / 3600, 2) . " hr";
            } elseif ($runtime > 60) {
                $runtime = number_format($runtime / 60, 2) . " min";
            } else {
                $runtime = $runtime . " sec";
            }
        } else {
            $runtime = "-";
        }
        $module_laststop = date("D M j, Y H:i:s", strtotime($module_laststop));
        ?>
			<tr>
				<td><b><?php 
        echo $module_name;
        ?>
</b></td>
				<td><a href="adminmodules.php?action=viewlogs&modulename=<?php 
        echo $module_name;
        ?>
">view logs</a></td>
				<td style="color: <?php 
        echo $color;
        ?>
"><?php 
        echo $module_status;
        ?>
 <?php 
        if ($module_status == "running" || $module_numrunning != 0) {
            ?>
<small>(<a href="adminmodules.php?action=reset&id=<?php 
            echo $id;
            ?>
">reset</a>)</small> <?php 
        }
        ?>
</td>
				<td><?php 
        echo $module_numrunning;
        ?>
</td>
				<td><?php 
        echo $module_laststop;
        ?>
</td>
				<td><?php 
        echo $runtime;
        ?>
</td>
				<td>
					<?php 
        if ($module_isactive) {
            ?>
<a href="adminmodules.php?action=disable&id=<?php 
            echo $id;
            ?>
"><img src="images/checkedbox16.png"></a><?php 
        } else {
            ?>
<a href="adminmodules.php?action=enable&id=<?php 
            echo $id;
            ?>
"><img src="images/uncheckedbox16.png"></a><?php 
        }
        ?>
				</td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}
예제 #25
0
function DisplayUserList()
{
    $urllist['Administration'] = "admin.php";
    $urllist['User List'] = "adminusers.php";
    $urllist['Add User'] = "******";
    NavigationBar("Admin", $urllist);
    ?>
	
	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Username</th>
				<th>Full name</th>
				<th>Email</th>
				<th>Login type</th>
				<!--<th>Instance</th>-->
				<th>Last Login</th>
				<th>Login Count</th>
				<th>Enabled</th>
				<th>Admin</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $sqlstring = "select * from users a left join user_instance b on a.user_id = b.user_id where b.instance_id = '" . $_SESSION['instanceid'] . "' order by username";
    //PrintSQL($sqlstring);
    $result = MySQLQuery($sqlstring, __FILE__, __LINE__);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['user_id'];
        $username = $row['username'];
        $fullname = $row['user_fullname'];
        $email = $row['user_email'];
        $login_type = $row['login_type'];
        //$instancename = $row['instance_name'];
        $lastlogin = $row['user_lastlogin'];
        $logincount = $row['user_logincount'];
        $enabled = $row['user_enabled'];
        $isadmin = $row['user_isadmin'];
        ?>
			<tr>
				<td><a href="adminusers.php?action=editform&id=<?php 
        echo $id;
        ?>
"><?php 
        echo $username;
        ?>
</td>
				<td><?php 
        echo $fullname;
        ?>
</td>
				<td><?php 
        echo $email;
        ?>
</td>
				<td><?php 
        echo $login_type;
        ?>
</td>
				<!--<td class="tiny"><?php 
        echo $instancename;
        ?>
</td>-->
				<td><?php 
        echo $lastlogin;
        ?>
</td>
				<td><?php 
        echo $logincount;
        ?>
</td>
				<td>
					<?php 
        if ($enabled) {
            ?>
<a href="adminusers.php?action=disable&id=<?php 
            echo $id;
            ?>
"><img src="images/checkedbox16.png"></a><?php 
        } else {
            ?>
<a href="adminusers.php?action=enable&id=<?php 
            echo $id;
            ?>
"><img src="images/uncheckedbox16.png"></a><?php 
        }
        ?>
				</td>
				<td>
					<?php 
        if ($isadmin) {
            ?>
<a href="adminusers.php?action=notadmin&id=<?php 
            echo $id;
            ?>
"><img src="images/checkedbox16.png"></a><?php 
        } else {
            ?>
<a href="adminusers.php?action=makeadmin&id=<?php 
            echo $id;
            ?>
"><img src="images/uncheckedbox16.png"></a><?php 
        }
        ?>
				</td>
				<!--<td><?php 
        if ($enabled) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($isadmin) {
            echo "&#10004;";
        }
        ?>
</td> -->
			</tr>
			<?php 
    }
    ?>
			<tr><td colspan="8" align="center">The Following users are unaffiliated with an instance</td></tr>
			<?php 
    $sqlstring = "select a.* from users a left join user_instance b on a.user_id = b.user_id where b.instance_id = '' or b.instance_id is null order by username";
    //PrintSQL($sqlstring);
    $result = MySQLQuery($sqlstring, __FILE__, __LINE__);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['user_id'];
        $username = $row['username'];
        $fullname = $row['user_fullname'];
        $email = $row['user_email'];
        $login_type = $row['login_type'];
        $instancename = $row['instance_name'];
        $lastlogin = $row['user_lastlogin'];
        $logincount = $row['user_logincount'];
        $enabled = $row['user_enabled'];
        $isadmin = $row['user_isadmin'];
        ?>
			<tr>
				<td><a href="adminusers.php?action=editform&id=<?php 
        echo $id;
        ?>
"><?php 
        echo $username;
        ?>
</td>
				<td><?php 
        echo $fullname;
        ?>
</td>
				<td><?php 
        echo $email;
        ?>
</td>
				<td><?php 
        echo $login_type;
        ?>
</td>
				<td class="tiny"><?php 
        echo $instancename;
        ?>
</td>
				<td><?php 
        echo $lastlogin;
        ?>
</td>
				<td><?php 
        echo $logincount;
        ?>
</td>
				<td>
					<?php 
        if ($enabled) {
            ?>
<a href="adminusers.php?action=disable&id=<?php 
            echo $id;
            ?>
"><img src="images/checkedbox16.png"></a><?php 
        } else {
            ?>
<a href="adminusers.php?action=enable&id=<?php 
            echo $id;
            ?>
"><img src="images/uncheckedbox16.png"></a><?php 
        }
        ?>
				</td>
				<td>
					<?php 
        if ($isadmin) {
            ?>
<a href="adminusers.php?action=notadmin&id=<?php 
            echo $id;
            ?>
"><img src="images/checkedbox16.png"></a><?php 
        } else {
            ?>
<a href="adminusers.php?action=makeadmin&id=<?php 
            echo $id;
            ?>
"><img src="images/uncheckedbox16.png"></a><?php 
        }
        ?>
				</td>
				<!--<td><?php 
        if ($enabled) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($isadmin) {
            echo "&#10004;";
        }
        ?>
</td> -->
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}
예제 #26
0
파일: csprefs.php 프로젝트: pmolfese/nidb
function DisplayPrefsList()
{
    $urllist['Analysis'] = "pipelines.php";
    $urllist['CS Prefs'] = "csprefs.php";
    $urllist['Create Preferences File'] = "csprefs.php?action=addform";
    NavigationBar("Analysis", $urllist);
    ?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Name</th>
				<th>Description</th>
			</tr>
		</thead>
		<form method="post" action="csprefs.php">
		<input type="hidden" name="action" value="setdefaultinstance">
		<tbody>
			<?php 
    $sqlstring = "select * from cs_prefs order by shortname";
    $result = MySQLQuery($sqlstring, __FILE__, __LINE__);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $prefid = $row['csprefs_id'];
        $shortname = $row['shortname'];
        $desc = $row['description'];
        ?>
			<tr>
				<td><?php 
        echo $shortname;
        ?>
</td>
				<td><?php 
        echo $description;
        ?>
</td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
		</form>
	</table>
	<?php 
}
예제 #27
0
	function DisplayStats() {
	
		$urllist['Statistics'] = "stats.php";
		NavigationBar("Stats", $urllist);

		$currentyear = date("Y");
		
		$sqlstring = "select count(*) count from subjects where isactive = 1";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numsubjects = number_format($row['count']);
		$numtotalsubjects = $row['count'];

		$sqlstring = "select count(*) count from studies";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numstudies = $row['count'];

		$totalseries = 0;
		$totalsize = 0;
		$sqlstring = "show tables from " . $GLOBALS['cfg']['mysqldatabase'] . " like '%_series'";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
			//print_r($row);
			$tablename = $row['Tables_in_' . $GLOBALS['cfg']['mysqldatabase'] . ' (%_series)'];
			//echo $tablename;
			$parts = explode("_", $tablename);
			$modality = $parts[0];
			
			$sqlstring2 = "select count(*) 'count', sum(series_size) 'size' from $modality" . "_series";
			$result2 = mysql_query($sqlstring2) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring2</i><br>");
			$row2 = mysql_fetch_array($result2, MYSQL_ASSOC);
			$totalseries += $row2['count'];
			$totalsize += $row2['size'];
			$seriescounts[$modality] = number_format($row2['count']);
			$seriessize[$modality] = HumanReadableFilesize($row2['size']);
		}
		
		/* total series qa time */
		$sqlstring = "select sum(cputime) totalcpu from mr_qa";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalcpu'];
		$totalseriesqacpu = FormatCountdown($diff);

		/* total study qa time */
		$sqlstring = "select sum(cputime) totalcpu from mr_studyqa";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalcpu'];
		$totalstudyqacpu = FormatCountdown($diff);
		
		/* total request processing time */
		$sqlstring = "select sum(req_cputime) totalrequestcpu from data_requests";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['totalrequestcpu'];
		$totalrequestcpu = FormatCountdown($diff);
		
		/* mean request time */
		$sqlstring = "SELECT avg(time_to_sec(timediff(req_completedate, req_date))) avgtime FROM `data_requests` where req_completedate > '000-00-00 00:00:00'";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['avgtime'];
		$avgrequesttime = FormatCountdown($diff);

		/* median request time */
		$sqlstring = "SELECT * FROM `data_requests` where req_completedate > '0000-00-00 00:00:00'";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$numrows = mysql_num_rows($result);
		$med = round($numrows/2);
		
		$sqlstring = "SELECT time_to_sec(timediff(req_completedate, req_date)) avgtime FROM `data_requests` where req_completedate > '0000-00-00 00:00:00' order by avgtime limit $med,1";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$diff = $row['avgtime'];
		$medianrequesttime = FormatCountdown($diff);
		
		$uptime = shell_exec('uptime');
		
		/* subject demographics */
		$sqlstring = "select (select count(*) from subjects where gender = 'F') 'numfemales', (select count(*) from subjects where gender = 'M') 'nummales', (select count(*) from subjects where gender = 'O') 'numother', (select count(*) from subjects where gender = 'U') 'numunknown', (select count(*) from subjects where gender not in ('F','M','O','U')) 'numnotspec'";
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numfemales = $row['numfemales'];
		$nummales = $row['nummales'];
		$numother = $row['numother'];
		$numunknown = $row['numunknown'];
		$numnotspec = $row['numnotspec'];
		
		?>
		
		<table width="100%">
			<tr>
				<td valign="top" width="50%">
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Series Info</td>
						</tr>
						<tr>
							<td class="body">
								<span style="font-size:10pt;">
								<b>Available Data:</b><br>
								<?php 
echo $numsubjects;
?>
 subjects<br>
								<?php 
echo number_format($numstudies);
?>
 studies<br>
								<br>
								<table class="smalldisplaytable">
									<tr>
										<th><b>Series</b></th>
										<th align="right"><b>Count</b></th>
										<th align="right"><b>Size</b></th>
									</tr>
								<?
									foreach ($seriescounts as $modality => $count) {
										?>
										<tr>
											<td><?php 
echo strtoupper($modality);
?>
</td>
											<td align="right"><?php 
echo $count;
?>
</td>
											<td align="right"><?php 
echo $seriessize[$modality];
?>
</td>
										</tr>
										<?
									}
								?>
									<tr style="color: #5882FA; font-weight: bold">
										<td>Total</td>
										<td align="right"><?php 
echo number_format($totalseries);
?>
</td>
										<td align="right"><?php 
echo HumanReadableFilesize($totalsize);
?>
</td>
									</tr>
								</table>
								</span>
							</td>
						</tr>
					</table>
					
					<br>
					
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">System Info</td>
						</tr>
						<tr>
							<td class="body">
								<span class="header">Uptime</span><br>
								<?php 
echo $uptime;
?>
								<br><bR>
								<span class="header">Data Requests</span><br>
								<b>CPU time:</b> <?php 
echo $totalrequestcpu;
?>
<br>
								<b>Mean request time:</b> <?php 
echo $avgrequesttime;
?>
<br>
								<b>Median request time:</b> <?php 
echo $medianrequesttime;
?>
<br>
							</td>
						</tr>
					</table>
					
					<br>
					
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">Subject Demographics</td>
						</tr>
						<tr>
							<td class="body">
								<table class="reviewtable">
									<tr>
										<td class="label"># females</td>
										<td class="value"><?php 
echo $numfemales;
?>
 (<?php 
echo number_format($numfemales / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># males</td>
										<td class="value"><?php 
echo $nummales;
?>
 (<?php 
echo number_format($nummales / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># other</td>
										<td class="value"><?php 
echo $numother;
?>
 (<?php 
echo number_format($numother / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># unknown</td>
										<td class="value"><?php 
echo $numunknown;
?>
 (<?php 
echo number_format($numunknown / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
									<tr>
										<td class="label"># not specified</td>
										<td class="value"><?php 
echo $numnotspec;
?>
 (<?php 
echo number_format($numnotspec / $numtotalsubjects * 100, 1);
?>
%)</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>					
				</td>
				<td valign="top" width="50%">
					<table class="bluerounded" width="100%">
						<tr>
							<td class="title">MR</td>
						</tr>
						<tr>
							<td class="body">
								<span class="header">CPU time</span><br>
								<b>Total series QA CPU time:</b> <?php 
echo $totalseriesqacpu;
?>
<br>
								<b>Total study QA CPU time:</b> <?php 
echo $totalstudyqacpu;
?>
<br>
							</td>
						</tr>
						<tr>
							<td class="body">
								<table cellspacing="0" cellpadding="2" style="font-size:10pt">
									<tr>
										<td colspan="24" align="center"><span class="header">Total # MR studies starting at time...</span></td>
									</tr>
									<tr>
										<td colspan="12" align="center" style="border-bottom: 1px solid gray; border-right: 1pt solid gray">AM</td>
										<td colspan="12" align="center" style="border-bottom: 1px solid gray">PM</td>
									</tr>
									<tr style="font-size:10pt">
										<?
											for ($hour=0;$hour<24;$hour++) {
												if ($hour == 0){
													?><td align="center" style="border-left: solid 1px #CCCCCC; border-right: solid 1px #CCCCCC;">12</td><?
												}
												else {
													if ($hour < 12) {
														?><td align="center" style="border-right: solid 1px #CCCCCC;"><?php 
echo $hour;
?>
</td><?
													}
													else {
														$hr = $hour;
														if ($hour != 12) {
															$hr = $hr - 12;
														}
														?><td align="center" style="border-right: solid 1px #CCCCCC;"><?php 
echo $hr;
?>
</td><?
													}
												}
											}
										?>
									</tr>
									<tr>
								<?
									for ($hour=0;$hour<24;$hour++) {
										$sqlstring = "select count(*) count from studies where hour(study_datetime) = $hour and study_modality = 'MR'";
										#echo "$sqlstring<br>";
										$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
										$row = mysql_fetch_array($result, MYSQL_ASSOC);
										$count = $row['count'];
										$percent = round(($count/$numstudies)*100);
										$counts[$hour] = $count;
										//echo "[$count] [$numstudies] [$percent]";
										#echo "<td align=right>$percent%&nbsp;</td>";
										?>
										<td valign="bottom" align="center" style="border-right: solid 1px #CCCCCC;">
											<table height="<? echo $percent*2; ?>px" cellpadding=0 cellspacing=0 width="15px">
												<tr>
													<td bgcolor="red" style="font-size: 0px">&nbsp;</td>
												</tr>
											</table>
										</td>
										<?
									}
									?> </tr><tr style="font-size:8pt"> <?
									for ($hour=0;$hour<24;$hour++) {
										echo "<td align=center>$counts[$hour]</td>";
									}
								?>
									</tr>
								</table>
								<br><br>
								<table cellspacing="0" cellpadding="2" style="font-size:10pt">
									<tr>
										<td colspan="13" align="center" style="border-bottom: 1pt solid darkgray"><span class="header">Scan History (# sessions per month)</span></td>
									</tr>
									<tr>
										<td>Year</td>
										<td>Jan</td>
										<td>Feb</td>
										<td>Mar</td>
										<td>Apr</td>
										<td>May</td>
										<td>Jun</td>
										<td>Jul</td>
										<td>Aug</td>
										<td>Sep</td>
										<td>Oct</td>
										<td>Nov</td>
										<td>Dec</td>
									</tr>
								<?
									$sqlstring = "select year(min(study_datetime)) firstyear from studies where study_datetime > '0000-00-00 00:00:01' and study_modality = 'MR'";
									$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
									$row = mysql_fetch_array($result, MYSQL_ASSOC);
									$firstyear = $row['firstyear'];
									
									$numyears = $currentyear - $firstyear;
									
									for ($year=$firstyear;$year<=$currentyear;$year++) {
										?>
										<tr>
											<td>
												<a href="reports.php?action=yearstudy&year=<?php 
echo $year;
?>
&modality=MR"><b><?php 
echo $year;
?>
</b></a>
											</td>
										<?
										for ($month=1;$month<=12;$month++) {
											$sqlstring = "select count(*) count from studies where year(study_datetime) = $year and month(study_datetime) = $month and study_modality = 'MR'";
											#echo "$sqlstring<br>";
											$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
											$row = mysql_fetch_array($result, MYSQL_ASSOC);
											$count = $row['count'];
											echo "<td align=right>$count &nbsp;</td>";
										}
										?>
										</tr>
										<?
									}
								?>
								</table>
								
							</td>
						</tr>
						<tr>
							<td class="body">
							<?
								$sqlstring = "SELECT (move_maxx-move_minx + move_maxy-move_miny + move_maxz-move_minz) 'totalmovement', datediff(c.study_datetime, e.birthdate) 'ageatscan', e.gender FROM mr_qa a left join mr_series b on a.mrseries_id = b.mrseries_id left join studies c on b.study_id = c.study_id left join enrollment d on c.enrollment_id = d.enrollment_id left join subjects e on d.subject_id = e.subject_id";
								$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
								$i=0;
								while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
									if (($row['totalmovement'] > 0) && ($row['totalmovement'] < 50)) {
										//print_r($row);
										$y[] = number_format($row['totalmovement'],2);
										$x[] = number_format($row['ageatscan']/365.25,2);
										if ($row['gender'] == 'F')
											$c[] = 'FF0000'; //$c[] = 'FFC0CB';
										elseif ($row['gender'] == 'M')
											$c[] = '0000FF'; //$c[] = '4169E1';
										else
											$c[] = '888888';
										$i++;
									}
									//if ($i>100) break;
								}
								//print_r($x);
								$chd = implode(",",$x) . "|" . implode(",",$y);
								$chco = implode("|",$c);
								
								$x = implode(",",$x);
								$y = implode(",",$y);
								$c = implode(",",$c);
								
								$chartfilename = DrawScatterPlot(600,400,$x,$y,$c);
							?>
							<b>Age vs movement</b><br>
							<img src="data:image/png;base64,<?php 
echo base64_encode(file_get_contents($chartfilename));
?>
">
							<?
								/* image data should've been sent to the browser, so delete the temp image */
								unlink($chartfilename);
							?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<?
	}
예제 #28
0
function DisplayDownloadList()
{
    $urllist['Public Downloads'] = "publicdownloads.php";
    NavigationBar("Export", $urllist);
    ?>

	<table class="graydisplaytable">
		<thead>
			<tr>
				<th>Description</th>
				<th>Status</th>
				<th>Created</th>
				<th>Expires</th>
				<th>Release notes</th>
				<th>Zip size<br><span class="tiny">bytes</span></th>
				<th>Unzipped size<br><span class="tiny">bytes</span></th>
				<th>Creator</th>
				<th>Password</th>
				<th>Download link<br><span class="tiny">Copy link to use</span></th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $sqlstring = "select * from public_downloads where pd_createdby = '" . $_SESSION['username'] . "' or pd_shareinternal = 1 order by pd_createdate desc";
    //PrintSQL($sqlstring);
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['pd_id'];
        $createdate = $row['pd_createdate'];
        $expiredate = $row['pd_expiredate'];
        $expiredays = $row['pd_expiredays'];
        $createdby = $row['pd_createdby'];
        $zipsize = $row['pd_zippedsize'];
        $unzipsize = $row['pd_unzippedsize'];
        $filename = $row['pd_filename'];
        $desc = $row['pd_desc'];
        $notes = $row['pd_notes'];
        $filecontents = $row['pd_filecontents'];
        $shareinternal = $row['pd_shareinternal'];
        $registerrequired = $row['pd_registerrequired'];
        $password = strtoupper($row['pd_password']);
        $status = $row['pd_status'];
        $key = strtoupper($row['pd_key']);
        ?>
			<tr>
				<td><?php 
        echo $desc;
        ?>
</td>
				<td><?php 
        echo $status;
        ?>
</td>
				<td style="font-size:9pt"><?php 
        echo $createdate;
        ?>
</td>
				<td style="font-size:9pt"><?php 
        echo $expiredate;
        ?>
</td>
				<td><img src="images/preview.gif" title="<?php 
        echo $notes;
        ?>
"></td>
				<td style="font-size:9pt" align="right"><?php 
        echo HumanReadableFilesize($zipsize);
        ?>
</td>
				<td style="font-size:9pt" align="right"><?php 
        echo HumanReadableFilesize($unzipsize);
        ?>
</td>
				<td><?php 
        echo $createdby;
        ?>
</td>
				<td style="font-size:8pt"><?php 
        echo $password;
        ?>
</td>
				<td><input type="text" value="<?php 
        echo $GLOBALS['cfg']['siteurl'] . "/pd.php?k={$key}";
        ?>
"></td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}
예제 #29
0
	function DisplayLonitudinalQC($groupid, $protocol) {
	
		$urllist['Groups'] = "longqc.php";
		NavigationBar("Longitudinal QC", $urllist,0,'','','','');
		
		# this only works for study groups
		$sqlstring = "select a.*, b.* from groups a left join group_data b on a.group_id = b.group_id where a.group_id = $groupid";
		//PrintSQL($sqlstring);
		$result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>");
		while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
			$name = $row['group_name'];
			$ownerusername = $row['ownerusername'];
			$grouptype = $row['group_type'];
			$studyid = $row['data_id'];
			$modality = $row['modality'];
			$seriesid = $row[$modality . "series_id"];
			
			$sqlstringA = "select *, unix_timestamp(DATE(series_datetime)) 'seriesdate' from $modality"."_series where study_id = $studyid and series_desc = '$protocol' order by seriesdate asc";
			//PrintSQL($sqlstringA);
			$resultA = mysql_query($sqlstringA) or die("Query failed: " . mysql_error() . "<br><i>$sqlstringA</i><br>");
			while ($rowA = mysql_fetch_array($resultA, MYSQL_ASSOC)) {
				$seriesid = $rowA[$modality."series_id"];
				$seriesdate = $rowA['seriesdate'];
				list($path, $uid, $studynum, $studyid, $subjectid) = GetDataPathFromSeriesID($seriesid, $modality);
				
				$qadir = "$path/qa";
				//echo "$qadir: ";
				
				$sqlstringB = "select * from mr_qa where mrseries_id = $seriesid";
				$resultB = mysql_query($sqlstringB) or die("Query failed: " . mysql_error() . "<br><i>$sqlstringB</i><br>");
				$rowB = mysql_fetch_array($resultB, MYSQL_ASSOC);
				$iosnr = $rowB["io_snr"];
				$pvsnr = $rowB["pv_snr"];
				$motion_rsq = $rowB["motion_rsq"];
				$moveminx = $rowB["move_minx"];
				$moveminy = $rowB["move_miny"];
				$moveminz = $rowB["move_minz"];
				$movemaxx = $rowB["move_maxx"];
				$movemaxy = $rowB["move_maxy"];
				$movemaxz = $rowB["move_maxz"];

				$iosnrs[$seriesdate]['studyid'] = $studyid;
				$iosnrs[$seriesdate]['uid'] = $uid;
				$iosnrs[$seriesdate]['studynum'] = $studynum;
				$iosnrs[$seriesdate]['subjectid'] = $subjectid;
				$iosnrs[$seriesdate]['value']= $iosnr;
				
				$pvsnrs[$seriesdate]['studyid'] = $studyid;
				$pvsnrs[$seriesdate]['uid'] = $uid;
				$pvsnrs[$seriesdate]['studynum'] = $studynum;
				$pvsnrs[$seriesdate]['subjectid'] = $subjectid;
				$pvsnrs[$seriesdate]['value'] = $pvsnr;
				
				$motionrsqs[$seriesdate] = $motion_rsq;
				$moves[$seriesdate]['minx'] = $moveminx;
				$moves[$seriesdate]['miny'] = $moveminy;
				$moves[$seriesdate]['minz'] = $moveminz;
				$moves[$seriesdate]['maxx'] = $movemaxx;
				$moves[$seriesdate]['maxy'] = $movemaxy;
				$moves[$seriesdate]['maxz'] = $movemaxz;
			}
		}
		ksort($iosnrs);
		ksort($pvsnrs);
		ksort($motionrsqs);
		ksort($moves);

		DisplayChart($iosnrs, "IO SNR", 250, 1);
		DisplayChart($pvsnrs, "PV SNR", 250, 2);
		DisplayChart($motionrsqs, "Motion r^2", 250, 3);
	}
예제 #30
0
function DisplayPipelineDownloadList()
{
    $urllist['Pipeline download list'] = "pipelinedownload.php";
    $urllist['Add pipeline download'] = "pipelinedownload.php?action=addform";
    NavigationBar("Pipeline Downloads", $urllist);
    ?>

	<table class="displaytable" width="100%">
		<thead>
			<tr>
				<th>Pipeline</th>
				<th>Admin</th>
				<th>Protocol</th>
				<th>Dir format</th>
				<th>NFS dir</th>
				<th>Anonymize?</th>
				<th>gzip?</th>
				<th>Preserve series?</th>
				<th>Group?</th>
				<th>Only new?</th>
				<th>File type</th>
				<th>Modality</th>
				<th>Beh format</th>
				<th>Create date</th>
			</tr>
		</thead>
		<tbody>
			<?php 
    $sqlstring = "select a.*, b.username 'adminusername', b.user_fullname 'adminfullname', c.pipeline_name from pipeline_download a left join users b on a.pd_admin = b.user_id left join pipelines c on a.pipeline_id = c.pipeline_id where a.pd_status = 'active' order by a.pd_protocol";
    $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>");
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id = $row['pipelinedownload_id'];
        $pipeline_name = $row['pipeline_name'];
        $adminusername = $row['adminusername'];
        $adminfullname = $row['adminfullname'];
        $protocol = $row['pd_protocol'];
        $dirformat = $row['pd_dirformat'];
        $nfsdir = $row['pd_nfsdir'];
        $anonymize = $row['pd_anonymize'];
        $gzip = $row['pd_gzip'];
        $preserveseries = $row['pd_preserveseries'];
        $groupbyprotocol = $row['pd_groupbyprotocol'];
        $onlynew = $row['pd_onlynew'];
        $filetype = $row['pd_filetype'];
        $modality = $row['pd_modality'];
        $behformat = $row['pd_behformat'];
        $behdirrootname = $row['pd_behdirrootname'];
        $createdate = $row['pd_createdate'];
        $status = $row['pd_status'];
        ?>
			<tr>
				<td><a href="pipelinedownload.php?action=editform&id=<?php 
        echo $id;
        ?>
"><?php 
        echo $pipeline_name;
        ?>
</a></td>
				<td><?php 
        echo $adminfullname;
        ?>
</td>
				<td><?php 
        echo $protocol;
        ?>
</td>
				<td><?php 
        echo $dirformat;
        ?>
</td>
				<td><?php 
        echo $nfsdir;
        ?>
</td>
				<td><?php 
        if ($anonymize) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($gzip) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($preserveseries) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($groupbyprotocol) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        if ($onlynew) {
            echo "&#10004;";
        }
        ?>
</td>
				<td><?php 
        echo $filetype;
        ?>
</td>
				<td><?php 
        echo $modality;
        ?>
</td>
				<td><?php 
        echo $behformat;
        ?>
 [<?php 
        echo $behdirrootname;
        ?>
]</td>
				<td><?php 
        echo $createdate;
        ?>
</td>
			</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}