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
a23abb97
Commit
a23abb97
authored
Oct 09, 2019
by
Romain Therville
☕
Browse files
New retention policy display in project view
issue
#120
parent
c89d40d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
ui/nG6/lib/class.tx_nG6_db.php
View file @
a23abb97
...
...
@@ -1549,6 +1549,27 @@ static function get_project_runs($project_id, $orderby='', $limit='') {
}
return
$full_size
;
}
static
function
get_project_space_id
(
$project_id
){
$queryParts
=
Array
(
'SELECT'
=>
' space_id '
,
'FROM'
=>
'tx_nG6_project '
,
'WHERE'
=>
'uid = '
.
$project_id
.
' '
,
'GROUPBY'
=>
''
,
'ORDERBY'
=>
''
,
'LIMIT'
=>
''
);
$space_id
=
""
;
$res
=
$GLOBALS
[
'TYPO3_DB'
]
->
exec_SELECT_queryArray
(
$queryParts
);
while
(
$row
=
$GLOBALS
[
'TYPO3_DB'
]
->
sql_fetch_assoc
(
$res
))
{
$space_id
=
$row
[
'space_id'
];
}
return
$space_id
;
}
/*
...
...
ui/nG6/lib/class.tx_nG6_utils.php
View file @
a23abb97
...
...
@@ -278,10 +278,92 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE##
return
$connection
;
}
static
function
get_config_content
(){
$config_file_path
=
__DIR__
.
"/../../../application.properties"
;
$config_file_content
=
file_get_contents
(
$config_file_path
);
return
(
$config_file_content
);
}
static
function
get_retention_policy_from_space_id
(
$space_id
=
"default"
){
$config_file_content
=
tx_nG6_utils
::
get_config_content
(
"default"
);
//file_put_contents("/work/ng6-test/jflow_rtherville/ng6_php.log", "tx_nG6_utils, get_retention_policy_from_space_id(), config_file_content: \n".$config_file_content."\n", FILE_APPEND);
//To explode the file content by line, we use PHP_EOL
$array_config_content
=
explode
(
PHP_EOL
,
$config_file_content
);
//file_put_contents("/work/ng6-test/jflow_rtherville/ng6_php.log", "tx_nG6_utils, get_retention_policy_from_space_id(), array_config_content: \n".print_r($array_config_content,TRUE)."\n", FILE_APPEND);
$space_id_retention_config
=
array
();
$pattern_to_find
=
"[space_"
.
$space_id
.
"]"
;
$is_space_id_found
=
FALSE
;
//We want to return the space id config as an array
foreach
(
$array_config_content
as
$line_id
=>
$line_content
){
//if we found the right section
if
(
$line_content
==
$pattern_to_find
){
$is_space_id_found
=
TRUE
;
}
//If we enter a new section, we stop the line copying
if
(
$is_space_id_found
&&
$line_content
!=
$pattern_to_find
&&
strpos
(
$line_content
,
'['
)
===
0
){
$is_space_id_found
=
FALSE
;
}
if
(
$is_space_id_found
){
$space_id_retention_config
[]
=
$line_content
;
}
}
return
(
$space_id_retention_config
);
}
static
function
get_project_retention_policy
(
$project_id
){
$space_id
=
tx_nG6_db
::
get_project_space_id
(
$project_id
);
$retention_policy
=
tx_nG6_utils
::
get_retention_policy_from_space_id
(
$space_id
);
$retention_line
=
""
;
$policy
=
""
;
$retention_value
=
""
;
$return_text
=
""
;
foreach
(
$retention_policy
as
$line
=>
$line_content
){
if
(
strpos
(
$line_content
,
"retention"
)
===
0
){
$retention_line
=
$line_content
;
}
}
if
(
is_numeric
(
strpos
(
$retention_line
,
"date"
))){
$policy
=
"date"
;
}
elseif
(
is_numeric
(
strpos
(
$retention_line
,
"period"
))){
$policy
=
"period"
;
}
$split_retention_line
=
explode
(
'='
,
$retention_line
);
$retention_value
=
$split_retention_line
[
1
];
if
(
$policy
==
"date"
){
$date
=
date
(
"d/m/Y"
,
strtotime
(
$retention_value
));
$nice_date
=
date
(
'l jS \of F Y h:i:s A'
,
$date
);
$return_text
=
" until "
.
$nice_date
;
}
elseif
(
$policy
==
"period"
){
$return_text
=
" for "
.
$retention_value
.
" months"
;
}
return
(
$return_text
);
}
}
if
(
defined
(
'TYPO3_MODE'
)
&&
$TYPO3_CONF_VARS
[
TYPO3_MODE
][
'XCLASS'
][
'ext/nG6/class.tx_nG6_utils.php'
])
{
include_once
(
$TYPO3_CONF_VARS
[
TYPO3_MODE
][
'XCLASS'
][
'ext/nG6/class.tx_nG6_utils.php'
]);
}
if
(
defined
(
'TYPO3_MODE'
)
&&
$TYPO3_CONF_VARS
[
TYPO3_MODE
][
'XCLASS'
][
'ext/nG6/class.tx_nG6_db.php'
])
{
include_once
(
$TYPO3_CONF_VARS
[
TYPO3_MODE
][
'XCLASS'
][
'ext/nG6/class.tx_nG6_db.php'
]);
}
?>
ui/nG6/pi1/class.tx_nG6_pi1.php
View file @
a23abb97
...
...
@@ -217,6 +217,8 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$txNG6Utils
=
new
tx_nG6_utils
;
//$smarty->register_object('tx_nG6_utils',$txNG6Utils);
$smarty
->
assign_by_ref
(
'tx_nG6_utils'
,
$txNG6Utils
);
$smarty
->
assign_by_ref
(
'retention_policy'
,
tx_nG6_utils
::
get_project_retention_policy
(
$projects
[
key
(
$projects
)][
'id'
]));
}
return
$smarty
->
fetch
(
'project_view.tpl'
);
...
...
ui/nG6/pi1/project_view.tpl
View file @
a23abb97
...
...
@@ -52,6 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<br
/>
{
assign
var
=
"project_size"
value
=
"<span id='size' class='tx-nG6-mini-wait'></span>"
}
Raw data and analysis results use
<strong>
{
$project_size
}
</strong>
on the hard drive for the whole project.
<br
/>
New data added to this project will be kept
{
$retention_policy
}
.
<br
/>
<br><label>
Data overview
</label><br>
<table
class=
"table table-striped table-bordered dataTable"
id=
"manag_purged_data_table"
>
...
...
Romain Therville
☕
@rtherville
mentioned in issue
#120 (closed)
·
Oct 09, 2019
mentioned in issue
#120 (closed)
mentioned in issue #120
Toggle commit list
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