class IndexPage extends FormPage (View source)

IndexPage class

Properties

protected string $head from Page
protected string $title from Page
protected string $access_permission from Page
protected array $tabs from Page
protected array $main_subtitle from Page
protected string $tabs_picture from Page
protected string $tabs_title from Page
protected string $active_tab from Page
protected boolean $close_form from Page
protected boolean $close_table from Page
protected boolean $add_fiche_end from Page
protected string $rights_class from Page
protected string $modulepart from Page
protected array $assets from Page
object $form from FormPage
protected string $body from FormPage
protected array $fields from FormPage
protected int $stats_id

Methods

__construct($page_title, $access_perm = '')

Constructor

$this
setTitle($page_title)

Set page title.

from Page
$this
setMainSubtitle($title, $picture = 'title_generic.png')

Set page main subtitle.

from Page
$this
loadLang($lang_file, $is_module_file = true)

Load a language file

from Page
$this
loadLangs($lang_files_array, $from_module = false)

Load an array of language files

from Page
$this
appendToHead($content)

Append content to page head.

from Page
$this
addJsFile($js_file)

Add JS file to page head.

from Page
$this
addJsFiles($js_files_array)

Add an array of JS files.

from Page
$this
addCssFile($css_file)

Add CSS file to page head.

from Page
$this
addCssFiles($css_files_array)

Add an array of CSS files.

from Page
$this
addTab($title, $url, $is_active = false, $position = -1)

Add a tab to the page.

from Page
$this
setTabsPicture($picture)

Set tabs picture.

from Page
$this
setTabsTitle($title)

Set tabs title.

from Page
generateTabs($noheader)

Generate tabs

from Page
$this
addSubTitle($title, $picture = 'title_generic.png', $morehtmlright = '')

Add a subtitle

from Page
$this
openForm($action = 'create', $enctype = '')

Open a form only if not already opened

from Page
$this
closeForm()

Close an opened form

from Page
$this
openTable($header_columns = array(), $attr = 'class="noborder allwidth"', $print_fiche_head = false, $summary = '')

Opens a new html table

from Page
$this
closeTable($print_fiche_end = false)

Close an opened html table

from Page
$this
openRow($odd = true, $more_attr = '')

Open a table row

from Page
$this
closeRow()

Close a table row

from Page
$this
addColumn($content, $attr = '')

Add a table column

from Page
$this
addLineBreak($repeat)

Add a line break (or many)

from Page
string
getTemplatePath($template)

Return template absolute path

from Page
$this
showTemplate($template_path, $path_is_absolute = false, $use_require_once = false, $template_params = array())

Include a template into the page.

from Page
$this
underConstruction()

Show page_under_construction template (only once)

from Page
$this
notFound()

Show page_not_found template (only once)

from Page
loadDefaultActions()

Load default actions

from Page
$this
begin()

Generate page beginning

generate()

Generate page body

from FormPage
redirect($url)

Redirect to a url (alias for dolibase_redirect function).

from Page
end()

Generate page end

$this
setFields($fields)

Set page fields

from FormPage
boolean
checkFields()

Check page fields

from FormPage
boolean|int
checkField($field_name, $field_trans = '', $field_validation_rules = '', $return_err_number = false)

Check specified field

from FormPage
Field|empty
getField($field_name)

Return specified field if found

from FormPage
$this
askForConfirmation($url, $title, $question, $action, $question_param = '', $dialog_id_suffix = '')

Show a confirmation message

from FormPage
$this
appendToBody($content)

Append a content to page body

from FormPage
$this
openLeftSection()

Opens a left section

$this
closeLeftSection()

Close a left section

$this
openRightSection()

Opens a right section

$this
closeRightSection()

Close a right section

$this
addSearchForm($fields, $url, $title = 'Search', $summary = '')

Add a search form

$this
addStatsGraph($table_name, $field_name, $field_values = array(), $graph_type = 'pie', $graph_title = 'Statistics', $pk_field_name = 'rowid')

Add a statistics graph

$this
addStatsGraphFromData($data, $legend = array(), $graph_type = 'pie', $graph_title = 'Statistics')

Add a statistics graph from predefined data

Details

__construct($page_title, $access_perm = '')

Constructor

Parameters

$page_title HTML page title
$access_perm Access permission

$this setTitle($page_title)

Set page title.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$page_title Page title

Return Value

$this

$this setMainSubtitle($title, $picture = 'title_generic.png')

Set page main subtitle.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$title title
$picture subtitle picture

Return Value

$this

$this loadLang($lang_file, $is_module_file = true)

Load a language file

Parameters

$lang_file Language file
$is_module_file File is in module 'langs' directory or not

Return Value

$this

$this loadLangs($lang_files_array, $from_module = false)

Load an array of language files

Parameters

$lang_files_array Language files array
$from_module Files should be loaded from module 'langs' directory or not

Return Value

$this

$this appendToHead($content)

Append content to page head.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$content content to add

Return Value

$this

$this addJsFile($js_file)

Add JS file to page head.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$js_file Javascript file

Return Value

$this

$this addJsFiles($js_files_array)

Add an array of JS files.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$js_files_array Javascript files array

Return Value

$this

$this addCssFile($css_file)

Add CSS file to page head.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$css_file CSS file

Return Value

$this

$this addCssFiles($css_files_array)

Add an array of CSS files.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$css_files_array CSS files array

Return Value

$this

