YaWK  24.1
Yet another WebKit
YAWK\tipOfDay Class Reference

TipOfDay class serve functions to get and draw a tip of the day. More...

+ Inheritance diagram for YAWK\tipOfDay:

Public Member Functions

 drawTip ($db, $lang)
 Draw tip of the day. More...
 

Public Attributes

 $id = 1
 
 $published = 1
 
 $sortation = 0
 
 $tipClass = ""
 
 $tipHeading = ""
 
 $tipLink = ""
 
 $tipText = ""
 

Additional Inherited Members

- Static Public Member Functions inherited from YAWK\alert
static draw ($type, $title, $text, $redirect, $delay)
 

Detailed Description

TipOfDay class serve functions to get and draw a tip of the day.

Display the tip of the day. (if enabled)

This class handles all tip of the day functions. Tips are stored in cms_tips database. Example: <?php YAWK\tipOfDay::displayRandom($db); ?> To show a random tip of the day.

Class covers backend functionality. See Methods Summary for Details!

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

Definition at line 20 of file tipOfDay.php.

Member Function Documentation

◆ drawTip()

YAWK\tipOfDay::drawTip (   $db,
  $lang 
)

Draw tip of the day.

Parameters
object$dbdatabase object
array$langlanguage array
Returns
string

Definition at line 180 of file tipOfDay.php.

181  {
182  // get next tip on load, ordered by ID
183  $this->getNextTipData($db);
184  // or get random tip on load
185  // $this->getRandomTipData($db);
186 
187  if (isset($this->tipLink) && (!empty($this->tipLink)))
188  {
189  if (filter_var($this->tipLink, FILTER_VALIDATE_URL))
190  {
191  $this->tipText .= "<br><a href=\"#\">$this->tipLink</a>";
192  }
193  }
194  if (isset($this->tipHeading) && (empty($this->tipHeading)))
195  {
196  // todo: last message that tutorial is over?
197  return false;
198  }
199  else if (isset($this->tipText) && (empty($this->tipText)))
200  {
201  // todo: last message that tutorial is over?
202  return false;
203  }
204  else
205  {
206  if($this->setPublished($db, $this->id, 0) == false)
207  {
208  return "failed to set tip to zero";
209  }
210  $this->tipHeading = $lang[$this->tipHeading];
211  $this->tipText = $lang[$this->tipText];
212  return alert::draw("tipofday", "Tip #$this->id - $this->tipHeading", "$this->tipText", '', 10000);
213  }
214  }
print $lang['FILEMAN_UPLOAD']
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30

References $db, $lang, YAWK\tipOfDay\$tipHeading, YAWK\tipOfDay\$tipText, and YAWK\alert\draw().

Member Data Documentation

◆ $id

YAWK\tipOfDay::$id = 1

Definition at line 22 of file tipOfDay.php.

◆ $published

YAWK\tipOfDay::$published = 1

Definition at line 23 of file tipOfDay.php.

◆ $sortation

YAWK\tipOfDay::$sortation = 0

Definition at line 24 of file tipOfDay.php.

◆ $tipClass

YAWK\tipOfDay::$tipClass = ""

Definition at line 25 of file tipOfDay.php.

◆ $tipHeading

YAWK\tipOfDay::$tipHeading = ""

Definition at line 26 of file tipOfDay.php.

Referenced by YAWK\tipOfDay\drawTip().

◆ $tipLink

YAWK\tipOfDay::$tipLink = ""

Definition at line 28 of file tipOfDay.php.

◆ $tipText

YAWK\tipOfDay::$tipText = ""

Definition at line 27 of file tipOfDay.php.

Referenced by YAWK\tipOfDay\drawTip().


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