Files
dolibarr/htdocs/admin/tools/ui/class/documentation.class.php
John BOTELLA 3d88e03c88 UIUX : Dolibarr js context from experimental to core (#37228)
* NEW Use the js lib into htdocs/public/includes instead of htdocs/includes

* New LNE Collect of buisness informations (#37084)

* Working LNE ping

* remove GPDA

* Add of other informations

* remove testing var

* fix Ci

* fix Ci

* fix ci

* fix CI

* Fix Ci

* fix Ci

---------

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>

* CI

* CI

* CI

* CI

* Clean code. File not used.

* CSS

* CSS

* Fix phpunit

* More legal info

* CI

* Fix CI

* Fix: IRPF tax not applied when creating invoice from project times (#37077)

* Remove 'supplier_invoice' from old path array

* Update module path in arrayforoldpath

Sorry Eldy, I was confused. You are absolutely right, it is already corrected.

* Replace localtax2 assignment with get_localtax function


Error when creating an invoice with personal income tax from project times. The rate does not apply

* Refactor localtax1 calculation using get_localtax

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix: IRPF tax not applied when creating invoice from project times (#37077)

* Remove 'supplier_invoice' from old path array

* Update module path in arrayforoldpath

Sorry Eldy, I was confused. You are absolutely right, it is already corrected.

* Replace localtax2 assignment with get_localtax function


Error when creating an invoice with personal income tax from project times. The rate does not apply

* Refactor localtax1 calculation using get_localtax

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Protect module

* Add currency

* CSS

* WIP LNE

* Fix navigation

* cs

* Debug registration process

* Debug setup navigation

* CI

* CI

* Factorize code

* Fix CI

* Fix CI

* Fix CI

* CI

* CI

* CI

* CI

* Disable phan on v23

* CI

* CI

* FIX: missing include for blockedlog lib (#37165)

* Debug CI

* fix ternary always true (#37161)

* fix ternary always true

* Update requests.php

* Update registration.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* CI

* FIX: missing include for blockedlog lib (#37165)

* FIX #37134 Use json_encode for IMAP search logging in EmailCollector (#37135)

var_export() produces multiline output that breaks log aggregators
(Loki, Splunk, Elasticsearch) as each line becomes a separate log entry.

Using json_encode() produces single-line structured output that works
correctly with all log aggregation tools.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Populate syslog with placeholder (#37163)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Doc

* datamodel for user change password next time (#37155)

* Qual: Update phan baseline (#37172)

* Fix typo in file path (#37160)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix phpunit

* Complete call to setStatus so we have a trigy as 4th parameter (help to
fix the #37129)

* FIX Product - Warning on admin (#37157)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* FIX Product - Warning on admin + CSS (#37158)

* FIX Product - Warning on admin

* CSS

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* CI

* CI

* CI

* Avoid error if include fails

* More functions in blacklist (even if nw we use the whitelist by default)

* #37166 [SQL] add: email template for ticket admin creation (#37182)

* Replace var_export with new function formatLogObject (#37178)

* FIX BOM - Class product missing, column offset and information recording (form/input overlap) in admin (#37177)

* FIX BOM - Class product missing in admin

* Fix column offset and information recording (form/input overlap)

* ci

* ci

* FIX Intracommreport - Warning & link problem on tab (#37176)

* FIX Bank transfer admin - Warning & save 0 on constant PAYMENTBYBANKTRANSFER_ADDDAYS (#37175)

* Look and feel v24

* Update default time handling in index.php (#37150)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix file path comment in supplier invoice module (#37133)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix file path comment in supplier invoice module (#37133)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix CI

* Add template in migration

* fix phpdoc comment (#37184)

* fix phpdoc comment

* fix phpdoc comment

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* CI

* Fix phpstan

* Replace var_export by formatLogObject (continued) (#37188)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Debug amount suggested on membership public form

* Issue 36923 Fix session title handling in survey creation (#37105)

* Issue 36923 Fix session title handling in survey creation

* Change input field to use id attribute for title

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* fix phpstan errors blocking action baseline (#37189)

* fix phpstan errors blocking action baseline

* fix phpstan errors blocking action baseline

* fix phpstan errors blocking action baseline

* fix phpstan errors blocking action baseline

* fix phpstan errors blocking action baseline

* refresh baseline

* QUAL Replace var_export() with json_encode() in dol_syslog() calls (#37138)

var_export() produces multiline output that breaks log aggregators
(Loki, Splunk, Elasticsearch, Graylog) as each line becomes a separate
log entry.

json_encode() produces single-line structured output that works correctly
with all log aggregation tools. This pattern is already used elsewhere
in Dolibarr (accountancy, install modules).

Files changed:
- core/class/commoninvoice.class.php (payment intent logging)
- core/class/commonobject.class.php (payment terms logging)
- core/modules/mailings/advthirdparties.modules.php (mailing targets)
- core/modules/oauth/google_oauthcallback.php (userinfo logging)
- core/modules/oauth/generic_oauthcallback.php (userinfo logging)
- public/payment/newpayment.php (GET/POST debug logging)
- public/payment/paymentok.php (payment tag logging)
- public/stripe/ipn.php (Stripe event data logging)
- paypal/lib/paypal.lib.php (PayPal response logging)
- api/index.php (API debug logging)
- stripe/class/stripe.class.php (payment/setup intent logging)

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix CI

* CI

* Check if upload_max_filesize is not empty

* clean code

* Debug v23

* CI

* Fix #33521 VAT total false (#36990)

* - Fix #33521 VAT total false
- Fix some warnings
- Fix : delete $this->vat_rate

* - Fix #33521 VAT total false
- Fix some warnings
- Fix  :delete $this->tva array (replaced by $this->tva_array)

* - Fix #33521 VAT total false
- Fix some warnings
- Fix  :delete $this->tva array (replaced by $this->tva_array)

* Update pdf_octopus.modules.php

* Update pdf_octopus.modules.php

* Update pdf_octopus.modules.php

* Update pdf_octopus.modules.php

* Update pdf_octopus.modules.php

---------

Co-authored-by: vmaury <vmaury@vmaury-Lafite-Pro-16-AMD>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* NEW #25829 Automatically send the invoice generated from a template (#36967)

* Update DB

* ADD email template

* Ajout d'une clé de trad

* Ajout des traductions

* Suppression des traductions, sauf en_US

* Add flag auto send

* Modif form + cron auto send

* Suppression auto_send

* correction loopError

* ajout du selected au model de mail

* Prise en compte default model

* Fix pre-commit

* ménage

* precommit

* Correction Phan

* Correction Phan

* Correction, double cal du trigger

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Develop force user change pass userclass (#37174)

* datamodel for user change password next time

* add force_pass_change in user object

* Initialize force_pass_change to 0

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Another step for #37171

* Qual: Partial phan run on PR's, complete run on integration branches (#37186)

* Qual: Partial phan run on PR's, complete on main

# Qual: Partial phan run on PR's, complete on main

The selection is based on the branch name.
To run a complete phan run in a PR, the branch name of the PR must include phan_full.
This can help to fix remaining phan issue before re-integrating to the develop branch.

* qual: Update workflow and pre-commit configurations

- Enable phan workflow by uncommenting the relevant lines
- Update actionlint version to v1.7.10
- Add manual stage to actionlint hook in pre-commit-config.yaml

* qual: Update Phan analysis conditions

The conditions for running Phan analysis have been updated to include an additional check for branches containing 'phan_full'.

* qual: Update Phan workflow

- Replace github.event.ref with github.ref_name
- Add FILE_CHANGE_LIST environment variable for better file handling
- Update file list creation and usage in the workflow

* qual: Update Phan workflow conditions

Fix the branch reference (head_ref in PR, ref_name otherwise)

* Add step for debug information

* Remove debug step

* Fix: Missing initialisations members/new.php

Following a suppression of assignments, the variables disabledphy and disabledmor were undefined.

* fix: Update budget selection dropdown arguments in member creation form

Correct the arguments in the member creation form.

* qual: Add cs2pr to phan workflow

- Add cs2pr to the tools list in the phan workflow
- Change the output mode of phan to checkstyle
- Add a step to add results to PR as Github notices
- Add a step to provide phan log as artifact

* qual: Update Phan workflow to use environment variable for file list

The change fixes the Phan workflow to use the environment variable `$FILE_CHANGED_LIST` to clear the file

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix phan

* Fix phan

* Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0

* Doc

* Qual: Fix ambigious redirect error on Phan workflow (#37200)

# Qual: Fix ambigious redirect error on Phan workflow

Rewrote the shell command that is supposed to suppress a file contents
but is flagged by the environment.

* PHPStan > Update baseline (#37197)

Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>

* Typo fix (#37195)

* Debug v23 - filters on agenda pages

* css

* css

* css

* qual: Update PHPStan workflow to run on all files in integration (#37207)

The PHPStan workflow has been updated to run on all files in integration branches.

* Fix CI

* Add hook in isEditable()

* Debug v23

* CLOSE #37190 ODT Templates for thirdparties - Birthday is returned in epoch format (#37198)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* fix: Remove HTML from accounting menu tooltips in eldy theme (#37203)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Qual: Update spelling (#37199)

* Qual: Update spelling for pre-select variants

# Qual: Update spelling for pre-select variants

In English, preselect is without the hyphen.  Update text and made some translations
related to preselect.

* Qual: Update composant to component and/or adequate translation.

# Qual: Update composant to component and/or adequate translation.

"Composant(s)" was mostly referenced in french file/class comments.
Updated

* Qual: Fix misspellings related to "criteria"

# Qual: Fix misspellings related to "criteria"

* Qual: Fix produt misspellings

# Qual: Fix produt misspellings

Change 'produt' to 'product'.

* Qual: Update French comments with "composants"

#Qual: Update French comments with "composants"

- Translating French comments to English (avoid codespell notice)

* Qual: Fixed typo 'bad practive' to 'bad practice'

# Qual: Fixed typo 'bad practive' to 'bad practice'

* Qual: Update phan.yml to exclude specific files from analysis

- Added file exclusion pattern to match phan configuration
- Added check for empty file list to avoid unnecessary phan execution

* Qual: Update file filtering in phan.yml workflow

The change updates the file filtering process in the phan.yml workflow to correctly redirect the output of the grep command to a temporary file.

* Qual: Ignore $systemfunction always exists

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Error handling methods for commonobject (#37201)

* Error handling methods for commonobject (#37201)

* NEW Can request and force user to change its password (#37196)

* force user to change password : redirect to user card on login

* force user to change password : redirect to user card on login

* redirect to a dedicated page

* bad old idea : self change passwd on user card + edit mode and rights: it makes a hole on security check

* only apply on dolibarr auth mode context

* only on dolibarr auth mode context

* Fix force_pass_change SQL assignment logic

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Doc

* Setup easier to understand between INVOICE_CHECK_POSTERIOR_DATE and
FAC_FORCE_DATE_VALIDATION

* Setup easier to understand between INVOICE_CHECK_POSTERIOR_DATE and
FAC_FORCE_DATE_VALIDATION

* Prepare 23.0

* Qual: Ignore exit code from `grep -v` in phan flow (#37213)

# Qual: Ignore exit code from `grep -v` in phan flow

`grep -v` returns 1 when the resulting filtered list is empty and would stop the execution.
This is fixed with `|| true` to have a final exit code that is 0.

* WIP LNE

* Debug v23

* Debug v23

* WIP LNE

* FIX Bad header name

* Fix CSP for ping

* Compatibility with multicompany

* Debug

* Fix include

* Transfert feedback css from experimental to core

* Dolibarr JS context Tools from experiemntal to Core

* Fix lang public mode

* fix php phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix phan

* Fix multi instance of Dolibarr on same Domain

* remove french comment

* FIX phpdoc on createFixedAmountDiscount() (#37212)

* FIX phpdoc on createFixedAmountDiscount

* FIX phpdoc

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix path

* Fix in card css modal display (#36569)

* Fix display of cards in a modal

* fix php stan

* fix php stan

* Try a change to force CI

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* More complete data on pings.

* Debug v23

* Debug initdemo

* Debug initdemo

* Debug initdemo

* Debug v23

* Update initdemo

* Update initdemo

* Cleaner GET call

* Add id of perm in url

* Init demo for v24

* Fix translation of "various payment" (not english, not pro) with the
term used in english to mean "Opérations diverses (OD)"

* Sync transifex

* CSS

* Trans

* Doc

* Trans

* Debug v23

* Debug v23

* Trans

* Debug v24

* Debug v23

* Debug v23

* WIP

* Debug v23

* Debug v23

* Debug v24

* Work on LNE

* WIP LNE

* Debug v24

* Doc

* Translation

* Sync transifex

* Debug

* Debug

* Debug

* Responsive

* Dev control archive integrity

* Debug

* Update supplier_proposal.lang (#37238)

* add company name on dropdown contract list (#37245)

* Clean dump file

* Fix CI

* FIX #37246 Modifying resteapayer calculation for credit note (#37247)

* Add 'type' parameter to completeTabsHead hook (#37235)

* #37257 FIX for piesemicircle (#37258)

* Fix #37227 Fix #37233

* Fix #37227 Fix #37233

* QUAL French comment in English (#37225)

* Edit label of $fields

* QUAL French comment in English

* Bump actions/upload-artifact from 4 to 6 (#37250)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* UI/UX : Transfert feedback css from experimental to core (#37226)

* Transfert feedback css from experimental to core

* fix php phan

* Fix phan

* Fix phan

* Fix phan

* Missing label

* Debug

* Debug savedemo

* Fix mention

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com>
Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
Co-authored-by: Laurent Destailleur <eldy@users.sourceforge.net>
Co-authored-by: Yamil Esteban Garcia <120027058+developmentOYR@users.noreply.github.com>
Co-authored-by: Noé Cendrier <81741011+altairis-noe@users.noreply.github.com>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: minimexat <minimexat@gmail.com>
Co-authored-by: hansemschnokeloch <hansemschnokeloch@users.noreply.github.com>
Co-authored-by: Eric - CAP-REL <1468823+rycks@users.noreply.github.com>
Co-authored-by: MDW <mdeweerd@users.noreply.github.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: evarisk-kilyan <kilyan.evarisk@gmail.com>
Co-authored-by: Vanyo <vanyolai@gmail.com>
Co-authored-by: jeremydassaud <49372108+jeremydassaud@users.noreply.github.com>
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Vincent Maury <artec.vm@arnac.net>
Co-authored-by: vmaury <vmaury@vmaury-Lafite-Pro-16-AMD>
Co-authored-by: Vincent Penel <vincent.penel@atm-consulting.fr>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
Co-authored-by: Joris Le Blansch <jleblansch@gmail.com>
Co-authored-by: intelliking <tyleradams93226@gmail.com>
Co-authored-by: Benjamin Falière <121813548+BenjaminFlr@users.noreply.github.com>
Co-authored-by: Charlène Benke <1179011+defrance@users.noreply.github.com>
Co-authored-by: demiton <fabien.cisse@gmail.com>
Co-authored-by: Jyhere <jyhere@gmail.com>
Co-authored-by: Delthair <41671350+Delthair@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-23 20:11:39 +01:00

541 lines
16 KiB
PHP

<?php
/* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admint/tools/ui/class/uidoc.class.php
* \ingroup ui
* \brief File of class to manage UI documentation
*/
/**
* Class to manage UI documentation
*/
class Documentation
{
/**
* Views
*
* @var array|array<int,string>
*/
public $view = array();
/**
* Menu - Set in setMenu in order to use dol_buildpath and called in constructor
*
* @var array<array{url?: string, summary?: array<string,string>, submenu?: array<string,mixed>}>
*/
public $menu = array();
/**
* Summary - Set in setSummary and called in constructor
*
* @var array<int,string>
*/
public $summary = array();
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string
*/
public $baseUrl = 'admin/tools/ui';
/**
* Constructor
*
* @param DoliDB $db Database handler
* @return void
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
// https://www.figma.com/community/file/1393171578760389765/dolibarr-ui-ux-kit
// Menu Constructor
$this->setMenu();
}
/**
* Set Documentation Menu
*
* @return mixed false if error, void if no errors
*/
private function setMenu()
{
global $hookmanager;
$hookmanager->initHooks(array('uidocumentation'));
// Go back to Dolibarr
$this->menu['BackToDolibarr'] = array(
'url' => dol_buildpath('modulebuilder/index.php', 1),
'icon' => 'fas fa-arrow-left',
'submenu' => array(),
);
// Home for Ui documentation
$this->menu['DocumentationHome'] = array(
'url' => dol_buildpath($this->baseUrl.'/index.php', 1),
'icon' => 'fas fa-book',
'submenu' => array(),
);
// Components
$this->menu['Components'] = array(
'url' => dol_buildpath($this->baseUrl.'/components/index.php', 1),
'icon' => 'fas fa-th-large',
'submenu' => array(
'Badges' => array(
'url' => dol_buildpath($this->baseUrl.'/components/badges.php', 1),
'icon' => 'fas fa-certificate',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#badgesection-basicusage',
'DocBadgeContextualVariations' => '#badgesection-contextvariations',
'DocBadgeDefaultStatus' => '#badgesection-defaultstatus',
'DocBadgePillBadges' => '#badgesection-pill',
'DocBadgeDotBadges' => '#badgesection-dot',
'DocBadgeLinks' => '#badgesection-links',
'DocBadgeHelper' => '#badgesection-dolgetbadge'
),
),
'Buttons' => array(
'url' => dol_buildpath($this->baseUrl.'/components/buttons.php', 1),
'icon' => 'fas fa-mouse',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#buttonsection-basicusage',
'DocButtonModal' => '#buttonsection-modals',
'DocButtonSubmenu' => '#buttonsection-submenu',
),
),
'Icons' => array(
'url' => dol_buildpath($this->baseUrl.'/components/icons.php', 1),
'icon' => 'far fa-flag',
'submenu' => array(),
'summary' => array(
'DocIconsList' => '#img-picto-section-list',
'DocIconsFontAwesomeList' => '#icon-section-list',
),
),
'Progress' => array(
'url' => dol_buildpath($this->baseUrl.'/components/progress-bars.php', 1),
'icon' => 'fas fa-battery-half',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#progresse-section-basic-usage',
'DocColorVariants' => '#progress-section-color',
'DocStripedVariants' => '#progresse-section-stripped',
),
),
'Event Message' => array(
'url' => dol_buildpath($this->baseUrl.'/components/event-message.php', 1),
'icon' => 'fas fa-comments',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#seteventmessagesection-basicusage',
'DocSetEventMessageContextualVariations' => '#seteventmessagesection-contextvariations',
)
),
'Inputs' => array(
'url' => dol_buildpath($this->baseUrl.'/components/inputs.php', 1),
'icon' => 'far fa-edit',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#setinputssection-basicusage',
'DocHelperFunctionsInputUsage' => '#setinputssection-helperfunctions',
'DocHelperFunctionsGetSearchFilterToolInput' => '#setinputssection-getSearchFilterToolInput',
)
),
'ExperimentalUxInputAjaxFeedback' => array(
'url' => dol_buildpath($this->baseUrl.'/content/input-feedback.php', 1),
'icon' => 'far fa-share-square',
'submenu' => array(),
'summary' => array(),
),
),
);
// Elements
$this->menu['Content'] = array(
'url' => dol_buildpath($this->baseUrl.'/content/index.php', 1),
'icon' => 'far fa-file-alt',
'submenu' => array(
'Titles' => array(
'url' => dol_buildpath('admin/tools/ui/content/titles.php', 1),
'icon' => 'fas fa-heading',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#titlesection-basicusage',
'DocTitleWithFilters' => '#titlesection-withfilters',
),
),
'Tables' => array(
'url' => dol_buildpath('admin/tools/ui/content/tables.php', 1),
'icon' => 'fas fa-table',
'submenu' => array(),
'summary' => array(
'DocBasicUsage' => '#tablesection-basicusage',
'DocTableWithFilters' => '#tablesection-withfilters',
'DocTableBeforeFilters' => '#tablesection-beforefilters',
'DocTableCSSClass' => '#tablesection-cssclasses',
),
),
'TableRowIntuitiveSelect' => array(
'url' => dol_buildpath($this->baseUrl.'/content/intuitive-table-row-select.php', 1),
'icon' => 'far fa-check-square',
'submenu' => array(),
'summary' => array(),
),
'FreezeTooltip' => array(
'url' => dol_buildpath($this->baseUrl.'/content/freeze-tooltip.php', 1),
'icon' => 'far fa-comment',
'submenu' => array(),
'summary' => array(),
),
)
);
// Elements
$this->menu['Resources'] = array(
'url' => dol_buildpath($this->baseUrl.'/resources/index.php', 1),
'icon' => 'fas fa-wrench',
'submenu' => array(
'Contributing' => array(
'url' => dol_buildpath($this->baseUrl.'/resources/contributing.php', 1),
'icon' => 'fas fa-code',
'submenu' => array(),
'summary' => array(
'DocContributeStep1' => '#contributesection-step1',
'DocContributeStep2' => '#contributesection-step2',
'DocContributeStep3' => '#contributesection-step3',
),
),
)
);
// Elements
$this->menu['UxDolibarrContext'] = array(
'url' => dol_buildpath($this->baseUrl.'/dolibarr-context/index.php', 1),
'icon' => 'fab fa-fort-awesome',
'submenu' => array(
'UxDolibarrContextHowItWork' => array(
'url' => dol_buildpath($this->baseUrl.'/dolibarr-context/index.php', 1),
'icon' => 'fab fa-fort-awesome',
'submenu' => array(),
'summary' => array(
'Introduction' => '#titlesection-basicusage',
'ConsoleHelp' => '#titlesection-console-help',
'JSDolibarrhooks' => '#titlesection-hooks',
'JSDolibarrhooksReadyVsInit' => '#titlesection-event-init-vs-ready',
'JSDolibarrAwaitHooks' => '#titlesection-await-hooks',
'ExampleOfCreatingNewContextTool' => '#titlesection-create-tool-example',
'SetEventMessageTool' => '#titlesection-tool-seteventmessage',
'SetAndUseContextVars' => '#titlesection-contextvars',
),
),
'UxDolibarrContextLangsTool' => array(
'url' => dol_buildpath($this->baseUrl.'/dolibarr-context/langs-tool.php', 1),
'icon' => 'far fa-flag',
'submenu' => array(),
'summary' => array(),
),
)
);
// Elements
$this->menu['ExperimentalUx'] = array(
'url' => dol_buildpath($this->baseUrl.'/experimental/index.php', 1),
'icon' => 'fas fa-flask',
'submenu' => array(
'ExperimentalUxIntroductionMenu' => array(
'url' => dol_buildpath($this->baseUrl.'/experimental/index.php', 1),
'icon' => 'fas fa-flask',
'submenu' => array(),
'summary' => array(
'Index' => '#top',
'ExperimentalUxIntroductionTitle' => '#experimental-ux-introduction',
'ExperimentalUxContributionTitle' => '#experimental-ux-contribution',
),
),
)
);
$parameters = array(
'baseUrl' => $this->baseUrl,
);
$action = '';
$reshook = $hookmanager->executeHooks('setMenu', $parameters, $this, $action);
if ($reshook < 0) {
return false;
}
}
/**
* Output header + body
*
* @param string $title Title of page
* @param string[] $arrayofjs Array of complementary js files
* @param string[] $arrayofcss Array of complementary css files
* @param string $hidenavmenu Hide nav menu
* @return void
*/
public function docHeader($title = '', $arrayofjs = [], $arrayofcss = [], $hidenavmenu = '')
{
global $langs;
$title = (!empty($title)) ? dol_escape_htmltag($title) : $langs->trans('Documentation');
$arrayofcss[] = 'admin/tools/ui/css/documentation.css';
top_htmlhead('', $title, 0, 0, $arrayofjs, $arrayofcss);
print '<body class="dolibarr-doc'.($hidenavmenu ? "-bis" : "").'">';
}
/**
* Output close body + html
* @return void
*/
public function docFooter()
{
global $langs;
// DIV FOR SCROLL ANIMATION
print '<div id="documentation-scrollwrapper">';
print '<div id="documentation-scroll"></div>';
print '</div>';
// JS
print '<script src="'.dol_buildpath('admin/tools/ui/js/documentation.js', 1).'"></script>';
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>';
print '</body>';
print '</html>';
dol_htmloutput_events(0);
}
/**
* Output sidebar
*
* @return void
*/
public function showSidebar()
{
print '<div class="doc-sidebar">';
// LOGO
print '<div class="sidebar-logo">';
if (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
print '<img src="'.$urllogo.'" />';
}
print '</div>';
// NAVIGATION
print '<nav>';
if (!empty($this->menu)) {
$this->displayMenu($this->menu);
}
print '</nav>';
print '</div>';
}
/**
* Recursive function to set Menu
*
* @param array<string, array{url?: string, icon?: string, summary?: array<string,string>, submenu?: array<string,array>}> $menu Menu entry or submenu
* @param int $level level of menu
* @return void
*/
private function displayMenu($menu, $level = 0)
{
global $langs;
$level++;
print '<ul>';
foreach ($menu as $key => $item) {
$levelclass = (!empty($item['submenu'])) ? 'li-withsubmenu' : '';
$levelclass .= (in_array($key, $this->view)) ? ' active' : '';
$levelclass .= ($key == 'BackToDolibarr') ? ' li-withseparator' : '';
print '<li class="'.trim($levelclass).' level-'.$level.'">';
print '<a href="'.$item['url'].'" class="'.((!empty($item['submenu'])) ? 'link-withsubmenu' : '').'">';
print ((!empty($item['icon'])) ? '<i class="menu-icon '.$item['icon'].' pictofixedwidth" aria-hidden="true"></i>' : '');
print '<span class="label">'.$langs->transnoentities($key).'</span>';
print ((!empty($item['submenu'])) ? '<i class="submenu-toggle fas fa-chevron-right" aria-hidden="true"></i>' : '');
print '</a>';
if (!empty($item['submenu'])) {
$this->displayMenu($item['submenu'], $level); // Appel récursif pour afficher les sous-menus
}
echo '</li>';
}
print '</ul>';
}
/**
* Output breadcrumb
* @return void
*/
public function showBreadcrumb()
{
global $langs;
print '<nav class="doc-breadcrumbs">';
print '<ul>';
print '<li class="breadcrumb-item"><a href="'.$this->menu['DocumentationHome']['url'].'"><i class="'.$this->menu['DocumentationHome']['icon'].'" aria-hidden="true"></i></a></li>';
if (!empty($this->view)) {
$nb_entries = count($this->view);
$i = 0;
$menu_entry = $this->menu;
foreach ($this->view as $page) {
$i++;
if ($i < $nb_entries && isset($menu_entry[$page])) {
print '<li class="breadcrumb-item"><a href="'.$menu_entry[$page]['url'].'">'.$langs->transnoentities($page).'</a></li>';
$menu_entry = $menu_entry[$page]['submenu'];
} else {
print '<li class="breadcrumb-item">'.$langs->transnoentities($page).'</li>';
}
}
} else {
print '<li class="breadcrumb-item">'.$langs->trans('Documentation').'</li>';
}
print '</ul>';
print '</nav>';
}
/**
* Output summary
*
* @param int $showsubmenu Show Sub menus: 0 = No, 1 = Yes
* @param int $showsubmenu_summary Show summary of sub menus: 0 = No, 1 = Yes
* @return void
*/
public function showSummary($showsubmenu = 1, $showsubmenu_summary = 1)
{
$i = 0;
$menu_entry = [];
if (!empty($this->view)) {
// Set the correct menu depth (level)
foreach ($this->view as $view) {
$i++;
if ($i == 1) {
$menu_entry = $this->menu[$view] ?? [];
} else {
$menu_entry = $menu_entry['submenu'][$view] ?? [];
}
}
}
if (!empty($menu_entry['summary']) || (!empty($menu_entry['submenu']) && $showsubmenu)) {
print '<div class="summary-wrapper">';
$this->displaySummary($menu_entry);
print '</div>';
}
}
/**
* Recursive function for Automatic Summary
*
* @param array{summary?: array<string,string>, submenu?: array<string,array>} $menu $this->menu or submenus
* @param int $level level of menu
* @param int $showsubmenu Show Sub menus: 0 = No, 1 = Yes
* @param int $showsubmenu_summary Show summary of sub menus: 0 = No, 1 = Yes
* @return void
*/
public function displaySummary($menu, $level = 0, $showsubmenu = 1, $showsubmenu_summary = 1)
{
global $langs;
$level++;
print '<ul class="documentation-summary level-'.$level.'"">';
if (!empty($menu['summary'])) {
foreach ($menu['summary'] as $summary_label => $summary_link) {
/*
if ($summary_link[0] == '#') {
$tmp_summary_link = $menu['url'];
if (GETPOSTINT('hidenavmenu')) {
$tmp_summary_link .= (strpos($tmp_summary_link, '?') === false ? '?' : '&').'hidenavmenu=1';
}
if (GETPOSTINT('displayMode')) {
$tmp_summary_link .= (strpos($tmp_summary_link, '?') === false ? '?' : '&').'displayMode=1';
}
$summary_link = $tmp_summary_link;
}
*/
print '<li><a href="'.$summary_link.'">'.$langs->trans($summary_label).'</a></li>';
}
}
if ($showsubmenu && !empty($menu['submenu'])) {
foreach ($menu['submenu'] as $key => $item) {
print '<li class="summary-title ">';
if (!empty($item['url'])) {
print '<h3 class="level-'.$level.'"><a href="'.dolBuildUrl($item['url']).'" >'.$langs->trans($key).'</a></h3>';
} else {
print '<h3 class="level-'.$level.'">'.$langs->trans($key).'</h3>';
}
if ($showsubmenu_summary) {
$this->displaySummary($item, $level);
}
print '</li>';
}
}
print '</ul>';
}
/**
* Output a View Code area
*
* @param array<int,string> $lines Lines of code to show
* @param string $option Source code language ('html', 'php' etc)
* @return void
*/
public function showCode($lines = array(), $option = 'html')
{
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
print '<div class="documentation-code">';
if (isset($lines[0])) {
if ($option === 'html' && strpos(strtolower($lines[0]), '<!doctype') === false) {
array_unshift($lines, '<!DOCTYPE html>', '');
}
}
$content = implode("\n", $lines) . "\n";
$doleditor = new DolEditor(md5($content), $content, '', 0, 'Basic', 'In', true, false, 'ace', 0, '99%', 1);
print $doleditor->Create(1, '', false, '', $option);
print '</div>';
}
}