FOSSology  4.4.0
Open Source License Compliance by Open Source Software
CopyrightHistogramProcessPost Class Reference

Handles Ajax requests for copyright. More...

Inheritance diagram for CopyrightHistogramProcessPost:
Inheritance graph
Collaboration diagram for CopyrightHistogramProcessPost:
Collaboration graph

Public Member Functions

 __construct ()
 base constructor. Most plugins will just use this More...
 
 Output ()
 Display the loaded menu and plugins. More...
 
 getCopyrights ($upload_pk, $item, $uploadTreeTableName, $agentId, $type, $filter, $activated=true, $offset=null, $limit=null)
 Get results from database and format for JSON. More...
 
 getTableName ($type)
 Get table name based on statement type. More...
 
 getAgentId ($upload_pk, $copyrightType)
 Get Agent ID for an upload. More...
 
- Public Member Functions inherited from FO_Plugin
 Install ()
 This function (when defined) is only called when the plugin is first installed. It should make sure all requirements are available and create anything it needs to run. It returns 0 on success, non-zero on failure. A failed install is not inserted in the system. More...
 
 Remove ()
 This function (when defined) is only called once, when the plugin is removed. It should uninstall and remove all items that are only used by this plugin. There should be no residues – if the plugin is ever installed again, it should act like a clean install. Thus, any DB, files, or state variables specific to this plugin must be removed. This function must always succeed.
 
 Initialize ()
 dummy stub till all references are removed.
 
 PostInitialize ()
 This function is called before the plugin is used and after all plugins have been initialized. If there is any initialization step that is dependent on other plugins, put it here. More...
 
 RegisterMenus ()
 While menus can be added to any time at or after the PostInitialize phase, this is the standard location for registering this item with menus. More...
 
 Destroy ()
 This is a destructor called after the plugin is no longer needed. It should assume that PostInitialize() was already run one time (this session) and succeeded. This function must always succeed.
 
 OutputOpen ()
 This function is called when user output is requested. This function is responsible for assigning headers.
 
 OutputUnSet ()
 Similar to OutputClose, this ends the output type for this object. However, this does NOT change any global settings. This is called when this object is a dependency for another object.
 
 getResponse ()
 
 getTemplateName ()
 
 renderString ($templateName, $vars=null)
 
 renderScripts ($scripts)
 Render JavaScript in the template's footer. More...
 
 getRequest ()
 
 execute ()
 
 preInstall ()
 
 postInstall ()
 
 unInstall ()
 
 getName ()
 
 __toString ()
 

Protected Member Functions

 doGetData ($upload, $activated=true)
 Handles GET request and create a JSON response. More...
 
 doUpdate ($itemId, $hash, $type)
 Update result. More...
 
 doDelete ($itemId, $hash, $type)
 Disable a result. More...
 
 doUndo ($itemId, $hash, $type)
 Rollback a result. More...
 
 doDeleteDecision ($decisionId, $pfileId, $type)
 Disable a decision. More...
 
 doUndoDecision ($decisionId, $pfileId, $type)
 Rollback a decision. More...
 
 doDeleteHashDecision ($hash, $upload, $type)
 Disable decisions for an upload which matches a hash. More...
 
 doUndoHashDecision ($hash, $upload, $type)
 Rollback decisions for an upload which matches a hash. More...
 
- Protected Member Functions inherited from FO_Plugin
 render ($templateName, $vars=null)
 

Protected Attributes

 $listPage
 
- Protected Attributes inherited from FO_Plugin
 $microMenu
 
 $renderer
 
 $vars = array()
 

Private Member Functions

 getTableData ($upload, $item, $agent_pk, $type, $listPage, $filter, $activated=true)
 Get the copyright data and fill in expected format. More...
 
 getOrderString ()
 Create sorting string for database query. More...
 
 addSearchFilter (&$filterParams)
 Add filter on content. More...
 
 getTableRowAction ($hash, $uploadTreeId, $upload, $type, $activated=true, $rw=true)
 Helper to create action column for results. More...
 
 fillTableRow ($row, $uploadTreeId, $upload, $agentId, $type, $listPage, $filter="", $activated=true, $rw=true)
 Fill table content for JSON response. More...
 

Private Attributes

 $uploadtree_tablename
 
 $dbManager
 
 $uploadDao
 
 $copyrightDao
 
 $dataTablesUtility
 
 $textFindingTypes = ["copyFindings"]
 

Additional Inherited Members

