YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\EXAMPLE\DEMO\example Class Reference

Example Widget (empty) for DEMO and development purpose! More...

+ Inheritance diagram for YAWK\WIDGETS\EXAMPLE\DEMO\example:

Public Member Functions

 __construct ($db)
 Load all widget settings from database and fill object. More...
 
 init ()
 Init example widget and call a function for demo purpose. More...
 
 printObject ()
 Print all object data. More...
 
 showHeading ()
 
- Public Member Functions inherited from YAWK\widget
 getHeading ($heading, $subtext)
 Get widget heading and subtext, return headline. More...
 
 getWidgetSettingsArray ($db)
 Get widget settings and return it as array. More...
 

Public Attributes

 $exampleHeading = ''
 
 $exampleSubtext = ''
 
 $widget = ''
 
- Public Attributes inherited from YAWK\widget
 $data
 
 $date_publish
 
 $date_unpublish
 
 $folder
 
 $id
 
 $marginBottom
 
 $marginTop
 
 $name
 
 $pageID
 
 $position
 
 $published
 
 $sort
 
 $widgetTitle
 
 $widgetType
 

Additional Inherited Members

- Static Public Member Functions inherited from YAWK\widget
static getAllSettingsIntoArray ($db, $widgetID)
 Returns an array with all widget settings data. More...
 
static getAllWidgetTypes ($db)
 Return all widget types as associative array. More...
 
static getCurrentWidgetPath ($db)
 return current widget path More...
 
static getFacebookLikeBox ()
 return the facebook likebox widget More...
 
static getLoginBox ()
 return the user login box widget More...
 
static loadWidgetsOfPage ($db, $page)
 Returns an array of all widgets that are linked with given page->id. More...
 

Detailed Description

Example Widget (empty) for DEMO and development purpose!

Empty Example Widget - for development and demo purpose

This widget is (nearly) empty. It can be used to understand the logic behind YaWK's widget system and/or is a great base to start and create your very own widget! Simply add the properties your application needs, add the database, build your own functions and your widget is ready to run the code as you need it.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 17 of file example.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\EXAMPLE\DEMO\example::__construct (   $db)

Load all widget settings from database and fill object.

Parameters
object$dbDatabase Object

Load all widget settings on object init.

Definition at line 31 of file example.php.

33  {
34  // load this widget settings from db
35  $this->widget = new \YAWK\widget();
36  $settings = $this->widget->getWidgetSettingsArray($db);
37  foreach ($settings as $property => $value) {
38  $this->$property = $value;
39  }
if(isset($_POST['save'])) $settings
$value

References $db, $settings, $value, and YAWK\widget\getWidgetSettingsArray().

Member Function Documentation

◆ init()

YAWK\WIDGETS\EXAMPLE\DEMO\example::init ( )

Init example widget and call a function for demo purpose.

Example Widget Init

Definition at line 56 of file example.php.

58  { // call any function or method you have previously defined in this class
59  echo $this->showHeading();
60 
61  // e.g. if you want to output all data of this widget object, you can do this:
62  // (remove comments // of next line to see it in action)
63  // $this->printObject();
64 
65  // It is also possible, to call any other YaWK methods.
66  // In that case, make sure, you load the proper class before
67  // or use spl_autoload to achieve this automatically.

References YAWK\WIDGETS\EXAMPLE\DEMO\example\showHeading().

◆ printObject()

YAWK\WIDGETS\EXAMPLE\DEMO\example::printObject ( )

Print all object data.

(for development and testing purpose)

Reimplemented from YAWK\widget.

Definition at line 45 of file example.php.

47  { // output data to screen
48  echo "<pre>";
49  print_r($this);
50  echo "</pre>";

◆ showHeading()

YAWK\WIDGETS\EXAMPLE\DEMO\example::showHeading ( )

Definition at line 69 of file example.php.

71  {
72  // draw headline on screen
73  return $this->getHeading($this->exampleHeading, $this->exampleSubtext);
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669

References YAWK\widget\getHeading().

Referenced by YAWK\WIDGETS\EXAMPLE\DEMO\example\init().

Member Data Documentation

◆ $exampleHeading

YAWK\WIDGETS\EXAMPLE\DEMO\example::$exampleHeading = ''
Parameters
stringTitle that will be shown above widget

Definition at line 22 of file example.php.

◆ $exampleSubtext

YAWK\WIDGETS\EXAMPLE\DEMO\example::$exampleSubtext = ''
Parameters
stringSubtext will be displayed beside title

Definition at line 24 of file example.php.

◆ $widget

YAWK\WIDGETS\EXAMPLE\DEMO\example::$widget = ''
Parameters
objectglobal widget object data

Definition at line 20 of file example.php.


The documentation for this class was generated from the following file: