-
Notifications
You must be signed in to change notification settings - Fork 3
/
addresseditor.php
42 lines (32 loc) · 1.14 KB
/
addresseditor.php
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
<?php
namespace AbraFlexi;
/**
* Address Book Record Editor form usage example
*
* @author Vítězslav Dvořák <[email protected]>
*/
require_once '../vendor/autoload.php';
\Ease\Shared::instanced()->loadConfig(dirname(__DIR__).'/tests/client.json',
true);
$oPage = new \Ease\TWB\WebPage(_('Address editor'));
$addressId = $oPage->getRequestValue('id');
if (empty($addressId)) {
$form = new \Ease\TWB\Form('idform');
$form->addInput(new \Ease\Html\InputTextTag('id'),
_('AbraFlexi address identifier'));
} else {
$adresser = new Adresar(is_numeric($addressId) ? (int) $addressId : $addressId);
if ($oPage->isPosted()) {
if ($adresser->sync($_POST)) {
$oPage->addItem(new \Ease\TWB\Label('success', _('Address saved')));
} else {
$oPage->addItem(new \Ease\TWB\Label('error',
_('Address save failed')));
}
}
$form = new ui\AdresarForm($adresser);
$form->addItem(new \Ease\Html\DivTag(new \Ease\TWB\SubmitButton(_('Save'),
'success'), ['style' => 'text-align: right']));
}
$oPage->addItem(new \Ease\TWB\Container($form));
$oPage->draw();