YaWK
24.1
Yet another WebKit
example.php
Go to the documentation of this file.
1
<?php
2
namespace
YAWK\WIDGETS\EXAMPLE\DEMO
3
{
4
/**
5
* @details<b>Empty Example Widget - for development and demo purpose</b>
6
*
7
* <p>This widget is (nearly) empty. It can be used to understand the logic behind YaWK's
8
* widget system and/or is a great base to start and create your very own widget! Simply
9
* add the properties your application needs, add the database, build your own functions
10
* and your widget is ready to run the code as you need it.</p>
11
*
12
*
13
* @author Daniel Retzl <
[email protected]
>
14
* @copyright 2018 Daniel Retzl
15
* @version 1.0.0
16
* @brief Example Widget (empty) for DEMO and development purpose!
17
*/
18
class
example
extends
\YAWK\widget
19
{
20
/** @param object global widget object data */
21
public
$widget
=
''
;
22
/** @param string Title that will be shown above widget */
23
public
$exampleHeading
=
''
;
24
/** @param string Subtext will be displayed beside title */
25
public
$exampleSubtext
=
''
;
26
27
/**
28
* @brief Load all widget settings from database and fill object
29
* @param object $db Database Object
30
* @brief Load all widget settings on object init.
31
*/
32
public
function
__construct
(
$db
)
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
}
40
}
41
42
/**
43
* @brief Print all object data
44
* @brief (for development and testing purpose)
45
*/
46
public
function
printObject
()
47
{
// output data to screen
48
echo
"<pre>"
;
49
print_r($this);
50
echo
"</pre>"
;
51
}
52
53
/**
54
* @brief Init example widget and call a function for demo purpose
55
* @brief Example Widget Init
56
*/
57
public
function
init
()
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.
68
}
69
70
public
function
showHeading
()
71
{
72
// draw headline on screen
73
return
$this->
getHeading
($this->exampleHeading, $this->exampleSubtext);
74
}
75
76
}
77
}
78
?>
YAWK\WIDGETS\EXAMPLE\DEMO\example
Example Widget (empty) for DEMO and development purpose!
Definition:
example.php:18
YAWK\WIDGETS\EXAMPLE\DEMO\example\__construct
__construct($db)
Load all widget settings from database and fill object.
Definition:
example.php:31
YAWK\WIDGETS\EXAMPLE\DEMO\example\init
init()
Init example widget and call a function for demo purpose.
Definition:
example.php:56
YAWK\WIDGETS\EXAMPLE\DEMO\example\printObject
printObject()
Print all object data.
Definition:
example.php:45
YAWK\WIDGETS\EXAMPLE\DEMO\example\$exampleHeading
$exampleHeading
Definition:
example.php:22
YAWK\WIDGETS\EXAMPLE\DEMO\example\showHeading
showHeading()
Definition:
example.php:69
YAWK\WIDGETS\EXAMPLE\DEMO\example\$widget
$widget
Definition:
example.php:20
YAWK\WIDGETS\EXAMPLE\DEMO\example\$exampleSubtext
$exampleSubtext
Definition:
example.php:24
YAWK\widget
Widgets are small, useful tools that you can include everywhere in your website.
Definition:
widget.php:22
YAWK\widget\getWidgetSettingsArray
getWidgetSettingsArray($db)
Get widget settings and return it as array.
Definition:
widget.php:69
YAWK\widget\getHeading
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition:
widget.php:669
$db
$db
Definition:
dismiss-notifications.php:4
YAWK\WIDGETS\EXAMPLE\DEMO
Definition:
example.php:2
$settings
if(isset($_POST['save'])) $settings
Definition:
settings-backend.php:46
$value
$value
Definition:
widget-edit.php:244
yawk.io
system
widgets
example
classes
example.php
Generated on Tue Jan 16 2024 21:59:03 for YaWK by
doxygen 1.9.1