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

  • Address
  • AddSubsiteTask
  • Announcement
  • AnnouncementDecorator
  • AnnouncementHolder
  • AssociatedFolderDecorator
  • AttachedFiles
  • AudioPhpCaptcha
  • AutoCompleteField
  • Base1CExchanger
  • BookingOrder_StatusLog
  • CalendarUtil
  • CalendarWidgetExtention
  • CatalogCatalogLinkedDecorator
  • CatalogOldFieldsDecorator
  • CatalogProductLinkedDecorator
  • CheckoutStep_ShippingMethod
  • ChequePayment
  • ClearHistoryTask
  • ClientEmailOrderNotification_SiteConfig
  • ClientVKOrderNotification_SiteConfig
  • CommentsSiteConfig
  • ContactsPage
  • CookieExtention
  • CostTableShippingRate
  • CustomMenu
  • CustomMenuAdmin
  • CustomMenuDecorator
  • CustomMenuHolder
  • CustomMenuItem
  • CustomPayment
  • DataObjectLoggerExtension
  • DataObjectSubsites
  • DefaultCMSActionDecorator
  • DocPage
  • DocumentDirection
  • DocumentHaving
  • DocumentSearchForm
  • DocumentSiteConfig
  • DocumentsPage
  • DocumentType
  • DOMUtil
  • ExtendPageAnnouncement
  • ExtendPagePoll
  • FavoriteExtention
  • FavoritePage
  • FavoriteProductMemberExtention
  • FavoriteProducts
  • FileOversizeDecorator
  • FindCyrillicSiteConfig
  • FolderRenameTask
  • GDMergeAlpha
  • HomePage
  • ImageAutoResize
  • ImageResizeTask
  • ImportCatalog1C_Importer
  • ImportCatalogSiteConfig
  • ImportSiteConfig
  • LoggerAdmin
  • LogItem
  • ManagerEmailOrderNotification_SiteConfig
  • MapObject
  • MapObjectGroup
  • MapPage
  • MediawebForm
  • MemberLoggerExtension
  • MonumentsSiteConfig
  • MultiUploadConfig
  • NearestEventExtention
  • NewDocumentsAdmin
  • NewsArchive
  • NewsEntry
  • NewsHolder
  • NewsSiteConfig
  • Order_StatusLog
  • Orders1CExchange_Exporter
  • PageHideFieldsExtension
  • PageInformerRates
  • PageInformerWeather
  • Payment_Failure
  • Payment_Processing
  • Payment_Result
  • Payment_Success
  • PaymentMethod
  • PaymentSiteConfig
  • PayPalPayment
  • PayPalPayment_Handler
  • PhoneField
  • PhotoAlbumExtentions
  • PhpCaptcha
  • PhpCaptchaColour
  • PhpCaptchaField
  • phpMorphy
  • phpMorphy_AncodesResolver_AsIs
  • phpMorphy_AncodesResolver_Proxy
  • phpMorphy_AncodesResolver_ToDialingAncodes
  • phpMorphy_AncodesResolver_ToText
  • phpMorphy_AnnotDecoder_Base
  • phpMorphy_AnnotDecoder_Common
  • phpMorphy_AnnotDecoder_Factory
  • phpMorphy_AnnotDecoder_Predict
  • phpMorphy_FilesBundle
  • phpMorphy_Fsa
  • phpMorphy_Fsa_Decorator
  • phpMorphy_Fsa_Proxy
  • phpMorphy_Fsa_Sparse_File
  • phpMorphy_Fsa_Sparse_Mem
  • phpMorphy_Fsa_Sparse_Shm
  • phpMorphy_Fsa_Tree_File
  • phpMorphy_Fsa_Tree_Mem
  • phpMorphy_Fsa_Tree_Shm
  • phpMorphy_Fsa_WordsCollector
  • phpMorphy_GramInfo
  • phpMorphy_GramInfo_AncodeCache
  • phpMorphy_GramInfo_Decorator
  • phpMorphy_Graminfo_File
  • phpMorphy_Graminfo_Mem
  • phpMorphy_GramInfo_Proxy
  • phpMorphy_GramInfo_Proxy_WithHeader
  • phpMorphy_GramInfo_RuntimeCaching
  • phpMorphy_Graminfo_Shm
  • phpMorphy_GrammemsProvider_Base
  • phpMorphy_GrammemsProvider_Decorator
  • phpMorphy_GrammemsProvider_Empty
  • phpMorphy_GrammemsProvider_Factory
  • phpMorphy_GrammemsProvider_ForFactory
  • phpMorphy_GrammemsProvider_ru_RU
  • phpMorphy_GramTab
  • phpMorphy_GramTab_Empty
  • phpMorphy_GramTab_Proxy
  • phpMorphy_Link
  • phpMorphy_Link_Annot
  • phpMorphy_Link_Base
  • phpMorphy_Morphier_Base
  • phpMorphy_Morphier_Bulk
  • phpMorphy_Morphier_Common
  • phpMorphy_Morphier_Empty
  • phpMorphy_Morphier_Finder_Base
  • phpMorphy_Morphier_Finder_Common
  • phpMorphy_Morphier_Finder_Predict_Databse
  • phpMorphy_Morphier_Finder_Predict_Suffix
  • phpMorphy_Morphier_Helper
  • phpMorphy_Morphier_Predict_Database
  • phpMorphy_Morphier_Predict_Suffix
  • phpMorphy_Morphier_PredictCollector
  • phpMorphy_Semaphore
  • phpMorphy_Semaphore_Empty
  • phpMorphy_Semaphore_Nix
  • phpMorphy_Semaphore_Win
  • phpMorphy_Shm_Cache
  • phpMorphy_Shm_Cache_FileDescriptor
  • phpMorphy_Shm_Header
  • phpMorphy_Source_Dba
  • phpMorphy_Source_Fsa
  • phpMorphy_State
  • phpMorphy_Storage
  • phpMorphy_Storage_Factory
  • phpMorphy_Storage_File
  • phpMorphy_Storage_Mem
  • phpMorphy_Storage_Proxy
  • phpMorphy_Storage_Shm
  • phpMorphy_UnicodeHelper
  • phpMorphy_UnicodeHelper_Base
  • phpMorphy_UnicodeHelper_MultiByteFixed
  • phpMorphy_UnicodeHelper_singlebyte
  • phpMorphy_UnicodeHelper_ucs_2be
  • phpMorphy_UnicodeHelper_ucs_2le
  • phpMorphy_UnicodeHelper_ucs_4be
  • phpMorphy_UnicodeHelper_ucs_4le
  • phpMorphy_UnicodeHelper_utf_16_Base
  • phpMorphy_UnicodeHelper_utf_16be
  • phpMorphy_UnicodeHelper_utf_16le
  • phpMorphy_UnicodeHelper_utf_32_Base
  • phpMorphy_UnicodeHelper_utf_32be
  • phpMorphy_UnicodeHelper_utf_32le
  • phpMorphy_UnicodeHelper_utf_8
  • phpMorphy_WordDescriptor
  • phpMorphy_WordDescriptor_Collection
  • phpMorphy_WordDescriptor_Collection_Serializer
  • phpMorphy_WordForm
  • ProductCatalogImportTask
  • ProductOldFieldsDecorator
  • ProductParamValue_BoolValueField
  • ProductParamValue_MultiValueField
  • ProductParamValue_MultiValueSetField
  • ProductParamValue_ValueField
  • ProductProductLinkedDecorator
  • PublHolder
  • Publication
  • PublicationSiteTree
  • RatingDataObject
  • RatingExtension
  • RealtySiteConfigDecorator
  • RecentComments
  • RecentFiles
  • RecentPages
  • RelatedPageLink
  • RoomRate_PriceField
  • RussianUpLower
  • SberbankPayment
  • SberbankPayment_Handler
  • SetMainSiteHomePageTypeTask
  • ShippingEstimator
  • ShippingPackage
  • ShowUserFromExtension
  • ShowViewedProductExtention
  • SiteConfigDecorator
  • SiteConfigSubsites
  • SiteTreeSubsites
  • SMSCOrderNotification_SiteConfig
  • SMSOrderNotification_SiteConfig
  • Socle
  • SocleSize
  • SortCMSActionDecorator
  • SS_Report_FakeQuery
  • SSMorphy
  • SSNController
  • SteppedCheckout_PageMessages
  • SubpageListField
  • SubscribeFormAllPagesExtension
  • SubsiteDropdownField
  • SubsiteReportWrapper
  • TableShippingRate
  • UnitellerPayment
  • UnitellerPayment_Handler
  • UnmoderatedComments
  • VAT
  • VideoManager
  • VideoSiteConfig
  • ViewedProductExtention
  • WatermarkImage
  • WatermarkSiteConfig
  • WeightTableShippingRate
  • XMLValidate
  • YaMoneyPayment
  • YaMoneyPayment_Handler
  • YMLExporter
  • YMLSiteConfig

