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 CustomMenuAdmin
  5  *
  6  * @author inxo, menedem
  7  */
  8 class CustomMenuAdmin extends LeftAndMain {
  9 
 10     static $url_segment = 'menus';
 11     static $menu_title = 'Menus';
 12     static $menu_priority = 10;
 13     static $url_priority = 41;
 14     static $url_rule = '/$Action/$ID/$OtherID';
 15     static $tree_class = "CustomMenuHolder";
 16 
 17     public function init() {
 18         parent::init();
 19         Requirements::javascript('custom_menu/javascript/CustomMenu_right.js');
 20         Requirements::css('custom_menu/css/CustomMenu.css');
 21     }
 22 
 23     /**
 24      * Basic action to display a blank pannel when the root node is selected
 25      * from the left sitetree.
 26      *
 27      * @return <type> false
 28      */
 29     public function root() {
 30         return false;
 31     }
 32 
 33     /**
 34      * get_menus retrieves all CustomMenuHolder objects from the database,
 35      * which will be rendered in the left pain by the template.
 36      *
 37      * @return DataObjectSet
 38      */
 39     public function get_menus() {
 40         $result = DataObject::get('CustomMenuHolder');
 41         return $result;
 42     }
 43 
 44     /**
 45      * Generate the editform, only if there is a URL ID available
 46      * @see cms/code/LeftAndMain#getEditForm($id)
 47      */
 48     function getEditForm($id = null) {
 49         if (!$id)
 50             $id = $this->urlParams['ID'];
 51 
 52         if ($id) {
 53             $currentMenu = DataObject::get_by_id('CustomMenuHolder', $id);
 54             // Create form fields
 55             $pagesManager = new FieldSet(
 56                             new TextField('OtherLink', 'OtherLink'),
 57                             new TreeDropdownField('PageLink', 'Страница', 'SiteTree')
 58             );
 59             $customMenus = DataObject::get('CustomMenuHolder')->toDropdownMap();
 60             $customMenus[0] = 'Не выбрано';
 61                     
 62             $menuManager = new DataObjectManager(
 63                 $this,
 64                 'Pages',
 65                 'CustomMenuItem',
 66                 array(
 67                     'Title' => 'Title',
 68                     'OtherLink' => 'OtherLink'
 69                 ),
 70                 null,
 71                 'ParentID = ' . $id
 72             );
 73         
 74             $fields = new FieldSet(
 75                             new HiddenField('ID', 'id #', $id),
 76                             new TabSet('Root',
 77                                     new Tab('Main',
 78                                             _t('CustomMenus.FormMain', 'Main'),
 79                                             new HeaderField('MenuHeading', _t('CustomMenus.FormMainHeader', 'Edit Menu')),
 80                                             new TextField('Title', _t('CustomMenus.FormMainTitle', 'Menu Title')),
 81                                             new TextField('Segment', _t('CustomMenus.FormMainSlug', 'Menu Slug (used in your control call)'))
 82                                     ), new Tab('Pages', _t('CustomMenus.FormPages', 'Pages'),
 83                                             new HeaderField('ManageMenu', 'Управление меню', 4),
 84                                             $menuManager
 85                                     )
 86                             )
 87             );
 88             
 89             $fields->addFieldToTab('Root.Pages', new HiddenField('ClassName', 'CustomMenuItem'));
 90             
 91             if (Director::isDev() && Member::currentUser()->isAdmin()) {
 92                 $actions = new FieldSet(
 93                                 new FormAction('doDeleteMenu', _t('CustomMenus.FormActionDelete', 'Delete Menu')),
 94                                 new FormAction('doUpdateMenu', _t('CustomMenus.FormActionUpdate', 'Update Menu'))
 95                 );
 96             } else {
 97                 $fields->removeByName('Main');
 98                 $actions = new FieldSet(
 99                                 new FormAction('doUpdateMenu', _t('CustomMenus.FormActionUpdate', 'Update Menu'))
100                 );
101             }
102             $this->extend('updateMenuHolderFields', $fields);
103             $form = new Form($this, "EditForm", $fields, $actions);
104             $form->loadDataFrom($currentMenu);
105             return $form;
106         }
107     }
108 
109     function leftMenuForm() {
110         if (Director::isDev() && Member::currentUser()->isAdmin()) {
111             // Create form fields
112             $fields = new FieldSet(
113                             new HiddenField('ID', 'id#', 'new')
114             );
115             $actions = new FieldSet(
116                             new FormAction('doCreateMenu', _t('CustomMenus.CreateMenu', 'Create Menu'))
117             );
118             $form = new Form($this, "LeftMenuForm", $fields, $actions);
119             return $form;
120         }
121         return false;
122     }
123 
124     function doUpdateMenu($data, $form) {
125         $id = $data['ID'];
126 
127         $record = DataObject::get_by_id("CustomMenuHolder", $id);
128         $record->Status = "Saved (update)";
129         $form->saveInto($record);
130 
131         if ($record->write()) {
132             FormResponse::status_message(_t('CustomMenus.UpdateSuccess', 'Updated Menu'), 'good');
133             FormResponse::update_status($record->Status);
134             FormResponse::set_node_title($id, $record->Title);
135             FormResponse::get_page($id);
136         } else {
137             FormResponse::status_message(_t('CustomMenus.UpdateFail', 'Update Failed'), 'bad');
138         }
139 
140         return FormResponse::respond();
141     }
142 
143     function doDeleteMenu($data, $form) {
144         if (Director::isDev() && Member::currentUser()->isAdmin()) {
145             $id = $data['ID'];
146 
147             $record = DataObject::get_by_id("CustomMenuHolder", $id);
148             $record->delete();
149 
150             FormResponse::add($this->deleteTreeNodeJS($record));
151             FormResponse::status_message(_t('CustomMenus.DeleteSuccess', 'Deleted Menu'), 'good');
152         } else {
153             FormResponse::status_message(_t('CustomMenus.DeleteFail', 'Delete Failed'), 'bad');
154         }
155         return FormResponse::respond();
156     }
157 
158     function doCreateMenu($data, $form) {
159         if (Director::isDev() && Member::currentUser()->isAdmin()) {
160             $menu = new CustomMenuHolder();
161             $menu->Title = 'New Menu';
162             $menu->Slug = "new-menu";
163 
164             if ($menu->write()) {
165                 FormResponse::status_message(_t('CustomMenus.CreateSuccess', 'Created Menu'), 'good');
166             } else
167                 FormResponse::status_message(_t('CustomMenus.CreateFail', 'Creation Failed'), 'bad');
168         }else {
169             FormResponse::status_message(_t('CustomMenus.CreateFail', 'Creation Failed'), 'bad');
170         }
171         return FormResponse::respond();
172     }
173 }
174 
[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