Commit acb642e7 authored by Celine Noirot's avatar Celine Noirot
Browse files

add with lab implie

parent 24737ffe
......@@ -91,16 +91,17 @@ class tx_nG6_db {
}
function get_project_list_by_group_filter($create_user_id, $user_group_id){
$where="";
function get_project_list_by_group_filter($create_user_id, $without_group_id, $with_group_id){
$where=Array();
$list_project_id_filter_by_group="";
$list_project_id_laboratories="";
if($user_group_id !=""){
### Search for project without group_id implied
if($without_group_id !=""){
#select all project_id with group OR/AND without group
$queryParts=array(
'SELECT' => 'project_id',
'FROM' => 'tx_nG6_view_project_user',
'WHERE' => 'user_group IN ( '.$user_group_id .')',
'WHERE' => 'user_group IN ( '.$without_group_id .')',
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
......@@ -114,21 +115,38 @@ class tx_nG6_db {
$list_project_id_filter_by_group = $res_row['project_id'];
}
}
$where .= "uid NOT IN (".$list_project_id_filter_by_group.")";
$where[] = "uid NOT IN (".$list_project_id_filter_by_group.")";
}
if($create_user_id != ""){
if($where != ""){
$where .= " AND cruser_id IN (".$create_user_id.")";
}else{
$where .= "cruser_id IN (".$create_user_id.")";
### Search for project with group_id implied
if($with_group_id !=""){
#select all project_id with group OR/AND without group
$queryParts=array(
'SELECT' => 'project_id',
'FROM' => 'tx_nG6_view_project_user',
'WHERE' => 'user_group IN ( '.$with_group_id .')',
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($res_row= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if( $list_project_id_filter_by_group != ""){
$list_project_id_filter_by_group .= ",".$res_row['project_id'];
}else{
$list_project_id_filter_by_group = $res_row['project_id'];
}
}
$where[] = "uid IN (".$list_project_id_filter_by_group.")";
}
### add create user filter
if($create_user_id != ""){
$where[] = "cruser_id IN (".$create_user_id.")";
}
$queryParts=array(
'SELECT' => 'uid AS project_id',
'FROM' => 'tx_nG6_project',
'WHERE' => $where,
'WHERE' => join (' AND ', $where),
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
......@@ -151,7 +169,7 @@ class tx_nG6_db {
# OBSOLETE / PURGE management
################################
function filter_list_retention_data_info($filter_size, $max_retention_date, $create_user_id, $user_group_id) {
function filter_list_retention_data_info($filter_size, $max_retention_date, $create_user_id, $without_user_group_id,$with_user_group_id) {
$where = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
$where .= ' AND purge_demand_id IS NULL ';
$where .= ' AND state IN ( \'stored\', \'extended\') ';
......@@ -163,8 +181,9 @@ class tx_nG6_db {
}
$project_list_ids = "";
if ($create_user_id != "" or $user_group_id != "") {
$project_list_ids = tx_nG6_db::get_project_list_by_group_filter($create_user_id,$user_group_id);
if ($create_user_id != "" or $without_user_group_id != "" or $with_user_group_id != "") {
#retrieve list of project id created by a user and with or without a list of group_id
$project_list_ids = tx_nG6_db::get_project_list_by_group_filter($create_user_id,$without_user_group_id, $with_user_group_id);
$where .=" AND project_id in (" . $project_list_ids.")" ;
}
return (tx_nG6_db::select_list_retention_data_info($where));
......
......@@ -322,17 +322,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>4. Without laboratories implie ?</h4>
<h4>4. Laboratories implie: </h4>
<div id="wrapper_datatable_laboratories">
<table class="table table-striped table-bordered dataTable" id="data_table_select_lab">
<thead>
<th></th>
<th>With</th>
<th>Without</th>
<th>Laboratories</th>
</thead>
<tbody>
{foreach $distribution key=group_name item=group_values}
<tr>
<td><center><input type="checkbox" class="chk_without_lab_element" value="{$group_values.group_id}"></center></td>
<td><center><input type="checkbox" class="chk_with_lab_element" name="group_{$group_values.group_id}" value="{$group_values.group_id}"></center></td>
<td><center><input type="checkbox" class="chk_without_lab_element" name="group_{$group_values.group_id}" value="{$group_values.group_id}"></center></td>
<td>{$group_name}</td>
</tr>
{/foreach}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment