Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdditionalMenuWidget_Item
  • AdvancedSliderHomepageWidget_Item
  • AssetManagerFolder
  • BannerWidget_Item
  • BaseObjectDecorator
  • BookingOrder
  • BookingPaymentMethod
  • BookingService
  • Boolean
  • ButtonsBlockHomepageWidget_Item
  • CarouselHomepageWidget_Item
  • CatalogFilter
  • CatalogRubricsHomepageWidget_CatalogDecorator
  • ClientEmailOrderNotification
  • ClientVKOrderNotification
  • ComponentSet
  • Currency
  • DatabaseAdmin
  • DataObject
  • DataObjectDecorator
  • DataObjectLog
  • DataObjectSet
  • DataObjectSet_Iterator
  • Date
  • DB
  • DBField
  • Decimal
  • DocumentItem
  • DocumentPage_File
  • Double
  • Enum
  • ErrorPageSubsite
  • FileDataObjectTrackingDecorator
  • FileImportDecorator
  • Float
  • FlowerGarden_Size
  • ForeignKey
  • Hierarchy
  • HouseCatalogProductDecorator
  • HTMLText
  • HTMLVarchar
  • Import1CLog
  • Import1CLog_File
  • Import1CLog_Item
  • Import1CLog_Task
  • ImportCatalog1C_PriceType
  • ImportCatalog1C_ProductProp
  • Int
  • ManagerEmailOrderNotification
  • Material3D_File
  • MediawebPage_File
  • MediawebPage_Photo
  • MobileContentDecorator
  • Money
  • MonumentGalleryItem
  • MonumentPhotoGallery
  • MultiEnum
  • MySQLDatabase
  • MySQLQuery
  • Notification
  • OrderDataObject
  • OrderDecorator
  • OrderHandlersDecorator
  • OrderItemDecorator
  • OrderItemVariationDecorator
  • Orders1CExchange_OrdersDecorator
  • OrderService
  • OrderServiceOrder
  • PageIcon
  • PageWidgets
  • Payment
  • PaymentMethodShippingDecorator
  • PaymentOrderExtension
  • Percentage
  • Person
  • PhotoAlbumItem
  • PhotoAlbumProductLinkDecorator
  • PhotoAlbumWidgetLinkDecorator
  • PhotoGalleryHomepageWidget_Item
  • PortraitType
  • PrimaryKey
  • Product3DDecorator
  • ProductCatalogCatalogLinkedDecorator
  • ProductImportLog
  • ProductImportLog_Item
  • ProductParam
  • ProductParamValue
  • ProductVariation
  • RatePeriod
  • RealtyImportLog
  • RealtyImportLog_Item
  • RedirectEntry
  • RoomOrder
  • RoomOrderPerson
  • RoomRate
  • RoomService
  • RoomServiceOrder
  • SberbankPaymentDecorator
  • SeoOpenGraphPageDecorator
  • ServiceOrder
  • ShippingMethodPaymentDecorator
  • ShopCountry
  • SimpleOrderCatalogDecorator
  • SimpleOrderProductDecorator
  • SiteConfigWidgets
  • SiteTreeDecorator
  • SiteTreeImportDecorator
  • SliderHomepageWidget_Item
  • SMSCOrderNotification
  • SMSOrderNotification
  • SortableDataObject
  • SQLMap
  • SQLMap_Iterator
  • SQLQuery
  • SS_Database
  • SS_Datetime
  • SS_Query
  • StringField
  • SubsiteDomain
  • Text
  • TextAnonsWidget_Item
  • Texture3D_File
  • Time
  • Varchar
  • Versioned
  • Versioned_Version
  • VideoCategory
  • VideoEntry
  • VKNotificationQueue
  • WebylonWidget_Item
  • YaMoneyPaymentDecorator
  • Year

