FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
keyword-hist.php
1 <?php
2 /***********************************************************
3  * Copyright (C) 2018 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 require_once('HistogramBase.php');
20 
21 define("TITLE_KEYWORDHISTOGRAM", _("Keyword Browser"));
22 
24  function __construct()
25  {
26  $this->Name = "keyword-hist";
27  $this->Title = TITLE_KEYWORDHISTOGRAM;
28  $this->viewName = "keyword-view";
29  $this->agentName = "keyword";
30  parent::__construct();
31  }
32 
40  protected function getTableContent($upload_pk, $Uploadtree_pk, $filter, $Agent_pk)
41  {
42  $type = 'keyword';
43  $decription = _("Keyword Analysis");
44 
45  $tableVars=array();
46  list($VKeyword, $keywordVars) = $this->getTableForSingleType($type, $decription, $upload_pk, $Uploadtree_pk, $filter, $Agent_pk);
47  $tableVars['keyword']=$keywordVars;
48  return array($VKeyword,$tableVars);
49  }
50 
59  protected function fillTables($upload_pk, $Uploadtree_pk, $filter, $agentId, $VF)
60  {
61  list($VKeyword, $tableVars) = $this->getTableContent($upload_pk, $Uploadtree_pk, $filter, $agentId);
62 
63  $V = "<table border=0 width='100%'>\n";
64  $V .= "<tr><td valign='top' width='50%'>$VKeyword</td><td valign='top'>$VF</td></tr>\n";
65  $V .= "</table>\n";
66  $V .= "<hr />\n";
67  return array($V,$tableVars);
68  }
69 
70  function RegisterMenus()
71  {
72  // For all other menus, permit coming back here.
73  $URI = $this->Name . Traceback_parm_keep(array("show","format","page","upload","item"));
74  $Item = GetParm("item",PARM_INTEGER);
75  $Upload = GetParm("upload",PARM_INTEGER);
76  if (!empty($Item) && !empty($Upload))
77  {
78  if (GetParm("mod",PARM_STRING) == $this->Name)
79  {
80  menu_insert("Browse::Keyword",10);
81  menu_insert("Browse::[BREAK]",100);
82  }
83  else
84  {
85  $text = _("View Keyword histogram");
86  menu_insert("Browse::Keyword",10,$URI,$text);
87  }
88  }
89  } // RegisterMenus()
90 
91  protected function createScriptBlock()
92  {
93  return "
94 
95  $(document).ready(function() {
96  tableKeyword = createTablekeyword();
97  } );
98 
99  ";
100 
101  }
102 
103 }
104 
105 $NewPlugin = new KeywordHistogram;
106 //$NewPlugin->Initialize();
getTableForSingleType($type, $description, $uploadId, $uploadTreeId, $filter, $agentId)
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:57
const PARM_STRING
Definition: common-parm.php:29
const PARM_INTEGER
Definition: common-parm.php:25
fillTables($upload_pk, $Uploadtree_pk, $filter, $agentId, $VF)
menu_insert($Path, $LastOrder=0, $URI=NULL, $Title=NULL, $Target=NULL, $HTML=NULL)
Given a Path, order level for the last item, and optional plugin name, insert the menu item...
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
getTableContent($upload_pk, $Uploadtree_pk, $filter, $Agent_pk)
Base class for histogram plugins.