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

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • 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
  • 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
  • ForeignKey
  • Hierarchy
  • HTMLText
  • HTMLVarchar
  • ImportLog_Item
  • Int
  • ManagerEmailOrderNotification
  • Material3D_File
  • MediawebPage_File
  • MediawebPage_Photo
  • MobileContentDecorator
  • Money
  • MultiEnum
  • MySQLDatabase
  • MySQLQuery
  • OrderDataObject
  • OrderHandlersDecorator
  • OrderItemVariationDecorator
  • OrderService
  • OrderServiceOrder
  • OrdersExportDecorator
  • PageIcon
  • PageWidgets
  • Payment
  • PaymentMethodShippingDecorator
  • PaymentOrderExtension
  • Percentage
  • PhotoAlbumItem
  • PhotoAlbumProductLinkDecorator
  • PhotoAlbumWidgetLinkDecorator
  • PhotoGalleryHomepageWidget_Item
  • PrimaryKey
  • Product3DDecorator
  • ProductCatalogCatalogLinkedDecorator
  • 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 AdvancedSliderHomepageWidget extends HomepageWidget {
 11     static $db = array(
 12         'SlideHeight' => 'Int',
 13         'ShowNavigation' => 'Boolean',
 14         'DelayTime' => 'Int',
 15     );
 16     
 17     static $has_many = array(
 18         'Items' => 'AdvancedSliderHomepageWidget_Item'
 19     );
 20     
 21     static $defaults = array(
 22         'SlideHeight' => 300,
 23         'ShowNavigation' => 1,
 24         'DelayTime' => 5,
 25     );
 26     
 27     /**
 28      * Установка набора типов анимации Слайдера     
 29      * 
 30      * @param array $types
 31      */
 32     static function set_animation_types($types = array()) {
 33         if (!is_array($types)) $types = array($types);
 34         self::$animation_types = $types;
 35     }
 36 
 37     function getCMSFields() {
 38         $fields = parent::getCMSFields();
 39 
 40         $dom = new ImageDataObjectManager(
 41             $this,
 42             'Items',
 43             'AdvancedSliderHomepageWidget_Item',
 44             null,
 45             null,
 46             null,
 47             "WidgetID = {$this->ID}"
 48         );
 49         $dom->setRelationAutoSetting(true);
 50 
 51         $previewFields = new LiteralField("css", "<style>div#Root_Main.tab {height: 80%}</style>");
 52         $dom->setPreviewFieldFor($previewFields);
 53         
 54         $fields->replaceField('Items', $dom);
 55         return $fields;
 56     }
 57     
 58     /**
 59      * Список активных слайдов
 60      * 
 61      * @return DataObjectSet
 62      */
 63     function ActiveItems() {
 64         return $this->Items('Active = 1');
 65     }
 66     
 67     /**
 68      * Переводит время задержки в миллисекунды
 69      * 
 70      * @return int
 71      */
 72     function DelayTimeMS() {
 73         return $this->DelayTime * 1000;
 74     }
 75 }
 76 
 77 class AdvancedSliderHomepageWidget_Item extends WebylonWidget_Item {
 78     static $db = array(
 79         'Text' => 'Text',
 80         'ButtonText' => 'Varchar(255)',
 81         'TextPlace' => "Enum('left,right')",
 82     );
 83     
 84     static $has_one = array(
 85         'Image' => 'Image',
 86         'MobImage' => 'Image',
 87     );
 88     
 89     static function get_text_places() {
 90         $rs = array();
 91         foreach(singleton('AdvancedSliderHomepageWidget_Item')->dbObject('TextPlace')->enumValues() as $value) {
 92             $rs[$value] = _t("AdvancedSliderHomepageWidget_Item.TextPlace_{$value}");
 93         }
 94         return $rs;
 95     }
 96     
 97     function getCMSFields() {
 98         $fields = parent::getCMSFields();
 99         
100         $fields->removeByName('Image');
101         $tab = $fields->findOrMakeTab('Root.Image', $this->fieldLabel('Image'));
102         if ($this->ImageID && $this->Image()->ID) {
103             $URL = $this->Image()->SetWidth(450)->URL;
104             $tab->push(new LiteralField("icon", "<div class='current-image'><img src='$URL' alt='".$this->Image()->Filename."' title='".$this->Image()->Filename."'  /></div>"));
105         }
106         
107         $mobImage = $fields->dataFieldByName('MobImage');
108         $fields->removeByName('MobImage');
109         $tab->push($mobImage);
110         
111         $fields->replaceField('TextPlace', new DropdownField('TextPlace', $this->fieldLabel('TextPlace'), self::get_text_places()));
112         
113         return $fields;
114     }
115     
116     function MobileImage() {
117         if ($this->MobImageID && $this->MobImage()->ID) {
118             return $this->MobImage();
119         }
120         return $this->Image();
121     }
122     
123     function AutoresizeMaxWidth() {
124         return WebylonWidget::$max_image_width;
125     }
126     
127     function AutoresizeMaxHeight() {
128         return WebylonWidget::$max_image_heigth;
129     }
130 }
131 
[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.1 API Docs API documentation generated by ApiGen 2.8.0