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

  • Address
  • AddSubsiteTask
  • Announcement
  • AnnouncementDecorator
  • AnnouncementHolder
  • AssociatedFolderDecorator
  • AttachedFiles
  • AudioPhpCaptcha
  • AutoCompleteField
  • BaseMediawebImportParser
  • BookingOrder_StatusLog
  • CalendarUtil
  • CalendarWidgetExtention
  • CatalogCatalogLinkedDecorator
  • CatalogImportTask
  • CatalogOldFieldsDecorator
  • CatalogProductLinkedDecorator
  • CheckoutStep_ShippingMethod
  • ChequePayment
  • ClearHistoryTask
  • ClientEmailOrderNotification_SiteConfig
  • ClientVKOrderNotification_SiteConfig
  • CommentsSiteConfig
  • ContactsPage
  • CookieExtention
  • CostTableShippingRate
  • CustomMenu
  • CustomMenuAdmin
  • CustomMenuDecorator
  • CustomMenuHolder
  • CustomMenuItem
  • CustomPayment
  • DataObjectLoggerExtension
  • DataObjectSubsites
  • DefaultCMSActionDecorator
  • DeleteOldAssociatedFoldersTask
  • DocPage
  • DocumentDirection
  • DocumentHaving
  • DocumentSearchForm
  • DocumentSiteConfig
  • DocumentsPage
  • DocumentType
  • DOMUtil
  • ExtendPageAnnouncement
  • ExtendPageNews
  • ExtendPagePoll
  • FileOversizeDecorator
  • FindCyrillicSiteConfig
  • FolderRenameTask
  • GDMergeAlpha
  • HomePage
  • ImageAutoResize
  • ImageResizeTask
  • ImportAdmin
  • ImportAutoStartTask
  • ImportCatalogMessage
  • ImportConfig
  • ImportLog
  • ImportSiteConfig
  • ImportTask
  • LoggerAdmin
  • LogItem
  • ManagerEmailOrderNotification_SiteConfig
  • MapObject
  • MapObjectGroup
  • MapPage
  • MediawebForm
  • MediawebImportParser
  • MemberLoggerExtension
  • MultiUploadConfig
  • NearestEventExtention
  • NewDocumentsAdmin
  • News_Controller
  • NewsEntry
  • NewsEntry_Controller
  • NewsHolder
  • NewsHolder_Controller
  • NewsLiveCalendarWidget
  • NewsSiteConfig
  • Order_StatusLog
  • Orders1CExchange
  • 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
  • ProductImportV1Decorator
  • ProductOldFieldsDecorator
  • ProductProductLinkedDecorator
  • PublHolder
  • Publication
  • PublicationSiteTree
  • RatingDataObject
  • RatingExtension
  • RealtySiteConfigDecorator
  • RecentComments
  • RecentFiles
  • RecentPages
  • RelatedPageLink
  • RepairImportTask
  • RoomRate_PriceField
  • RussianUpLower
  • SberbankPayment
  • SberbankPayment_Handler
  • SetMainSiteHomePageTypeTask
  • ShippingEstimator
  • ShippingPackage
  • ShowUserFromExtension
  • SiteConfigDecorator
  • SiteConfigSubsites
  • SiteTreeSubsites
  • SMSCOrderNotification_SiteConfig
  • SMSOrderNotification_SiteConfig
  • SortCMSActionDecorator
  • SS_Report_FakeQuery
  • SSMorphy
  • SSNController
  • SteppedCheckout_PageMessages
  • SubpageListField
  • SubscribeFormAllPagesExtension
  • SubsiteDropdownField
  • SubsiteReportWrapper
  • TableShippingRate
  • UnitellerPayment
  • UnitellerPayment_Handler
  • UnmoderatedComments
  • VideoManager
  • VideoSiteConfig
  • WatermarkImage
  • WatermarkSiteConfig
  • WebylonImportAdmin
  • WebylonImportCatalog
  • WeightTableShippingRate
  • XMLValidate
  • YaMoneyPayment
  • YaMoneyPayment_Handler
  • YMLExporter
  • YMLSiteConfig

