diff options
-rw-r--r-- | app/model/common.mod.php | 15 | ||||
-rw-r--r-- | app/view/common/setting.modal.view.php | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/app/model/common.mod.php b/app/model/common.mod.php index a177c13..080c78e 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -44,10 +44,10 @@ class CommonModel extends MasterModel { switch ($input['action']) { - case "common-setting-user": $this->saveSettingUser($input, $attachment); break; - case "common-setting-admin": $this->saveSettingAdmin($input); break; - case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break; - case "common-setting-allusers-edituser": $this->saveSettingAllusersEdituser($input); break; + case "common-setting-user": $this->saveSettingUser($input, $attachment); break; + case "common-setting-admin": $this->saveSettingAdmin($input); break; + case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break; + case "common-setting-allusers-edituser": $this->saveSettingAllusersEdituser($input, $attachment); break; } } @@ -196,7 +196,7 @@ class CommonModel extends MasterModel /* * Allow an admin to edit user accounts */ - function saveSettingAllusersEdituser($input) + function saveSettingAllusersEdituser($input, $attachment) { $form = new Form(); $form->field_text("guid"); @@ -247,6 +247,11 @@ class CommonModel extends MasterModel $user->setEmail($form->email); $user->saveObj(); + + if ($form->saveFile($attachment, $this->HEAD_IMG_MAX_SIZE, $this->HEAD_IMG_MIME, "assets/img/heads/" . $user->guid)) + $this->logNotice("Image uploaded"); + else + $this->logFormErrors($form); } } diff --git a/app/view/common/setting.modal.view.php b/app/view/common/setting.modal.view.php index 1d7951a..369a789 100644 --- a/app/view/common/setting.modal.view.php +++ b/app/view/common/setting.modal.view.php @@ -219,7 +219,7 @@ <div class="panel-collapse collapse" id="common-setting-allusers-<?=$user->guid?>-collapse"> <div class="panel-body"> - <form method="post" action="<?=$mod->ap()?>"> + <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data"> <input type="hidden" name="input[action]" value="common-setting-allusers-edituser" /> <input type="hidden" name="input[guid]" value="<?=$user->guid?>" /> @@ -254,7 +254,7 @@ <div class="collapse" id="input<?=$user->guid?>ImageCollapse"> <div class="form-group"> <label>User Image</label> - <input type="file" name="inputf[image]" /> + <input type="file" name="attachment" /> </div> </div> |