Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
7b27790b
Commit
7b27790b
authored
Mar 10, 2014
by
Jerome Mariette
Browse files
data repartition ok
parent
dc9bf700
Changes
3
Hide whitespace changes
Inline
Side-by-side
ui/nG6/class.tx_nG6_eid.php
View file @
7b27790b
...
...
@@ -686,20 +686,19 @@ class tx_nG6_eid {
$by
=
trim
(
t3lib_div
::
_GP
(
'by'
));
$role
=
trim
(
t3lib_div
::
_GP
(
'role'
));
print
json_encode
(
tx_nG6_db
::
select_projects_evolution
(
$values
,
$by
,
$role
));
}
elseif
(
$type
==
'get_size_per_group'
){
$usergroup
=
intVal
(
trim
(
t3lib_div
::
_GP
(
'usergroup'
)));
$data_folder
=
trim
(
t3lib_div
::
_GP
(
'data_folder'
));
}
elseif
(
$type
==
'data_distribution'
){
$values
=
split
(
","
,
trim
(
t3lib_div
::
_GP
(
'values'
)));
$by
=
trim
(
t3lib_div
::
_GP
(
'by'
));
$role
=
trim
(
t3lib_div
::
_GP
(
'role'
));
$get_analyzes
=
false
;
if
(
trim
(
t3lib_div
::
_GP
(
'get_analyzes'
))
==
'1'
){
$get_analyzes
=
true
;
}
$
get_cumulatives
=
fals
e
;
if
(
trim
(
t3lib_div
::
_GP
(
'
get_cumulatives
'
))
==
'1'
){
$
get_cumulatives
=
tru
e
;
$
octet
=
tru
e
;
if
(
trim
(
t3lib_div
::
_GP
(
'
octet
'
))
==
'1'
){
$
octet
=
fals
e
;
}
$size_tab
=
tx_nG6_db
::
get_size
(
$usergroup
,
$data_folder
,
$get_analyzes
,
$get_cumulatives
,
0
);
$encode_size_tab
=
json_encode
(
$size_tab
);
print
$encode_size_tab
;
print
json_encode
(
tx_nG6_db
::
select_storage_distribution
(
$values
,
$by
,
$role
,
$get_analyzes
,
$octet
));
}
}
...
...
ui/nG6/lib/class.tx_nG6_db.php
View file @
7b27790b
...
...
@@ -321,6 +321,75 @@ class tx_nG6_db {
return
$results
;
}
function
select_storage_distribution
(
$values
,
$by
,
$role
,
$get_analyzes
,
$octet
)
{
if
(
$by
==
"organism"
||
$by
==
"location"
)
{
$by
=
"tx_nG6_"
.
$by
;
}
$storage_unit
=
"full_seq_size"
;
if
(
$octet
)
{
$storage_unit
=
"storage_size"
;
}
$from
=
""
;
$where
=
""
;
if
(
$role
==
"create_user"
)
{
$from
=
'tx_nG6_project '
.
' INNER JOIN tx_nG6_project_run ON tx_nG6_project_run.project_id= tx_nG6_project.uid'
.
' INNER JOIN tx_nG6_run ON tx_nG6_project_run.run_id= tx_nG6_run.uid'
.
' INNER JOIN fe_users ON tx_nG6_project.cruser_id=fe_users.uid '
.
' INNER JOIN fe_groups ON fe_groups.uid=fe_users.usergroup '
;
}
else
if
(
$role
==
"manager"
)
{
$from
=
'tx_nG6_project '
.
' INNER JOIN tx_nG6_project_run ON tx_nG6_project_run.project_id= tx_nG6_project.uid'
.
' INNER JOIN tx_nG6_run ON tx_nG6_project_run.run_id= tx_nG6_run.uid'
.
' INNER JOIN fe_rights ON tx_nG6_project.uid=fe_rights.project_id '
.
' INNER JOIN fe_users ON fe_rights.fe_user_id=fe_users.uid '
.
' INNER JOIN fe_groups ON fe_groups.uid=fe_users.usergroup '
;
$where
=
"fe_rights.right_id=1"
;
}
$queryParts
=
array
(
'SELECT'
=>
'tx_nG6_run.uid, tx_nG6_run.'
.
$storage_unit
.
', fe_groups.'
.
$by
,
'FROM'
=>
$from
,
'WHERE'
=>
$where
,
'GROUPBY'
=>
''
,
'ORDERBY'
=>
''
,
'LIMIT'
=>
''
);
$results
=
array
();
$res
=
$GLOBALS
[
'TYPO3_DB'
]
->
exec_SELECT_queryArray
(
$queryParts
);
$others
=
0
;
while
(
$res_row
=
$GLOBALS
[
'TYPO3_DB'
]
->
sql_fetch_assoc
(
$res
))
{
$analyses_size
=
0
;
if
(
$get_analyzes
&&
$octet
)
{
$run_analysis
=
tx_nG6_db
::
get_run_analysis
(
$res_row
[
"uid"
]);
foreach
(
$run_analysis
as
$analyse_id
=>
$analyze_values
)
{
$analyses_size
+=
intval
(
$analyze_values
[
"storage_size"
]);
}
}
if
(
in_array
(
$res_row
[
$by
],
$values
)
)
{
if
(
array_key_exists
(
$res_row
[
$by
],
$results
)
)
{
$results
[
$res_row
[
$by
]]
+=
$res_row
[
$storage_unit
]
+
$analyses_size
;
}
else
{
$results
[
$res_row
[
$by
]]
=
$res_row
[
$storage_unit
]
+
$analyses_size
;
}
}
else
{
$others
+=
$res_row
[
$storage_unit
]
+
$analyses_size
;
}
}
if
(
$others
!=
0
)
{
$results
[
"OTHERS"
]
=
$others
;
}
$final_results
=
array
();
foreach
(
$results
as
$group_key
=>
$group_values
)
{
$final_results
[]
=
array
(
$group_key
,
$group_values
);
}
return
$final_results
;
}
/*
* Project functions
...
...
@@ -1017,6 +1086,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '
.
'tx_nG6_analyze.hidden AS analyze_hidden, '
.
'tx_nG6_analyze.description AS analyze_description, '
.
'tx_nG6_analyze.storage_size AS analyze_storage_size, '
.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '
.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid '
,
'FROM'
=>
'tx_nG6_run_analyze '
.
...
...
@@ -1043,6 +1113,7 @@ class tx_nG6_db {
'version'
=>
$row
[
'analyze_version'
],
'date'
=>
$row
[
'analyze_date'
],
'description'
=>
$row
[
'analyze_description'
],
'storage_size'
=>
$row
[
'analyze_storage_size'
],
'is_editable'
=>
$row
[
'analyze_is_editable'
],
'parent_id'
=>
$row
[
'analyze_parent_uid'
]
);
...
...
ui/nG6/res/js/tx_nG6_pi6.js
View file @
7b27790b
...
...
@@ -349,6 +349,73 @@ function projectDistributionHandler() {
});
}
function
dataDistributionHandler
(){
$
(
"
table[id^=data_table_]
"
).
each
(
function
(){
if
(
$
(
this
).
parent
(
'
div.dataTables_wrapper
'
).
first
().
css
(
"
display
"
)
!=
'
none
'
)
{
var
group_by
=
$
(
"
[name=group_by]:checked
"
).
val
();
var
real_group
=
"
laboratories
"
;
if
(
group_by
==
"
organism
"
)
{
real_group
=
"
organizations
"
;
}
else
if
(
group_by
==
"
location
"
)
{
real_group
=
"
locations
"
;
}
var
role
=
$
(
"
[name=users_to_consider]:checked
"
).
val
();
var
values
=
new
Array
();
$
(
this
).
find
(
"
:checked
"
).
each
(
function
(){
values
.
push
(
$
(
this
).
val
());
});
$
.
ajax
({
url
:
"
index.php?eID=tx_nG6&type=data_distribution&by=
"
+
group_by
+
"
&role=
"
+
role
+
"
&values=
"
+
values
.
join
(
"
,
"
),
dataType
:
'
json
'
,
success
:
function
(
val
,
status
,
xhr
)
{
// reformat the data with values to integer
for
(
var
i
=
0
;
i
<
val
.
length
;
i
++
)
{
val
[
i
][
1
]
=
parseInt
(
val
[
i
][
1
]);
}
console
.
log
(
val
)
$
(
'
#highcharts_graph
'
).
highcharts
({
chart
:
{
width
:
930
},
title
:
{
text
:
'
Data storage size gathered by
'
+
real_group
},
tooltip
:
{
pointFormat
:
'
<b>{point.percentage:.1f}%</b>
'
},
credits
:
{
enabled
:
false
},
plotOptions
:
{
pie
:
{
allowPointSelect
:
true
,
cursor
:
'
pointer
'
,
dataLabels
:
{
enabled
:
true
,
color
:
'
#000000
'
,
connectorColor
:
'
#000000
'
,
formatter
:
function
()
{
console
.
log
(
this
)
return
'
<b>
'
+
this
.
point
.
name
+
'
</b>
'
;
}
}
}
},
series
:
[{
type
:
'
pie
'
,
data
:
val
}]
});
$
(
"
#refresh_graph_btn
"
).
addClass
(
"
disabled
"
)
$
(
"
#refresh_graph_btn
"
).
unbind
(
"
click
"
);
}
});
}
});
}
function
dataEvolutionHandler
(){
}
function
updateButtons
()
{
$
(
"
#refresh_graph_btn
"
).
unbind
(
"
click
"
);
...
...
@@ -357,9 +424,9 @@ function updateButtons () {
}
else
if
(
$
(
"
:radio[name=display_b]:checked
"
).
val
()
==
"
project_evolution
"
)
{
$
(
"
#refresh_graph_btn
"
).
bind
(
"
click
"
,
projectEvolutionHandler
);
}
else
if
(
$
(
"
:radio[name=display_b]:checked
"
).
val
()
==
"
data_distribution
"
)
{
alert
(
"
TODO:
data
d
istribution
"
);
$
(
"
#refresh_graph_btn
"
).
bind
(
"
click
"
,
data
D
istribution
Handler
);
}
else
if
(
$
(
"
:radio[name=display_b]:checked
"
).
val
()
==
"
data_evolution
"
)
{
alert
(
"
TODO:
data
e
volution
"
);
$
(
"
#refresh_graph_btn
"
).
bind
(
"
click
"
,
data
E
volution
Handler
);
}
$
(
"
#refresh_graph_btn
"
).
each
(
function
(){
if
(
$
(
"
[type='checkbox']:checked
"
).
size
()
==
0
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment