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

  • DashboardAdmin
  • DashboardPlugin
  • SiteInfo
  • WebylonNews
  1 <?php
  2  /**
  3   * Main dashboard class. Auto creates a link in the CMS by being extended from LeftAndMain.
  4   * 
  5   * @package Dashboard
  6   */
  7 class DashboardAdmin extends LeftAndMain {
  8     static $url_segment = 'dashboard';
  9     static $menu_title = 'Dashboard';
 10     static $menu_priority = 99;
 11     static $url_priority = 41;
 12 
 13     /**
 14      * @var $plugins = A colection of all the plugins available to the Dashboard. 
 15      *                 Loads all subclasses of DashboardPlugin
 16      */
 17     static $plugins = array();
 18     
 19     /**
 20      * @var $default_position = Default position that a plugin will have
 21      */
 22     static $default_position = 0;
 23 
 24     /**
 25      * Initialisation method called before accessing any functionality that RandomLinksAdmin has to offer
 26      */
 27     public function init() {
 28         parent::init();
 29 
 30         $vars = array(
 31             'Base' => Director::baseURL()
 32         );
 33         
 34         Requirements::css('dashboard/css/Dashboard.css');
 35         Requirements::insertHeadTags('<!--[if IE 6]><link type="text/css" href="dashboard/css/ie6.css" rel="stylesheet" media="screen" /><![endif]-->');
 36 
 37         
 38         Requirements::javascript('dashboard/javascript/greybox.js');
 39         Requirements::javascriptTemplate('dashboard/javascript/Dashboard.js',$vars);
 40 
 41         self::load_plugins();
 42     }
 43     
 44     /**
 45      * load_plugins gets all of the DashboardPlugin subclasses and loads them into the
 46      * $plugins class property.
 47      *
 48      * @return void
 49      */
 50     private static function load_plugins() {
 51         foreach(DashboardPlugin::$positions as $pos) 
 52             self::$plugins[$pos] = array();
 53             
 54         $classes = ClassInfo::subclassesFor("DashboardPlugin");
 55         
 56         if(is_array($classes)) {
 57             foreach($classes as $class) {
 58                 if($class != "DashboardPlugin" && !in_array($class,DashboardPlugin::get_disabled_plugins())) {
 59                     $SNG = singleton($class);
 60                     self::add_plugin($class, $SNG->stat('position'), $SNG->stat('sort'));
 61                 }
 62             }
 63         }
 64     }
 65 
 66     /**
 67      * Adds a plugin to the $plugins array, indexed by position, then sorted by class.
 68      *
 69      * @return void
 70      */ 
 71     private static function add_plugin($class, $pos, $sort) {
 72         if(!is_string($pos) || !in_array(strtolower($pos), DashboardPlugin::$positions))
 73             $pos = self::$default_position;
 74 
 75         if(!is_numeric($sort))
 76             $sort = 0;
 77 
 78         while(isset(self::$plugins[$pos][$sort]))
 79             $sort++;
 80 
 81         self::$plugins[$pos][$sort] = $class;
 82     }
 83 
 84     /**
 85      * Gets all plugins by the specified position, retaining sort given in load_plugins
 86      *
 87      * @return array
 88      */             
 89     private static function get_plugins_by_position($pos) {
 90         return self::$plugins[$pos];
 91     }
 92 
 93     /**
 94      * Gets all of the output of plugins of a given position. Helper for template functions
 95      *
 96      * @return DataObjectSet
 97      */ 
 98     private function Plugins($pos) {
 99         if($plugins = self::get_plugins_by_position($pos)) {
100             ksort($plugins);
101             $data = new DataObjectSet();
102             
103             foreach($plugins as $plugin) {
104                 $data->push(new ArrayData(array(
105                     'Plugin' => new $plugin(),
106                     'Class' => $plugin
107                 )));
108             }
109                         
110             return $data;
111        }
112        
113        return false;    
114     }
115 
116     /**
117      * Gets all of the output from the plugins with $position property set to that of $pos.
118      * These must be valid possitions found within DashboardPlugin::$positions
119      *
120      * @return DataObjectSet
121      */
122     public function get_plugins($pos = 'left') {
123         return $this->Plugins($pos);
124     }
125     
126     /**
127      * Returns the base site URL, that can be accessed from the template
128      * @return String - Site URL 
129      */
130     public function visit_site_link() {
131         return Director::baseURL();
132     }
133 }
134 
135 ?>
[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