|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Jaxon\App\FuncComponent; |
|
4
|
|
|
use Jaxon\Jaxon; |
|
5
|
|
|
|
|
6
|
|
|
class HelloWorld extends FuncComponent |
|
7
|
|
|
{ |
|
8
|
|
|
public function sayHello(bool $isCaps) |
|
9
|
|
|
{ |
|
10
|
|
|
$text = $isCaps ? 'HELLO WORLD!' : 'Hello World!'; |
|
11
|
|
|
$xResponse = jaxon()->getResponse(); |
|
12
|
|
|
$xResponse->assign('div2', 'innerHTML', $text); |
|
13
|
|
|
$this->bag('upload')->set('caps', $isCaps); |
|
|
|
|
|
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function setColor(string $sColor) |
|
17
|
|
|
{ |
|
18
|
|
|
$xResponse = jaxon()->getResponse(); |
|
19
|
|
|
$xResponse->assign('div2', 'style.color', $sColor); |
|
20
|
|
|
$this->bag('upload')->set('color', $sColor); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function upload() |
|
24
|
|
|
{ |
|
25
|
|
|
$xResponse = jaxon()->getResponse(); |
|
26
|
|
|
$files = jaxon()->upload()->files(); |
|
27
|
|
|
$xResponse->dialog->show('Uploaded files', print_r([ |
|
|
|
|
|
|
28
|
|
|
'bags' => [ |
|
29
|
|
|
'caps' => $this->bag('upload')->get('caps') ? 'yes' : 'no', |
|
30
|
|
|
'color' => $this->bag('upload')->get('color'), |
|
31
|
|
|
], |
|
32
|
|
|
'photos' => $files['photos'], |
|
33
|
|
|
], true), []); |
|
34
|
|
|
$xResponse->dialog->info('Uploaded ' . count($files['photos']) . ' file(s).'); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
// Register object |
|
39
|
|
|
$jaxon = jaxon(); |
|
40
|
|
|
|
|
41
|
|
|
// Request processing URI |
|
42
|
|
|
$jaxon->setOption('js.lib.uri', '/js'); |
|
43
|
|
|
$jaxon->setOption('js.app.minify', false); |
|
44
|
|
|
|
|
45
|
|
|
$jaxon->setOption('upload.enabled', true); |
|
46
|
|
|
$jaxon->setOption('upload.default.dir', __DIR__ . '/files'); |
|
47
|
|
|
|
|
48
|
|
|
$jaxon->setAppOption('dialogs.default.modal', 'bootbox'); |
|
49
|
|
|
$jaxon->setAppOption('dialogs.default.alert', 'toastr'); |
|
50
|
|
|
|
|
51
|
|
|
$jaxon->callback()->after(function($target, $end) { |
|
|
|
|
|
|
52
|
|
|
jaxon()->di()->getResponseManager()->getResponse()->debug('After upload'); |
|
53
|
|
|
}); |
|
54
|
|
|
|
|
55
|
|
|
$jaxon->register(Jaxon::CALLABLE_CLASS, HelloWorld::class, [ |
|
56
|
|
|
'functions' => [ |
|
57
|
|
|
'*' => [ |
|
58
|
|
|
'bags' => ['upload'], |
|
59
|
|
|
], |
|
60
|
|
|
'upload' => [ |
|
61
|
|
|
'upload' => "'file-select'", |
|
62
|
|
|
], |
|
63
|
|
|
], |
|
64
|
|
|
]); |
|
65
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.