CSGuiToolbar
in package
The CSGuiToolbar provides an vertical or horizontal CONTENTSERV Toolbar
For each button can be definied the visiblity. If it is set the button is hidden at startup. The visibility has the form GROUP:NAME with GROUP the type of the buttongroup and name the name in the group, e.g. Tab:General, HtmlEditor:bold If any event (e.g. changing a tab or selecting a HtmlEditor) calls the showToolbarButtons method for a given group all buttons within this group, which are not in the list are hidden and all others are shown At the moment the visibility works only for vertical and horizontal toolbars.
This class has no public constructor, use the factory method instead.
Tags
Table of Contents
- $_hideEmptyToolbar : mixed
- $buttons : mixed
- $id : mixed
- $rightTitle : mixed
- $showMouseOverEffects : mixed
- $toolbar : mixed
- $type : mixed
- __construct() : mixed
- activateRichEditorMode() : string
- Changes the toolbar type to RICH, so that the rich editor can load own toolbar to the defined html element.
- addButton() : CSGuiToolbarButton
- Adds a button to the toolbar
- addCheckboxButton() : CSGuiToolbarButton
- Adds a checkbox button to the toolbar
- addChoice() : CSGuiToolbarButton
- Adds a select component to the toolbar This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_HORIZONTAL
- addComponent() : CSGuiToolbarButton
- Adds an arbitrary html code to the toolbar
- addHandle() : CSGuiToolbarButton
- Adds a toolbar handle This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL
- addSeparator() : CSGuiToolbarButton
- Adds a toolbar separator This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL
- addTextfield() : CSGuiToolbarButton
- Adds a text input to the toolbar
- addToggleButton() : CSGuiToolbarButton
- Adds a toggle button to the toolbar
- createToolbar() : mixed
- disableMouseOverEffects() : void
- Disables the mouse hover effects to avoid flickering on some pages
- getButton() : CSGuiToolbarButton
- returns the toolbar button that maches the $nameOrIndex parameter
- getButtons() : array<string|int, CSGuiToolbarButton>
- Returns all defined buttons of this toolbar
- getRightSubTitle() : mixed
- Gets the right sub title of the toolbar
- getRightTitle() : mixed
- Gets the right title of the toolbar
- hideEmptyToolbar() : mixed
- makeHtml() : string
- Returns the html representation of the toolbar
- makeToolbarHtml() : mixed
- removeAllButtons() : mixed
- removeButton() : void
- removes a button from the toolbar
- removeDuplicates() : mixed
- setDefaultToolbar() : mixed
- setRightTitle() : mixed
- Sets the right title of the toolbar
Properties
$_hideEmptyToolbar
public
mixed
$_hideEmptyToolbar
= \false
Tags
$buttons
public
mixed
$buttons
= array()
Tags
$id
public
mixed
$id
Tags
$rightTitle
public
mixed
$rightTitle
Tags
$showMouseOverEffects
public
mixed
$showMouseOverEffects
= \true
Tags
$toolbar
public
mixed
$toolbar
= \null
Tags
$type
public
mixed
$type
Tags
Methods
__construct()
public
__construct([mixed $type = CSGUI_TOOLBAR_TYPE_HORIZONTAL_LARGE ][, mixed $id = '' ]) : mixed
Parameters
- $type : mixed = CSGUI_TOOLBAR_TYPE_HORIZONTAL_LARGE
- $id : mixed = ''
Tags
Return values
mixed —activateRichEditorMode()
Changes the toolbar type to RICH, so that the rich editor can load own toolbar to the defined html element.
public
activateRichEditorMode([string $sNewId = '' ]) : string
Parameters
- $sNewId : string = ''
-
The toolbar ID.
Tags
Return values
string —addButton()
Adds a button to the toolbar
public
addButton(string $image, string $title[, string $href = '#' ][, string $target = '_self' ][, string $onclick = '' ][, string $accesskey = '' ][, string $id = '' ][, string $visibility = '' ][, string $menubar = 'GUI_MENU_FILE' ][, string $additionalAttributes = '' ][, string $index = -1 ]) : CSGuiToolbarButton
Parameters
- $image : string
-
the image of the button relative to the admin/images/toolbar or in case of the CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL relative to the admin/images/popup directory
- $title : string
-
the text or tooltip title of the button
- $href : string = '#'
-
the link of the button
- $target : string = '_self'
-
the target of the link of the button
- $onclick : string = ''
-
javascript code to be evaluated onClick
- $accesskey : string = ''
-
the keybord accelerator to navigate to the button with the alt key
- $id : string = ''
-
an optional id of the toolbar if you want to use more than one toolbar at the same time
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
- $menubar : string = 'GUI_MENU_FILE'
-
the popupmenu in the menubar the button should be displayed or '' if it should not be displayed
- $additionalAttributes : string = ''
-
additional attributes which should be added to the button
- $index : string = -1
-
either the index as a number or in the form GUI_MENU_UPDATE+1 to define the position of the toolbar button in the toolbar. If set to -1 it is appended to the end
Tags
Return values
CSGuiToolbarButton —the created button object
addCheckboxButton()
Adds a checkbox button to the toolbar
public
addCheckboxButton(string $image, array<string|int, mixed> $titles[, array<string|int, mixed> $hrefs = array('#') ][, array<string|int, mixed> $targets = array('_self') ][, array<string|int, mixed> $onclicks = array('') ][, bool $defaultState = true ][, string $accesskey = '' ][, string $id = '' ][, string $visibility = '' ][, string $menubar = 'GUI_MENU_FILE' ][, string $additionalAttributes = '' ][, string $groupName = '' ]) : CSGuiToolbarButton
Parameters
- $image : string
-
the images of the button relative to the admin/images/toolbar or in case of the CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL relative to the admin/images/popup directory
- $titles : array<string|int, mixed>
-
the text or tooltip title of the button
- $hrefs : array<string|int, mixed> = array('#')
-
the links of the button
- $targets : array<string|int, mixed> = array('_self')
-
the targets of the link of the button
- $onclicks : array<string|int, mixed> = array('')
-
javascript code to be evaluated onClick if this javascript functions return the boolean value 'false' the button toggle is canceld
- $defaultState : bool = true
-
the default state of the button (true => first state is used, false => second state is used)
- $accesskey : string = ''
-
the keybord accelerator to navigate to the button with the alt key
- $id : string = ''
-
an optional id of the toolbar if you want to use more than one toolbar at the same time
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
- $menubar : string = 'GUI_MENU_FILE'
-
the popupmenu in the menubar the button should be displayed or '' if it should not be displayed
- $additionalAttributes : string = ''
-
additional attributes which should be added to the button
- $groupName : string = ''
-
a string with a group name. Only one button of a group can be active at the same time
Tags
Return values
CSGuiToolbarButton —the created button object
addChoice()
Adds a select component to the toolbar This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_HORIZONTAL
public
addChoice([array<string|int, mixed> $options = array() ][, string $title = '' ][, string $onChange = '' ][, string $selectedValue = '' ][, string $width = '' ][, string $id = '' ][, mixed $visibility = '' ]) : CSGuiToolbarButton
Parameters
- $options : array<string|int, mixed> = array()
-
an array with options to be added, uses the keys of the array as option values and the values as labels
- $title : string = ''
-
the text or tooltip title of the select
- $onChange : string = ''
-
javascript code to be evaluated onChange
- $selectedValue : string = ''
-
an preselected value
- $width : string = ''
-
the width of the select component, add px or % as unit
- $id : string = ''
-
an optional id of the select component
- $visibility : mixed = ''
Tags
Return values
CSGuiToolbarButton —the created button object
addComponent()
Adds an arbitrary html code to the toolbar
public
addComponent(string $html[, string $title = "" ][, string $visibility = '' ]) : CSGuiToolbarButton
Parameters
- $html : string
-
the code to be added
- $title : string = ""
-
the text or tooltip title of the button
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
Tags
Return values
CSGuiToolbarButton —the created button object
addHandle()
Adds a toolbar handle This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL
public
addHandle([string $visibility = '' ]) : CSGuiToolbarButton
Parameters
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
Tags
Return values
CSGuiToolbarButton —the created button object
addSeparator()
Adds a toolbar separator This method only affects toolbars with type CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL
public
addSeparator([string $visibility = '' ]) : CSGuiToolbarButton
Parameters
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
Tags
Return values
CSGuiToolbarButton —the created button object
addTextfield()
Adds a text input to the toolbar
public
addTextfield(string $name, string $onsubmit[, string $title = '' ][, string $id = '' ][, string $visibility = '' ]) : CSGuiToolbarButton
Parameters
- $name : string
-
the name of the textfield
- $onsubmit : string
-
the js code which is called when pressing enter
- $title : string = ''
-
the text or tooltip title next to the textfield
- $id : string = ''
-
the id of the input
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
Tags
Return values
CSGuiToolbarButton —the created button object
addToggleButton()
Adds a toggle button to the toolbar
public
addToggleButton(array<string|int, mixed> $images, array<string|int, mixed> $titles[, array<string|int, mixed> $hrefs = array('#') ][, array<string|int, mixed> $targets = array('_self') ][, array<string|int, mixed> $onclicks = array('') ][, bool $defaultState = true ][, string $accesskey = '' ][, string $id = '' ][, string $visibility = '' ][, string $menubar = 'GUI_MENU_FILE' ][, string $additionalAttributes = '' ]) : CSGuiToolbarButton
Parameters
- $images : array<string|int, mixed>
-
the images of the button relative to the admin/images/toolbar or in case of the CSGUI_TOOLBAR_TYPE_VERTICAL or CSGUI_TOOLBAR_TYPE_HORIZONTAL relative to the admin/images/popup directory
- $titles : array<string|int, mixed>
-
the text or tooltip title of the button
- $hrefs : array<string|int, mixed> = array('#')
-
the links of the button
- $targets : array<string|int, mixed> = array('_self')
-
the targets of the link of the button
- $onclicks : array<string|int, mixed> = array('')
-
javascript code to be evaluated onClick if this javascript functions return the boolean value 'false' the button toggle is canceld
- $defaultState : bool = true
-
the default state of the button (true => first state is used, false => second state is used)
- $accesskey : string = ''
-
the keybord accelerator to navigate to the button with the alt key
- $id : string = ''
-
an optional id of the toolbar if you want to use more than one toolbar at the same time
- $visibility : string = ''
-
the visibility with the form GROUP:NAME
- $menubar : string = 'GUI_MENU_FILE'
-
the popupmenu in the menubar the button should be displayed or '' if it should not be displayed
- $additionalAttributes : string = ''
-
additional attributes which should be added to the button
Tags
Return values
CSGuiToolbarButton —the created button object
createToolbar()
public
createToolbar() : mixed
Tags
Return values
mixed —disableMouseOverEffects()
Disables the mouse hover effects to avoid flickering on some pages
public
disableMouseOverEffects([bool $disable = true ]) : void
Parameters
- $disable : bool = true
-
whether the mouse over effects should be disabled or not
Tags
Return values
void —getButton()
returns the toolbar button that maches the $nameOrIndex parameter
public
getButton(mixed $nameOrIndex) : CSGuiToolbarButton
Parameters
- $nameOrIndex : mixed
-
the title or index of the button
Tags
Return values
CSGuiToolbarButton —the button that matches the $nameOrIndex parameter
getButtons()
Returns all defined buttons of this toolbar
public
getButtons() : array<string|int, CSGuiToolbarButton>
Tags
Return values
array<string|int, CSGuiToolbarButton> —the buttons
getRightSubTitle()
Gets the right sub title of the toolbar
public
getRightSubTitle() : mixed
Tags
Return values
mixed —getRightTitle()
Gets the right title of the toolbar
public
getRightTitle() : mixed
Tags
Return values
mixed —hideEmptyToolbar()
public
hideEmptyToolbar(mixed $hide) : mixed
Parameters
- $hide : mixed
Tags
Return values
mixed —makeHtml()
Returns the html representation of the toolbar
public
makeHtml() : string
Tags
Return values
string —html code of the toolbar
makeToolbarHtml()
public
makeToolbarHtml([mixed $orientation = 'Vertical' ]) : mixed
Parameters
- $orientation : mixed = 'Vertical'
Tags
Return values
mixed —removeAllButtons()
public
removeAllButtons() : mixed
Tags
Return values
mixed —removeButton()
removes a button from the toolbar
public
removeButton(string $title) : void
Parameters
- $title : string
-
the title of the button to remove
Tags
Return values
void —removeDuplicates()
public
removeDuplicates() : mixed
Tags
Return values
mixed —setDefaultToolbar()
public
setDefaultToolbar(mixed $toolbar) : mixed
Parameters
- $toolbar : mixed
Tags
Return values
mixed —setRightTitle()
Sets the right title of the toolbar
public
setRightTitle(mixed $title[, mixed $subtitle = '' ][, mixed $tooltip = '' ]) : mixed
Parameters
- $title : mixed
- $subtitle : mixed = ''
- $tooltip : mixed = ''
