FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
MenuRenderer.php
1 <?php
2 /***********************************************************
3  * Copyright (C) 2015 Siemens AG
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
18 
19 namespace Fossology\Lib\UI;
20 
22 {
28  public static function menuToActiveSelect($menu, &$parm, $uploadId = "")
29  {
30  if (empty($menu)) {
31  return '';
32  }
33 
34  $showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1;
35  $optionsOut = "";
36 
37  foreach ($menu as $Val) {
38  if (!empty($Val->HTML)) {
39  $entry = $Val->HTML;
40  } else if (!empty($Val->URI)) {
41  if (!empty($uploadId) && "tag" == $Val->URI) {
42  $tagstatus = TagStatus($uploadId);
43  if (0 == $tagstatus) { // tagging on this upload is disabled
44  break;
45  }
46  }
47 
48  $entry = '<option value="' . Traceback_uri() . '?mod=' . $Val->URI . '&' . $parm . '"';
49  if (!empty($Val->Title)) {
50  $entry .= ' title="' . htmlentities($Val->Title, ENT_QUOTES) . '"';
51  }
52  $entry .= '>'. $Val->getName($showFullName).'</option>';
53  } else {
54  $entry = "<option>" . $Val->getName($showFullName) . "</option>";
55  }
56  $optionsOut .= $entry;
57  }
58 
59  if (plugin_find_id('showjobs') >= 0) {
60  $optionsOut .= '<option value="' . Traceback_uri() . '?mod=showjobs&upload='.$uploadId.'" title="' . _("Scan History") . '" >'._("History").'</option>';
61  }
62 
63  return '<select class="goto-active-option"><option disabled selected>-- select action --</option>'.$optionsOut.'</select>';
64  }
65 }
Traceback_uri()
Get the URI without query to this location.
static menuToActiveSelect($menu, &$parm, $uploadId="")