[UI][CONTROLLER] Profile settings action functionality working
This commit is contained in:
parent
643a937152
commit
02318d954c
@ -32,6 +32,9 @@
|
|||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Core\Controller;
|
use App\Core\Controller;
|
||||||
|
// use App\Core\Event;
|
||||||
|
// use App\Util\Common;
|
||||||
|
use App\Core\DB\DB;
|
||||||
use App\Core\Form;
|
use App\Core\Form;
|
||||||
use function App\Core\I18n\_m;
|
use function App\Core\I18n\_m;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
@ -52,6 +55,19 @@ class UserAdminPanel extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$prof->handleRequest($request);
|
$prof->handleRequest($request);
|
||||||
|
if ($prof->isSubmitted()) {
|
||||||
|
$data = $prof->getData();
|
||||||
|
if ($prof->isValid()) {
|
||||||
|
$profile = DB::find('\App\Entity\Profile', ['id' => 2]);
|
||||||
|
foreach (['Nickname', 'FullName', 'Homepage', 'Bio', 'Location'] as $key) {
|
||||||
|
$method = "set{$key}";
|
||||||
|
$profile->{$method}($data[_m($key)]);
|
||||||
|
}
|
||||||
|
DB::flush();
|
||||||
|
} else {
|
||||||
|
// Display error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'_template' => 'settings/profile.html.twig',
|
'_template' => 'settings/profile.html.twig',
|
||||||
|
@ -35,23 +35,6 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class='content'>
|
<div class='content'>
|
||||||
<div id='nickname'>
|
{{ form(prof) }}
|
||||||
<div class='label'> {{ form_label(prof.Nickname) }} </div> {{ form_widget(prof.Nickname) }}
|
|
||||||
</div>
|
|
||||||
<div id='name'>
|
|
||||||
<div class='label'> {{ form_label(prof.FullName) }} </div> {{ form_widget(prof.FullName) }}
|
|
||||||
</div>
|
|
||||||
<div id='homepage'>
|
|
||||||
<div class='label'> {{ form_label(prof.Homepage) }} </div> {{ form_widget(prof.Homepage) }}
|
|
||||||
</div>
|
|
||||||
<div id='bio'>
|
|
||||||
<div class='label'> {{ form_label(prof.Bio) }} </div> {{ form_widget(prof.Bio) }}
|
|
||||||
</div>
|
|
||||||
<div id='location'>
|
|
||||||
<div class='label'> {{ form_label(prof.Location) }} </div> {{ form_widget(prof.Location) }}
|
|
||||||
</div>
|
|
||||||
<div id='save'>
|
|
||||||
{{ form_widget(prof.save) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user