FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
AjaxBulkHistory.php
1 <?php
2 /*
3  Copyright (C) 2014, Siemens AG
4  Author: Daniele Fognini, Johannes Najjar
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 namespace Fossology\UI\Ajax;
21 
30 
32 {
33  const NAME = "bulk-history";
35  private $uploadDao;
37  private $clearingDao;
38 
39  function __construct()
40  {
41  parent::__construct(self::NAME, array(
42  self::PERMISSION => Auth::PERM_READ
43  ));
44 
45  $this->uploadDao = $this->getObject('dao.upload');
46  $this->clearingDao = $this->getObject('dao.clearing');
47  }
48 
53  protected function handle(Request $request)
54  {
55  $uploadId = intval($request->get('upload'));
56  if (empty($uploadId)) {
57  return;
58  }
59  $uploadTreeId = intval($request->get('item'));
60  if (empty($uploadTreeId)) {
61  return;
62  }
63  $onlyTried = !$request->get('all');
64 
65  $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
67  $itemTreeBounds = $this->uploadDao->getItemTreeBounds($uploadTreeId, $uploadTreeTableName);
69  $session = $this->getObject('session');
70  $groupId = $session->get(Auth::GROUP_ID);
71  $bulkHistory = $this->clearingDao->getBulkHistory($itemTreeBounds, $groupId, $onlyTried);
72  return $this->render("bulk-history.html.twig",$this->mergeWithDefault(array('bulkHistory'=>$bulkHistory)));
73  }
74 }
75 
76 register_plugin(new AjaxBulkHistory());
render($templateName, $vars=null, $headers=null)