FOSSology  4.4.0
Open Source License Compliance by Open Source Software
keyword-hist.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2018 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 require_once('HistogramBase.php');
9 
10 define("TITLE_KEYWORDHISTOGRAM", _("Keyword Browser"));
11 
13 {
14  function __construct()
15  {
16  $this->Name = "keyword-hist";
17  $this->Title = TITLE_KEYWORDHISTOGRAM;
18  $this->viewName = "keyword-view";
19  $this->agentName = "keyword";
20  parent::__construct();
21  }
22 
30  protected function getTableContent($upload_pk, $Uploadtree_pk, $filter, $Agent_pk)
31  {
32  $type = 'keyword';
33  $decription = _("Keyword Analysis");
34 
35  $tableVars=array();
36  list($VKeyword, $keywordVars) = $this->getTableForSingleType($type, $decription, $upload_pk, $Uploadtree_pk, $filter, $Agent_pk);
37  $tableVars['keyword']=$keywordVars;
38  return array($VKeyword,$tableVars);
39  }
40 
49  protected function fillTables($upload_pk, $Uploadtree_pk, $filter, $agentId, $VF)
50  {
51  list($VKeyword, $tableVars) = $this->getTableContent($upload_pk, $Uploadtree_pk, $filter, $agentId);
52 
53  $V = "<table border=0 width='100%'>\n";
54  $V .= "<tr><td valign='top'>$VKeyword</td><td valign='top'>$VF</td></tr>\n";
55  $V .= "</table>\n";
56  $V .= "<hr />\n";
57  return array($V,$tableVars);
58  }
59 
60  function RegisterMenus()
61  {
62  // For all other menus, permit coming back here.
63  $URI = $this->Name . Traceback_parm_keep(array("show","format","page","upload","item"));
64  $Item = GetParm("item",PARM_INTEGER);
65  $Upload = GetParm("upload",PARM_INTEGER);
66  if (!empty($Item) && !empty($Upload)) {
67  if (GetParm("mod",PARM_STRING) == $this->Name) {
68  menu_insert("Browse::Keyword",10);
69  menu_insert("Browse::[BREAK]",100);
70  } else {
71  $text = _("View Keyword histogram");
72  menu_insert("Browse::Keyword",10,$URI,$text);
73  }
74  }
75  } // RegisterMenus()
76 
77  protected function createScriptBlock()
78  {
79  return "
80 
81  $(document).ready(function() {
82  tableKeyword = createTablekeyword();
83  $('#testReplacementkeyword').click(function() {
84  testReplacement(tableKeyword, 'keyword');
85  });
86  });
87 
88  ";
89 
90  }
91 }
92 
93 $NewPlugin = new KeywordHistogram;
94 //$NewPlugin->Initialize();
Base class for histogram plugins.
getTableForSingleType($type, $description, $uploadId, $uploadTreeId, $filter, $agentId)
getTableContent($upload_pk, $Uploadtree_pk, $filter, $Agent_pk)
fillTables($upload_pk, $Uploadtree_pk, $filter, $agentId, $VF)
RegisterMenus()
While menus can be added to any time at or after the PostInitialize phase, this is the standard locat...
__construct()
base constructor. Most plugins will just use this
createScriptBlock()
Create JavaScript block for histogram.
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.
const PARM_INTEGER
Definition: common-parm.php:14
const PARM_STRING
Definition: common-parm.php:18
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:46
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:308