Commit f7ee077c authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Last fix for class.tx_nG6_eid.php

Same as last commit.

issue #151
parent 91738e64
......@@ -78,7 +78,8 @@ class tx_nG6_eid {
print $html_tree;
// If the type of data requested is run
} else if ($type == 'run'){
}
elseif ($type == 'run'){
$run_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('object_id'));
// Select all analysis linked to the run and the run information
$run_analysis = tx_nG6_db::get_user_run_analysis($user_id, $run_id, 'tx_nG6_analyze.name');
......@@ -93,7 +94,8 @@ class tx_nG6_eid {
print $html_tree;
// If asked to check a job status
} else if($type == 'check_status') {
}
elseif($type == 'check_status') {
$pid = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pid'));
$archive_path = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('archive_path'));
$process = new Process();
......@@ -107,7 +109,7 @@ class tx_nG6_eid {
}
// If asked to hide a {project/run}
} else if ($type == 'hide') {
} elseif ($type == 'hide') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// {project/run}_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -118,18 +120,18 @@ class tx_nG6_eid {
foreach($tab_ids as $id => $value) {
tx_nG6_db::hide_project($value);
}
} else if ($hide_level == 'run') {
} elseif ($hide_level == 'run') {
foreach($tab_ids as $id => $value) {
tx_nG6_db::hide_run($value, $user_id);
}
} else if ($hide_level == 'analysis') {
} elseif ($hide_level == 'analysis') {
foreach($tab_ids as $id => $value) {
tx_nG6_db::hide_analysis($value, $user_id);
}
}
// If asked to unhide a {project/run}
} else if ($type == 'unhide') {
} elseif ($type == 'unhide') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// {project/run}_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -140,18 +142,19 @@ class tx_nG6_eid {
foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_project($value);
}
} else if ($unhide_level == 'run') {
} elseif ($unhide_level == 'run') {
foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_run($value, true);
}
} else if ($unhide_level == 'analysis') {
} elseif ($unhide_level == 'analysis') {
foreach($tab_ids as $id => $value) {
tx_nG6_db::unhide_analysis($value, true);
}
}
// If asked to delete a {project/run/analyze}
} else if ($type == 'delete') {
}
elseif ($type == 'delete') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// {project/run}_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -178,12 +181,12 @@ class tx_nG6_eid {
$res = tx_nG6_db::delete_project($value, $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; }
}
} else if ($delete_level == 'run') {
} elseif ($delete_level == 'run') {
foreach($tab_ids as $id => $value) {
$res = tx_nG6_db::delete_run($value, $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; }
}
} else if ($delete_level == 'analysis') {
} elseif ($delete_level == 'analysis') {
foreach($tab_ids as $id => $value) {
$res = tx_nG6_db::delete_analysis($value, $user_login, $user_pwd, $data_folder);
if ($res != 0) { break; }
......@@ -193,7 +196,7 @@ class tx_nG6_eid {
print $res;
// If asked to publish a project
} else if ($type == 'publish') {
} elseif ($type == 'publish') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// project_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -203,7 +206,7 @@ class tx_nG6_eid {
}
// If asked to unpublish a project
} else if ($type == 'unpublish') {
} elseif ($type == 'unpublish') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// project_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -213,7 +216,7 @@ class tx_nG6_eid {
}
// If asked the size
} else if ($type == 'get_size') {
} elseif ($type == 'get_size') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
$view = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('view'));
$tab_ids = explode(",",$ids);
......@@ -221,14 +224,14 @@ class tx_nG6_eid {
foreach($tab_ids as $id => $value) {
if ($view == "run") {
$full_size += tx_nG6_db::get_run_size($value, true);
} else if ($view == "project") {
} elseif ($view == "project") {
$full_size += tx_nG6_db::get_project_size($value, true);
}
}
print tx_nG6_utils::get_octet_string_representation($full_size);
// data size
}else if ($type == 'get_data_size'){
}elseif ($type == 'get_data_size'){
$run_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('run_ids'));
$data_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('data_ids'));
$analysis_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('analysis_ids'));
......@@ -255,7 +258,7 @@ class tx_nG6_eid {
print $full_size . ":::" . tx_nG6_utils::get_octet_string_representation($full_size);
// If update a field
} else if ($type == 'update_db_field') {
} elseif ($type == 'update_db_field') {
//Retrieve infomation
$table = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table'));
......@@ -279,7 +282,7 @@ class tx_nG6_eid {
}
// add comment
else if ($type == 'add_comment') {
elseif ($type == 'add_comment') {
$view = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('view'));
$view_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('view_id')); // project_id or run_id or analyze_id
$new_comment = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('new_comment'));
......@@ -301,7 +304,7 @@ class tx_nG6_eid {
print $res;
}
//delete comment
else if ($type == 'delete_comment') {
elseif ($type == 'delete_comment') {
$view = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('view'));
$view_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('view_id')); // project_id or run_id or analyze_id
$comment_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('comment_id'));
......@@ -318,7 +321,7 @@ class tx_nG6_eid {
print $res;
}
//update comment
else if ($type == 'update_comment') {
elseif ($type == 'update_comment') {
$comment_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('comment_id'));
$new_comment = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('new_comment'));
$res = 0;
......@@ -327,7 +330,7 @@ class tx_nG6_eid {
print $res;
// If asked the krona page
} else if ($type == 'get_krona') {
} elseif ($type == 'get_krona') {
$data_folder = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('data_folder'));
$file_name = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('file_name'));
......@@ -443,7 +446,7 @@ class tx_nG6_eid {
$val .= '</html>';
print $val;
} else if ($type == 'delete_users') {
} elseif ($type == 'delete_users') {
$ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ids'));
// users_id to array (1;2;3;...) -> [1;2;3;...]
......@@ -487,7 +490,7 @@ class tx_nG6_eid {
}
// to change users' right on project
} else if ($type == 'change_right') {
} elseif ($type == 'change_right') {
$project_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project_id'));
$c_user_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('c_user_id'));
......@@ -496,7 +499,7 @@ class tx_nG6_eid {
tx_nG6_db::change_access_to_project($c_user_id, $project_id, $right_id);
// jquery autocomplete
} else if ($type == 'autocomplete') {
} elseif ($type == 'autocomplete') {
$col = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('gender'));
$project_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project_id'));
......@@ -523,7 +526,7 @@ class tx_nG6_eid {
print $json_res;
// add a new member on project
} else if ($type == 'add_user') {
} elseif ($type == 'add_user') {
$part = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('part'));
$user_name = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('username'));
......@@ -581,14 +584,14 @@ class tx_nG6_eid {
mail($email, $create_user_title, $message, "From: <".$from_email.">");
}
print '2'; // ok
} else if ($res_code == 1) {
} elseif ($res_code == 1) {
print '4'; // username exists
} else if ($res_code == 2) {
} elseif ($res_code == 2) {
print '5'; // email exists
}
// user exists in DB
} else if ($user["username"] != $user_name || $user["email"] != $email || $user["first_name"] != $first_name || $user["last_name"] != $last_name) {
} elseif ($user["username"] != $user_name || $user["email"] != $email || $user["first_name"] != $first_name || $user["last_name"] != $last_name) {
// there is difference between information provided and the user account
print '3';
} else {
......@@ -622,7 +625,7 @@ class tx_nG6_eid {
}
}
else if ($type == 'check_ssh_user'){
elseif ($type == 'check_ssh_user'){
$user_login = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_login'));
$user_pwd = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_pwd'));
$project_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project_id'));
......@@ -638,7 +641,7 @@ class tx_nG6_eid {
if (!$connection) {
//1st test, basic SSH connection
$res = 3;
} else if( !ssh2_auth_password($connection, $user_login,$user_pwd ) ){
} elseif( !ssh2_auth_password($connection, $user_login,$user_pwd ) ){
//2nd test, SSH connection with user + pwd
$res = 2;
}else{
......@@ -669,25 +672,25 @@ class tx_nG6_eid {
}
else if ( $type == 'add_to_ng6_admin'){
elseif ( $type == 'add_to_ng6_admin'){
$userid = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('userid'));
tx_nG6_db::add_to_ng6_admin($userid);
}
else if ( $type == 'delete_from_ng6_admin'){
elseif ( $type == 'delete_from_ng6_admin'){
$userids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('userids'));
$userids = explode(',', $userids);
tx_nG6_db::remove_from_ng6_admin($userids);
}
else if ( $type == 'add_to_ng6_superadmin'){
elseif ( $type == 'add_to_ng6_superadmin'){
$userid = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('userid'));
tx_nG6_db::add_to_ng6_superadmin($userid);
}
else if ( $type == 'delete_from_ng6_superadmin'){
elseif ( $type == 'delete_from_ng6_superadmin'){
$userids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('userids'));
$userids = explode(',', $userids);
tx_nG6_db::remove_from_ng6_superadmin($userids);
}
else if($type == 'update_user'){
elseif($type == 'update_user'){
$email = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('email'));
$first_name = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('first_name'));
$last_name = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('last_name'));
......@@ -735,7 +738,7 @@ class tx_nG6_eid {
print $nb_updated;
}
else if ($type == 'get_user_group'){
elseif ($type == 'get_user_group'){
$id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_id'));
print json_encode(tx_nG6_db::get_group_informations(tx_nG6_db::get_user_usergroup($id)));
}
......@@ -767,7 +770,8 @@ class tx_nG6_eid {
$smarty->assign('login_user', $login_user);
print $smarty->fetch('run_table.tpl');
} elseif($type == 'projects_table') {
}
elseif($type == 'projects_table') {
$smarty = new Smarty();
$smarty->setTemplateDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/pi1');
$smarty->setCompileDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/res/smarty/templates_c');
......@@ -916,13 +920,14 @@ class tx_nG6_eid {
$purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay));
} elseif ($type == 'refresh_purge_list') {
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filter_space'));
$without_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('without_lab'));
$with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab'));
$with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab'));
$create_users = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('create_users'));
//Change date format
//print ('test');
print json_encode(tx_nG6_db::filter_list_retention_data_info($filter_space,$max_retention_date,$create_users, $without_laboratories_id,$with_laboratories_id));
} elseif ($type == 'delete_purge_data') {
//Delete data link to the list of purge demand
......
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