Location: PHPKode > projects > NetVis Module > netvis/survey.php
<?php
// enter social network data through online survey when selected from socialnetworks.php

	include("config.php");
	include($baseDir . "common/_func.php");

	//if user is not logged in, redirect to homepage
		if(!isset($uID)){header("Location: http://www.netvis.org");exit;}

	//if user is logged in as demo, redirect to homepage
		demoRedirect($username);

	// define variables
	$array_variables = array("ego","geo","error_netname","error_netnum","error_age","error_sex","error_known","error_distance","error_media","error_other","error_comm","error_close","error_otherMatrix","error_otherMatrixText","error_otherText","error_otherScale","error_otherScale1","error_otherScale2","error_otherScale3","error_otherScale4","error_otherScale5","error_city","error_state","error_country","error_zip","error_timezone","error_daylight","error_latitude","error_longitude","error_otherScale","error_cutoff","error","peoples","display_matrix","start_matrix");

	for($i=0; $i<count($array_variables); $i++){
		$array_variable=$array_variables[$i];
		session_register("$array_variable");
			if(!isset(${$array_variable})){
				${$array_variable}=FALSE;
			}
	}

	$peoples=0;

	include($baseDir . "common/_javascript.php");
	include($baseDir . "common/_header.php");
?>

<center>
 <table width=700 border=0 cellspacing=0 cellpadding=1 bordercolor=#006699>
<tr bgcolor=#CCCCCC align=center>
 <td nowrap bgcolor=#FFFFFF height=22>
 <div align='left'><a href='logout.php'><font color=#006699>Home</font></a>
	 &gt; <a href="socialnetworks.php"><font color=#006699>Social
	 Networks</font></a> &gt; Online Survey</div>
 </td>
 <td nowrap bgcolor=#FFFFFF height=22>
	<div align='right'>
<?php
	include($baseDir . "common/_options.php");
?>
	</div>
 </td>
</tr>
<form action="survey_att.php" method="post" name="form">
 <tr>
	<td colspan=2 bgcolor=#006699><font color=#FFFFFF>
	 <p align=center><font size='+2'>Please provide a name and number of people for your social network</font></p>
	 </font></td>
 </tr>
 <tr>
	<td bgcolor=#CCCCCC>
	 <div align='left'><font size="+1">Name of social network (e.g., family, friends, work)</font>
<?
	// if network left blank give error message
	if($error==1){
		echo "<br><font color=#ff0000>(please enter unique name)</font>";
	}
?>
	</div>
	</td>
	<td bgcolor=#CCCCCC>
	 <div align='right'>
	<input onKeyPress='if(window.event.keyCode==13) {
	document.forms[0].jsenabled.value = "T";document.forms[0].submit();return false; }'
	type=textbox name="netname" value="<?=$error_netname?>" >
	 </div>
	</td>
 </tr>
 <tr>
	<td bgcolor=#CCCCCC>
	 <div align='left'><font size="+1">Number of people in this social network (5 or more)</font>
<?
	// if number left blank give error message
	if($error==2){
		echo "<br><font color=#ff0000>(please enter number greater than zero)</font>";
	}