Interfaces

  • PaymentObjectInterface
  • phpMorphy_AncodesResolver_Interface
  • phpMorphy_AnnotDecoder_Interface
  • phpMorphy_Fsa_Interface
  • phpMorphy_GramInfo_Interace
  • phpMorphy_GrammemsProvider_Interface
  • phpMorphy_GramTab_Interface
  • phpMorphy_Morphier_Finder_Interface
  • phpMorphy_Morphier_Interface
  • phpMorphy_Shm_Cache_Interface
  • phpMorphy_Source_Interface

Exceptions

  • phpMorphy_Exception

Functions

  • column_sort
  • column_sort_callback_basic
  • encodeFileForEmail
  • encodeMultipart
  • getMimeType
  • htmlEmail
  • loadMimeTypes
  • phpmorphy_overload_mb_funcs
  • plaintextEmail
  • processHeaders
  • QuotedPrintable_encode
  • supressOutput
  • validEmailAddr
  • wrapImagesInline
  • wrapImagesInline_rewriter
  1 <?php
  2 /**
  3  * Контейнер для данных анонса
  4  *
  5  * @author inxo
  6  */
  7 class Announcement extends Page {
  8     static $icon = 'anons/img/anons';
  9 
 10     static $can_be_root = false;
 11     static $allowed_children = 'none';
 12     static $default_parent = 'AnnouncementHolder';
 13 
 14     static $db = array(
 15             'Date' => 'Date',
 16             'LinkType' => 'Int',
 17             'Description' => 'Text',
 18             'ExternalLink' => 'Text',
 19     );
 20 
 21     static $has_one = array(
 22             'Photo' => 'Image',
 23             'InternalLink' => 'SiteTree'
 24     );
 25 
 26     static $defaults = array(
 27             'LinkType' => 0,
 28             'ShowOnlyInTab' => 0,
 29             'ShowInSearch' => 0,
 30             'ShowInMenus' => 0,
 31             'AutoChild' => 0,
 32     );
 33     static $summary_fields = array(
 34             'Title','Date','Link','Description'
 35     );
 36 
 37     static $searchable_fields = array(
 38         'Title','Description','Content'
 39     );
 40 
 41     public function Link() {
 42         $Link = false;
 43         switch ($this->LinkType) {
 44             case 1:
 45                 $Link = $this->ExternalLink;
 46                 break;
 47             case 2:
 48                 $Link = $this->InternalLink()->Link();
 49                 break;
 50             case 3:
 51                 $Link = Controller::join_links(Director::baseURL(), $this->RelativeLink());
 52                 break;
 53             default:
 54                 break;
 55         }
 56         return $Link;
 57     }
 58 
 59     function getCMSFields() {
 60         $fields = parent::getCMSFields();
 61 
 62         $fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date', $this->fieldLabel('Date')));
 63         if (!property_exists('FormField', 'use_html5') || !FormField::use_html5()) {
 64             $dateField->setLocale('ru_RU');
 65             $dateField->setConfig('dateformat', 'dd/MM/yyyy');
 66             $dateField->setConfig('showcalendar',1);
 67         }
 68 
 69         $fields->addFieldToTab('Root.Content.Main', new TextField('Title', $this->fieldLabel('Title')));
 70         $fields->addFieldToTab('Root.Content.Main', new TextareaField('Description', $this->fieldLabel('Description')));
 71 
 72         $fields->addFieldToTab('Root.Content.Main', $imageField = new ImageField('Photo', $this->fieldLabel('Photo')));
 73         $imageField->setFolderName('Anons');        
 74         
 75         // задаем max размеры для ImageAutoResize
 76         if ($this->ParentID && AnnouncementHolder::is_slider_holder($this->ParentID)) {
 77             $imageField->AutoresizeMaxWidth = AnnouncementHolder::$max_slider_width;
 78         }
 79 
 80         $fields->addFieldToTab('Root.Content', new Tab('Link', $this->fieldLabel(_t('Announcement.tab_Link', 'Information'))), 'PagePhotos');
 81 
 82         $fields->addFieldToTab('Root.Content.Link', $type = new SelectionGroup('LinkType', array(
 83             '0//' . _t('Announcement.NoLink', 'No Link') => new LiteralField('NoLink', ''),
 84             '1//' . _t('Announcement.ExternalLink', 'External Link') => new TextField('ExternalLink', _t('Announcement.ExternalLink', 'External Link')),
 85             '2//' . _t('Announcement.InternalLink', 'Internal Link') => new TreeDropdownField('InternalLinkID', _t('Announcement.InternalLink', 'Internal Link'), 'SiteTree'),
 86             '3//' . _t('Announcement.db_Content', 'Content') => $fields->dataFieldByName('Content')
 87         )));
 88         $fields->removeFieldFromTab('Root.Content.Main', 'Content');
 89 
 90         $this->extend('hideCMSFields', $fields); // extend для скрытия полей из админки
 91         return $fields;
 92     }
 93     
 94     function onBeforeWrite() {
 95         parent::onBeforeWrite();
 96         
 97         // нельзя ссылаться на самого себя - происходит зацикливание
 98         if ($this->InternalLinkID == $this->ID) {
 99             $this->InternalLinkID = 0;
100         }
101     }
102 
103     public function  getCMSActions() {
104         Requirements::javascript('webylon/javascript/SubpageAction.js');
105         $fields = parent::getCMSActions();
106         $fields->push(new HiddenField('backLink', '', $this->Parent()->ID));
107         $fields->insertBefore(new FormAction('goBack', _t('Announcement.BACKBUTTON','Back')),'action_unpublish');
108         return $fields;
109     }
110 
111     public function populateDefaults() {
112         parent::populateDefaults();
113         $this->Date = date('d/m/Y');
114     }
115 
116     public function Widget($id=null, $limit=null) {
117         if (is_numeric($id) && $id > 0) {
118             $parent = DataObject::get_by_id(self::$default_parent, $id);
119         }
120         else if ($id) {
121             $parent = DataObject::get_one(self::$default_parent, "URLSegment='" . Convert::raw2sql($id) . "'");
122         }
123         else {
124             $parent = DataObject::get_one(self::$default_parent);
125         }
126 
127         if (!$parent) return FALSE;
128 
129         $showtype = $parent->ShowTypeBlock;
130         if (!$showtype) return FALSE;
131 
132         switch ($showtype) {
133             case 1:
134                 $sort = 'Date DESC';
135                 break;
136             case 2:
137                 $sort = 'RAND()';
138                 break;
139             case 3:
140                 $sort = 'Sort';
141                 break;
142             default:
143                 break;
144         }
145         if ($limit == null) {
146             if ($showtype == 3) {
147                 $limit = '';
148             } else {
149                 $limit = $parent->PerBlock;
150             }
151         }
152         return DataObject::get($this->ClassName, "`ParentID` = {$parent->ID} AND `Status` LIKE '%Published%'", $sort, '', $limit);
153     }
154 }
155 
156 class Announcement_Controller extends Page_Controller {
157 
158 }
159 
[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