|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Epesi\Base\Dashboard\Seeds; |
|
4
|
|
|
|
|
5
|
|
|
use atk4\ui\View; |
|
6
|
|
|
|
|
7
|
|
|
class Applet extends View |
|
8
|
|
|
{ |
|
9
|
|
|
public $ui = 'applet segment raised'; |
|
10
|
|
|
public $defaultTemplate = 'applet.html'; |
|
11
|
|
|
|
|
12
|
|
|
protected $appletId; |
|
13
|
|
|
protected $jointClass; |
|
14
|
|
|
protected $options; |
|
15
|
|
|
protected $admin = false; |
|
16
|
|
|
protected $locked = false; |
|
17
|
|
|
|
|
18
|
|
|
public function renderView() |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* @var \Epesi\Base\Dashboard\Integration\Joints\AppletJoint $joint |
|
22
|
|
|
*/ |
|
23
|
|
|
$joint = new $this->jointClass(); |
|
24
|
|
|
|
|
25
|
|
|
$this->set('Name', $joint->caption())->setAttr('applet-id', $this->appletId); |
|
26
|
|
|
|
|
27
|
|
|
if ($this->admin) { |
|
28
|
|
|
$this->set($joint->info())->setAttr('searchkey', strtolower($joint->caption() . ';' . $joint->info())); |
|
29
|
|
|
} |
|
30
|
|
|
else { |
|
31
|
|
|
if (! $this->locked) { |
|
32
|
|
|
$this->addControl('close', 'applet-close')->setAttr('title', __('Close applet')); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
$this->addControl('ellipsis vertical')->setAttr('title', __('Applet settings'))->link($this->app->moduleLink('dashboard', 'showSettings', [$this->appletId])); |
|
36
|
|
|
|
|
37
|
|
|
if ($link = $joint->go()) { |
|
|
|
|
|
|
38
|
|
|
$this->addControl('expand')->setAttr('title', __('Full screen'))->link($link); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
ob_start(); |
|
42
|
|
|
$joint->body($this, $this->options?? $joint->defaultOptions()); |
|
43
|
|
|
|
|
44
|
|
|
if ($content = ob_get_clean()) { |
|
45
|
|
|
$this->set($content); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
parent::renderView(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function addControl($icon, $ui = null) |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->addAction($icon, 'applet-control ' . $ui); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function addAction($icon, $ui = null) |
|
58
|
|
|
{ |
|
59
|
|
|
$control = $this->add(['View', 'ui' => $ui], 'Controls')->link('#'); |
|
60
|
|
|
$control->add(['Icon', $icon]); |
|
61
|
|
|
|
|
62
|
|
|
return $control; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.