Commit ce6052b5 authored by Romain Therville's avatar Romain Therville 🐭

Superadmins can see all runs on the "Runs list" page (/index.php?id=56)

issue#126
parent 8148ac2a
......@@ -1125,6 +1125,80 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
}
return $projects;
}
/**
* Select all runs for the superadmin
*
* @param string $user_id the user id
* @return table with all projects
*/
/* @param string $user_id the user id
* @return table with all projects
*/
static function select_superadmin_runs( $orderby='', $limit='') {
// Execute the request
$queryParts = Array(
'SELECT' => 'tx_nG6_run.uid AS run_id,'.
'tx_nG6_run.directory AS run_directory,'.
'tx_nG6_run.species AS run_species,'.
'tx_nG6_run.description AS run_description, '.
'tx_nG6_run.data_nature AS run_data_nature, '.
'tx_nG6_run.sequencer AS run_sequencer, '.
'tx_nG6_run.type AS run_type, '.
'tx_nG6_run.name AS run_name, '.
'tx_nG6_run.nb_sequences AS run_nb_sequences, '.
'tx_nG6_run.full_seq_size AS run_full_seq_size, '.
'tx_nG6_run.date AS run_date, '.
'tx_nG6_run.hidden AS run_hidden, '.
'tx_nG6_run.data_state AS run_data_state, '.
'tx_nG6_run.retention_date AS run_retention_date, '.
'tx_nG6_run.purged_date AS run_purged_date, '.
'tx_nG6_run.purged_size AS run_purged_size, '.
'tx_nG6_run.mail_sent_date AS run_mail_sent_date, '.
'tx_nG6_project.uid AS project_id, '.
'tx_nG6_project.name AS project_name ',
'FROM' => 'tx_nG6_project '.
'INNER JOIN tx_nG6_project_run ON tx_nG6_project.uid=tx_nG6_project_run.project_id '.
'INNER JOIN tx_nG6_run ON tx_nG6_project_run.run_id=tx_nG6_run.uid ',
'WHERE' => '',
'GROUPBY' => '',
'ORDERBY' => $orderby,
'LIMIT' => $limit
);
// Then create the result hash table
$results = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$run_id = $row['run_id'];
if (!isset($results['run_'.$run_id])) {
$results['run_'.$run_id] = array(
'id' => $run_id,
'directory' => $row['run_directory'],
'name' => $row['run_name'],
'project_name' => $row['project_name'],
'project_id' => $row['project_id'],
'hidden' => $row['run_hidden'],
'data_state' => $row['run_data_state'],
'retention_date' => $row['run_retention_date'],
'purged_date' => $row['run_purged_date'],
'purged_size' => $row['run_purged_size'],
'mail_sent_date' => $row['run_mail_sent_date'],
'species' => $row['run_species'],
'nb_sequences' => $row['run_nb_sequences'],
'full_seq_size' => $row['run_full_seq_size'],
'date' => $row['run_date'],
'data_nature' => $row['run_data_nature'],
'sequencer' => $row['run_sequencer'],
'type' => $row['run_type'],
'description' => $row['run_description']
);
}
}
return $results;
}
/**
* Select a run from the database
......
......@@ -275,7 +275,11 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$single_run_display = true;
}
} else {
$runs = tx_nG6_db::select_all_user_runs($user_id,"tx_nG6_run.uid DESC");
if($is_current_user_superadmin){
$runs = tx_nG6_db::select_superadmin_runs("tx_nG6_run.uid DESC");
}else{
$runs = tx_nG6_db::select_all_user_runs($user_id,"tx_nG6_run.uid DESC");
}
}
if (count($runs) > 0) {
......
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