FOSSology  4.4.0
Open Source License Compliance by Open Source Software
AjaxBulkHistory.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: Daniele Fognini, Johannes Najjar
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\UI\Ajax;
10 
16 use Symfony\Component\HttpFoundation\Request;
17 use Symfony\Component\HttpFoundation\Response;
18 use Symfony\Component\HttpFoundation\Session\Session;
19 
21 {
22  const NAME = "bulk-history";
24  private $uploadDao;
26  private $clearingDao;
27 
28  function __construct()
29  {
30  parent::__construct(self::NAME, array(
31  self::PERMISSION => Auth::PERM_READ
32  ));
33 
34  $this->uploadDao = $this->getObject('dao.upload');
35  $this->clearingDao = $this->getObject('dao.clearing');
36  }
37 
42  protected function handle(Request $request)
43  {
44  $uploadId = intval($request->get('upload'));
45  if (empty($uploadId)) {
46  return;
47  }
48  $uploadTreeId = intval($request->get('item'));
49  if (empty($uploadTreeId)) {
50  return;
51  }
52  $onlyTried = !$request->get('all');
53 
54  $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
56  $itemTreeBounds = $this->uploadDao->getItemTreeBounds($uploadTreeId, $uploadTreeTableName);
58  $session = $this->getObject('session');
59  $groupId = $session->get(Auth::GROUP_ID);
60  $bulkHistory = $this->clearingDao->getBulkHistory($itemTreeBounds, $groupId, $onlyTried);
61  return $this->render("bulk-history.html.twig",$this->mergeWithDefault(array('bulkHistory'=>$bulkHistory)));
62  }
63 }
64 
65 register_plugin(new AjaxBulkHistory());
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
render($templateName, $vars=null, $headers=null)