* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ // ////////// Check Inclusion de pages //////////// if (!class_exists('auth')) { include_once("../lib/lib_common.php"); ReloadIndex('admin'); } // ////////// // @todo renforcer le check des droits //////////// Check Droits utilisateur //////////// if (!$l21auth->hasRight('project')) ReloadIndex('admin'); //////////// include_once("../lib/input_helpers.php"); include_once(override('../level/display.php', THEME_ADMIN_PATH)); include_once(override('../project/display.php', THEME_ADMIN_PATH)); include_once('../class/class.tag.php'); function displayListProjectByLevels($statut, $filter, $id_filter) { $data = $GLOBALS['sql_object']->DBSelect(SQL_getLevelsList()); // we retrieve main levels if($filter != 'LEVEL') { $data = getLevelChildren($data, 0); // 0 is parentid $depth = 0; } else { $current = $GLOBALS['sql_object']->DBSelect(SQL_getoneLevel($id_filter)); $data = getLevelChildren($GLOBALS['sql_object']->DBSelect(SQL_getLevelsList()), $id_filter); $id_filter = array_extract($data, 'level_id', true, 'children'); $content = '

' . $current[0]['level_name'] . '

' . PHP_EOL; $content .= '

' . $current[0]['level_desc_project'] . '

' . PHP_EOL; $depth = 1; } echo '
'; if(isset($content)) echo $content; echo generate_html_list_recursive($data, $statut, $filter, $id_filter, $depth, ''); echo '
'; } function generate_html_list_recursive($data, $statut, $filter, $id_filter, $depth, $class) { // begin with an empty html string $html = ''; // loop through all items in this level foreach($data as $key => &$item) { // echo "$key

"; // where only interested in numeric items // as those are the actual children if( !is_numeric( $key ) ) { // otherwise continue continue; } // we get all parents // print_r($item); // echo '

'; // we display link only on main levels if($item['level_parent'] == 0) { $class = ' level-' . $item['level_id']; // if root level we init $class to superior level $html .= '

' . PHP_EOL; } else { // @todo - enhance $class / selection system. Today only handle 2 levels $class = 'level-'.$item['level_parent'].' level-' . $item['level_id']; // if not root level we concatenate classes $html .= '' . PHP_EOL; } // we pass the level ID to the SQL query if($filter == 'TAG') { $projects = $GLOBALS['sql_object']->DBSelect(SQL_getProjectsList(0, 999, $statut, 'LEVEL_TAG', $item['level_id'], $id_filter)); } else { $projects = $GLOBALS['sql_object']->DBSelect(SQL_getProjectsList(0, 999, $statut, 'LEVEL', $item['level_id'])); } // // we sort values on level names // // Obtain a list of columns // foreach ($projects as $key => $row) { // $level[$key] = $row['level_name']; // } // // Sort the data with level descending // // Add $projects as the last parameter, to sort by the common key // array_multisort($level, SORT_DESC, $projects); if ($projects != 0) { $html .= '
' . PHP_EOL; for($i = 0; $i < count($projects); $i++) { // getting tags $otag = new tag(); $display_tags =$otag->getTags('project', $projects[$i]['project_id'], true); $project_name = formatText($projects[$i]['complete_project_name'], '2HTML'); $project_description = formatText($projects[$i]['project_description'], '2HTML'); $html .= '

' . PHP_EOL; $html .= '' . PHP_EOL; if(!empty($display_tags)) $html .= "\n"; $html .= '

' . PHP_EOL; } $html .= '
' . PHP_EOL; } // call this funcion recursively // with the next level ($item) // it will figure out again whether that level has numeric children as well // returns a new complete set, if applicable, otherwise an empty string if(isset($item['children'])) $html .= generate_html_list_recursive($item['children'], $statut, $filter, $id_filter, $depth+1, $class); } // return the resulting html return $html; } $excludes = array('csv', 'json', 'png'); $select_format = selectBox($lang['export']['format'], "format_report", strtolower($lang['export']['format']['pdf']), null, $excludes); $js = "$('input.filter-select').change(function() { // console.log($(this).prop('checked')); var matchedClass = $(this).attr('id'); if($(this).prop('checked') === true) { $('input.' + matchedClass).prop('checked', true); } else { $('input.' + matchedClass).prop('checked', false); } return false; });"; footerAddInlineJS($js); $js = "$('#projects_all').click(function() { $('#display_projects').slideUp(); }); $('#projects_det').click(function() { $('#display_projects').slideDown(); });"; footerAddInlineJS($js); // if there is as selection stoed in session if(isset($_SESSION['project_export_ids'])) { $js = ' var actives = '. json_encode($_SESSION["project_export_ids"]) . '; $("#projects_det").click(); $("input:checkbox[name=\'projects_id[]\']").each(function() { // if in array we check input if($.inArray( $(this).val().toString(), actives) != -1) $(this).prop("checked", true); })'; footerAddInlineJS($js); } // affichage liste infos $listing = ''; $listing .= "

" . _t('report','comp_choice') . "

"; $listing .= "
\n"; $listing .= "\t\n"; $listing .= "
\n"; ?>


  • ('._t('project', 'session-stored').')', count($_SESSION['project_export_ids'])); ?>