FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
AjaxJobInfo.php
1
<?php
2
/***********************************************************
3
* Copyright (C) 2014 Siemens AG
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* version 2 as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
***********************************************************/
18
19
namespace
Fossology\UI\Ajax
;
20
21
use
Fossology\Lib\Auth\Auth
;
22
use
Fossology\Lib\Db\DbManager
;
23
use
Fossology\Lib\Plugin\DefaultPlugin
;
24
use
Symfony\Component\HttpFoundation\Request
;
25
use
Symfony\Component\HttpFoundation\Response
;
26
27
class
AjaxJobInfo
extends
DefaultPlugin
28
{
29
const
NAME =
"jobinfo"
;
31
private
$dbManager;
32
33
function
__construct()
34
{
35
parent::__construct(self::NAME, array(
36
self::PERMISSION =>
Auth::PERM_READ
37
// , 'outputtype' => 'JSON'
38
));
39
40
$this->
dbManager
= $this->
getObject
(
'db.manager'
);
41
}
42
47
protected
function
handle
(Request $request)
48
{
49
$userId = $_SESSION[
'UserId'
];
50
$jqIds = (array) $request->get(
'jqIds'
);
51
52
$result = array();
53
foreach
($jqIds as $jq_pk) {
54
$jobInfo = $this->
dbManager
->getSingleRow(
55
"SELECT jobqueue.jq_end_bits as end_bits FROM jobqueue INNER JOIN job ON jobqueue.jq_job_fk = job.job_pk
56
WHERE jobqueue.jq_pk = $1 AND job_user_fk = $2"
,
57
array($jq_pk, $userId)
58
);
59
if
($jobInfo !==
false
) {
60
$result[$jq_pk] = array(
'end_bits'
=> $jobInfo[
'end_bits'
]);
61
}
62
}
63
64
ReportCachePurgeAll
();
65
$status = empty($result) ? Response::HTTP_INTERNAL_SERVER_ERROR : Response::HTTP_OK;
66
if
(empty($result)) {
67
$result = array(
"error"
=>
"no info"
);
68
}
69
$response =
new
Response(json_encode($result),$status,array(
'content-type'
=>
'text/json'
));
70
return
$response;
71
}
72
}
73
74
register_plugin(
new
AjaxJobInfo
());
Request
Response
Fossology\UI\Ajax\AjaxJobInfo\handle
handle(Request $request)
Definition:
AjaxJobInfo.php:47
Fossology\Lib\Plugin\DefaultPlugin
Definition:
DefaultPlugin.php:32
Fossology\UI\Ajax\AjaxJobInfo
Definition:
AjaxJobInfo.php:27
Fossology\Lib\Plugin\DefaultPlugin\getObject
getObject($name)
Definition:
DefaultPlugin.php:249
Fossology\Lib\Auth\Auth\PERM_READ
const PERM_READ
Definition:
Auth.php:54
Fossology\UI\Ajax
Definition:
AjaxAdminScheduler.php:20
Auth
ReportCachePurgeAll
ReportCachePurgeAll()
Purge all records from the report cache.
Definition:
common-cache.php:160
dbManager
fo_dbManager * dbManager
fo_dbManager object
Definition:
process.c:28
DbManager
DefaultPlugin
src
www
ui
async
AjaxJobInfo.php
Generated on Mon Jun 29 2020 12:03:44 for FOSSology by
1.8.11