YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\BLOG\WIDGET\blogWidget Class Reference

Embed a blog on your website. More...

+ Inheritance diagram for YAWK\WIDGETS\BLOG\WIDGET\blogWidget:

Public Member Functions

 __construct ($db)
 Load all widget settings on object init. More...
 
 drawBlogWidget ($db)
 Draw the blog. More...
 
 init ($db)
 Init Gallery and load methods. More...
 
 printObject ()
 Print all object data. More...
 
- 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

 $blogHeading = ''
 
 $blogID = ''
 
 $blogLimitEntries = ''
 
 $blogSubtext = ''
 
 $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

Embed a blog on your website.

Embed plugin: blog

This is the widget to the blog plugin. With this widget you can embed any blog that you you've created before using the blog plugin. Simply set the ID of the blog you would like to embed, setup your settings, choose the position and page where you like to display your blog and you're good to go.

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 blogWidget.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::__construct (   $db)

Load all widget settings on object init.

Load all widget settings from database and fill object

Parameters
object$dbDatabase Object

Definition at line 39 of file blogWidget.php.

40  {
41  // load this widget settings from db
42  $this->widget = new \YAWK\widget();
43  $settings = $this->widget->getWidgetSettingsArray($db);
44  foreach ($settings as $property => $value) {
45  $this->$property = $value;
46  }
47  }
if(isset($_POST['save'])) $settings
$value

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

Member Function Documentation

◆ drawBlogWidget()

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::drawBlogWidget (   $db)

Draw the blog.

Parameters
dbobject Database object

(for development and testing purpose)

Parameters
$db\YAWK\db *
$widget\YAWK\widget

Definition at line 76 of file blogWidget.php.

77  {
78  /** @param $db \YAWK\db * */
79  error_reporting(1);
80  if (!isset($this->blogID) || (empty($this->blogID)))
81  {
82  echo "Error: unable to load blog because there was no blog ID given.";
83  }
84  else
85  { // include blog plugin base class
86  require_once 'system/plugins/blog/classes/blog.php';
87 
88  // include required JS files
89  /* echo "<script type=\"text/javascript\" src=\"../../../plugins/blog/js/comments.js\"></script>
90  <script type=\"text/javascript\" src=\"../../../plugins/blog/js/voting.js\"></script>";
91  */
92 
93 
94  /*
95  * FRONTEND BLOG PAGE
96  */
97  // create new blog object
98  $blog = new \YAWK\PLUGINS\BLOG\blog();
99 
100  /* a blog can be called by GET variable or via page include */
101  // assign blog ID
102  $blog->blogid = $this->blogID;
103 
104  // load global blog settings
105  $blog->loadBlogProperties($db, $blog->blogid);
106 
107  // for debug purpose
108  // print_r($blog);
109 
110  /* get templateID */
112 
113  // if blog is not offline, get entries from db + draw it on screen.
114  if ($blog->published != 0) {
115  /** @param $widget \YAWK\widget */
116  // get headline
117  $this->headline = $this->getHeading($this->blogHeading, $this->blogSubtext);
118 
119  if (!isset($blog->itemid)) {
120  $blog->itemid = 0;
121  }
122 
123  // load blog title
124  $blog->getTitle($db, $blog->blogid);
125 
126  // check if full view is set
127  if (!isset($full_view)) {
128  $full_view = 0;
129  }
130 
131  // load the blog entries into blog object
132  $blog->getFrontendEntries($db, $blog->blogid, $blog->itemid, $full_view, $this->blogLimitEntries);
133  // check footer setting and load it on demand
134  // if ($blog->getBlogProperty($db, $blog->blogid, "footer")) {
135  // $blog->getFooter($db);
136  // }
137  // finally: draw the blog
138  print $blog->draw();
139  print "</div>";
140  }
141  else
142  { // blog is not published, draw message
143  echo \YAWK\alert::draw("warning", "Entschuldigung!", "Dieser Bereich ist im Moment offline, da gerade daran gearbeitet wird. Bitte komm sp&auml;ter wieder.", "", "4800");
144  }
145  }
146  }
$blog
Definition: blog.php:122
$templateID
Definition: blog.php:9
static getCurrentTemplateId(object $db)
return ID of current (active) template
Definition: template.php:73
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669

References $blog, YAWK\WIDGETS\BLOG\WIDGET\blogWidget\$blogID, $db, $templateID, YAWK\template\getCurrentTemplateId(), and YAWK\widget\getHeading().

Referenced by YAWK\WIDGETS\BLOG\WIDGET\blogWidget\init().

◆ init()

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::init (   $db)

Init Gallery and load methods.

load Javascript and draw image gallery

Definition at line 64 of file blogWidget.php.

65  {
66  // $this->printObject();
67  $this->drawBlogWidget($db);
68  }
drawBlogWidget($db)
Draw the blog.
Definition: blogWidget.php:76

References $db, and YAWK\WIDGETS\BLOG\WIDGET\blogWidget\drawBlogWidget().

◆ printObject()

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::printObject ( )

Print all object data.

(for development and testing purpose)

Reimplemented from YAWK\widget.

Definition at line 53 of file blogWidget.php.

54  {
55  echo "<pre>";
56  print_r($this);
57  echo "</pre>";
58  }

Member Data Documentation

◆ $blogHeading

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::$blogHeading = ''
Parameters
stringTitle that will be shown above widget

Definition at line 24 of file blogWidget.php.

◆ $blogID

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::$blogID = ''
Parameters
intGallery ID

Definition at line 22 of file blogWidget.php.

Referenced by YAWK\WIDGETS\BLOG\WIDGET\blogWidget\drawBlogWidget().

◆ $blogLimitEntries

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::$blogLimitEntries = ''
Parameters
intLimit Entries (if 0 all items will be displayed) This can overrule the global blog setting and has only impact to the specific blog widget

Definition at line 30 of file blogWidget.php.

◆ $blogSubtext

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::$blogSubtext = ''
Parameters
stringSubtext will be displayed beside title

Definition at line 26 of file blogWidget.php.

◆ $widget

YAWK\WIDGETS\BLOG\WIDGET\blogWidget::$widget = ''
Parameters
objectglobal widget object data

Definition at line 20 of file blogWidget.php.


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