1
|
|
|
|
2
|
|
|
<div id="page-wrapper"> |
3
|
|
|
<div class="row"> |
4
|
|
|
<div class="col-lg-12"> |
5
|
|
|
<h1 class="page-header">Profile</h1> |
6
|
|
|
</div> |
7
|
|
|
<!-- /.col-lg-12 --> |
8
|
|
|
</div> |
9
|
|
|
<!-- /.row --> |
10
|
|
|
<div class="row"> |
11
|
|
|
<div class="col-sm-2 col-lg-2"></div> |
12
|
|
|
<div class="col-sm-8 col-lg-8"> |
13
|
|
|
<div class="panel panel-default"> |
14
|
|
|
<div class="panel-heading"> |
15
|
|
|
<i class="fa fa-pencil"></i> Update Profile |
16
|
|
|
</div> |
17
|
|
|
<div class="panel-body"> |
18
|
|
|
<div class="row"> |
19
|
|
|
<div class="col-lg-12"> |
20
|
|
|
<form action="<?php echo PUBLIC_ROOT; ?>User/updateProfileInfo" id="form-profile-info" method="post" > |
21
|
|
|
<div class="form-group"> |
22
|
|
|
<div class="block-section text-center"> |
23
|
|
|
<img src="<?= $info["image"];?>" class="img-circle profile-pic-lg"> |
24
|
|
|
<h3><strong><?= $info["name"];?></strong></h3> |
25
|
|
|
<h4> |
26
|
|
|
<span class="label label-primary"><?= ucfirst($info["role"]);?></span> |
27
|
|
|
</h4> |
28
|
|
|
</div> |
29
|
|
|
</div> |
30
|
|
|
<div class="form-group"> |
31
|
|
|
<label>User Name</label> |
32
|
|
|
<input dir="auto" type="text" name="name" value="<?= $info["name"];?>" class="form-control" required maxlength="30" placeholder="Your Name.."> |
33
|
|
|
<p class="help-block"><em>The maximum number of characters allowed is <strong>30</strong></em></p> |
34
|
|
|
</div> |
35
|
|
|
<div class="form-group"> |
36
|
|
|
<label>Password</label> |
37
|
|
|
<input type="password" name="password" class="form-control" placeholder="Password"> |
38
|
|
|
<p class="help-block">Please enter a complex password</p> |
39
|
|
|
</div> |
40
|
|
|
<div class="form-group"> |
41
|
|
|
<label>Email</label> |
42
|
|
|
<input type="email" name="email" value="<?= $this->encodeHTML($info["email"]); ?>" class="form-control" maxlength="50" placeholder="Your Email.."> |
43
|
|
|
</div> |
44
|
|
|
<div class="form-group"> |
45
|
|
|
<input type="email" name="confirm_email" value="" class="form-control" maxlength="50" placeholder="Confirm Email"> |
46
|
|
|
<p class="help-block"><em>Please enter your email again.</em></p> |
47
|
|
|
</div> |
48
|
|
|
<div class="form-group"> |
49
|
|
|
<input type="hidden" name="csrf_token" value="<?= Session::generateCsrfToken(); ?>" /> |
50
|
|
|
</div> |
51
|
|
|
<div class="form-group form-actions text-right"> |
52
|
|
|
<button type="submit" name="submit" value="submit" class="btn btn-md btn-primary"> |
53
|
|
|
<i class="fa fa-check"></i> Update |
54
|
|
|
</button> |
55
|
|
|
</div> |
56
|
|
|
</form> |
57
|
|
|
|
58
|
|
|
<?php |
59
|
|
View Code Duplication |
if(!empty(Session::get('profile-info-errors'))){ |
|
|
|
|
60
|
|
|
echo $this->renderErrors(Session::getAndDestroy('profile-info-errors')); |
61
|
|
|
}else if(!empty(Session::get('profile-info-success'))){ |
62
|
|
|
echo $this->renderSuccess(Session::getAndDestroy('profile-info-success')); |
63
|
|
|
} |
64
|
|
|
?> |
65
|
|
|
|
66
|
|
|
<?php if(!empty($emailUpdates["success"])):?> |
67
|
|
|
<div class="success"> |
68
|
|
|
<div class="alert alert-success"> |
69
|
|
|
<i class="fa fa-check-circle"></i> <?= $emailUpdates["success"]; ?> |
70
|
|
|
</div> |
71
|
|
|
</div> |
72
|
|
|
<?php elseif(!empty($emailUpdates["errors"])):?> |
73
|
|
|
<div class="error"> |
74
|
|
|
<div class="alert alert-danger"> |
75
|
|
|
<i class="fa fa-times-circle"></i> <strong>Heads Up!</strong> |
76
|
|
|
<br><i class="fa fa-angle-right"></i> <?= $emailUpdates["errors"][0]; ?> |
77
|
|
|
</div> |
78
|
|
|
</div> |
79
|
|
|
<?php endif; ?> |
80
|
|
|
<!-- END Update Profile --> |
81
|
|
|
|
82
|
|
|
<hr> |
83
|
|
|
<!-- Upload Profile Picture --> |
84
|
|
|
<form action="<?php echo PUBLIC_ROOT; ?>User/updateProfilePicture" id="form-profile-picture" |
85
|
|
|
method="post" enctype="multipart/form-data"> |
86
|
|
|
<div class="form-group"> |
87
|
|
|
<label>Profile Picture</label> |
88
|
|
|
<input type="file" name="file" required> |
89
|
|
|
<p class="help-block"><em> Only JPEG, JPG, PNG & GIF Files</em></p> |
90
|
|
|
<p class="help-block"><em> Max File Size: 2MB</em></p> |
91
|
|
|
</div> |
92
|
|
|
<!-- Hidden By default--> |
93
|
|
|
<div class="progress progress-striped active display-none"> |
94
|
|
|
<div class="progress-bar progress-bar-success" style="width: 0%"></div> |
95
|
|
|
</div> |
96
|
|
|
<div class="form-group"> |
97
|
|
|
<input type="hidden" name="csrf_token" value="<?= Session::generateCsrfToken(); ?>" /> |
98
|
|
|
</div> |
99
|
|
|
<div class="form-group form-actions text-right"> |
100
|
|
|
<button type="submit" value="submit" class="btn btn-md btn-primary"> |
101
|
|
|
<i class="fa fa-upload"></i> Upload |
102
|
|
|
</button> |
103
|
|
|
</div> |
104
|
|
|
</form> |
105
|
|
|
<?php |
106
|
|
|
if(!empty(Session::get('profile-picture-errors'))){ |
107
|
|
|
echo $this->renderErrors(Session::getAndDestroy('profile-picture-errors')); |
108
|
|
|
} |
109
|
|
|
?> |
110
|
|
|
|
111
|
|
|
</div> |
112
|
|
|
<!-- /.col-lg-6 (nested) --> |
113
|
|
|
</div> |
114
|
|
|
<!-- /.row (nested) --> |
115
|
|
|
</div> |
116
|
|
|
<!-- /.panel-body --> |
117
|
|
|
</div> |
118
|
|
|
</div> |
119
|
|
|
<!-- END Profile Block --> |
120
|
|
|
</div> |
121
|
|
|
<!-- /.row --> |
122
|
|
|
</div> |
123
|
|
|
<!-- /#page-wrapper --> |
124
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.