FOSSology  4.4.0
Open Source License Compliance by Open Source Software
MenuRenderer.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2015 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 namespace Fossology\Lib\UI;
9 
11 {
18  public static function menuToActiveSelect($menu, &$parm, $uploadId = "", $folderId = 0)
19  {
20  $agentRequiringFolderId = ["ui_reportImport", "ui_fodecisionimporter"];
21  if (empty($menu)) {
22  return '';
23  }
24 
25  $showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1;
26  $optionsOut = "";
27 
28  foreach ($menu as $Val) {
29  if (!empty($Val->HTML)) {
30  $entry = $Val->HTML;
31  } else if (!empty($Val->URI)) {
32  if (!empty($uploadId) && "tag" == $Val->URI) {
33  $tagstatus = TagStatus($uploadId);
34  if (0 == $tagstatus) { // tagging on this upload is disabled
35  break;
36  }
37  }
38 
39  $value = Traceback_uri() . '?mod=' . $Val->URI . '&' . $parm;
40  if ($folderId != 0 && in_array($Val->URI, $agentRequiringFolderId)) {
41  $value .= '&folder=' . $folderId;
42  }
43  $entry = '<option value="' . $value . '"';
44  if (!empty($Val->Title)) {
45  $entry .= ' title="' . htmlentities($Val->Title, ENT_QUOTES) . '"';
46  }
47  $entry .= '>'. $Val->getName($showFullName).'</option>';
48  } else {
49  $entry = "<option>" . $Val->getName($showFullName) . "</option>";
50  }
51  $optionsOut .= $entry;
52  }
53 
54  if (plugin_find_id('showjobs') >= 0) {
55  $optionsOut .= '<option value="' . Traceback_uri() . '?mod=showjobs&upload='.$uploadId.'" title="' . _("Scan History") . '" >'._("History").'</option>';
56  }
57 
58  return '<select class="goto-active-option form-control-sm"><option disabled selected>-- select action --</option>'.$optionsOut.'</select>';
59  }
60 }
static menuToActiveSelect($menu, &$parm, $uploadId="", $folderId=0)
Traceback_uri()
Get the URI without query to this location.
Definition: common-parm.php:97