FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ajax-tags.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2010-2012 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_AJAX_TAGS", _("List Tags"));
12 
13 class ajax_tags extends FO_Plugin
14 {
15  function __construct()
16  {
17  $this->Name = "tag_get";
18  $this->Title = TITLE_AJAX_TAGS;
19  $this->DBaccess = PLUGIN_DB_READ;
20  $this->OutputType = 'Text'; /* This plugin needs no HTML content help */
21 
22  parent::__construct();
23  }
24 
28  function Output()
29  {
30  $V="";
31 
32  $item = GetParm("uploadtree_pk",PARM_INTEGER);
33  /* get uploadtree_tablename from $Item */
34  $uploadtreeRec = GetSingleRec("uploadtree", "where uploadtree_pk='$item'");
35  $uploadRec = GetSingleRec("upload", "where upload_pk='$uploadtreeRec[upload_fk]'");
36  if (empty($uploadRec['uploadtree_tablename'])) {
37  $uploadtree_tablename = "uploadtree";
38  } else {
39  $uploadtree_tablename = $uploadRec['uploadtree_tablename'];
40  }
41 
42  $List = GetAllTags($item, true, $uploadtree_tablename);
43  foreach ($List as $L) {
44  $V .= $L['tag_name'] . ",";
45  }
46 
47  return new Response($V, Response::HTTP_OK,array('content-type'=>'text/plain'));
48  }
49 }
50 
51 $NewPlugin = new ajax_tags();
52 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Output()
Display the loaded menu and plugins.
Definition: ajax-tags.php:28
__construct()
base constructor. Most plugins will just use this
Definition: ajax-tags.php:15
GetSingleRec($Table, $Where="")
Retrieve a single database record.
Definition: common-db.php:91
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
GetAllTags($Item, $Recurse=true, $uploadtree_tablename="uploadtree")
Get all Tags of this uploadtree_pk.
Definition: common-tags.php:26
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:37