aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/studyarea.php
blob: e43c9b0af15bfe919b648379ed47e6f8f2368ffc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

/**
 * treenode.php - Controller for editing tree nodes
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * @author      Thomas Hackl <hackl@data-quest.de>
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 or later
 * @category    Stud.IP
 * @since       5.4
 */

class StudyareaController extends AuthenticatedController
{
    public function edit_action($id = '')
    {
        if ($id !== '') {
            $object = StudipStudyArea::find($id);
        } else {
            $object = new StudipStudyArea();
        }

        PageLayout::setTitle($object->isNew() ? _('Studienbereich anlegen') : _('Studienbereich bearbeiten'));

        $this->form = Studip\Forms\Form::fromSORM(
            $object,
            [
                'legend' => $object->isNew()
                    ? _('Neuer Studienbereich')
                    : sprintf(_('Studienbereich %s'), $object->name),
                'text' => ['text' => ''],
                'fields' => [
                    'name' => [
                        'label' => _('Name'),
                        'type' => 'text',
                        'required' => true
                    ],
                    'info' => [
                        'label' => _('Beschreibung'),
                        'type' => 'textarea'
                    ]
                ]
            ]
        )->setURL($this->url_for('studyarea/store', $object->id));
    }

}