BlockBackgroundAnimationManager.php
1.6 KB
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
52
53
54
55
56
57
58
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation\Block\BackgroundAnimationManager;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Visual\AbstractBlockVisual;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonApply;
use Nextend\SmartSlider3\Application\Admin\Layout\Block\Forms\Button\BlockButtonCancel;
use Nextend\SmartSlider3\BackgroundAnimation\ModelBackgroundAnimation;
class BlockBackgroundAnimationManager extends AbstractBlockVisual {
/** @var ModelBackgroundAnimation */
protected $model;
/**
* @return ModelBackgroundAnimation
*/
public function getModel() {
return $this->model;
}
public function display() {
$this->model = new ModelBackgroundAnimation($this);
$this->renderTemplatePart('Index');
}
public function displayTopBar() {
$buttonCancel = new BlockButtonCancel($this);
$buttonCancel->addClass('n2_fullscreen_editor__cancel');
$buttonCancel->display();
$buttonApply = new BlockButtonApply($this);
$buttonApply->addClass('n2_fullscreen_editor__save');
$buttonApply->display();
}
public function displayContent() {
$model = $this->getModel();
Js::addFirstCode("
new _N2.BgAnimationManager({
setsIdentifier: '" . $model->getType() . "set',
sets: " . json_encode($model->getSets()) . ",
visuals: {},
ajaxUrl: '" . $this->createAjaxUrl(array('backgroundanimation/index')) . "'
});
");
$model->renderForm();
}
}