Commit 3381ea09 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

add the hierarchical display

parent 51df336e
......@@ -188,7 +188,7 @@ class tx_nG6_db {
'data_nature' => $row['run_data_nature'],
'sequencer' => $row['run_sequencer'],
'type' => $row['run_type'],
'description' => $row['run_description']
'description' => $row['run_description']
);
}
}
......@@ -214,6 +214,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.params AS analyze_params, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid, '.
'tx_nG6_analyze.hidden AS analyze_hidden, '.
'tx_nG6_project.fe_group AS project_fe_group',
'FROM' => 'tx_nG6_project INNER JOIN (tx_nG6_project_analyze INNER JOIN tx_nG6_analyze ON ' .
......@@ -253,7 +254,8 @@ class tx_nG6_db {
'software' => $row['analyze_software'],
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description']
'description' => $row['analyze_description'],
'parent_id' => $row['analyze_parent_uid']
);
}
}
......@@ -586,6 +588,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.hidden AS analyze_hidden, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid, '.
'tx_nG6_project.fe_group AS project_fe_group',
'FROM' => 'tx_nG6_project INNER JOIN ( tx_nG6_project_run INNER JOIN ( tx_nG6_run INNER JOIN ( tx_nG6_run_analyze INNER JOIN '.
'tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id) ON tx_nG6_run_analyze.run_id = tx_nG6_run.uid '.
......@@ -625,7 +628,8 @@ class tx_nG6_db {
'software' => $row['analyze_software'],
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description']
'description' => $row['analyze_description'],
'parent_id' => $row['analyze_parent_uid']
);
}
}
......@@ -762,9 +766,12 @@ class tx_nG6_db {
'tx_nG6_analyze.directory AS analyze_directory,'.
'tx_nG6_analyze.name AS analyze_name, '.
'tx_nG6_analyze.params AS analyze_params, '.
'tx_nG6_analyze.software AS analyze_software, '.
'tx_nG6_analyze.class AS analyze_class, '.
'tx_nG6_analyze.date AS analyze_date, '.
'tx_nG6_analyze.description AS analyze_description ',
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_project INNER JOIN (tx_nG6_project_analyze INNER JOIN tx_nG6_analyze ON ' .
'tx_nG6_analyze.uid=tx_nG6_project_analyze.analyze_id) ON tx_nG6_project.uid = tx_nG6_project_analyze.project_id ',
'WHERE' => 'tx_nG6_analyze.uid='.$analyse_id,
......@@ -789,7 +796,10 @@ class tx_nG6_db {
'class' => $row['analyze_class'],
'params' => $row['analyze_params'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description']
'description' => $row['analyze_description'],
'parent_id' => $row['analyze_parent_uid'],
'software' => $row['analyze_software'],
'version' => $row['analyze_version']
);
}
return $result;
......@@ -805,7 +815,10 @@ class tx_nG6_db {
'tx_nG6_analyze.params AS analyze_params, '.
'tx_nG6_analyze.class AS analyze_class, '.
'tx_nG6_analyze.date AS analyze_date, '.
'tx_nG6_analyze.description AS analyze_description',
'tx_nG6_analyze.software AS analyze_software, '.
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.description AS analyze_description,'.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_project INNER JOIN ( tx_nG6_project_run INNER JOIN ( tx_nG6_run INNER JOIN ( tx_nG6_run_analyze INNER JOIN '.
'tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id) ON tx_nG6_run_analyze.run_id = tx_nG6_run.uid '.
') ON tx_nG6_run.uid = tx_nG6_project_run.run_id) ON tx_nG6_project_run.project_id = tx_nG6_project.uid ',
......@@ -827,7 +840,10 @@ class tx_nG6_db {
'params' => $row['analyze_params'],
'class' => $row['analyze_class'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description']
'description' => $row['analyze_description'],
'software' => $row['analyze_software'],
'parent_id' => $row['analyze_parent_uid'],
'version' => $row['analyze_version']
);
}
return $result;
......
......@@ -31,6 +31,35 @@ require_once(PATH_t3lib.'class.t3lib_div.php');
class tx_nG6_utils {
/**
* Describe all links between analyzes (and their ancestor) and build a tree. The main Array is the root.
* Example of result : Array( [a] => Array( ["data"] => Array(), ["child"] => Array( ... ) ) )
*
* @param Array $analyzes_map analyze array (for example, result of tx_nG6_db::get_project_analysis(...))
* @return a tree describing the links children-parents of all analyzes
*/
function trace_hierarchy($analyzes_map) {
$base_tree = array();
foreach(array_values($analyzes_map) as $id => $analyze) {
$base_tree[$analyze['id']] = $analyze['parent_id'];
//$tree_analyze[$analyze['id']] = $analyze;
$tree_analyze[$analyze['id']] = array("data" => $analyze, "child" => array());
}
// Create relationships
$h_analysis = array();
foreach($tree_analyze as $analyze_id => $analyze_infos) {
if ($analyze_infos["data"]["parent_id"] == 0) {
$h_analysis[$analyze_id] = &$tree_analyze[$analyze_id];
} else {
$tree_analyze[$analyze_infos["data"]["parent_id"]]["child"][$analyze_id] = &$tree_analyze[$analyze_id];
}
}
return $h_analysis;
}
/**
* Test if the substring ends the string
*
......
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