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
17c09807
Commit
17c09807
authored
Feb 26, 2014
by
Jerome Mariette
Browse files
first part for the statistics
parent
91a7757e
Changes
8
Hide whitespace changes
Inline
Side-by-side
ui/nG6/class.tx_nG6_eid.php
View file @
17c09807
...
...
@@ -689,6 +689,10 @@ class tx_nG6_eid {
}
}
print
$res
;
}
elseif
(
$type
==
'project_repartition'
)
{
$role
=
trim
(
t3lib_div
::
_GP
(
'role'
));
$by
=
trim
(
t3lib_div
::
_GP
(
'by'
));
print
json_encode
(
tx_nG6_db
::
select_projects_repartition
(
$role
,
$by
));
}
}
...
...
ui/nG6/lib/class.tx_nG6_db.php
View file @
17c09807
...
...
@@ -174,6 +174,78 @@ class tx_nG6_db {
return
$res_tab
;
}
/**
* Select all project for the current user
*
* @param string $by by can group, organism, location
* @param string $role role can be create_user, manager
* @return table with all projects
*/
function
select_projects_repartition
(
$role
,
$by
=
'title'
)
{
if
(
$role
==
"create_user"
)
{
$queryParts
=
array
(
'SELECT'
=>
'tx_nG6_project.uid as pid, fe_groups.title as title, fe_groups.tx_nG6_organism as organism, fe_groups.tx_nG6_location as location'
,
'FROM'
=>
'tx_nG6_project '
.
' INNER JOIN fe_users ON tx_nG6_project.cruser_id=fe_users.uid '
.
' INNER JOIN fe_groups ON fe_groups.uid=fe_users.usergroup '
,
'WHERE'
=>
""
,
'GROUPBY'
=>
''
,
'ORDERBY'
=>
''
,
'LIMIT'
=>
''
);
//$where = "tx_nG6_project.cruser_id="
}
else
if
(
$role
==
"manager"
)
{
$queryParts
=
array
(
'SELECT'
=>
'tx_nG6_project.uid as pid, fe_groups.title as title, fe_groups.tx_nG6_organism as organism, fe_groups.tx_nG6_location as location'
,
'FROM'
=>
'tx_nG6_project '
.
' 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"
,
'GROUPBY'
=>
''
,
'ORDERBY'
=>
''
,
'LIMIT'
=>
''
);
}
$by_title
=
array
()
;
$by_organism
=
array
();
$by_location
=
array
();
$res
=
$GLOBALS
[
'TYPO3_DB'
]
->
exec_SELECT_queryArray
(
$queryParts
);
while
(
$res_row
=
$GLOBALS
[
'TYPO3_DB'
]
->
sql_fetch_assoc
(
$res
))
{
if
(
!
isset
(
$by_title
[
$res_row
[
'title'
]]))
{
$by_title
[
$res_row
[
'title'
]]
=
array
(
'count'
=>
1
,
'organism'
=>
$row
[
'organism'
],
'location'
=>
$row
[
'location'
]);
}
else
{
$by_title
[
$res_row
[
'title'
]][
'count'
]
+=
1
;
}
if
(
!
isset
(
$by_organism
[
$res_row
[
'organism'
]]))
{
$by_organism
[
$res_row
[
'organism'
]]
=
array
(
'count'
=>
1
);
}
else
{
$by_organism
[
$res_row
[
'organism'
]][
'count'
]
+=
1
;
}
if
(
!
isset
(
$by_location
[
$res_row
[
'location'
]]))
{
$by_location
[
$res_row
[
'location'
]]
=
array
(
'count'
=>
1
);
}
else
{
$by_location
[
$res_row
[
'location'
]][
'count'
]
+=
1
;
}
}
if
(
$by
==
'title'
)
{
return
(
$by_title
);
}
else
if
(
$by
==
'organism'
)
{
return
(
$by_organism
);
}
else
if
(
$by
==
'location'
)
{
return
(
$by_location
);
}
}
/*
* Project functions
*------------------------------------------------------------*/
...
...
ui/nG6/pi6/accordion_graph.tpl
deleted
100644 → 0
View file @
91a7757e
{*
Copyright (C) 2009 INRA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*}
<div
class=
"accordion"
id=
"
{
$prefix
}
_stat_menu"
>
<div
class=
"accordion-group"
>
<div
class=
"accordion-heading"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#
{
$prefix
}
_stat_menu"
href=
"#
{
$prefix
}
_bygroup"
>
By group
</a>
</div>
<div
id=
"
{
$prefix
}
_bygroup"
class=
"accordion-body collapse in"
>
<div
class=
"accordion-inner"
>
<table
class=
"table table-striped table-bordered dataTable"
id=
"
{
$prefix
}
_group_data_table"
>
<thead>
<th><center><input
type=
"checkbox"
id=
"
{
$prefix
}
_chk_all_group"
></center></th>
<th>
Group name
</th>
<th>
Organism
</th>
<th>
Location
</th>
<th>
Number of user in group
</th>
</thead>
<tbody>
<td><center><input
type=
"checkbox"
id=
"
{
$prefix
}
_chk_group_"
value=
"group_"
></center></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tbody>
</table>
<div
id=
"
{
$prefix
}
_group_graph"
>
</div>
</div>
</div>
</div>
<div
class=
"accordion-group"
>
<div
class=
"accordion-heading"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#
{
$prefix
}
_stat_menu"
href=
"#
{
$prefix
}
_byorganism"
>
By organism
</a>
</div>
<div
id=
"
{
$prefix
}
_byorganism"
class=
"accordion-body collapse"
>
<div
class=
"accordion-inner"
>
Anim pariatur cliche...
</div>
</div>
</div>
<div
class=
"accordion-group"
>
<div
class=
"accordion-heading"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#
{
$prefix
}
_stat_menu"
href=
"#
{
$prefix
}
_bylocation"
>
By location
</a>
</div>
<div
id=
"
{
$prefix
}
_bylocation"
class=
"accordion-body collapse"
>
<div
class=
"accordion-inner"
>
Anim pariatur cliche...
</div>
</div>
</div>
<div
class=
"accordion-group"
>
<div
class=
"accordion-heading"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#
{
$prefix
}
_stat_menu"
href=
"#
{
$prefix
}
_bysequencer"
>
By sequencer
</a>
</div>
<div
id=
"
{
$prefix
}
_bysequencer"
class=
"accordion-body collapse"
>
<div
class=
"accordion-inner"
>
Anim pariatur cliche...
</div>
</div>
</div>
</div>
\ No newline at end of file
ui/nG6/pi6/administration_view.tpl
View file @
17c09807
...
...
@@ -46,12 +46,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div
class=
"tab-pane fade in active"
id=
"wf_monitoring"
></div>
<div
class=
"tab-pane fade"
id=
"project_stat"
>
{
include
file
=
"accordion_graph.tpl"
prefix
=
"project"
}
{
include
file
=
"statistics_menu.tpl"
prefix
=
"project"
}
<div
id=
"project_graph"
>
</div>
</div>
<div
class=
"tab-pane fade"
id=
"data_stat"
>
{
include
file
=
"
accordion_graph
.tpl"
prefix
=
"data"
}
{
include
file
=
"
statistics_menu
.tpl"
prefix
=
"data"
}
<div
id=
"data_graph"
>
</div>
<!--
<div id="size_chart"></div>
<div id="chart_options" class="form-inline">
...
...
ui/nG6/pi6/class.tx_nG6_pi6.php
View file @
17c09807
...
...
@@ -89,7 +89,8 @@ class tx_nG6_pi6 extends tslib_pibase {
$smarty
->
assign
(
'group_list'
,
$group_list
);
$smarty
->
assign
(
'data_folder'
,
$this
->
conf
[
"data"
]);
$smarty
->
assign
(
'server_url'
,
$this
->
conf
[
'server_url'
]);
$distribution
=
tx_nG6_db
::
select_projects_repartition
(
'create_user'
,
'title'
);
$smarty
->
assign
(
'distribution'
,
$distribution
);
return
$smarty
->
fetch
(
'administration_view.tpl'
);
}
}
...
...
ui/nG6/pi6/statistics_menu.tpl
0 → 100644
View file @
17c09807
{*
Copyright (C) 2009 INRA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*}
<div
class=
"accordion"
id=
"
{
$prefix
}
_stat_menu"
>
<legend>
1. Which users should be considered ?
</legend>
<label
class=
"radio"
>
<input
type=
"radio"
name=
"users_to_consider_
{
$prefix
}
"
id=
"select_cruser_
{
$prefix
}
"
value=
"create_user"
checked
>
users who have added data
</label>
<label
class=
"radio"
>
<input
type=
"radio"
name=
"users_to_consider_
{
$prefix
}
"
id=
"select_owner_
{
$prefix
}
"
value=
"manager"
>
users for whom data were made available
</label>
<br
/>
<legend>
2. How should they be grouped ?
</legend>
<label
class=
"radio"
>
<input
type=
"radio"
name=
"group_by_
{
$prefix
}
"
id=
"by_laboratories_
{
$prefix
}
"
value=
"title"
checked
>
by laboratories
</label>
<label
class=
"radio"
>
<input
type=
"radio"
name=
"group_by_
{
$prefix
}
"
id=
"by_organization_
{
$prefix
}
"
value=
"organism"
>
by organization
</label>
<label
class=
"radio"
>
<input
type=
"radio"
name=
"group_by_
{
$prefix
}
"
id=
"by_location_
{
$prefix
}
"
value=
"location"
>
by location
</label>
<br
/>
<legend>
3. Which
<span
id=
"by_span_
{
$prefix
}
"
>
laboratories
</span>
should be displayed ?
<small>
non selected ones will be gathered in the "others" group
</small></legend>
<table
class=
"table table-striped table-bordered dataTable"
id=
"data_table_
{
$prefix
}
"
>
<thead>
<th><center><input
type=
"checkbox"
id=
"
{
$prefix
}
_chk_all_group"
></center></th>
<th>
Group name
</th>
<th>
Organism
</th>
<th>
Location
</th>
<th>
Number of project
</th>
</thead>
<tbody>
{
foreach
$distribution
key
=
group_name
item
=
group_values
}
<tr>
<td><center><input
type=
"checkbox"
id=
"
{
$prefix
}
_chk_group_"
value=
"group_"
></center></td>
<td>
{
$group_name
}
</td>
<td>
{
$group_values.organism
}
</td>
<td>
{
$group_values.location
}
</td>
<td>
{
$group_values.count
}
</td>
</tr>
{/
foreach
}
</tbody>
</table>
<br
/>
<div
class=
"row"
>
<div
class=
"span2 offset9"
>
<div
class=
"btn-group"
data-toggle=
"buttons-radio"
>
<button
type=
"button"
id=
"distribution_
{
$prefix
}
"
class=
"btn btn-primary"
>
<i
class=
"icon-certificate icon-white"
></i>
distribution
</button>
<button
type=
"button"
id=
"evolution_
{
$prefix
}
"
class=
"btn"
><i
class=
"icon-random"
></i>
evolution
</button>
</div>
</div>
</div>
</div>
\ No newline at end of file
ui/nG6/res/js/highstock.js
View file @
17c09807
This source diff could not be displayed because it is too large. You can
view the blob
instead.
ui/nG6/res/js/tx_nG6_pi6.js
View file @
17c09807
...
...
@@ -26,7 +26,6 @@
* @author PF bioinformatique de Toulouse <>
*/
$
(
function
()
{
$
(
'
#myTab
'
).
tab
();
...
...
@@ -50,6 +49,117 @@ $(function () {
redraw_chart
();
});
// statistics menu handling
$
(
'
:radio[id^=select_cruser_]
'
).
attr
(
'
checked
'
,
'
checked
'
);
$
(
'
:radio[id^=by_laboratories_]
'
).
attr
(
'
checked
'
,
'
checked
'
);
$
(
'
:radio[id^=distribution_]
'
).
attr
(
'
checked
'
,
'
checked
'
);
$
(
"
:radio[id^=by_]
"
).
change
(
function
(){
var
prefix
=
$
(
this
).
attr
(
"
id
"
).
split
(
"
_
"
)[
2
];
$
(
"
#by_span_
"
+
prefix
).
html
((
$
(
this
).
val
()));
refreshTable
(
prefix
);
});
$
(
"
:radio[id^=select_]
"
).
change
(
function
(){
var
prefix
=
$
(
this
).
attr
(
"
id
"
).
split
(
"
_
"
)[
2
];
refreshTable
(
prefix
);
});
$
(
"
[id^=data_table_]
"
).
dataTable
({
"
aaSorting
"
:
[[
1
,
"
asc
"
]],
"
aoColumns
"
:
[
{
"
bSortable
"
:
false
},
null
,
null
,
null
,
null
]
});
Highcharts
.
getOptions
().
colors
=
Highcharts
.
map
(
Highcharts
.
getOptions
().
colors
,
function
(
color
)
{
return
{
radialGradient
:
{
cx
:
0.5
,
cy
:
0.3
,
r
:
0.7
},
stops
:
[
[
0
,
color
],
[
1
,
Highcharts
.
Color
(
color
).
brighten
(
-
0.3
).
get
(
'
rgb
'
)]
// darken
]
};
});
$
.
ajax
({
url
:
"
index.php?eID=tx_nG6&type=project_repartition&role=create_user
"
,
dataType
:
"
json
"
,
success
:
function
(
data
)
{
console
.
log
(
data
);
$
(
'
#project_graph
'
).
highcharts
({
chart
:
{
plotBackgroundColor
:
null
,
plotBorderWidth
:
null
,
plotShadow
:
false
,
width
:
930
},
tooltip
:
{
pointFormat
:
'
{series.name}: <b>{point.percentage:.1f}%</b>
'
},
plotOptions
:
{
pie
:
{
allowPointSelect
:
true
,
cursor
:
'
pointer
'
,
dataLabels
:
{
enabled
:
true
,
color
:
'
#000000
'
,
connectorColor
:
'
#000000
'
,
formatter
:
function
()
{
return
'
<b>
'
+
this
.
point
.
name
+
'
</b>:
'
+
this
.
percentage
+
'
%
'
;
}
}
}
},
series
:
[{
type
:
'
pie
'
,
name
:
'
Browser share
'
,
data
:
[
[
'
Firefox
'
,
45.0
],
[
'
IE
'
,
26.8
],
{
name
:
'
Chrome
'
,
y
:
12.8
,
sliced
:
true
,
selected
:
true
},
[
'
Safari
'
,
8.5
],
[
'
Opera
'
,
6.2
],
[
'
Others
'
,
0.7
]
]
}]
});
}
});
// lock/unlock chart options fields when ajax request is sent
function
lock_fields
(
lock
){
if
(
lock
==
1
){
...
...
@@ -169,3 +279,19 @@ function initGroupTable () {
var
groupTable
=
$
(
'
#group_data_table
'
).
dataTable
();
return
groupTable
;
}
function
refreshTable
(
kind
)
{
var
role
=
$
(
"
[name=users_to_consider_
"
+
kind
+
"
]:checked
"
).
val
();
var
by
=
$
(
"
[name=group_by_
"
+
kind
+
"
]:checked
"
).
val
();
if
(
kind
==
"
project
"
)
{
$
.
ajax
({
url
:
"
index.php?eID=tx_nG6&type=project_repartition&role=
"
+
role
+
"
&by=
"
+
by
,
dataType
:
'
json
'
,
success
:
function
(
val
,
status
,
xhr
)
{
console
.
log
(
val
);
}
});
}
}
\ No newline at end of file
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