<?php
defined('BASEPATH') OR exit('No direct script access allowed');

?>

			<div class="content-wrapper">
				<section class="content-header">
					<?php echo $pagetitle; ?>
					<?php echo $breadcrumb; ?>
				</section>

				<section class="content">
					<div class="row">
						<div class="col-md-12">
							 <div class="box">
								<div class="box-header with-border">
									<h3 class="box-title"><?php echo lang('users_edit_user'); ?></h3>
								</div>
								<div class="box-body">


								<?php  // echo  '<br> 0$array_csrf variable '; 																			?>
								<?php  // echo   key($array_csrf);    																					?>
								<?php  // echo  '<br> 0$array_csrf valor'; 																				?>
								<?php  // echo  array_values($array_csrf)[0];   																		?>
								<?php  // echo '<br> <br><br><br>1$array_csrf '. 						$array_csrf; 									?>
								<?php  // echo '<br> ----------------------------------------------------------------------'; 							?>
								<?php  // echo '<br> $flashdata_mostrarkey: '. 						$flashdata_mostrarkey; 								?>
								<?php  // echo '<br> $flashdata_mostrarkeyValue: '. 					$flashdata_mostrarkeyValue; 					?>
								<?php  // echo '<br> ----------------------------------------------------------------------'; 							?>
								<?php  // echo '<br>  _SESSION[key($array_csrf)]: '. 					$_SESSION[key($array_csrf)]; 					?>
								<?php  // echo '<br>  _SESSION[array_values($array_csrf)[0]] '. 		$_SESSION[array_values($array_csrf)[0]];		?>
 

								<?php  // echo '<br> ----------------------------------------------------------------------'; 							?>
								<?php  // echo '<br>  _SESSION[bandera_csrf] '. 						$_SESSION['bandera_csrf'];						?>
								<?php  // echo '<br>  _SESSION[ingresa_get_csrf_nonce] '. 			$_SESSION['ingresa_get_csrf_nonce'];				?>
								<?php  // echo '<br>  _SESSION[ingresa_valid_csrf_nonce] '. 			$_SESSION['ingresa_valid_csrf_nonce'];			?>
								<?php  // echo '<br>  _SESSION[ingresa_set_flashdata] '. 				$_SESSION['ingresa_set_flashdata'];				?>
								<?php  // echo '<br>  _SESSION[ingresa_set_userdata] '. 				$_SESSION['ingresa_set_userdata'];				?>
								<?php  // echo '<br>  _SESSION[mark_as_flash] '. 						$_SESSION['mark_as_flash']						?>
 

								<?php  // echo '<br> ----------------------------------------------------------------------'; 							?>
								<?php  // echo '<br>  _SESSION[csrfkey]: '. 							$_SESSION['csrfkey']; 							?>
								<?php  // echo '<br>  _SESSION[csrfvalue] '. 							$_SESSION['csrfvalue'];							?>
								<?php  // echo '<br>   $_SESSION[inicio]    '. 							$_SESSION['inicio'];							?>
							

									<?php echo $message;?>

									<?php echo form_open(uri_string(), array('class' => 'form-horizontal', 'id' => 'form-edit_user')); ?>
 										<div class="form-group">
											<?php echo lang('users_nick', 'nick', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($nick);?>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_firstname', 'first_name', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($first_name);?>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_lastname', 'last_name', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($last_name);?>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_email', 'email', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($email);?>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_company', 'company', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($company);?>
											</div>
										</div>

										<div class="form-group">
											<?php echo lang('users_phone', 'phone', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($phone);?>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_password', 'password', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($password);?>
												<div class="progress" style="margin:0">
													<div class="pwstrength_viewport_progress"></div>
												</div>
											</div>
										</div>
										<div class="form-group">
											<?php echo lang('users_password_confirm', 'password_confirm', array('class' => 'col-sm-2 control-label')); ?>
											<div class="col-sm-10">
												<?php echo form_input($password_confirm);?>
											</div>
										</div>

										<?php if ($this->ion_auth->is_admin()): ?>
										<div class="form-group">
											<label class="col-sm-2 control-label"><?php echo lang('users_member_of_groups');?></label>
											<div class="col-sm-10">
												<?php foreach ($groups as $group):
													$gID     = $group['id'];
													$checked = NULL;
													$item    = NULL;
													foreach($currentGroups as $grp) {
														if ($gID == $grp->id) {
															$checked = ' checked="checked"';
															break;
														}
													}
												?>
												<div class="checkbox">
													<label>
														<input 
														type=	"checkbox" 
														name=	"groups[]" 
														value=	"<?php echo $group['id']; ?>"
														<?php echo $checked; ?>
														>
														<?php echo htmlspecialchars($group['name'], ENT_QUOTES, 'UTF-8'); ?>
													</label>
												</div>
												<?php endforeach ?>
											</div>
										</div>
										<?php endif ?>
										<div class="form-group">
											<div class="col-sm-offset-2 col-sm-10">
												<?php echo form_hidden('id', $user->id);?>
												<?php //echo form_hidden( key($array_csrf), array_values($array_csrf)[0]); ?> 
												<?php //echo form_hidden($array_csrf); ?> 
												<?php //echo form_hidden( key($csrf), array_values($csrf)[0]); ?> 
												<?php echo form_hidden($csrf); ?> 
												<div class="btn-group">
													<?php echo form_button(array('type' => 'submit', 'class' => 'btn btn-primary btn-flat', 'content' => lang('actions_submit'))); ?>
													<?php echo form_button(array('type' => 'reset', 'class' => 'btn btn-warning btn-flat', 'content' => lang('actions_reset'))); ?>
													<?php echo anchor('admin/users', lang('actions_cancel'), array('class' => 'btn btn-default btn-flat')); ?>
												</div>
											</div>
										</div>
									<?php echo form_close();?>
								</div>
							</div>
						 </div>
					</div>
				</section>
			</div>
