Exemplo n.º 1
0
 /**
  * @param $uploadTreeId
  * @param $tagId
  * @param ItemTreeBounds $itemTreeBounds
  * @param int|int[] $agentIds
  * @param ClearingDecision []
  * @return array
  */
 private function createLicenseHistogram($uploadTreeId, $tagId, ItemTreeBounds $itemTreeBounds, $agentIds, $groupId)
 {
     $fileCount = $this->uploadDao->countPlainFiles($itemTreeBounds);
     $licenseHistogram = $this->licenseDao->getLicenseHistogram($itemTreeBounds, $agentIds);
     $editedLicensesHist = $this->clearingDao->getClearedLicenseIdAndMultiplicities($itemTreeBounds, $groupId);
     $agentId = GetParm('agentId', PARM_INTEGER);
     $licListUri = Traceback_uri() . "?mod=license_list_files&item={$uploadTreeId}";
     if ($tagId) {
         $licListUri .= "&tag={$tagId}";
     }
     if ($agentId) {
         $licListUri .= "&agentId={$agentId}";
     }
     /* Write license histogram to $VLic  */
     list($tableData, $totalScannerLicenseCount, $editedTotalLicenseCount) = $this->createLicenseHistogramJSarray($licenseHistogram, $editedLicensesHist, $licListUri);
     $uniqueLicenseCount = count($tableData);
     $scannerUniqueLicenseCount = count($licenseHistogram);
     $editedUniqueLicenseCount = count($editedLicensesHist);
     $noScannerLicenseFoundCount = array_key_exists(LicenseDao::NO_LICENSE_FOUND, $licenseHistogram) ? $licenseHistogram[LicenseDao::NO_LICENSE_FOUND]['count'] : 0;
     $editedNoLicenseFoundCount = array_key_exists(LicenseDao::NO_LICENSE_FOUND, $editedLicensesHist) ? $editedLicensesHist[LicenseDao::NO_LICENSE_FOUND]['count'] : 0;
     $vars = array('tableDataJson' => json_encode($tableData), 'uniqueLicenseCount' => $uniqueLicenseCount, 'fileCount' => $fileCount, 'scannerUniqueLicenseCount' => $scannerUniqueLicenseCount, 'editedUniqueLicenseCount' => $editedUniqueLicenseCount, 'scannerLicenseCount' => $totalScannerLicenseCount, 'editedLicenseCount' => $editedTotalLicenseCount - $editedNoLicenseFoundCount, 'noScannerLicenseFoundCount' => $noScannerLicenseFoundCount, 'editedNoLicenseFoundCount' => $editedNoLicenseFoundCount, 'scannerLicenses' => $licenseHistogram, 'editedLicenses' => $editedLicensesHist);
     return $vars;
 }