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 /**
  4  * Description of NewsHolder
  5  *
  6  * @todo Проверять при dev/build есть ли хоть один Newsholder и если нет создавать с DevEditMode='Fixed'
  7  * 
  8  * @author inxo
  9  */
 10 class NewsHolder extends Page {
 11 
 12     static $icon = 'news/images/rss';
 13     static $allowed_children = array('NewsEntry', 'NewsHolder');
 14 
 15     static $db = array(
 16         'SortType' => 'Int', // Сортировка 0 - ASC 1 - DESC
 17         'Template' => 'Text' // шаблон для вывода страницы с новостями
 18     );
 19 
 20     static $defaults = array(
 21         'SortType' => 2,
 22         'AutoChild' => 0,
 23         "ShowInMenus" => 0,
 24         "ShowInSearch" => 0,
 25     );
 26 
 27     static $subpage_children = 'NewsEntry';
 28 
 29     function getCMSFields() {
 30         $fields = parent::getCMSFields();
 31         $fields->removeFieldFromTab('Root.Content.Main', 'Content');
 32         $fields->addFieldToTab('Root.Content.Main',
 33                 new OptionsetField('SortType', $this->fieldLabel('SortType'), array(
 34                     1 => _t('NewsHolder.TYPE_SORT_ASC', "ASC"),
 35                     2 => _t('NewsHolder.TYPE_SORT_DESC', "DESC"),
 36                 ))
 37         );
 38         $sc = SiteConfig::current_site_config();
 39         if ($sc->NewsCustomTemplates) {
 40             $fields->addFieldToTab('Root.Content.Main', new TextField('Template', _t('NewsHolder.db_Template')));
 41         }
 42         $fields->addFieldToTab('Root.Content', new Tab('tabSubPages', _t('NewsHolder.TABLABEL', 'News')), 'Metadata');
 43         $subClass = self::$subpage_children;
 44         $sp = new SubpageListField('Subpages', $this, $subClass, 'Date DESC');
 45         $sp->Sortable = false;
 46         $url = '<a href=\"admin/show/$ID\">$value</a>';
 47         $sp->setFieldFormatting(array_combine(array_keys(singleton($subClass)->summaryFields()), array_fill(0, count(singleton($subClass)->summaryFields()), $url)));
 48         $fields->addFieldToTab('Root.Content.tabSubPages', $sp);
 49 
 50         return $fields;
 51     }
 52 
 53     /*
 54      * Получение новостей
 55      */
 56 
 57     public function Entries($start = '', $limit = '',$start_date = null, $end_date = null) {
 58         $filter = '';
 59         if ($start_date) {
 60             $filter .= ' AND DATE(Date) >= \'' . $start_date->date() . '\'';
 61             if ($end_date) {
 62                 $filter .= ' AND DATE(Date) <= \'' . $end_date->date() . '\'';
 63             }
 64         }
 65         if ($limit != '') {
 66             if ($start != '') {
 67                 $limit = "$start,$limit";
 68             }
 69         }
 70 
 71         if ($this->SortType == 1) {
 72             $sort = 'ASC';
 73         } else {
 74 
 75             $sort = 'DESC';
 76         }
 77         $res = DataObject::get("NewsEntry", "`ParentID` = $this->ID AND `Status` LIKE '%Published%' $filter", "`NewsEntry`.Date $sort, `NewsEntry`.ID $sort", "", "$limit");
 78         return $res;
 79     }
 80 
 81     //function canDelete() {
 82     //    return false;
 83     //}
 84 }
 85 
 86 class NewsHolder_Controller extends News_Controller {
 87 
 88     function init() {
 89         parent::init();
 90         RSSFeed::linkToFeed($this->Link("rss"), _t('NewsHolder.RSSFEED', "RSS feed"));
 91     }
 92 
 93     function index() {
 94         $start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
 95         if ($start < 0) $start = 0;
 96 
 97         $sc = SiteConfig::current_site_config();
 98 
 99         $limit = $sc->NewsPerPage;
100         $limit = ($limit > 0) ? $limit : 10;        
101         $data = $this->Entries($start, $limit);
102         if ($this->hasMethod('setSEOVars')) {
103             $this->setSEOVars($data);   //Выставляем SEO-переменные (ф-я setSEOVars находится в Webylon Page_Controller)
104         }
105         return ($sc->NewsCustomTemplates && $this->Template) ? $this->renderWith(array($this->Template, $this->ClassName, 'Page'), array('Items' => $data)) : $this->render(array('Items' => $data));
106     }
107 
108     public function view() {
109         $this->parseURL();
110 
111         $start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
112         if ($start < 0) $start = 0;
113 
114         $sc = SiteConfig::current_site_config();
115 
116         $limit = $sc->NewsPerPage;
117         $limit = ($limit > 0) ? $limit : 10;
118         $data = $this->Entries($start, $limit,$this->start_date,$this->end_date);
119         if ($this->hasMethod('setSEOVars')) {
120             $this->setSEOVars($data); //Выставляем SEO-переменные (ф-я setSEOVars находится в Webylon Page_Controller)  
121         }
122         return ($sc->NewsCustomTemplates && $this->Template) ? $this->renderWith(array($this->Template, $this->ClassName, 'Page'), array('Items' => $data)) : $this->render(array('Items' => $data));
123     }
124 
125     function CurrentPeriod() {
126         switch ($this->view) {
127             case 'year':
128                 return $this->year;
129 
130             case 'month':
131                 return $this->StartDate()->formatI18N('%B %Y');
132 
133             case 'day':
134                 return $this->StartDate()->formatI18N('%e.%m.%Y');
135 
136             case 'range':
137                 return $this->StartDate()->rangeString($this->EndDate()) ;
138         }
139         return false;
140     }
141 
142     function StartDate() {
143         if (!$this->start_date) return false;
144         $date = new Date('StartDate');
145         $date->setValue($this->start_date->get());
146         return $date;
147     }
148 
149     function EndDate() {
150         if (!$this->end_date) return false;
151         $date = new Date('EndDate');
152         $date->setValue($this->end_date->get());
153         return $date;
154     }
155 
156     function ViewType() {
157         return $this->view;
158     }
159 
160     function rss() {
161         global $project;
162         HTTP::set_cache_age(3600);
163 
164         $sc = SiteConfig::current_site_config();
165         $Name = $sc->Title;
166         $altName = $project . _t('NewsHolder.RSSNAME', ' news');
167         $entries = $this->Entries(0, $sc->NewsInRSS);
168 
169         if ($entries) {
170             $rss = new RSSFeed($entries, $this->Link() . 'rss', ($Name ? $Name : $altName), "", "Title", "Description");
171             $rss->outputToBrowser();
172         }
173     }
174 
175 }
176 
177 
[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