|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Jaxon\Jaxon; |
|
4
|
|
|
use Jaxon\App\FuncComponent; |
|
5
|
|
|
use Jaxon\Dialogs\Dialog\Library\Bootbox; |
|
6
|
|
|
use Jaxon\Dialogs\Dialog\Library\Noty; |
|
7
|
|
|
|
|
8
|
|
|
class HelloWorld extends FuncComponent |
|
9
|
|
|
{ |
|
10
|
|
|
public function sayHello(bool $isCaps, bool $bNotify = true) |
|
11
|
|
|
{ |
|
12
|
|
|
$text = $isCaps ? 'HELLO WORLD!' : 'Hello World!'; |
|
13
|
|
|
if(($bNotify)) |
|
14
|
|
|
{ |
|
15
|
|
|
// $this->response->confirmCommands(2, 'Skip text assignement?'); |
|
16
|
|
|
$this->response->assign('div2', 'innerHTML', $text); |
|
|
|
|
|
|
17
|
|
|
// $this->response->confirmCommands(1, 'Skip text notification?'); |
|
18
|
|
|
$this->response->dialog->success("div2 text is now $text"); |
|
19
|
|
|
} |
|
20
|
|
|
else |
|
21
|
|
|
{ |
|
22
|
|
|
// $this->response->confirmCommands(1, 'Skip text assignement?'); |
|
23
|
|
|
$this->response->assign('div2', 'innerHTML', $text); |
|
24
|
|
|
} |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function setColor(string $sColor, bool $bNotify = true) |
|
28
|
|
|
{ |
|
29
|
|
|
if(($bNotify)) |
|
30
|
|
|
{ |
|
31
|
|
|
// $this->response->confirmCommands(1, 'Skip color assignement?'); |
|
32
|
|
|
$this->response->assign('div2', 'style.color', $sColor); |
|
|
|
|
|
|
33
|
|
|
// $this->response->confirmCommands(1, 'Skip color assignement?'); |
|
34
|
|
|
$this->response->dialog->success("div2 color is now $sColor"); |
|
35
|
|
|
} |
|
36
|
|
|
else |
|
37
|
|
|
{ |
|
38
|
|
|
// $this->response->confirmCommands(1, 'Skip color assignement?'); |
|
39
|
|
|
$this->response->assign('div2', 'style.color', $sColor); |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function showDialog() |
|
44
|
|
|
{ |
|
45
|
|
|
$buttons = [['title' => 'Close', 'class' => 'btn', 'click' => 'close']]; |
|
46
|
|
|
$options = ['width' => 500]; |
|
47
|
|
|
$this->response->dialog->show("Modal Dialog", |
|
|
|
|
|
|
48
|
|
|
"This modal dialog is powered by Bootbox!!", $buttons, $options); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
$jaxon = jaxon(); |
|
53
|
|
|
|
|
54
|
|
|
// $jaxon->setOption('core.debug.on', true); |
|
55
|
|
|
$jaxon->setOption('core.prefix.class', 'Jaxon'); |
|
56
|
|
|
|
|
57
|
|
|
// Js options |
|
58
|
|
|
$jaxon->setOption('js.lib.uri', '/js'); |
|
59
|
|
|
// $jaxon->setOption('js.lib.uri', '/exp/js/lib'); |
|
60
|
|
|
// $jaxon->setOption('js.app.minify', false); |
|
61
|
|
|
|
|
62
|
|
|
// Dialog options |
|
63
|
|
|
$jaxon->setAppOption('dialogs.default.modal', Bootbox::NAME); |
|
64
|
|
|
$jaxon->setAppOption('dialogs.default.alert', Noty::NAME); |
|
65
|
|
|
$jaxon->setAppOption('dialogs.default.confirm', Noty::NAME); |
|
66
|
|
|
|
|
67
|
|
|
$jaxon->setAppOption('dialogs.confirm.title', 'Confirmer'); |
|
68
|
|
|
$jaxon->setAppOption('dialogs.confirm.yes', 'Oui'); |
|
69
|
|
|
$jaxon->setAppOption('dialogs.confirm.no', 'Non'); |
|
70
|
|
|
|
|
71
|
|
|
// Register object |
|
72
|
|
|
$jaxon->register(Jaxon::CALLABLE_CLASS, HelloWorld::class); |
|
73
|
|
|
|