first
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Widget\Bullet;
|
||||
|
||||
|
||||
use Nextend\SmartSlider3\Widget\AbstractWidget;
|
||||
|
||||
abstract class AbstractBullet extends AbstractWidget {
|
||||
|
||||
protected $key = 'widget-bullet-';
|
||||
|
||||
public function getCommonAssetsPath() {
|
||||
return dirname(__FILE__) . '/Assets';
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Widget\Bullet;
|
||||
|
||||
|
||||
use Nextend\Framework\Platform\Platform;
|
||||
use Nextend\Framework\Url\Url;
|
||||
use Nextend\SmartSlider3\Widget\AbstractWidgetFrontend;
|
||||
|
||||
abstract class AbstractBulletFrontend extends AbstractWidgetFrontend {
|
||||
|
||||
public function __construct($sliderWidget, $widget, $params) {
|
||||
|
||||
parent::__construct($sliderWidget, $widget, $params);
|
||||
|
||||
if ($params->get($this->key . 'thumbnail-show-image')) {
|
||||
$this->slider->exposeSlideData['thumbnail'] = true;
|
||||
}
|
||||
|
||||
$this->addToPlacement($this->key . 'position-', array(
|
||||
$this,
|
||||
'render'
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function getCommonAssetsUri() {
|
||||
return Url::pathToUri($this->getCommonAssetsPath());
|
||||
}
|
||||
|
||||
public function getCommonAssetsPath() {
|
||||
|
||||
return Platform::filterAssetsPath(dirname(__FILE__) . '/Assets');
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Widget\Bullet\BulletTransition;
|
||||
|
||||
|
||||
use Nextend\Framework\Form\Element\OnOff;
|
||||
use Nextend\Framework\Form\Element\Select;
|
||||
use Nextend\Framework\Form\Element\Style;
|
||||
use Nextend\Framework\Form\Fieldset\FieldsetRow;
|
||||
use Nextend\SmartSlider3\Form\Element\Group\WidgetPosition;
|
||||
use Nextend\SmartSlider3\Widget\Bullet\AbstractBullet;
|
||||
|
||||
class BulletTransition extends AbstractBullet {
|
||||
|
||||
protected $defaults = array(
|
||||
'widget-bullet-position-mode' => 'simple',
|
||||
'widget-bullet-position-area' => 10,
|
||||
'widget-bullet-position-offset' => 10,
|
||||
'widget-bullet-action' => 'click',
|
||||
'widget-bullet-style' => '{"data":[{"backgroundcolor":"000000ab","padding":"5|*|5|*|5|*|5|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"50","extra":"margin: 4px;"},{"backgroundcolor":"1D81F9FF"}]}',
|
||||
'widget-bullet-bar' => '',
|
||||
'widget-bullet-align' => 'center',
|
||||
'widget-bullet-orientation' => 'auto',
|
||||
'widget-bullet-bar-full-size' => 0,
|
||||
'widget-bullet-thumbnail-show-image' => 0,
|
||||
'widget-bullet-thumbnail-width' => 60,
|
||||
'widget-bullet-thumbnail-style' => '{"data":[{"backgroundcolor":"00000080","padding":"3|*|3|*|3|*|3|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":"margin: 5px;"}]}',
|
||||
'widget-bullet-thumbnail-side' => 'before'
|
||||
);
|
||||
|
||||
public function renderFields($container) {
|
||||
|
||||
$row1 = new FieldsetRow($container, 'widget-bullet-transition-row-1');
|
||||
|
||||
new WidgetPosition($row1, 'widget-bullet-position', n2_('Position'));
|
||||
|
||||
$row2 = new FieldsetRow($container, 'widget-bullet-transition-row-2');
|
||||
|
||||
new Style($row2, 'widget-bullet-style', n2_('Dot'), '', array(
|
||||
'mode' => 'dot',
|
||||
'style2' => 'sliderwidget-bullet-bar',
|
||||
'preview' => 'SmartSliderAdminWidgetBulletTransition'
|
||||
));
|
||||
|
||||
new Style($row2, 'widget-bullet-bar', n2_('Bar'), '', array(
|
||||
'mode' => 'simple',
|
||||
'style2' => 'sliderwidget-bullet-style',
|
||||
'preview' => 'SmartSliderAdminWidgetBulletTransition'
|
||||
));
|
||||
}
|
||||
|
||||
public function prepareExport($export, $params) {
|
||||
$export->addVisual($params->get($this->key . 'style'));
|
||||
$export->addVisual($params->get($this->key . 'bar'));
|
||||
}
|
||||
|
||||
public function prepareImport($import, $params) {
|
||||
|
||||
$params->set($this->key . 'style', $import->fixSection($params->get($this->key . 'style')));
|
||||
$params->set($this->key . 'bar', $import->fixSection($params->get($this->key . 'bar')));
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\Widget\Bullet\BulletTransition;
|
||||
|
||||
|
||||
use Nextend\Framework\Asset\Js\Js;
|
||||
use Nextend\Framework\View\Html;
|
||||
use Nextend\SmartSlider3\Widget\Bullet\AbstractBulletFrontend;
|
||||
|
||||
class BulletTransitionFrontend extends AbstractBulletFrontend {
|
||||
|
||||
public function render($attributes = array()) {
|
||||
|
||||
$slider = $this->slider;
|
||||
$id = $this->slider->elementId;
|
||||
$params = $this->params;
|
||||
|
||||
if ($slider->getSlidesCount() <= 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$slider->addLess(self::getAssetsPath() . '/style.n2less', array(
|
||||
"sliderid" => $slider->elementId
|
||||
));
|
||||
|
||||
Js::addStaticGroup($this->getCommonAssetsPath() . '/dist/w-bullet.min.js', 'w-bullet');
|
||||
|
||||
$displayAttributes = $this->getDisplayAttributes($params, $this->key, 1);
|
||||
|
||||
$bulletStyle = $slider->addStyle($params->get($this->key . 'style'), 'dot');
|
||||
$barStyle = $slider->addStyle($params->get($this->key . 'bar'), 'simple');
|
||||
|
||||
$orientation = $this->getOrientationByPosition($params->get($this->key . 'position-mode'), $params->get($this->key . 'position-area'), $params->get($this->key . 'orientation'), 'horizontal');
|
||||
|
||||
|
||||
$parameters = array(
|
||||
'area' => intval($params->get($this->key . 'position-area')),
|
||||
'dotClasses' => $bulletStyle,
|
||||
'mode' => '',
|
||||
'action' => $params->get($this->key . 'action')
|
||||
);
|
||||
|
||||
if ($params->get($this->key . 'thumbnail-show-image')) {
|
||||
|
||||
$parameters['thumbnail'] = 1;
|
||||
$parameters['thumbnailWidth'] = intval($params->get($this->key . 'thumbnail-width'));
|
||||
$parameters['thumbnailHeight'] = intval($params->get($this->key . 'thumbnail-height'));
|
||||
$parameters['thumbnailStyle'] = $slider->addStyle($params->get($this->key . 'thumbnail-style'), 'simple', '');
|
||||
$side = $params->get($this->key . 'thumbnail-side');
|
||||
|
||||
|
||||
if ($side == 'before') {
|
||||
if ($orientation == 'vertical') {
|
||||
$position = 'left';
|
||||
} else {
|
||||
$position = 'top';
|
||||
}
|
||||
} else {
|
||||
if ($orientation == 'vertical') {
|
||||
$position = 'right';
|
||||
} else {
|
||||
$position = 'bottom';
|
||||
}
|
||||
}
|
||||
$parameters['thumbnailPosition'] = $position;
|
||||
}
|
||||
|
||||
$slider->features->addInitCallback('new _N2.SmartSliderWidgetBulletTransition(this, ' . json_encode($parameters) . ');');
|
||||
$slider->sliderType->addJSDependency('SmartSliderWidgetBulletTransition');
|
||||
|
||||
$fullSize = intval($params->get($this->key . 'bar-full-size'));
|
||||
|
||||
return Html::tag("div", Html::mergeAttributes($attributes, $displayAttributes, array(
|
||||
"class" => 'n2-ss-control-bullet n2-ow-all n2-ss-control-bullet-' . $orientation . ($fullSize ? ' n2-ss-control-bullet-fullsize' : '')
|
||||
)), Html::tag("div", array(
|
||||
"class" => $barStyle . " nextend-bullet-bar n2-bar-justify-content-" . $params->get($this->key . 'align')
|
||||
), '<div class="n2-bullet ' . $bulletStyle . '" style="visibility:hidden;"></div>'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user