diff --git a/lib/digiriskdolibarr_function.lib.php b/lib/digiriskdolibarr_function.lib.php index ae28f2d68..56ca7ad1e 100644 --- a/lib/digiriskdolibarr_function.lib.php +++ b/lib/digiriskdolibarr_function.lib.php @@ -551,3 +551,238 @@ function digiriskshowdocuments($modulepart, $modulesubdir, $filedir, $urlsource, return $out; } + +/** + * Show HTML header HTML + BODY + Top menu + left menu + DIV + * + * @param string $head Optionnal head lines + * @param string $title HTML title + * @param string $help_url Url links to help page + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * For other external page: http://server/url + * @param string $target Target to use on links + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) + * @param string $morecssonbody More CSS on body tag. + * @param string $replacemainareaby Replace call to main_area() by a print of this string + * @return void + */ +function digiriskHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '') +{ + global $conf, $langs, $db; + + dol_include_once('/custom/digiriskdolibarr/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php'); + dol_include_once('/custom/digiriskdolibarr/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php'); + + $mod_groupment = new $conf->global->DIGIRISKDOLIBARR_GROUPMENT_ADDON(); + $mod_workunit = new $conf->global->DIGIRISKDOLIBARR_WORKUNIT_ADDON(); + + // html header + $tmpcsstouse = 'sidebar-collapse'.($morecssonbody ? ' '.$morecssonbody : ''); + // If theme MD and classic layer, we open the menulayer by default. + if ($conf->theme == 'md' && !in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + global $mainmenu; + if ($mainmenu != 'website') $tmpcsstouse = $morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. + } + + if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) { + $tmpcsstouse .= ' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + } + + print ''."\n"; + + llxHeader('', $title, $help_url); + + //Body navigation digirisk + $object = new DigiriskElement($db); + $objects = $object->fetchAll('', '', 0,0,array('entity' => $conf->entity)); + $results = recurse_tree(0,0,$objects); ?> +
+
+
+
+ +
+
+
+ fk_parent) { + $result[$noeud->id] = array( + 'id' => $noeud->id, + 'object' => $noeud, + 'children' => recurse_tree($noeud->id, ($niveau + 1), $array), + ); + } + } + return $result; +} + +/** + * Display Recursive tree process + * + * @param array $result Global Digirisk Element list after recursive process + * @return void + */ +function display_recurse_tree($results) { + global $conf, $langs; + + dol_include_once('/custom/digiriskdolibarr/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php'); + dol_include_once('/custom/digiriskdolibarr/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php'); + + $mod_groupment = new $conf->global->DIGIRISKDOLIBARR_GROUPMENT_ADDON(); + $mod_workunit = new $conf->global->DIGIRISKDOLIBARR_WORKUNIT_ADDON(); + + if ( !empty( $results ) ) { + foreach ($results as $element) { ?> +
  • +
    + element_type == 'groupment' && count($element['children'])) { ?> +
    + +
    + +
    + + digiriskdolibarr->multidir_output[$conf->entity].'/'.$element['object']->element_type.'/'.$element['object']->ref.'/', "files", 0, '', '(\.odt|_preview.*\.png)$', 'position_name', 'asc', 1); + if (count($filearray)) { + print ''.digirisk_show_photos('digiriskdolibarr', $conf->digiriskdolibarr->multidir_output[$conf->entity].'/'.$element['object']->element_type, 'small', 1, 0, 0, 0, 50, 0, 0, 0, 0, $element['object']->element_type, $element['object']).''; + } else { + $nophoto = '/public/theme/common/nophoto.png'; ?> + No photo + + + element_type == 'groupment') { ?> + + +
    + +
  • + next_prev_filter can be set to restrict select to find next or previous record by $form->showrefnav. + * + * @param Object $object Object to show + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link + * @param string $morehtml More html content to output just before the nav bar + * @param int $shownav Show Condition (navigation is shown if value is 1) + * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field). Use 'none' for no prev/next search. + * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous + * @param string $morehtmlref More html to show after ref + * @param string $moreparam More param to add in nav link url. + * @param int $nodbprefix Do not include DB prefix to forge table name + * @param string $morehtmlleft More html code to show before ref + * @param string $morehtmlstatus More html code to show under navigation arrows + * @param int $onlybanner Put this to 1, if the card will contains only a banner (this add css 'arearefnobottom' on div) + * @param string $morehtmlright More html code to show before navigation arrows + * @return void + */ +function digirisk_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $onlybanner = 0, $morehtmlright = '') +{ + global $form; + + print '
    '; + print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); + print '
    '; + print '
    '; +}