?>
	</div>
	</td>
	<td bgcolor=#CCCCCC>
	 <div align='right'>
	<input onKeyPress='if(window.event.keyCode==13) {
	document.forms[0].jsenabled.value = "T";document.forms[0].submit();return false; }'
	maxlength=5 size=5 name="netnum" value=<?=$error_netnum?>>
	 </div>
	</td>
	</tr>

	<?php
		$ego_checked=($ego==1)?"checked":"";
		$complete_checked=($ego==FALSE || $ego==0)?"checked":"";
	?>

	<tr bgcolor=#CCCCCC>
	<td bgcolor=#CCCCCC><font color="000000" size="+1">Which kind of social network do you want to create?</font></td>
	<td><div align='right'><input type=radio name="dataset" <?=$ego_checked?> value=1><a href='javascript:wopen("popup.php?label=ego_example","ego_example","scrollbars=no,resizable=yes,width=350,height=300");'><font color=#006699>Ego</font></a>
	<input type=radio name="dataset" <?=$complete_checked?> value=2><a href='javascript:wopen("popup.php?label=complete_example","complete_example","scrollbars=no,resizable=yes,width=350,height=300");'><font color=#006699>Complete</font></a>
	</div>
	</td>
	</tr>

	<tr>
	<td bgcolor=#CCCCCC colspan=2><table width='100%' border=0 cellspacing=0 cellpadding=1 bordercolor=#006699>
	<tr>
	<td width=50% bgcolor="CCCCCC" colspan=2>

	<?php
	// if attribute or matrix left blank give error message
	if($error=="3"){
		echo "<font color=#ff0000 size='+1'><br>Please check at least one attribute below:</font></td>";
	}
	if($error=="4"){
		echo "<font color=#ff0000 size='+1'><br>Please check at least one matrix below:</font></td>";
	}
	?>
			</tr>
			<tr>
	<td width=50% bgcolor="CCCCCC"><font color="000000" size="+1"><br>Attributes</font></td>
	<td width=50% bgcolor="CCCCCC"><font color="000000" size="+1"><br>Matrices</font></td>
			</tr>
			<tr>
	<td width=50% bgcolor="CCCCCC" valign="top">
		<div align='left'>
			<input type="checkbox" name="age"
			value=1>&nbsp; Age<br>
			<?
				if($error_age!=FALSE){echo " checked ";}
			?>			
			&nbsp; &nbsp; &nbsp; <i>Person's age (in years)</i><br><br>
			<input type="checkbox" name="sex"
			value=1>&nbsp; Sex<br>
			<?
				if($error_sex!=FALSE){echo " checked ";}
			?>			
			&nbsp; &nbsp; &nbsp; <i>Person's sex (male/female)</i><br><br>
			<input type="checkbox" name="known" 
			<?
				if($error_known!=FALSE){echo " checked ";}
			?>			
			value=1>&nbsp; Known<br>
			&nbsp; &nbsp; &nbsp; <i>Years known person</i><br><br>
			<input type="checkbox" name="distance" 
			<?
				if($error_distance!=FALSE){echo " checked ";}
			?>			
			value=1>&nbsp; Distance<br>
			&nbsp; &nbsp; &nbsp; <i>Physical distance from person</i><br><br>
			<input type="checkbox" name="media" 
			<?
				if($error_media!=FALSE){echo " checked ";}
			?>						
			value=1>&nbsp; Media<br>
			&nbsp; &nbsp; &nbsp; <i>Communication media (e.g., phone, email)</i><br><br>
			<input type="checkbox" name="other" 
			<?
				if($error_other!=FALSE){echo " checked ";}
			?>									
			value=1>&nbsp; Other 
				<?php
				// if attribute other left blank give error message
				if($error_other==FALSE){
					echo "<font color=#000000>(enter attribute below)</font><br>";
				}
				?>
			&nbsp; &nbsp; &nbsp; <i><input type="text" name="otherText" value="<?=$error_otherText?>"></i>
		</div>
	</td>
	<td width=50% bgcolor="CCCCCC" valign="top">
		<div align='left'>
			<input type="checkbox" name="comm" 
			<?
				if($error_comm!=FALSE){echo " checked ";}
			?>												
			checked value=1>&nbsp; Communication Matrix<br>
			&nbsp; &nbsp; &nbsp; <i>How often do the following people communicate with each other?</i><br><br>
			<input type="checkbox" name="close" 
			<?
				if($error_close!=FALSE){echo " checked ";}
			?>															
			checked value=1>&nbsp; Closeness Matrix<br>
			&nbsp; &nbsp; &nbsp; <i>How close do the following people feel to each other?</i><br><br>
			<input type="checkbox" name="otherMatrix" 
			<?
				if($error_otherMatrix!=FALSE){echo " checked ";}
			?>																		
			value=1>&nbsp;  Other Matrix 
				<?php
				// if matrix other left blank give error message
				if($error_otherMatrix==FALSE){
					echo "<font color=#000000>(enter question below)</font><br>";
				}
				?>

			&nbsp; &nbsp; &nbsp; <input type="text" name="otherMatrixText" size="45" value="<?=$error_otherMatrixText?>">
			<table width='100%' border=0 cellspacing=0 cellpadding=1 bordercolor=#006699>
	<tr>
				<?php
				// if scale other left blank give error message
				if($error_otherScale==FALSE){
					echo "<font color=#000000>Please select scale</font><br>";
				}
				?>
		<td align=center><input type=radio name="otherScale"
		<? if($error_otherScale=="2"){echo " checked ";}?>																			
		value=2></td>
		<td align=center><input type=radio name="otherScale" 
		<? if($error_otherScale=="3"){echo " checked ";}?>
		value=3></td>
		<td align=center><input type=radio name="otherScale" 
		<? if($error_otherScale=="4"){echo " checked ";}?>																			
		value=4>
				<?php
				// if scale items left blank give error message
				echo "<font color=#000000>(enter scale items)</font><br>";
				?>
		</td></tr>
	</tr>
	<tr>
		<td valign="top">Not at all</td>
		<td valign="top">Strongly disagree</td>
		<td><input type="text" name="otherScale1" value="<?=$error_otherScale1?>"></td></tr>
	</tr>
	<tr>
		<td valign="top">Monthly</td>
		<td valign="top">Disagree</td>
		<td><input type="text" name="otherScale2" value="<?=$error_otherScale2?>"></td></tr>
	</tr>
	<tr>
		<td valign="top">Bi-weekly</td>
		<td valign="top">Neutral</td>
		<td><input type="text" name="otherScale3" value="<?=$error_otherScale3?>"></td></tr>
	</tr>
	<tr>
		<td valign="top">Weekly</td>
		<td valign="top">Agree</td>
		<td><input type="text" name="otherScale4" value="<?=$error_otherScale4?>"></td></tr>
	</tr>
	<tr>
		<td valign="top">Daily</td>
		<td valign="top">Strongly Agree</td>
		<td><input type="text" name="otherScale5" value="<?=$error_otherScale5?>"></td></tr>
	</tr>
			</table>
	<br><br></center>
		</div>
	</td>
			</tr>
		</table></td>
	</tr>

	<?php
		$nogeodis_checked=($geo==1)?"checked":"";
		$geodis_checked=($geo==FALSE || $geo==0)?"checked":"";
	?>

	<tr bgcolor=#CCCCCC>
	<td bgcolor=#CCCCCC><font color="000000" size="+1">Do you want to include questions on 
	geographic distance?</font></td>
	<td><div align='right'>(<a href='javascript:wopen("popup.php?label=distance_example","distance_example","scrollbars=no,resizable=yes,width=500,height=325");'><font color=#006699>example</font></a>)<input type=radio name="geodis" <?=$nogeodis_checked?> value=1>Yes <input type=radio name="geodis" <?=$geodis_checked?> value=0>No
	</div>
	</td>
	</tr>

 <tr>
	<td bgcolor=#FFFFFF>&nbsp; </td>
	<td bgcolor=#FFFFFF>
	<div align='right'><a class=smalltext onClick='document.forms[0].jsenabled.value = "T";
document.forms[0].submit(); return false;' href="survey_att.php"><img alt="Submit" src="<?php echo $url . "/img/submit.gif"; ?>" border=0 width="59" height="17"></a></div>
 </tr>
 <input type=hidden value=F name=jsenabled>
</form>

<SCRIPT LANGUAGE="JavaScript">
form.netname.focus()
</SCRIPT>
 </table>
</center>

<?php
	$error=0;
	include($baseDir . "common/_footer.php");
?>
Return current item: NetVis Module