Location: PHPKode > projects > Enzyme: PHP profile/object community mgr > Enzyme-0.6.3/main/edit/settings.php3
<?
page_open(array("sess" => "Poe_Session", "auth" => "Poe_Challenge_Auth", "perm" => "Cat_Perm", "user" => "Poe_User"));
$perm->check( "student" );
?>
<?
include( "cat_header_code.inc" );
include( "UpdateOrInsert.inc" );

//NOTE: this must be changed whenever we add a new setting.
define( "NUMBER_OF_SETTINGS", 7 ); // number of possible settings
if( $submit_item or $Next ) {
  //password handling done directly for now.
  if( $oldpassword ) {
    if( $password1 != $password2 )
      $pword2_err = "Passwords do not match.";
    else if( strlen( $password1 ) < 6 )
      $pword1_err = "Password must be at least 6 characters.";
    else {
      $db = new DB_Poe;
      $query = sprintf( "SELECT * FROM auth_user WHERE ( username = \"%s\" );", $auth->auth[uname] );
      $db->query( $query );
      $db->next_record();
      if( $oldpassword != $db->f( "password" ) )
	$oldpword_err = "Old password is incorrect.";
      else {
	$query = sprintf( "UPDATE auth_user SET password = \"%s\" WHERE username = \"%s\";", $password1, $auth->auth[uname] );
	$db->query( $query );
      }
    }
  }

  for( $i = 0; $i < NUMBER_OF_SETTINGS; $i++ ) {
    if( !$HTTP_POST_VARS["student_setting_level_$i"] )
      $HTTP_POST_VARS["student_setting_level_$i"] = 0; //prevent exclude null from ignoring unchecked boxes.
  }
  MultiUpdate( NUMBER_OF_SETTINGS, "student_setting", 0, array( "settingid", "studentid" ) );
}

include( "setup_settings.inc" );
$input_form = setup_settings();

multiloadValues( "student_setting", array( "studentid" ), array( getStudentid() ), "_", "settingid" );

//This bit is actually a bit tricky -- different settingid's will need to have different forms.
//For now it just so happens that the indexing on the variable names corresponds to the settingids
//in that nice i = i + 1 relationship. Later, these values may need to be set manually according to
//their corresponding forms.
for( $i = 0; $i < NUMBER_OF_SETTINGS; $i++ ) {
  $GLOBALS["student_setting_settingid_$i"] = $i + 1;
}
$input_form->load_defaults();

?>
<?

$PAGE_TITLE = "Account Settings";
include "cat_header_layout.inc";

?>
		
<table border="0" cellpadding="3" cellspacing="0" frame width="100%">
	<tr>
		<td width="300" colspan="3" bgcolor="#3130CE">
		<img src="headerImages/accountSettings.gif">
	</tr>
</table>
<?
$help = "settings";
include( "navBarNoCatTop.inc" );
?>
<table border="0" cellpadding="3" cellspacing="0" frame width="100%">
	<tr>
		<td colspan="2">
			<font color="<? echo $cat_textOnLightBKG; ?>">
			<b>Change Password</b>	
			</font>
		</td>
	</tr>
	<tr>
		<td height="18" width="20%" align="right" align="right">
			<font color="<? echo $cat_textOnLightBKG; ?>">Old password</font></td>
		<td height="18" width="79%">
                <font color="red" size="3"><i><? echo $oldpword_err; ?></i></font>
<?
$input_form->show_element( "oldpassword" );
?>
		</td>
	</tr>
	<tr height="18">
		<td height="18" width="20%" align="right">
			<font color="<? echo $cat_textOnLightBKG; ?>">
			New password
			</font></td>
		<td height="18" width="79%">
                <font color="red" size="3"><i><? echo $pword1_err; ?></i></font>
<?
$input_form->show_element( "password1" );
?>
		</td>
	</tr>
	<tr height="18">
		<td height="18" width="20%" align="right">
			<font color="<? echo $cat_textOnLightBKG; ?>">Retype new password</font></td>
		<td height="18" width="79%">
                <font color="red" size="3"><i><? echo $pword2_err; ?></i></font>
<?
$input_form->show_element( "password2" );
?>
		</td>
	</tr>
	</tr>
		<td colspan= "2">
		
		</td>
</table>
<img src="images/shim.gif" height="4" width="400">


<table border="0" cellpadding="2" width="100%">
	
<tr>
	<td>
	 	<font color="<? echo $cat_textOnLightBKG; ?>">
	 	<b>Profile Availability<b>
	 	</font>
	 </td>
</tr>
 <tr>
	<td height="18">
<blockquote>
<?
$input_form->show_element( "student_setting_level_6" );
?>  
<font color="<? echo $cat_textOnLightBKG; ?>">
I would like to temporarily <I>hide</I> my profile from all employers.
</font>
<br>
<?
$input_form->show_element( "student_setting_level_5" );
?>  
<font color="<? echo $cat_textOnLightBKG; ?>">
I would like to make my profile available for public view at http://www.CatalystRecruiting.com/u/<? echo $auth->auth[uname]; ?>.
	</font>
</blockquote>
		</td>
	</tr>
			<tr>
		<td>
		<img src="images/shim.gif" height="2" width="400">
		</td>
	</tr>
	
	<tr>
	<td >
	<font color="<? echo $cat_textOnLightBKG; ?>">
<b>Level of mail from Catalyst</b>
</font>
		</td>
	</tr>
	<tr>
		<td height="18" >
<blockquote>
<?
//$input_form->show_element( "student_setting_settingid_0" );
$input_form->show_element( "student_setting_level_0", 0 );
?>
<font color="<? echo $cat_textOnLightBKG; ?>">
			Yes! I would like to hear from Catalyst about promotions, partnerships, and special deals.
</font>
	</blockquote>
	</td>
	</tr>
    		<tr>
		<td>
		<img src="images/shim.gif" height="2" width="400">
		</td>
	</tr>    
    <tr>
		<td height="18">
		<font color="<? echo $cat_textOnLightBKG; ?>">
		<b>Yes!  I would like to hear cool stuff about:</b>
		</font>
		</td>
	</tr>
	<tr>
		<td>
<blockquote>
<?
$input_form->show_element( "student_setting_level_1" );
?>
<font color="<? echo $cat_textOnLightBKG; ?>">
			Non-profits</font>
<br>
<?
$input_form->show_element( "student_setting_level_2" );
?> 
<font color="<? echo $cat_textOnLightBKG; ?>">
			Start-up companies</font>
<br>
<?
$input_form->show_element( "student_setting_level_3" );
?>  		
<font color="<? echo $cat_textOnLightBKG; ?>">
Tech</font>
<br>
<?
$input_form->show_element( "student_setting_level_4" );
?>
<font color="<? echo $cat_textOnLightBKG; ?>">
			Finance
</font>
</blockquote>
</td>
	</tr>
			<tr>
		<td>
		<img src="images/shim.gif" height="30" width="400">
		</td>
	</tr>
</table>
<? include( "navBarNoCatBottom.inc" ); ?>
<!-- BEGIN CAT_FOOTER.INC -->
<? include( "cat_footer.inc" ); ?>
Return current item: Enzyme: PHP profile/object community mgr