29 private $detectLicensesFolder;
33 private $licenseProjector;
35 function __construct()
37 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
38 $this->uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
39 $this->clearingDao = $GLOBALS[
'container']->get(
'dao.clearing');
40 $this->detectLicensesFolder = $GLOBALS[
'container']->get(
'businessrules.detectlicensesfolder');
49 public function getReuseSummary($uploadId)
51 $declearedLicenses = $this->detectLicensesFolder->getDeclearedLicenses($uploadId);
54 $uploadTreeId = $this->uploadDao->getUploadParent($uploadId);
55 $itemTreeBounds = $this->uploadDao->getItemTreeBounds($uploadTreeId, $uploadtreeTablename);
56 $clearedLicenses = $this->clearingDao->getClearedLicenses($itemTreeBounds, $groupId);
57 $this->licenseProjector =
new LicenseMap($this->
dbManager,$groupId,LicenseMap::CONCLUSION,
true);
58 $concludedLicenses = [];
60 if (!empty($clearedLicenses)) {
61 foreach ($clearedLicenses as $licenseRef) {
62 $projectedName = $this->licenseProjector->getProjectedShortname($licenseRef->getId(),$licenseRef->getShortName());
63 $concludedLicenses[] = $projectedName;
68 $vars[
"declearedLicense"] = implode(
", ", $declearedLicenses);
69 $vars[
"clearedLicense"] = implode(
", ", $concludedLicenses);
71 if (empty($declearedLicenses)) {
72 $vars[
"usedLicense"] =
"";
73 $vars[
"unusedLicense"] =
"";
74 $vars[
"missingLicense"] = implode(
", ", $concludedLicenses);
78 $vars[
"usedLicense"] = implode(
", ", array_intersect($declearedLicenses, $concludedLicenses));
79 $vars[
"unusedLicense"] = implode(
", ", array_diff($declearedLicenses, $concludedLicenses));
80 $vars[
"missingLicense"] = implode(
", ", array_diff($concludedLicenses, $declearedLicenses));
Contains the constants and helpers for authentication of user.
static getGroupId()
Get the current user's group id.
Detects licenses declard inside LICENSES directory.
Wrapper class for license map.
FUNCTION char * GetUploadtreeTableName(PGconn *pgConn, int upload_pk)
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".
fo_dbManager * dbManager
fo_dbManager object
Contains business rules for FOSSology.