Interfaces

  • ImportInterface
  • 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
  • validateError
  • validEmailAddr
  • wrapImagesInline
  • wrapImagesInline_rewriter
  1 <?php
  2 /**
  3  * Description of Publication
  4  *
  5  * @author inxo, menedem
  6  */
  7 class Publication extends Page {
  8 
  9     static $default_parent = "PublHolder";
 10     static $allowed_children = null;
 11     static $can_be_root = false;
 12     static $icon = "publication/img/publication";
 13     
 14     static $db = array(
 15         'Date' => 'Date',
 16         'Description' => 'Text',
 17         'Author' => 'Text',
 18         'Source' => 'Text',
 19         'SourceLink' => 'Varchar(255)',
 20         'IsHidden' => 'Boolean',
 21         'Favorite' => 'Boolean',
 22     );
 23     
 24     static $defaults = array(
 25         'AutoChild' => 0,
 26         'ShowInMenus' => 0,
 27         'ShowInSiteMap' => 0,
 28         'ShowInSearch' => 1,        
 29         'ShowOnlyInTab' => 1,
 30         'IsHidden' => 0,
 31         'Favorite' => 0,
 32     );
 33     
 34     static $has_one = array(
 35         'Photo' => 'Image',
 36     );
 37     
 38     static $summary_fields = array('Date', 'Title', 'FavoriteTitle', 'IsHiddenTitle');
 39 
 40     function getCMSFields() {
 41         $fields = parent::getCMSFields();
 42         
 43         $dateField = new DateField('Date', $this->fieldLabel('Date'));
 44         if (!property_exists('FormField', 'use_html5') || !FormField::use_html5()) {
 45             $dateField->setLocale('ru_RU');
 46             $dateField->setConfig('dateformat', 'dd/MM/yyyy');
 47             $dateField->setConfig('showcalendar', true);
 48         }
 49         $fields->addFieldToTab('Root.Content.Main', $dateField, 'Title');
 50         
 51         $PublImage = new ImageField('Photo', _t('Publication.has_one_Photo'));
 52         $PublImage->setFolderName('Publications');
 53         $fields->addFieldToTab('Root.Content.Main', $PublImage);
 54         
 55         $fields->addFieldToTab('Root.Content.Main', new TextareaField('Description', _t('Publication.db_Description')));
 56         $fields->addFieldToTab('Root.Content.Main', new TextField('Author', _t('Publication.db_Author')));
 57         $fields->addFieldToTab('Root.Content.Main', new TextField('Source', _t('Publication.db_Source')));
 58         $fields->addFieldToTab('Root.Content.Main', new TextField('SourceLink', _t('Publication.db_SourceLink')));
 59         $fields->addFieldToTab('Root.Content.Main', new CheckboxField('IsHidden', _t('Publication.db_IsHidden','Hidden')));
 60         $fields->addFieldToTab('Root.Content.Main', new CheckboxField('Favorite', _t('Publication.db_Favorite','Favorite')));       
 61         
 62         $fields->addFieldToTab('Root.Content', new Tab('FullContent', _t('Publication.SINGULARNAME')), 'PagePhotos');
 63         $fields->addFieldToTab('Root.Content.FullContent', $fields->dataFieldByName('Content'));
 64         
 65         return $fields;
 66     }
 67 
 68     public function FavoriteTitle() {
 69         return ($this->Favorite) ?  _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No');
 70     }
 71     
 72     public function IsHiddenTitle() {
 73         return ($this->IsHidden) ? _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No');
 74     }
 75     
 76     function fieldLabels($relations = true) {
 77         $labels = parent::fieldLabels($relations);
 78         $labels['FavoriteTitle'] = _t('Publication.FavoriteTitle', 'Favorite');
 79         $labels['IsHiddenTitle'] = _t('Publication.IsHiddenTitle', 'Is Hidden');        
 80         return $labels;
 81     }   
 82     
 83     public function getCMSActions() {
 84         Requirements::javascript('webylon/javascript/SubpageAction.js');
 85         $fields = parent::getCMSActions();
 86         $fields->push(new HiddenField('backLink', '', $this->Parent()->ID));
 87         $fields->insertBefore(new FormAction('goBack', _t('News.BACKBUTTON', 'Back')), 'action_unpublish');
 88         return $fields;
 89     }
 90     public function getCMSValidator() {
 91         return new RequiredFields('Title');
 92     }
 93 
 94     public function populateDefaults() {
 95         parent::populateDefaults();
 96         $this->setField('Date', date('Y-m-d'), strtotime('now'));
 97     }
 98 
 99     function onBeforeWrite() {
100         if (!$this->Description)
101             $this->Description = trim(strip_tags($this->Content));
102         parent::onBeforeWrite();
103     }
104 
105     /*    
106      * Заготовка для анонсов
107      */
108     public function DescriptionSummmary() {
109         if ($this->obj('Description'))
110             return $this->obj('Description');
111         else {
112             return $this->obj('Content')->FirstParagraph('html');
113         }
114     }
115     
116     
117     /**
118      * возвращает список публикаций для виджета
119      * 
120      * @param int $count - лимит возвращаемых публикаций [1]
121      * @param boolean $favorites - отображение только избранных публикаций [1]
122      * @param int $holderID -  id раздела PubHolder, если не указан - из всех
123      * @param boolean $random  - флаг случайная сортировка или по умолчанию 
124      * 
125      * @return DataObjectSet
126      */
127     static function get_publications($count = 1, $favorites = false, $holderID = false, $random = false) {      
128         $filter = 'IsHidden = 0';
129         $sort = ($random) ? 'RAND()' : 'Date DESC';     
130         if ($favorites) {
131             $filter .= " AND Favorite = 1";
132         }       
133         if ($holderID !== false) {          
134             $filter .= " AND ParentID = $holderID";         
135         }       
136         return DataObject::get('Publication', $filter, $sort, '', $count);
137     }   
138 }       
139 
140 class Publication_Controller extends Page_Controller {
141 }
142 
[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