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

  • AdditionalMenuWidget
  • AdvancedSliderHomepageWidget
  • AuthFormWidget
  • BannerWidget
  • ButtonsBlockHomepageWidget
  • CallBackWidget
  • CarouselHomepageWidget
  • CartWidget
  • CatalogFilterSidebarWidget
  • CatalogRubricsHomepageWidget
  • ConsultantWidget
  • ContactsBlockWidget
  • CurrencyWidget
  • EventCalendarWidget
  • FAQHomepageWidget
  • FAQSidebarWidget
  • FavoriteProductsSidebarWidget
  • FeedbackHomepageWidget
  • GuestbookWidget
  • HomepageWidget
  • HomepageWidgetArea
  • HTMLBlockHomepageWidget
  • HTMLBlockSidebarWidget
  • PageMenuWidget
  • PhotoAlbumHomepageWidget
  • PhotoGalleryHomepageWidget
  • PhotoGalleryWidget
  • PollSidebarWidget
  • PriceListWidget
  • PublicationWidget
  • SearchWidget
  • SeparateHomepageWidget
  • SeparateSidebarWidget
  • SidebarWidget
  • SidebarWidgetArea
  • SliderHomepageWidget
  • SpecialCatalogHomepageWidget
  • SpecialCatalogSidebarWidget
  • SubscribeWidget
  • SubsectionMenuWidget
  • TextAnonsWidget
  • TextBlockHomepageWidget
  • TextBlockSidebarWidget
  • WeatherSidebarWidget
  • WebylonWidget
  • WebylonWidgetArea
  • WidgetAdmin
  • WidgetSortCMSActionDecorator
  • YandexMapsHomepageWidget
  • YandexMapsWidget
 1 <?php
 2 /**
 3  * Виджет "Погода" для боковой колонки
 4  * Позволяет добавить в боковую колону прогноз погоды
 5  *
 6  * @package widgets
 7  * @author  menedem
 8  */
 9 class WeatherSidebarWidget extends SidebarWidget {
10     
11     static $db = array(
12         'CityID' => 'Varchar(255)'
13     );
14     
15     static $cities = array(
16         'russia/kareliya/petrozavodsk' => 'Петрозаводск',
17         'russia/kareliya/belomorskiy-rayon/belomorsk' => 'Беломорск',
18         'russia/kareliya/pudozhskiy-rayon/pudozh' => 'Пудож',
19     );
20     
21     static function set_cities($cities) {
22         self::$cities = $cities;
23     }
24     
25     public $needObjects = array(
26         'PageInformerWeather' => 'Class'
27     );
28     
29     function getCMSFields() {
30         if (!$this->canCreate()) {
31             return $this->getFailCMSFields();
32         }
33         $fields = parent::getCMSFields();
34         $fields->addFieldToTab('Root.Main', new DropdownField('CityID', $this->fieldLabel('CityID'), self::$cities));
35         return $fields;
36     }
37     
38     function Title() {
39         return ($this->Title) ? $this->Title : $this->i18n_singular_name();
40     }
41 
42     function CMSTitle() {
43         return $this->Title();
44     }
45     
46     function Weather() {
47         if ($this->CityID) {
48             //PageInformerWeather::SetCityId($this->CityID);
49             $weather = singleton('PageInformerWeather')->WeatherInfo(2, $this->CityID);     
50             return $weather;
51         }
52         return false;
53     }
54     
55     function hasContent() {
56         if ($this->Weather()) {
57             return true;
58         }
59         return false;
60     }
61 }
62 
63 
[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