Beispiel #1
0
             <div class="form-group">
			        <label for="password" class="control-label" title="Passwords are strongly encrypted, but longer is better the minimum is 8 characters">Password</label>
				<span class="help-block">Users will be emailed with their first time password to login and change.</span>
			</div>
<?php 
}
?>
		<div class="form-group">
              <label for="email" class="control-label" title="What is this users email address?">Email Address</label>			  
				<input name="email" id="email" type="email" class="form-control email" maxlength="50" required>				
		</div>
				<div class="form-group">
					<label for="department" class="control-label" title="Which Department does this user belong to?">Department</label> 
                <select name="department" class="form-control">
				<?php 
$availDepartments = Department_model::getAllDepartments();
foreach ($availDepartments as $row) {
    ?>
					<option id="department" value="<?php 
    echo $row->id;
    ?>
"><?php 
    echo $row->name;
    ?>
</option>
			<?php 
}
?>
                </select>
			</div>
			<div class="checkbox"  >
Beispiel #2
0
 public function saveDepartmentModification()
 {
     if ($this->session->admin) {
         $post = $this->input->post();
         $nameExists = Department_Model::checkDepartmentName($post['id'], $post['name']);
         $colorExists = Department_Model::checkDepartmentColor($post['id'], $post['color']);
         if ($nameExists) {
             $error = array('status' => 'error', 'msg' => 'A department with that name already exists. Please choose a different name or keep the current name.');
             echo json_encode($error);
             exit;
         } elseif ($colorExists) {
             $error = array('status' => 'error', 'msg' => 'A department with that color already exists. Please pick another color, or keep your current one.');
             echo json_encode($error);
             exit;
         } else {
             Department_model::updateDepartment($post);
             $msg = array('status' => 'success', 'msg' => 'You have successfully updated the ' . $post['name'] . ' department.');
             echo json_encode($msg);
         }
     } else {
         $this->session->set_flashdata('error', 'You do not have permission to modify a department');
         redirect('home');
     }
 }