Datei: plugins/example.hellowidget.php
Quellcode
Darstellung:
-
<?php
- /**
- * Plugin example: Hello widget
- *
- */
- class HelloWidgetExample extends BMPlugin
- {
- function HelloWidgetExample()
- {
- $this->name = 'Hello widget example';
- $this->author = 'B1G Software';
- $this->web = 'http://www.b1g.de';
- $this->mail = 'info@b1g.de';
- $this->version = '1.1';
- $this->designedfor = '7.2.0';
- $this->type = BMPLUGIN_WIDGET;
-
- $this->widgetTitle = 'Hello!';
- $this->widgetTemplate = 'hello.widget.tpl';
- $this->widgetIcon = 'widget_welcome.png';
- $this->widgetPrefs = true;
- $this->widgetPrefsWidth = 320;
- $this->widgetPrefsHeight = 100;
- }
-
- function isWidgetSuitable($for)
- {
- return($for == BMWIDGET_START);
- }
-
- function renderWidget()
- {
- global $tpl, $userRow, $thisUser;
-
- $tpl->assign('hello_fullname', $userRow['vorname'] . ' ' . $userRow['nachname']);
- $tpl->assign('hello_testSetting', $thisUser->GetPref('helloWidget.testSetting'));
- }
-
- function renderWidgetPrefs()
- {
- global $tpl, $thisUser;
-
- if(isset($_POST['save']))
- {
- $thisUser->SetPref('helloWidget.testSetting', isset($_POST['testSetting']));
- $this->_closeWidgetPrefs(true);
- }
- else
- {
- $tpl->assign('testSetting', $thisUser->GetPref('helloWidget.testSetting'));
- $tpl->display($this->_templatePath('hello.widget.prefs.tpl'));
- }
- }
- }
-
- /**
- * register plugin
- */
- $plugins->registerPlugin('HelloWidgetExample');
- ?>