<?php
 	/**
 * user_profile_view.php - My Profile popup page.
 *
 * @author $Author: dtong $
 * @version $Id: user_profile_view.php,v 1.15 2011/04/27 06:10:20 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

$href   = base_url();
$refresh= base_url().'admin/user/editprofile/';
$page   = base_url().$page;

$display	= lang('display') ;
$width = lang('width') ;
$fontweight = lang('font-weight') ;
$textalign = lang('text-align') ;
$message = lang('message') ;
$color = lang('color') ;

$imgreq = 'req.gif';
$img_req = "<img src=". osa_imagepath() .
	"$imgreq  title='Required field' alt='Required field' border='0' />";

//$mode = CMS_ADMIN_UPDATE;
//Use a different function to tighten up security
$update_url = "$page/update1";
if ( isset($data)==FALSE || count($data) == 0 )  {
	echo lang('admin_user_error_nodata');
	return false;
}
$row = $data;
//$mode = $page.'/'.$mode.'/'.'1';
?>
<?php
$showhide='';
if ( $row->auth_id != CMS_AUTH_ID_LOCAL ){
	$showhide='display:none;';
}
?>
<form method="POST"  name="resource_form" >
<input type="hidden" id="id" name="id" size="30" value="<?php   echo $row->id; ?>" />
<input type="hidden" id="id" name="auth_id" size="30" value="<?php   echo $row->auth_id; ?>" />

<center>
<div class="user_title"><?php echo $displayname; ?></div>
<div id='dhtmlwin_user' class="user_profile">

<div id="div_username">
	<table class="user_table_edit">
	  		<tr >
			<td class="field_req" ><?php echo lang('admin_user_col_username'); ?><?php echo $img_req; ?></td>
			<td class="user_text_left" >
			<span ><?php   echo $row->username; ?></span>
			<input type="hidden" id="username" name="username" size="30" value="<?php echo $row->username; ?>" />
			</tr>
	</table>
</div>

<div id="div_password" style="<?php echo $showhide ; ?>">
	<table class="user_table_edit">
	  	<tr >
		<td class="field_req" ><?php echo lang('admin_user_col_password'); ?><?php echo $img_req; ?></td>
		<td class="user_text_left" >
		<input type="hidden" id="password" name="password" size="30" value="" />
		<div id="show_selectd"  ><input type="password" id="showpass" name="showpass" size="30" value="<?php   echo $password; ?>" /></div>
		</tr>
	</table>
</div>

<div id="firstname">
	<table class="user_table_edit">
	 	<tr >
		<td class="field_req" ><?php echo lang('admin_user_col_firstname'); ?><?php echo $img_req; ?></td>
		<td class="user_text_left" ><input type="text" id="firstname" name="firstname" size="30" value="<?php   echo $row->firstname; ?>" />
		</td>
		</tr >
	</table>
</div>

<div id="lastname">
	<table class="user_table_edit">
	 	<tr >
		<td class="field_req" ><?php echo lang('admin_user_col_lastname'); ?><?php echo $img_req; ?></td>
		<td class="user_text_left" ><input type="text" id="lastname" name="lastname" size="30" value="<?php   echo $row->lastname; ?>" />
	</tr>
	</table>
</div>

<div id="middlename">
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_middlename'); ?></td>
		<td class="user_text_left" ><input type="text" id="middlename" name="middlename" size="30" value="<?php   echo $row->middlename; ?>" />
		</tr>
	</table>
</div>

<div id="displayname">
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_displayname'); ?></td>
		<td class="user_text_left" ><input type="text" id="displayname" name="displayname" size="30" value="<?php   echo $displayname; ?>" />
		</tr>
	</table>
</div>

<div id="sis_teacher_number">
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_teacher_number'); ?></td>
		<td class="user_text_left" ><input type="text" id="sis_teacher_number" name="sis_teacher_number" size="30" value="<?php   echo $row->sis_teacher_number; ?>" />
		</tr>
	</table>
</div>

<div id="email">
	<table class="user_table_edit">
		<tr >
		<td class="field_req" ><?php echo lang('admin_user_col_email'); ?><?php echo $img_req; ?></td>
		<td class="user_text_left" ><input type="text" id="email" name="email" size="30" value="<?php   echo $row->email; ?>" />
		</tr>
	</table>
</div>

<div id="title">
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_title'); ?></td>
		<td class="user_text_left" ><input type="text" id="title" name="title" size="30" value="<?php   echo $row->title; ?>" />
		</tr>
	</table>
</div>

<div id="department">
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_department'); ?></td>
		<td class="user_text_left" >
 		<?php
	    	echo form_dropdown("department_id", $department, $selected_dep, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>
<?php if ( isset($show_hide_unit_admin_note) && $show_hide_unit_admin_note == TRUE ) {?>
<div>
	<table class="user_table_edit">
		<tr >
		<td class="user_edit_left" ><?php echo lang('admin_user_col_hide_unit_admin_note'); ?></td>
		<td class="user_text_left" >
 		<?php
	    	echo form_dropdown("hide_unit_admin_note", $hide_unit_admin_note_selections, $row->hide_unit_admin_note, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>
<?php } ?>
</div>
<span class="admin_req"  style="color:red"><?php echo lang('admin_red'); ?></span>
<span class="admin_req" ><?php echo lang('admin_req'); ?></span>
</center>


<div class="reswin_buttons">

<input type="button" value="<?php echo lang('admin_btn_cancel'); ?>" name="cancel" <?php osa_btn()?>
onClick="cancelIframe('user_profile');return false;" />

<span style="margin-left:30px">&nbsp;</span>

<?php
//$jscript_save = "onClick=\"javascript:checkdupe('$mode','password','comfirmpassword','$display','$width','$color','$fontweight','$textalign','$message'); \"";
?>

<input type="button" value="<?php echo lang('admin_btn_save'); ?>" name="save" <?php osa_btn()?>
onClick="submitUser('<?php echo $update_url; ?>','resource_form','','page_content','user_profile' );
			ajaxGetpage('header','<?php echo base_url()?>admin/user/update_header',true); return false;" />

</div>
<br />
</form>