FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ajax-manage-tag.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2012-2013 Hewlett-Packard Development Company, L.P.
4  SPDX-FileCopyrightText: © 2015 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 use Symfony\Component\HttpFoundation\Response;
10 
11 define("TITLE_UPLOAD_TAGGING", _("Manage Upload Tagging"));
12 
14 {
15  var $Name = "upload_tagging";
16  var $Title = TITLE_UPLOAD_TAGGING;
17  var $Version = "1.0";
18  var $Dependency = array();
19  var $DBaccess = PLUGIN_DB_ADMIN;
20  var $NoHTML = 1; /* This plugin needs no HTML content help */
21 
25  function Output()
26  {
27  $upload_id = GetParm("upload",PARM_INTEGER);
28  if (empty($upload_id)) {
29  return new Response('', Response::HTTP_OK,array('content-type'=>'text/plain'));
30  }
31 
33  $sql = "select count(*) from tag_manage where upload_fk = $1 and is_disabled = true";
34  $numTags = $GLOBALS['container']->get('db.manager')->getSingleRow($sql,array($upload_id));
35  $count = $numTags['count'];
36  if (empty($count)) { // enabled
37  $text = _("Disable");
38  $V = "<input type='submit' name='manage' value='$text'>\n";
39  } else { // disabled
40  $text = _("Enable");
41  $V = "<input type='submit' name='manage' value='$text'>\n";
42  }
43 
44  return new Response($V, Response::HTTP_OK,array('content-type'=>'text/plain'));
45  }
46 }
47 
48 $NewPlugin = new upload_tagging;
49 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Output()
Display the loaded menu and plugins.
const PARM_INTEGER
Definition: common-parm.php:14
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:46
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
Definition: libfossology.h:39