class Widget extends ModeleBoxes (View source)

Widget class

Known issue: This class is also affected by the same kind of issue as in DolibaseModule class (see module.php).

Fast solution:

  • Use Dolibase widget builder.

Properties

Widget $boxlabel
Widget $boximg
Widget $position
Widget $enabled

Methods

__construct($db, $param = '')

Constructor

$this
setTitle($title, $max = 5)

Set widget title

$this
setLink($link, $picture, $tooltip = '', $target = '_self', $class = 'center" style="vertical-align: middle;margin-right: 5px;')

Set widget link

$this
addContent($text, $attr = 'align="center"', $clean_text = false, $max_length, $first_col_attr = '')

Add content to widget

$this
newLine()

Add a new line to widget

void
showBox(array $head = null, array $contents = null, int $nooutput)

Method to show box. Called by Dolibarr eatch time it wants to display the box.

Details

__construct($db, $param = '')

Constructor

Parameters

$db Database handler
$param More widget options

$this setTitle($title, $max = 5)

Set widget title

Parameters

$title widget title
$max maximum number of rows to show (will be added to translated title if so)

Return Value

$this

Set widget link

Parameters

$link widget link
$picture link picture
$tooltip tooltip text
$target link target, use '' or '_blank' to open in a new window / tab
$class link css class

Return Value

$this

$this addContent($text, $attr = 'align="center"', $clean_text = false, $max_length, $first_col_attr = '')

Add content to widget

Parameters

$text text to show
$attr element attributes (align, colspan, ...)
$clean_text allow HTML cleaning & truncation
$max_length maximum text length (0 = disabled)
$first_col_attr first column attributes

Return Value

$this

$this newLine()

Add a new line to widget

Return Value

$this

void showBox(array $head = null, array $contents = null, int $nooutput)

Method to show box. Called by Dolibarr eatch time it wants to display the box.

Parameters

array $head Array with properties of box title
array $contents Array with properties of box lines
int $nooutput No print, only return string

Return Value

void