Interfaces

  • CompositeDBField
  • CurrentPageIdentifier
  • DataObjectInterface
  1 <?php
  2 
  3 /**
  4  * Виджет "Слайдер"
  5  * Показывает сменяющиеся изображения
  6  *
  7  * @package widgets
  8  * @author  menedem
  9  */
 10 class SliderHomepageWidget extends HomepageWidget {
 11     static $db = array(
 12         'SlideHeight' => 'Int',
 13         'ShowSlideTitle' => 'Boolean',
 14         'TitleFontSize' => 'Int',
 15         'ShowNavigation' => 'Boolean',
 16         'AnimationType' => 'Varchar',
 17         'DelayTime' => 'Int',
 18     );
 19     
 20     
 21     static $has_many = array(
 22         'Items' => 'SliderHomepageWidget_Item'
 23     );
 24     
 25     static $defaults = array(
 26         'ShowSlideTitle' => 0,
 27         'ShowNavigation' => 1,
 28         'DelayTime' => 5,
 29         'SlideHeight' => 300,
 30     );
 31     
 32     /**
 33      * Набор типов анимации Слайдера     
 34      */
 35     static $animation_types = array(
 36         'horizontal',
 37         'vertical',
 38         'fade',
 39     );
 40     
 41     /**
 42      * Установка набора типов анимации Слайдера     
 43      * 
 44      * @param array $types
 45      */
 46     static function set_animation_types($types = array()) {
 47         if (!is_array($types)) $types = array($types);
 48         self::$animation_types = $types;
 49     }
 50 
 51     function getCMSFields() {
 52         $fields = parent::getCMSFields();
 53         
 54         $sizes = array();
 55         for($i = 8; $i <= 32; $i=$i+2) {
 56             $sizes[$i] = $i;
 57         }
 58         for($i = 36; $i <= 64; $i=$i+4) {
 59             $sizes[$i] = $i;
 60         }
 61         $fields->replaceField('TitleFontSize', new DropdownField('TitleFontSize', $this->fieldLabel('TitleFontSize'), $sizes, null, null, _t('COMMON.default','default')));
 62         
 63         if (count(self::$animation_types) == 0) {
 64             $fields->removeByName('AnimationType');
 65             $fields->removeByName('DelayTime');
 66         } elseif (count(self::$animation_types) == 1) {
 67             $fields->replaceField('AnimationType', new HiddenField('AnimationType', '', self::$animation_types[0]));
 68             $fields->addFieldToTab('Root.Main', new HeaderField('AnimationSettings', _t('SliderHomepageWidget.AnimationSettings')), 'AnimationType');
 69         } else {
 70             $fields->addFieldToTab('Root.Main', new HeaderField('AnimationSettings', _t('SliderHomepageWidget.AnimationSettings')), 'AnimationType');
 71             $fields->replaceField('AnimationType', new DropdownField('AnimationType', $this->fieldLabel('AnimationType'), WebylonWidget::get_array_localization($this->class, 'AnimationType', self::$animation_types)));
 72         }
 73 
 74         $dom = new ImageDataObjectManager(
 75             $this,
 76             'Items',
 77             'SliderHomepageWidget_Item',
 78             null,
 79             null,
 80             null,
 81             "WidgetID = {$this->ID}"
 82         );
 83         $dom->setRelationAutoSetting(true);
 84 
 85         $previewFields = new LiteralField("css", "<style>div#Root_Main.tab {height: 80%}</style>");
 86         $dom->setPreviewFieldFor($previewFields);
 87         
 88         $fields->replaceField('Items', $dom);
 89         return $fields;
 90     }
 91     
 92     /**
 93      * Список активных слайдов
 94      * 
 95      * @return DataObjectSet
 96      */
 97     function ActiveItems() {
 98         return $this->Items('Active = 1');
 99     }
100     
101     /**
102      * Переводит время задержки в миллисекунды
103      * 
104      * @return int
105      */
106     function DelayTimeMS() {
107         return $this->DelayTime * 1000;
108     }
109 }
110 
111 class SliderHomepageWidget_Item extends WebylonWidget_Item {    
112     static $has_one = array(    
113         'Image' => 'Image',
114     );
115     
116     function getCMSFields() {
117         $fields = parent::getCMSFields();
118         
119         $fields->removeByName('Image');
120         if ($this->ImageID && $this->Image()->ID) {
121             $tab = $fields->findOrMakeTab('Root.Image', $this->fieldLabel('Image'));
122             $URL = $this->Image()->SetHeight(200)->URL;
123             $tab->push(new LiteralField("icon", "<div class='current-image'><img src='$URL' alt='".$this->Image()->Filename."' title='".$this->Image()->Filename."'  /></div>"));
124         }
125         return $fields;
126     }
127     
128     function AutoresizeMaxWidth() {
129         return WebylonWidget::$max_image_width;
130     }
131     
132     function AutoresizeMaxHeight() {
133         return WebylonWidget::$max_image_heigth;
134     }
135 }
136 
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0