| Current Path : /proc/thread-self/root/var/tmp/ |
| Current File : //proc/thread-self/root/var/tmp/phpkkjbjJ |
<?php
namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Form\Fieldset\FieldsetVisualSet;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Model\StorageSectionManager;
use Nextend\Framework\Visual\ModelVisual;
class ModelPostBackgroundAnimation extends ModelVisual {
protected $type = 'postbackgroundanimation';
protected function init() {
PostBackgroundAnimationStorage::getInstance();
$this->storage = StorageSectionManager::getStorage('smartslider');
}
protected function getPath() {
return dirname(__FILE__);
}
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(), 'postbackgroundanimation-sets', n2_('Animation type'));
new Select($setsTab, 'sets', false);
$form->render();
}
public function renderForm() {
$form = new Form($this, 'n2-post-background');
$table = new ContainerTable($form->getContainer(), 'post-background-preview', n2_('Preview'));
$table->setFieldsetPositionEnd();
new NumberAutoComplete($table->getFieldsetLabel(), 'transformorigin-x', false, '50', array(
'style' => 'width:22px;',
'values' => array(
0,
50,
100
),
'unit' => '%',
'sublabel' => 'X'
));
new NumberAutoComplete($table->getFieldsetLabel(), 'transformorigin-y', false, '50', array(
'style' => 'width:22px;',
'values' => array(
0,
50,
100
),
'unit' => '%',
'sublabel' => 'Y'
));
$form->render();
}
}<?php
namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;
use Nextend\Framework\Pattern\VisualManagerTrait;
use Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager\BlockPostBackgroundAnimationManager;
class PostBackgroundAnimationManager {
use VisualManagerTrait;
public function display() {
$postBackgroundAnimationManagerBlock = new BlockPostBackgroundAnimationManager($this->MVCHelper);
$postBackgroundAnimationManagerBlock->display();
}
}<?php
namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation;
use Nextend\Framework\Pattern\SingletonTrait;
use Nextend\Framework\Plugin;
class PostBackgroundAnimationStorage {
use SingletonTrait;
private $sets = array();
private $animation = array();
private $animationBySet = array();
private $animationById = array();
protected function init() {
Plugin::addAction('smartsliderpostbackgroundanimationset', array(
$this,
'animationSet'
));
Plugin::addAction('smartsliderpostbackgroundanimation', array(
$this,
'animations'
));
Plugin::addAction('postbackgroundanimation', array(
$this,
'animation'
));
}
private function load() {
static $loaded;
if (!$loaded) {
Plugin::doAction('postBackgroundAnimationStorage', 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];
}
}
}<?php
namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager;
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\SmartSlider3Pro\PostBackgroundAnimation\ModelPostBackgroundAnimation;
class BlockPostBackgroundAnimationManager extends AbstractBlockVisual {
/** @var ModelPostBackgroundAnimation */
protected $model;
/**
* @return ModelPostBackgroundAnimation
*/
public function getModel() {
return $this->model;
}
public function display() {
$this->model = new ModelPostBackgroundAnimation($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();
$sets = $model->getSets();
Js::addFirstCode("
new _N2.PostBgAnimationManager({
setsIdentifier: '" . $model->getType() . "set',
sets: " . json_encode($sets) . ",
visuals: {},
ajaxUrl: '" . $this->createAjaxUrl(array('postbackgroundanimation/index')) . "'
});
");
$model->renderForm();
}
}<?php
namespace Nextend\SmartSlider3Pro\PostBackgroundAnimation\Block\PostBackgroundAnimationManager;
/**
* @var BlockPostBackgroundAnimationManager $this
*/
?>
<div id="n2-lightbox-postbackgroundanimation" 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('Ken Burns effect'); ?>
</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>