- Public Attributes inherited from FO_Plugin
 $State = PLUGIN_STATE_INVALID
 
 $Name = ""
 
 $Version = "1.0"
 
 $Title = ""
 
 $DBaccess = PLUGIN_DB_NONE
 
 $LoginFlag = 0
 
 $NoMenu = 0
 
 $NoHeader = 0
 
 $PluginLevel = 10
 
 $Dependency = array()
 
 $InitOrder = 0
 
 $MenuList = NULL
 
 $MenuOrder = 0
 
 $MenuTarget = NULL
 
 $OutputType = "HTML"
 
 $OutputToStdout = 0
 

Detailed Description

Handles Ajax requests for copyright.

Definition at line 24 of file ajax-copyright-hist.php.

Constructor & Destructor Documentation

◆ __construct()

CopyrightHistogramProcessPost::__construct ( )

base constructor. Most plugins will just use this

Makes sure the plugin is in the correct state. If so, the plugin is inserted into the Plugins data structure.

The constructor assumes that Install() was already run one time (possibly years ago and not during this object's creation).

Returns
true on success, false on failure.

On failure the plugin is not used by the system. NOTE: This function must NOT assume that other plugins are installed. See PostInitialize.

Reimplemented from FO_Plugin.

Definition at line 57 of file ajax-copyright-hist.php.

Member Function Documentation

◆ addSearchFilter()

CopyrightHistogramProcessPost::addSearchFilter ( $filterParams)
private

Add filter on content.

Parameters
[out]array$filterParamsParameters list for database query
Returns
string Filter string for query

Definition at line 386 of file ajax-copyright-hist.php.

◆ doDelete()

CopyrightHistogramProcessPost::doDelete (   $itemId,
  $hash,
  $type 
)
protected

Disable a result.

Parameters
int$itemIdUpload tree id of the item to update
string$hashHash of the content
string$type'copyright'|'ecc'
Returns
Response

Definition at line 503 of file ajax-copyright-hist.php.

◆ doDeleteDecision()

CopyrightHistogramProcessPost::doDeleteDecision (   $decisionId,
  $pfileId,
  $type 
)
protected

Disable a decision.

Parameters
int$decisionIdDecision id
string$pfileIdPfile id of the item
string$type'copyright'|'ecc'
Returns
JsonResponse

Definition at line 533 of file ajax-copyright-hist.php.

◆ doDeleteHashDecision()

CopyrightHistogramProcessPost::doDeleteHashDecision (   $hash,
  $upload,
  $type 
)
protected

Disable decisions for an upload which matches a hash.

Parameters
string$hashHash of the decision
int$uploadUpload id
string$type'copyright'|'ecc'
Returns
JsonResponse

Definition at line 559 of file ajax-copyright-hist.php.

◆ doGetData()

CopyrightHistogramProcessPost::doGetData (   $upload,
  $activated = true 
)
protected

Handles GET request and create a JSON response.

Gets the copyright history for given upload and generate a JSONResponse using getTableData()

Parameters
int$uploadUpload id to fetch results
bool$activatedTrue to get activated results, false for disabled
Returns
JsonResponse JSON response for JavaScript

Definition at line 173 of file ajax-copyright-hist.php.

◆ doUndo()

CopyrightHistogramProcessPost::doUndo (   $itemId,
  $hash,
  $type 
)
protected

Rollback a result.

Parameters
int$itemIdUpload tree id of the item to update
string$hashHash of the content
string$type'copyright'|'ecc'
Returns
Response

Definition at line 518 of file ajax-copyright-hist.php.

◆ doUndoDecision()

CopyrightHistogramProcessPost::doUndoDecision (   $decisionId,
  $pfileId,
  $type 
)
protected

Rollback a decision.

Parameters
int$decisionIdDecision id
string$pfileIdPfile id of the item
string$type'copyright'|'ecc'
Returns
JsonResponse

Definition at line 546 of file ajax-copyright-hist.php.

◆ doUndoHashDecision()

CopyrightHistogramProcessPost::doUndoHashDecision (   $hash,
  $upload,
  $type 
)
protected

Rollback decisions for an upload which matches a hash.

Parameters
string$hashHash of the decision
int$uploadUpload id
string$type'copyright'|'ecc'
Returns
JsonResponse

Definition at line 578 of file ajax-copyright-hist.php.

◆ doUpdate()

CopyrightHistogramProcessPost::doUpdate (   $itemId,
  $hash,
  $type 
)
protected

Update result.

Parameters
int$itemIdUpload tree id of the item to update
string$hashHash of the content
string$type'copyright'|'ecc'|'keyword'
Returns
Response

Definition at line 481 of file ajax-copyright-hist.php.

◆ fillTableRow()

CopyrightHistogramProcessPost::fillTableRow (   $row,
  $uploadTreeId,
  $upload,
  $agentId,
  $type,
  $listPage,
  $filter = "",
  $activated = true,
  $rw = true 
)
private

Fill table content for JSON response.

Parameters
array$rowResult row from database
int$uploadTreeIdUpload tree id of the item
int$uploadUpload id
string$agentIdAgent id
string$typeType of content
string$listPagePage slug
string$filterFilter for query
boolean$activatedTrue to get activated results, false otherwise
Returns
string[]

Definition at line 444 of file ajax-copyright-hist.php.

◆ getAgentId()

CopyrightHistogramProcessPost::getAgentId (   $upload_pk,
  $copyrightType 
)

Get Agent ID for an upload.

Parameters
integer$upload_pkUpload ID
string$copyrightTypeCopyright Type
Returns
integer Agent ID

Definition at line 376 of file ajax-copyright-hist.php.

◆ getCopyrights()

CopyrightHistogramProcessPost::getCopyrights (   $upload_pk,
  $item,
  $uploadTreeTableName,
  $agentId,
  $type,
  $filter,
  $activated = true,
  $offset = null,
  $limit = null 
)

Get results from database and format for JSON.

Parameters
int$upload_pkUpload id to get results from
int$itemUpload tree id of the item
string$uploadTreeTableNameUpload tree table to use
string$agentIdId of the agent who loaded the results
string$typeType of the statement (statement, url, email, author or ecc)
string$filterFilter data from query
boolean$activatedTrue to get activated copyrights, else false
Returns
array[][] Array of table records, filtered records, total records

Definition at line 231 of file ajax-copyright-hist.php.

◆ getOrderString()

CopyrightHistogramProcessPost::getOrderString ( )
private

Create sorting string for database query.

Returns
string Sorting string

Definition at line 361 of file ajax-copyright-hist.php.

◆ getTableData()

CopyrightHistogramProcessPost::getTableData (   $upload,
  $item,
  $agent_pk,
  $type,
  $listPage,
  $filter,
  $activated = true 
)
private

Get the copyright data and fill in expected format.

Parameters
int$uploadUpload id to get results from
int$itemUpload tree id of the item
string$agent_pkId of the agent who loaded the results
string$typeType of the statement (statement, url, email, author or ecc)
string$listPagePage slug to use
string$filterFilter data from query
boolean$activatedTrue to get activated copyrights, else false
Returns
array[][] Array of table data, total records in database, filtered records

Definition at line 203 of file ajax-copyright-hist.php.

◆ getTableName()

CopyrightHistogramProcessPost::getTableName (   $type)

Get table name based on statement type.

  • statement => copyright
  • ecc => ecc
  • others => author
  • scancode_statement => scancode copyright
  • scancode_email => scancode email
  • scancode_author => scancode author
  • scancode_url => scancode url
    Parameters
    string$typeResult type
    Returns
    string Table name

Definition at line 324 of file ajax-copyright-hist.php.

◆ getTableRowAction()

CopyrightHistogramProcessPost::getTableRowAction (   $hash,
  $uploadTreeId,
  $upload,
  $type,
  $activated = true,
  $rw = true 
)
private

Helper to create action column for results.

Parameters
string$hashHash of the content
int$uploadTreeIdItem id in upload tree table
int$uploadUpload id
string$typeType of content
boolean$activatedTrue if content is activated, else false
boolean$rwtrue if content is editable
Returns
string

Definition at line 410 of file ajax-copyright-hist.php.

◆ Output()

CopyrightHistogramProcessPost::Output ( )

Display the loaded menu and plugins.

See also
FO_Plugin::Output()

Reimplemented from FO_Plugin.

Definition at line 79 of file ajax-copyright-hist.php.

Member Data Documentation

◆ $listPage

string CopyrightHistogramProcessPost::$listPage
protected

Page slug for plugin

Definition at line 29 of file ajax-copyright-hist.php.

◆ $textFindingTypes

array CopyrightHistogramProcessPost::$textFindingTypes = ["copyFindings"]
private

List of types used for text findings

Definition at line 55 of file ajax-copyright-hist.php.


The documentation for this class was generated from the following file: