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

  • BaseObjectCategory
  • BookingAdminPage
  • BookingPage
  • ErrorPage
  • ErrorPage_Controller
  • MediawebPage
  • Notifications
  • Page
  • Room
  • RoomCatalog
  • SiteConfig
  • SiteTree
  • SubsitesSelectorPage
  • SubsitesVirtualPage
  • SubsitesVirtualPage_Controller
  • VideoBankPage
  • VirtualPage
  • VirtualPage_Controller
  • VirtualProduct_Controller

Interfaces

  • HiddenClass
  1 <?php
  2 
  3 class VideoBankPage extends Page {
  4 
  5     static $icon = "video/images/video";
  6     static $allowed_children = array(
  7         'VideoBankPage'
  8     );
  9     static $can_be_root = true;
 10     static $has_many = array(
 11         'Items' => 'VideoEntry',
 12     );
 13     static $many_many = array(
 14         'Categories' => 'VideoCategory'
 15     );
 16 
 17     function getCMSFields() {
 18         $fields = parent::getCMSFields();
 19         $fields->findOrMakeTab('Root.Content.Category', 'Темы');
 20         $fields->findOrMakeTab('Root.Content.Video', 'Видео');
 21         $categoryManager = new ComplexTableField(
 22                         $this,
 23                         'Categories',
 24                         'VideoCategory'
 25         );
 26         $fields->addFieldToTab('Root.Content.Category', $categoryManager);
 27         //$videoManager = new ComplexTableField($this, 'Items', 'VideoEntry', array('Title'), 'getCMSFields_forPopup', '', "Created DESC");
 28         $videoManager = new VideoManager(
 29                         $this,
 30                         'Items',
 31                         'VideoEntry',
 32                         'SourceVideo',
 33                         array(
 34                             'Caption' => _t('VideoEntry.Title', 'Title')
 35                         ),
 36                         'getCMSFields_forPopup');
 37         $fields->addFieldToTab('Root.Content.Video', $videoManager);
 38         return $fields;
 39     }
 40 
 41     static function find_root_link() {
 42         $videoRoot = DataObject::get_one('VideoBankPage', 'ParentID=0');
 43         return $videoRoot->Link();
 44     }
 45     
 46     function onAfterDelete() {
 47         if ($this->IsDeletedFromStage && !$this->ExistsOnLive) {
 48             if ($this->Items()) {
 49                 foreach ($this->Items() as $item) {
 50                     $item->delete();
 51                 }
 52             }
 53         }
 54         parent::onAfterDelete();
 55     }
 56 }
 57 
 58 class VideoBankPage_Controller extends Page_Controller {
 59     /*
 60      * Список роликов
 61      */
 62 
 63     function init() {
 64         Requirements::javascript('video/javascript/flowplayer-3.2.4.min.js');
 65         Requirements::set_write_js_to_body(false);
 66         parent::init();
 67     }
 68 
 69     function index() {
 70         $filter = "VideoBankPageID = ".$this->ID;
 71         return $this->render(
 72                 array(
 73                     'Videos' => VideoEntry::get($filter,'SortOrder DESC', $this->getLimitPerPage())
 74                 )
 75         );
 76     }
 77 
 78     /*
 79      * Ролики по теме
 80      */
 81     function theme() {
 82         if (Director::urlParam('ID')) {
 83             $categoryTitle = Director::urlParam('ID');
 84             $videos = VideoCategory::getVideoByCategory(
 85                             $categoryTitle,
 86                             $this->getLimitPerPage()
 87             );
 88             return $this->render(
 89                     array(
 90                         'Category' => VideoCategory::getCategory($categoryTitle),
 91                         'Videos' => $videos
 92                     )
 93             );
 94         }
 95         return Director::redirect(VideoBankPage::find_root_link());
 96     }
 97 
 98     /*
 99      * Показывает ролик
100      */
101     function show() {
102         if (Director::urlParam('ID')) {
103             return $this->render(
104                     array(
105                         'Video' => VideoEntry::get_by_id((int) Director::urlParam('ID'))
106                     )
107             );
108         }
109         return Director::redirect(VideoBankPage::find_root_link());
110     }
111 
112     private function getLimitPerPage() {
113         $start = 0;
114         $sc = SiteConfig::current_site_config();
115         if (isset($_GET['start'])) {
116             if (is_numeric($_GET['start'])) {
117                 $start = (int) $_GET['start'];
118             }
119         }
120         return $start . ',' . $sc->VideoPerPage;
121     }
122 }
123 
[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