$this addTab($title, $url, $is_active = false, $position = -1)

Add a tab to the page.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$title tab title
$url tab url
$is_active should this tab be the activated one (true or false)
$position tab position (-1 means add to the end)

Return Value

$this

$this setTabsPicture($picture)

Set tabs picture.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$picture tabs picture

Return Value

$this

$this setTabsTitle($title)

Set tabs title.

Note: this function should be called before $page->begin() function, otherwise it will not work as expected.

Parameters

$title tabs title

Return Value

$this

protected generateTabs($noheader)

Generate tabs

Parameters

$noheader -1 or 0=Add tab header, 1=no tab header.

$this addSubTitle($title, $picture = 'title_generic.png', $morehtmlright = '')

Add a subtitle

Parameters

$title subtitle title
$picture subtitle picture
$morehtmlright more HTML to show on the right

Return Value

$this

$this openForm($action = 'create', $enctype = '')

Open a form only if not already opened

Parameters

$action form action
$enctype form enctype attribute

Return Value

$this

$this closeForm()

Close an opened form

Return Value

$this

$this openTable($header_columns = array(), $attr = 'class="noborder allwidth"', $print_fiche_head = false, $summary = '')

Opens a new html table

Parameters

$header_columns table header columns, e.: array( array('name' => 'Column1', 'attr' => 'align="center"'), array('name' => 'Column2', 'attr' => 'align="center" width="20"') )
$attr table attributes
$print_fiche_head print Dolibarr fiche head
$summary table summary

Return Value

$this

$this closeTable($print_fiche_end = false)

Close an opened html table

Parameters

$print_fiche_end print Dolibarr fiche end

Return Value

$this

$this openRow($odd = true, $more_attr = '')

Open a table row

Parameters

$odd row is odd or peer
$more_attr more attributes to add

Return Value

$this

$this closeRow()

Close a table row

Return Value

$this

$this addColumn($content, $attr = '')

Add a table column

Parameters

$content column content
$attr column attributes

Return Value

$this

$this addLineBreak($repeat)

Add a line break (or many)

Parameters

$repeat repeat line breaks

Return Value

$this

protected string getTemplatePath($template)

Return template absolute path

Parameters

$template template relative path or name

Return Value

string template absolute path

$this showTemplate($template_path, $path_is_absolute = false, $use_require_once = false, $template_params = array())

Include a template into the page.

Note: the template should be inside module tpl folder when $path_is_absolute parameter equal false.

Parameters

$template_path template path
$path_is_absolute define whether the template path is absolute or not
$use_require_once permit to avoid including the template many times on the same page
$template_params template parameters

Return Value

$this

$this underConstruction()

Show page_under_construction template (only once)

Return Value

$this

$this notFound()

Show page_not_found template (only once)

Return Value

$this

protected loadDefaultActions()

Load default actions

$this begin()

Generate page beginning

Return Value

$this

protected generate()

Generate page body

redirect($url)

Redirect to a url (alias for dolibase_redirect function).

Note: this function should be called before any output, so before $page->begin() function.

Parameters

$url

end()

Generate page end

$this setFields($fields)

Set page fields

Parameters

$fields array of fields

Return Value

$this

boolean checkFields()

Check page fields

Return Value

boolean true or false

boolean|int checkField($field_name, $field_trans = '', $field_validation_rules = '', $return_err_number = false)

Check specified field

Parameters

$field_name Field name
$field_trans Field translation
$field_validation_rules Field validatin rules
$return_err_number return errors number or boolean value

Return Value

boolean|int true/false | errors number

protected Field|empty getField($field_name)

Return specified field if found

Parameters

$field_name

Return Value

Field|empty field object or empty value

$this askForConfirmation($url, $title, $question, $action, $question_param = '', $dialog_id_suffix = '')

Show a confirmation message

Parameters

$url Page url
$title Message title
$question Message question / content
$action Action to do after confirmation
$question_param Question parameter
$dialog_id_suffix Dialog id suffix (used to show the dialog without reloading the page)

Return Value

$this

$this appendToBody($content)

Append a content to page body

Parameters

$content content to add

Return Value

$this

$this openLeftSection()

Opens a left section

Return Value

$this

$this closeLeftSection()

Close a left section

Return Value

$this

$this openRightSection()

Opens a right section

Return Value

$this

$this closeRightSection()

Close a right section

Return Value

$this

$this addSearchForm($fields, $url, $title = 'Search', $summary = '')

Add a search form

Parameters

$fields an array of form fields, e.: array('Field 1' => 'field_name')
$url form url
$title form title
$summary form summary

Return Value

$this

$this addStatsGraph($table_name, $field_name, $field_values = array(), $graph_type = 'pie', $graph_title = 'Statistics', $pk_field_name = 'rowid')

Add a statistics graph

Parameters

$table_name Table name (without prefix)
$field_name Table field name
$field_values Table field values, e.: array(0 => 'Status 1', 1 => 'Status 2')
$graph_type Type of graph ('pie', 'bars', 'lines')
$graph_title Graph title
$pk_field_name Table primary key name

Return Value

$this

$this addStatsGraphFromData($data, $legend = array(), $graph_type = 'pie', $graph_title = 'Statistics')

Add a statistics graph from predefined data

Parameters

$data Data to show
$legend Legend array
$graph_type Type of graph ('pie', 'bars', 'lines')
$graph_title Graph title

Return Value

$this