Commit effe9b6f authored by Jerome Mariette's avatar Jerome Mariette
Browse files

clean some code

parent b90f03ff
...@@ -70,7 +70,7 @@ class tx_nG6_eid { ...@@ -70,7 +70,7 @@ class tx_nG6_eid {
} else if ($type == 'run'){ } else if ($type == 'run'){
$run_id = trim(t3lib_div::_GP('id')); $run_id = trim(t3lib_div::_GP('id'));
// Select all analysis linked to the run and the run information // Select all analysis linked to the run and the run information
$run_analysis = tx_nG6_db::get_run_analysis($user_id, $run_id, 'tx_nG6_analyze.name'); $run_analysis = tx_nG6_db::get_run_analysis($run_id, 'tx_nG6_analyze.name');
$run_info = tx_nG6_db::select_run($run_id); $run_info = tx_nG6_db::select_run($run_id);
// for each analysis // for each analysis
$html_tree = ''; $html_tree = '';
...@@ -131,7 +131,7 @@ class tx_nG6_eid { ...@@ -131,7 +131,7 @@ class tx_nG6_eid {
if ($hide_level == 'project') { if ($hide_level == 'project') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
tx_nG6_db::hide_project($value, $user_id); tx_nG6_db::hide_project($value);
} }
} else if ($hide_level == 'run') { } else if ($hide_level == 'run') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
...@@ -153,15 +153,15 @@ class tx_nG6_eid { ...@@ -153,15 +153,15 @@ class tx_nG6_eid {
if ($unhide_level == 'project') { if ($unhide_level == 'project') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_project($value, $user_id); tx_nG6_db::unhide_project($value);
} }
} else if ($unhide_level == 'run') { } else if ($unhide_level == 'run') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_run($value, $user_id); tx_nG6_db::unhide_run($value, true);
} }
} else if ($unhide_level == 'analysis') { } else if ($unhide_level == 'analysis') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_analysis($value, $user_id); tx_nG6_db::unhide_analysis($value, true);
} }
} }
...@@ -190,12 +190,12 @@ class tx_nG6_eid { ...@@ -190,12 +190,12 @@ class tx_nG6_eid {
if ($res == 0) { if ($res == 0) {
if ($delete_level == 'project') { if ($delete_level == 'project') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
$res = tx_nG6_db::delete_project($user_id, $value, $user_login, $user_pwd, $data_folder); $res = tx_nG6_db::delete_project($value, $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; } if ($res != 0) { break; }
} }
} else if ($delete_level == 'run') { } else if ($delete_level == 'run') {
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
$res = tx_nG6_db::delete_run($user_id, $value, $user_login, $user_pwd, $data_folder); $res = tx_nG6_db::delete_run($value, $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; } if ($res != 0) { break; }
} }
} else if ($delete_level == 'analysis') { } else if ($delete_level == 'analysis') {
...@@ -214,7 +214,7 @@ class tx_nG6_eid { ...@@ -214,7 +214,7 @@ class tx_nG6_eid {
// project_id to array (1;2;3;...) -> [1;2;3;...] // project_id to array (1;2;3;...) -> [1;2;3;...]
$tab_ids = explode(";",$ids); $tab_ids = explode(";",$ids);
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
tx_nG6_db::publish_project($value, $user_id); tx_nG6_db::publish_project($value);
} }
// If asked to unpublish a project // If asked to unpublish a project
...@@ -236,9 +236,9 @@ class tx_nG6_eid { ...@@ -236,9 +236,9 @@ class tx_nG6_eid {
$full_size = 0; $full_size = 0;
foreach($tab_ids as $id => $value) { foreach($tab_ids as $id => $value) {
if ($view == "run") { if ($view == "run") {
$full_size += tx_nG6_db::get_run_size($value, $data_folder, $user_id); $full_size += tx_nG6_db::get_run_size($value, $data_folder);
} else if ($view == "project") { } else if ($view == "project") {
$full_size += tx_nG6_db::get_project_size($value, $data_folder, $user_id); $full_size += tx_nG6_db::get_project_size($value, $data_folder);
} }
} }
print tx_nG6_utils::get_octet_string_representation($full_size); print tx_nG6_utils::get_octet_string_representation($full_size);
...@@ -649,7 +649,7 @@ class tx_nG6_eid { ...@@ -649,7 +649,7 @@ class tx_nG6_eid {
$ddest .= '.'.$run["project_id"]."/Run_".str_replace($char_to_replace, '_', $run["name"]).".".$id[1]."/RawData"; $ddest .= '.'.$run["project_id"]."/Run_".str_replace($char_to_replace, '_', $run["name"]).".".$id[1]."/RawData";
$dest_directories[] = $ddest; $dest_directories[] = $ddest;
} }
foreach(tx_nG6_db::get_run_analysis($user_id, $id[1], 'tx_nG6_analyze.name') as $analyse_id => $analyse_values) { foreach(tx_nG6_db::get_run_analysis($id[1], 'tx_nG6_analyze.name') as $analyse_id => $analyse_values) {
$aid = preg_split("/_/", $analyse_id); $aid = preg_split("/_/", $analyse_id);
if (!in_array($data_folder.$analyse_values["directory"], $src_directories)) { if (!in_array($data_folder.$analyse_values["directory"], $src_directories)) {
$src_directories[] = $data_folder.$analyse_values["directory"]; $src_directories[] = $data_folder.$analyse_values["directory"];
......
...@@ -86,14 +86,7 @@ class tx_nG6_db { ...@@ -86,14 +86,7 @@ class tx_nG6_db {
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$project_id = $row['project_id']; $project_id = $row['project_id'];
if (!isset ($projects['project_'.$project_id])) {
// Is the user allowed to see this project
$user_allowed = false;
if ($row['project_hidden'] == 0 || $row['project_public'] == 0) {
$user_allowed = true;
}
if (!isset ($projects['project_'.$project_id]) and $user_allowed) {
$projects['project_'.$project_id] = array( $projects['project_'.$project_id] = array(
'id' => $project_id, 'id' => $project_id,
'name' => $row['project_name'], 'name' => $row['project_name'],
...@@ -169,15 +162,8 @@ class tx_nG6_db { ...@@ -169,15 +162,8 @@ class tx_nG6_db {
$results = array(); $results = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$run_id = $row['run_id']; $run_id = $row['run_id'];
if (!isset($results['run_'.$run_id])) {
// Is the user allowed to see this run
$user_allowed = false;
if ($row['run_hidden'] == 0) {
$user_allowed = true;
}
if (!isset($results['run_'.$run_id]) and $user_allowed) {
$results['run_'.$run_id] = array( $results['run_'.$run_id] = array(
'id' => $run_id, 'id' => $run_id,
'directory' => $row['run_directory'], 'directory' => $row['run_directory'],
...@@ -233,14 +219,7 @@ class tx_nG6_db { ...@@ -233,14 +219,7 @@ class tx_nG6_db {
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$analyze_id = $row['analyze_id']; $analyze_id = $row['analyze_id'];
if (!isset ($results['analyse_'.$analyze_id])) {
// Is the user allowed to see this analyse
$user_allowed = false;
if ($row['analyze_hidden'] == 0) {
$user_allowed = true;
}
if (!isset ($results['analyse_'.$analyze_id]) and $user_allowed) {
$results['analyse_'.$analyze_id] = array( $results['analyse_'.$analyze_id] = array(
'directory' => $row['analyze_directory'], 'directory' => $row['analyze_directory'],
'name' => $row['analyze_name'], 'name' => $row['analyze_name'],
...@@ -263,14 +242,13 @@ class tx_nG6_db { ...@@ -263,14 +242,13 @@ class tx_nG6_db {
* Hide a project and sublevels (runs & analyzes) datas from database project * Hide a project and sublevels (runs & analyzes) datas from database project
* *
* @param string $p_id the project id to hide * @param string $p_id the project id to hide
* @param string $user_id the current user id
*/ */
function hide_project($p_id, $user_id) { function hide_project($p_id) {
// First change all project runs // First change all project runs
$project_runs = tx_nG6_db::get_project_runs($p_id); $project_runs = tx_nG6_db::get_project_runs($p_id);
foreach($project_runs as $run_id => $run_values) { foreach($project_runs as $run_id => $run_values) {
tx_nG6_db::hide_run($run_values['id'], $user_id); tx_nG6_db::hide_run($run_values['id']);
} }
// Then all project analysis // Then all project analysis
...@@ -287,14 +265,13 @@ class tx_nG6_db { ...@@ -287,14 +265,13 @@ class tx_nG6_db {
* Unhide a project and sublevels (runs & analyzes) datas * Unhide a project and sublevels (runs & analyzes) datas
* *
* @param string $p_id the project id to hide * @param string $p_id the project id to hide
* @param string $user_id the current user id
*/ */
function unhide_project($p_id, $user_id) { function unhide_project($p_id) {
// First change all project runs // First change all project runs
$project_runs = tx_nG6_db::get_project_runs($p_id); $project_runs = tx_nG6_db::get_project_runs($p_id);
foreach($project_runs as $run_id => $run_values) { foreach($project_runs as $run_id => $run_values) {
tx_nG6_db::unhide_run($run_values['id'], $user_id); tx_nG6_db::unhide_run($run_values['id']);
} }
// Then all project analysis // Then all project analysis
...@@ -311,11 +288,10 @@ class tx_nG6_db { ...@@ -311,11 +288,10 @@ class tx_nG6_db {
* Publish the project * Publish the project
* *
* @param string $p_id the project id to publish * @param string $p_id the project id to publish
* @param int $user_id the current user id
*/ */
function publish_project($p_id, $user_id) { function publish_project($p_id) {
// First unhide the project // First unhide the project
tx_nG6_db::unhide_project($p_id, $user_id); tx_nG6_db::unhide_project($p_id);
// The set the project as visible // The set the project as visible
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery ('tx_nG6_project', 'uid='.$p_id, array('public' => '0')); $GLOBALS['TYPO3_DB']-> exec_UPDATEquery ('tx_nG6_project', 'uid='.$p_id, array('public' => '0'));
} }
...@@ -332,13 +308,12 @@ class tx_nG6_db { ...@@ -332,13 +308,12 @@ class tx_nG6_db {
/** /**
* Delete a project and sublevels (runs & analyzes) datas from database project * Delete a project and sublevels (runs & analyzes) datas from database project
* *
* @param string $user_id the user id
* @param string $p_id the project id * @param string $p_id the project id
* @param string $user_login the user login * @param string $user_login the user login
* @param string $user_pwd the user password * @param string $user_pwd the user password
* @param string $data_folder the data folder * @param string $data_folder the data folder
*/ */
function delete_project($user_id, $p_id, $user_login, $user_pwd, $data_folder) { function delete_project($p_id, $user_login, $user_pwd, $data_folder) {
$res = 0; $res = 0;
// All runs // All runs
...@@ -346,7 +321,7 @@ class tx_nG6_db { ...@@ -346,7 +321,7 @@ class tx_nG6_db {
foreach($project_runs as $run_id => $run_values) { foreach($project_runs as $run_id => $run_values) {
if ($run_values['id'] != 'undefined' && $run_values['id'] != '') { if ($run_values['id'] != 'undefined' && $run_values['id'] != '') {
//delete the run sublevels //delete the run sublevels
$res = tx_nG6_db::delete_run($user_id, $run_values['id'], $user_login, $user_pwd, $data_folder); $res = tx_nG6_db::delete_run($run_values['id'], $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; } if ($res != 0) { break; }
} }
} }
...@@ -379,15 +354,14 @@ class tx_nG6_db { ...@@ -379,15 +354,14 @@ class tx_nG6_db {
* *
* @param string $p_id the project id to return the size * @param string $p_id the project id to return the size
* @param string $data_folder the data folder * @param string $data_folder the data folder
* @param string $user_id the user id
*/ */
function get_project_size($p_id, $data_folder, $user_id) { function get_project_size($p_id, $data_folder) {
$full_size = 0; $full_size = 0;
// All runs // All runs
$project_runs = tx_nG6_db::get_project_runs($p_id); $project_runs = tx_nG6_db::get_project_runs($p_id);
foreach($project_runs as $run_id => $run_values) { foreach($project_runs as $run_id => $run_values) {
$full_size += tx_nG6_db::get_run_size($run_values['id'], $data_folder, $user_id); $full_size += tx_nG6_db::get_run_size($run_values['id'], $data_folder);
} }
// All analysis // All analysis
$project_analysis = tx_nG6_db::get_project_analysis($p_id); $project_analysis = tx_nG6_db::get_project_analysis($p_id);
...@@ -444,15 +418,8 @@ class tx_nG6_db { ...@@ -444,15 +418,8 @@ class tx_nG6_db {
$results = array(); $results = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$run_id = $row['run_id']; $run_id = $row['run_id'];
if (!isset($results['run_'.$run_id])) {
// Is the user allowed to see this run
$user_allowed = false;
if ($row['run_hidden'] == 0) {
$user_allowed = true;
}
if (!isset($results['run_'.$run_id]) and $user_allowed) {
$results['run_'.$run_id] = array( $results['run_'.$run_id] = array(
'id' => $run_id, 'id' => $run_id,
'directory' => $row['run_directory'], 'directory' => $row['run_directory'],
...@@ -562,11 +529,10 @@ class tx_nG6_db { ...@@ -562,11 +529,10 @@ class tx_nG6_db {
/** /**
* Select all analysis linked to the specified run * Select all analysis linked to the specified run
* *
* @param int $user_id the user id
* @param string $run_id the run id * @param string $run_id the run id
* @return hash table with all analysis information * @return hash table with all analysis information
*/ */
function get_run_analysis($user_id, $run_id, $orderby='', $limit='') { function get_run_analysis($run_id, $orderby='', $limit='') {
// First select all analysis from the database // First select all analysis from the database
$queryParts = array( $queryParts = array(
'SELECT' => 'tx_nG6_analyze.uid AS analyze_id,'. 'SELECT' => 'tx_nG6_analyze.uid AS analyze_id,'.
...@@ -580,13 +546,9 @@ class tx_nG6_db { ...@@ -580,13 +546,9 @@ class tx_nG6_db {
'tx_nG6_analyze.hidden AS analyze_hidden, '. 'tx_nG6_analyze.hidden AS analyze_hidden, '.
'tx_nG6_analyze.description AS analyze_description, '. 'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ', 'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'fe_rights '. 'FROM' => 'tx_nG6_run_analyze '.
'INNER JOIN tx_nG6_project ON tx_nG6_project.uid=fe_rights.project_id '.
'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_run.uid = tx_nG6_project_run.run_id '.
'INNER JOIN tx_nG6_run_analyze ON tx_nG6_run_analyze.run_id = tx_nG6_run.uid '.
'INNER JOIN tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id ', 'INNER JOIN tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id ',
'WHERE' => 'tx_nG6_run_analyze.run_id='.$run_id.' AND fe_rights.fe_user_id='.$user_id, 'WHERE' => 'tx_nG6_run_analyze.run_id='.$run_id,
'GROUPBY' => '', 'GROUPBY' => '',
'ORDERBY' => $orderby, 'ORDERBY' => $orderby,
'LIMIT' => $limit 'LIMIT' => $limit
...@@ -596,14 +558,7 @@ class tx_nG6_db { ...@@ -596,14 +558,7 @@ class tx_nG6_db {
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$analyze_id = $row['analyze_id']; $analyze_id = $row['analyze_id'];
if (!isset ($results['analyse_'.$analyze_id])) {
// Is the user allowed to see this analyse
$user_allowed = false;
if ($row['analyze_hidden'] == 0) {
$user_allowed = true;
}
if (!isset ($results['analyse_'.$analyze_id]) and $user_allowed) {
$results['analyse_'.$analyze_id] = array( $results['analyse_'.$analyze_id] = array(
'directory' => $row['analyze_directory'], 'directory' => $row['analyze_directory'],
'name' => $row['analyze_name'], 'name' => $row['analyze_name'],
...@@ -625,16 +580,15 @@ class tx_nG6_db { ...@@ -625,16 +580,15 @@ class tx_nG6_db {
/** /**
* Delete a run, sample and sublevel (analyzes) datas from database project * Delete a run, sample and sublevel (analyzes) datas from database project
* *
* @param int $user_id the user id
* @param string $r_id the run id * @param string $r_id the run id
* @param string $user_login the user login * @param string $user_login the user login
* @param string $user_pwd the user password * @param string $user_pwd the user password
* @param string $data_folder the data folder * @param string $data_folder the data folder
*/ */
function delete_run($user_id, $r_id, $user_login, $user_pwd, $data_folder) { function delete_run($r_id, $user_login, $user_pwd, $data_folder) {
$res = 0; $res = 0;
$run_analysis = tx_nG6_db::get_run_analysis($user_id, $r_id); $run_analysis = tx_nG6_db::get_run_analysis($r_id);
foreach($run_analysis as $analyse_id => $analyze_values) { foreach($run_analysis as $analyse_id => $analyze_values) {
if ($analyze_values['id'] != 'undefined' && $analyze_values['id'] != '') { if ($analyze_values['id'] != 'undefined' && $analyze_values['id'] != '') {
// delete table 'analyze' entries // delete table 'analyze' entries
...@@ -678,11 +632,10 @@ class tx_nG6_db { ...@@ -678,11 +632,10 @@ class tx_nG6_db {
* *
* @param string $r_id the run id to return the size * @param string $r_id the run id to return the size
* @param string $data_folder the data folder * @param string $data_folder the data folder
* @param int $user_id the user id
*/ */
function get_run_size($r_id, $data_folder, $user_id) { function get_run_size($r_id, $data_folder) {
$full_size = 0; $full_size = 0;
$run_analysis = tx_nG6_db::get_run_analysis($user_id, $r_id); $run_analysis = tx_nG6_db::get_run_analysis($r_id);
foreach($run_analysis as $analyse_id => $analyze_values) { foreach($run_analysis as $analyse_id => $analyze_values) {
$full_size += tx_nG6_db::get_analysis_size($analyze_values['id'], $data_folder); $full_size += tx_nG6_db::get_analysis_size($analyze_values['id'], $data_folder);
} }
...@@ -700,12 +653,11 @@ class tx_nG6_db { ...@@ -700,12 +653,11 @@ class tx_nG6_db {
* Hide a run and sublevels (analysis) * Hide a run and sublevels (analysis)
* *
* @param string $r_id the run id to hide * @param string $r_id the run id to hide
* @param int $user_id the current user id
*/ */
function hide_run($r_id, $user_id) { function hide_run($r_id) {
// First select all run analysis // First select all run analysis
$run_analysis = tx_nG6_db::get_run_analysis($user_id, $r_id); $run_analysis = tx_nG6_db::get_run_analysis($r_id);
foreach($run_analysis as $analysis_id => $analysis_values) { foreach($run_analysis as $analysis_id => $analysis_values) {
tx_nG6_db::hide_analysis($analysis_values['id']); tx_nG6_db::hide_analysis($analysis_values['id']);
} }
...@@ -718,22 +670,23 @@ class tx_nG6_db { ...@@ -718,22 +670,23 @@ class tx_nG6_db {
* Unhide a run and sublevels (analysis) * Unhide a run and sublevels (analysis)
* *
* @param string $r_id the run id to hide * @param string $r_id the run id to hide
* @param int $user_id the current user id
*/ */
function unhide_run($r_id, $user_id) { function unhide_run($r_id, $unhide_up=false) {
if ($unhide_up) {
// Unhide the project
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery (
'tx_nG6_project, tx_nG6_project_run',
'tx_nG6_project.uid = tx_nG6_project_run.project_id AND tx_nG6_project_run.run_id = '.$r_id ,
array('tx_nG6_project.hidden' => '0')
);
}
// Then all run analysis // Then all run analysis
$run_analysis = tx_nG6_db::get_run_analysis($user_id, $r_id); $run_analysis = tx_nG6_db::get_run_analysis($r_id);
foreach($run_analysis as $analysis_id => $analysis_values) { foreach($run_analysis as $analysis_id => $analysis_values) {
tx_nG6_db::unhide_analysis($analysis_values['id']); tx_nG6_db::unhide_analysis($analysis_values['id']);
} }
// Unhide the project
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery (
'tx_nG6_project, tx_nG6_project_run',
'tx_nG6_project.uid = tx_nG6_project_run.project_id AND tx_nG6_project_run.run_id = '.$r_id ,
array('tx_nG6_project.hidden' => '0')
);
// Finaly change the run itself // Finaly change the run itself
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery ('tx_nG6_run', 'uid='.$r_id, array('hidden' => '0')); $GLOBALS['TYPO3_DB']-> exec_UPDATEquery ('tx_nG6_run', 'uid='.$r_id, array('hidden' => '0'));
...@@ -913,40 +866,43 @@ class tx_nG6_db { ...@@ -913,40 +866,43 @@ class tx_nG6_db {
* *
* @param string $a_id the analysis id to hide * @param string $a_id the analysis id to hide
*/ */
function unhide_analysis($a_id) { function unhide_analysis($a_id, $unhide_up=false) {
$queryParts = array(
'SELECT' => 'tx_nG6_project_analyze.uid', if ($unhide_up) {
'FROM' => 'tx_nG6_project_analyze', $queryParts = array(
'WHERE' => 'tx_nG6_project_analyze.analyze_id = '.$a_id, 'SELECT' => 'tx_nG6_project_analyze.uid',
'GROUPBY' => '', 'FROM' => 'tx_nG6_project_analyze',
'ORDERBY' => '', 'WHERE' => 'tx_nG6_project_analyze.analyze_id = '.$a_id,
'LIMIT' => '' 'GROUPBY' => '',
); 'ORDERBY' => '',
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts) ; 'LIMIT' => ''
$is_project_analyze = $GLOBALS['TYPO3_DB']->sql_num_rows( $res ) ; );
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts) ;
// If the analyse isn't link to run $is_project_analyze = $GLOBALS['TYPO3_DB']->sql_num_rows( $res ) ;
if( $is_project_analyze )
{ // If the analyse isn't link to run
// unhide the project if( $is_project_analyze )
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery ( {
'tx_nG6_project, tx_nG6_project_analyze', // unhide the project
'tx_nG6_project.uid = tx_nG6_project_analyze.project_id AND tx_nG6_project_analyze.analyze_id = '.$a_id , $GLOBALS['TYPO3_DB']-> exec_UPDATEquery (
array('tx_nG6_project.hidden' => '0') 'tx_nG6_project, tx_nG6_project_analyze',
) ; 'tx_nG6_project.uid = tx_nG6_project_analyze.project_id AND tx_nG6_project_analyze.analyze_id = '.$a_id ,
} array('tx_nG6_project.hidden' => '0')
// If the analyse is link to run ) ;
else }
{ // If the analyse is link to run
// unhide the project and the run else
$GLOBALS['TYPO3_DB']->exec_UPDATEquery ( {
'tx_nG6_project, tx_nG6_project_run, tx_nG6_run, tx_nG6_run_analyze', // unhide the project and the run
'tx_nG6_project.uid = tx_nG6_project_run.project_id '. $GLOBALS['TYPO3_DB']->exec_UPDATEquery (
'AND tx_nG6_project_run.run_id = tx_nG6_run.uid '. 'tx_nG6_project, tx_nG6_project_run, tx_nG6_run, tx_nG6_run_analyze',
'AND tx_nG6_run.uid = tx_nG6_run_analyze.run_id '. 'tx_nG6_project.uid = tx_nG6_project_run.project_id '.
'AND tx_nG6_run_analyze.analyze_id = '.$a_id , 'AND tx_nG6_project_run.run_id = tx_nG6_run.uid '.
array('tx_nG6_project.hidden' => '0', 'tx_nG6_run.hidden' => '0') 'AND tx_nG6_run.uid = tx_nG6_run_analyze.run_id '.
) ; 'AND tx_nG6_run_analyze.analyze_id = '.$a_id ,
array('tx_nG6_project.hidden' => '0', 'tx_nG6_run.hidden' => '0')
) ;
}
} }
// Change the analysis itself // Change the analysis itself
......
...@@ -165,11 +165,11 @@ class tx_nG6_pi1 extends tslib_pibase { ...@@ -165,11 +165,11 @@ class tx_nG6_pi1 extends tslib_pibase {
foreach($projects as $project_id => $project_values) { foreach($projects as $project_id => $project_values) {
// project admin ? // project admin ?
if (tx_nG6_db::is_project_administrator($GLOBALS['TSFE']->fe_user->user['uid'], $project_values['id']) ) { $projects[$project_id]['is_admin'] = tx_nG6_db::is_project_administrator($GLOBALS['TSFE']->fe_user->user['uid'], $project_values['id']);
$projects[$project_id]['is_project_admin'] = true; // project manager ?
}else{ $projects[$project_id]['is_manager'] = tx_nG6_db::is_project_manager($GLOBALS['TSFE']->fe_user->user['uid'], $project_values['id']);
$projects[$project_id]['is_project_admin'] = false; // project member ?