YaWK  24.1
Yet another WebKit
bubblus.php
Go to the documentation of this file.
1 <?php
3 {
4  /**
5  * @details<b>Embed any bubbl.us mindmap on your page.</b>
6  *
7  * <p>Bubbl.us is a service, where you can create mindmaps and share them with your friends and the web.
8  * With this widget, you are able to embed any public Bubbl.us mindmaps. Simply enter the URL of your
9  * mindmap and a view settings. Embedding and sharing mindmaps has never been easier.</p>
10  *
11  *
12  * @author Daniel Retzl <[email protected]>
13  * @copyright 2018 Daniel Retzl
14  * @version 1.0.0
15  * @brief Embed Bubbl.us Presentations on your pages.
16  */
17  class bubblus
18  {
19  /** @param object global widget object data */
20  public $widget = '';
21  /** @param string URL of your bubblus presentation */
22  public $bubblusUrl = '';
23  /** @param string Width in percent */
24  public $bubblusWidth = '100%';
25  /** @param string Height in px */
26  public $bubblusHeight = '370';
27  /** @param string Heading */
28  public $bubblusHeading = '';
29  /** @param string Subtext */
30  public $bubblusSubtext = '';
31  /** @param string Headline HTML Markup */
32  public $bubblusHeadline = '';
33 
34  /**
35  * @brief Load all widget settings from database and fill object
36  * @param object $db Database Object
37  * @brief Load all widget settings on object init.
38  */
39  public function __construct($db)
40  {
41  // load this widget settings from db
42  $this->widget = new \YAWK\widget();
44  foreach ($settings as $property => $value) {
45  $this->$property = $value;
46  }
47  }
48 
49  /**
50  * @brief Print all object data
51  * @brief (for development and testing purpose)
52  */
53  public function printObject()
54  {
55  echo "<pre>";
56  print_r($this);
57  echo "</pre>";
58  }
59 
60  /**
61  * @brief Set widget properties from database and fill object params
62  * @brief Load all widget settings.
63  */
64  public function setProperties()
65  {
66  // if a heading is set and not empty
67  if (isset($this->bubblusHeading) && (!empty($this->bubblusHeading)))
68  {
69  // if subtext is set, add <small> subtext to string
70  if (isset($this->bubblusSubtext) && (!empty($this->bubblusSubtext)))
71  { // build a headline with heading and subtext
72  $this->bubblusSubtext = "<small>$this->bubblusSubtext</small>";
73  $this->bubblusHeadline = "<div id=\"bubblusHeading\"><h1>$this->bubblusHeading&nbsp;"."$this->bubblusSubtext</h1></div>";
74  }
75  else
76  { // build just a headline - without subtext
77  $this->bubblusHeadline = "<h1>$this->bubblusHeading</h1>"; // draw just the heading
78  }
79  }
80  else
81  { // leave empty if it's not set
82  $this->bubblusHeadline = '';
83  }
84 
85  // prepare url
86  if (isset($this->bubblusUrl) && (!empty($this->bubblusUrl)))
87  { // remove trailing slash
88  $this->bubbleusUrl = rtrim("/", $this->bubblusUrl);
89  }
90  }
91 
92  /**
93  * @brief Embed any BubblUs mindmaps
94  * @brief This method does the setup and embed job
95  */
96  public function init()
97  {
98  // set widget obj properties
99  $this->setProperties();
100  // draw headline, if set
101  echo "$this->bubblusHeadline";
102  // embed mindmap via iframe...
103  echo "<iframe width=\"$this->bubblusWidth\" height=\"$this->bubblusHeight\" allowfullscreen frameborder=\"0\" src=\"$this->bubblusUrl\"></iframe>";
104  }
105  }
106 }
Embed Bubbl.us Presentations on your pages.
Definition: bubblus.php:17
__construct($db)
Load all widget settings from database and fill object.
Definition: bubblus.php:38
printObject()
Print all object data.
Definition: bubblus.php:52
setProperties()
Set widget properties from database and fill object params.
Definition: bubblus.php:63
init()
Embed any BubblUs mindmaps.
Definition: bubblus.php:95
Widgets are small, useful tools that you can include everywhere in your website.
Definition: widget.php:22
getWidgetSettingsArray($db)
Get widget settings and return it as array.
Definition: widget.php:69
if(isset($_POST['save'])) $settings
$value