This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation;
use Nextend\Framework\Pattern\VisualManagerTrait;
use Nextend\SmartSlider3\BackgroundAnimation\Block\BackgroundAnimationManager\BlockBackgroundAnimationManager;
class BackgroundAnimationManager {
use VisualManagerTrait;
public function display() {
$backgroundAnimationManagerBlock = new BlockBackgroundAnimationManager($this->MVCHelper);
$backgroundAnimationManagerBlock->display();
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation;
use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;
class BackgroundAnimationStorage {
use SingletonTrait;
private $sets = array();
private $animation = array();
private $animationBySet = array();
private $animationById = array();
protected function init() {
Plugin::addAction('smartsliderbackgroundanimationset', array(
$this,
'animationSet'
));
Plugin::addAction('smartsliderbackgroundanimation', array(
$this,
'animations'
));
Plugin::addAction('backgroundanimation', array(
$this,
'animation'
));
}
private function load() {
static $loaded;
if (!$loaded) {
Plugin::doAction('backgroundAnimationStorage', array(
&$this->sets,
&$this->animation
));
for ($i = 0; $i < count($this->animation); $i++) {
if (!isset($this->animationBySet[$this->animation[$i]['referencekey']])) {
$this->animationBySet[$this->animation[$i]['referencekey']] = array();
}
$this->animationBySet[$this->animation[$i]['referencekey']][] = &$this->animation[$i];
$this->animationById[$this->animation[$i]['id']] = &$this->animation[$i];
}
$loaded = true;
}
}
public function animationSet($referenceKey, &$sets) {
$this->load();
for ($i = count($this->sets) - 1; $i >= 0; $i--) {
$this->sets[$i]['isSystem'] = 1;
$this->sets[$i]['editable'] = 0;
array_unshift($sets, $this->sets[$i]);
}
}
public function animations($referenceKey, &$animation) {
$this->load();
if (isset($this->animationBySet[$referenceKey])) {
$_animation = &$this->animationBySet[$referenceKey];
for ($i = count($_animation) - 1; $i >= 0; $i--) {
$_animation[$i]['isSystem'] = 1;
$_animation[$i]['editable'] = 0;
array_unshift($animation, $_animation[$i]);
}
}
}
public function animation($id, &$animation) {
$this->load();
if (isset($this->animationById[$id])) {
$this->animationById[$id]['isSystem'] = 1;
$this->animationById[$id]['editable'] = 0;
$animation = $this->animationById[$id];
}
}
}

View File

@ -0,0 +1,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();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation\Block\BackgroundAnimationManager;
/**
* @var BlockBackgroundAnimationManager $this
*/
?>
<div id="n2-lightbox-backgroundanimation" class="n2_fullscreen_editor">
<div class="n2_fullscreen_editor__overlay"></div>
<div class="n2_fullscreen_editor__window">
<div class="n2_fullscreen_editor__nav_bar">
<div class="n2_fullscreen_editor__nav_bar_label">
<?php n2_e('Background animation'); ?>
</div>
<div class="n2_fullscreen_editor__nav_bar_actions">
<?php $this->displayTopBar(); ?>
</div>
</div>
<div class="n2_fullscreen_editor__content">
<div class="n2_fullscreen_editor__content_sidebar n2_container_scrollable">
<?php
$this->getModel()
->renderSetsForm();
?>
</div>
<div class="n2_fullscreen_editor__content_content n2_container_scrollable">
<?php $this->displayContent(); ?>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,15 @@
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation;
use Nextend\Framework\Controller\Admin\AdminVisualManagerAjaxController;
class ControllerAjaxBackgroundAnimation extends AdminVisualManagerAjaxController {
protected $type = 'backgroundanimation';
public function getModel() {
return new ModelBackgroundAnimation($this);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace Nextend\SmartSlider3\BackgroundAnimation;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\Color;
use Nextend\Framework\Form\Fieldset\FieldsetVisualSet;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Visual\ModelVisual;
class ModelBackgroundAnimation extends ModelVisual {
protected $type = 'backgroundanimation';
protected function init() {
BackgroundAnimationStorage::getInstance();
$this->storage = StorageSectionManager::getStorage('smartslider');
}
public function renderSetsForm() {
$form = new Form($this, $this->type . 'set');
$form->addClass('n2_fullscreen_editor__content_sidebar_top_bar');
$form->setDark();
$setsTab = new FieldsetVisualSet($form->getContainer(), 'backgroundanimation-sets', n2_('Animation type'));
new Select($setsTab, 'sets', false);
$form->render();
}
public function renderForm() {
$form = new Form($this, 'n2-background-animation');
$table = new ContainerTable($form->getContainer(), 'background-animation-preview', n2_('Preview'));
$table->setFieldsetPositionEnd();
new Color($table->getFieldsetLabel(), 'color', false, '333333ff', array(
'alpha' => true
));
$form->render();
}
}