* @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');
}
////////////
//////////// Check Droits utilisateur ////////////
if (!$l21auth->hasRight('project')) ReloadIndex('admin');
////////////
include_once(override('../level/display.php'));
include_once(override('../project/display.php'));
include_once('../class/class.tag.php');
include_once(override('../vote/display.php'));
// getting tags menu filter
$otag = new tag();
$tags =$otag->getTags('project', -1, false);
$finalities = $GLOBALS ['sql_object']->DBSelect ( SQL_getFinalities ( false ) );
$scales = $GLOBALS ['sql_object']->DBSelect ( SQL_getScales () );
$priorities = $GLOBALS ['sql_object']->DBSelect ( SQL_getPriorities() );
$managers = $sql_object->DBSelect(SQL_getProjectManagersList());
$filter_menu = getMenuFilter($tags, $finalities, $scales, $priorities, $managers);
if(!isset($_GET['statut']) || $_GET['statut']==-1) $statut=-1;
elseif($_GET['statut']!=-1) $statut=$_GET['statut'];
if(!isset($_GET['debut'])) $debut=0;
else $debut=$_GET['debut'];
$mask_statut_1='';
$mask_statut_2='';
$mask_statut_3='';
$mask_statut_4='';
if($statut=='public') $mask_statut_1=' selected="selected"';
if($statut=='draft') $mask_statut_2=' selected="selected"';
if($statut=='archives_p') $mask_statut_3=' selected="selected"';
if($statut=='archives_a') $mask_statut_4=' selected="selected"';
$link_statut=$rub_link."&todo=list";
if(isset($_REQUEST['view'])) $link_statut.="&view=".$_REQUEST['view'];
$current_list = $link_statut;
$link_statut.="&statut=";
$link_self=$link_statut.'&statut='.$statut;
// Nombre d'enregistrement total dans la bdd
$result_nb_req=$sql_object->DBSelect($req_count_projects);
$bdd_nb_projects=$result_nb_req[0]['num_rows'];
$bdd_nb_projects_display = $bdd_nb_projects." "._t('project','nb_total')." \n";
$levels = $GLOBALS['sql_object']->DBSelect(SQL_getLevelsList());
$levels = getLevelChildren($levels, 0); // 0 is parentid
if($statut!=-1) {
$link_back="
";
$req_count_projects=SQL_getCountProjectsList($statut);
$result_nb_req=$sql_object->DBSelect($req_count_projects);
$count_request=$result_nb_req[0]['num_rows'];
// $req_list_projects=SQL_getProjectsList($debut, 999, $statut);
// $projects=$sql_object->DBSelect($req_list_projects);
} else {
$link_back='';
$count_request=$bdd_nb_projects;
// $req_list_projects=SQL_getProjectsList($debut, 999, $statut);
// $projects=$sql_object->DBSelect($req_list_projects);
}
// get total completion by status
$r = $sql_object->DBSelect(SQL_getTotalProjectCompletion($statut));
if(is_array($r) && isset($r[0]['completion'])) $completion_display = mb_ucfirst(_t('project', 'completion')). ' : ' . round($r[0]['completion'], 0) .' % ';
else $completion_display = '';
$comp = $GLOBALS['sql_object']->DBSelect(SQL_getTotalProjectCompletion('P'));
if(is_array($r) && isset($r[0]['completion'])) $completion_dynamic_display = sprintf(''._t('project', 'completion-percentage').'
', ''.round($comp[0]['completion'], 0).' ');
else $completion_dynamic_display = '';
if($count_request<=1) $count_request_display = _t('divers','query_result')." : ".$count_request." "._t('divers','record')." \n";
else $count_request_display = _t('divers','query_result')." : ".$count_request." "._t('divers','records')." \n";
// Liste des acteurs éditable pour les administrateurs
if ($l21auth->isSuperAdmin ()) {
$actors_list = $sql_object->DBSelect(SQL_getActorsListWithOccurrences());
$actors_content = ''.PHP_EOL;
$actors_content .= ''.PHP_EOL;
$actors_content .= '
' . _t('project','modify_actors_notice') .'
'.PHP_EOL;
if(is_array($actors_list)) {
foreach ($actors_list as $a) {
$actors_content .= '
'.$a['actor_name'].'
('.$a['actor_occ'].') ';
}
}
else {
$actors_content .= "
" . _t('divers','nodata') . "
".PHP_EOL;
}
$actors_content .= "
".PHP_EOL;
// we add code to allow inline edition
$js = "$('#actors-container').hide();
if (typeof CKEDITOR !== 'undefined') {
$(\"div[contenteditable='true']\").each(function( index ) {
var element_id = $(this).attr('id');
var arr = element_id.split('-');
var actor_id = arr[1];
// console.log('project : ' + element_id);
CKEDITOR.inline( element_id, {
customConfig: 'l21_light_confignoimgur.js', // because imgur make multi-instance bug
enterMode : CKEDITOR.ENTER_BR,
on: {
blur: function( event ) {
var data = event.editor.getData();
// alert('Sending: ' + data.length + ' to ' + contrib_id );
if(data.length < 2) alertify.error('". addslashes(_t('msg', 'update_failed')) ."');
else {
$.ajax({type:'POST', url: '".SITE_ROOT_URL."project/_ajax_edit.php', data: { name: data, id: actor_id }, dataType: 'json', success: function(data) {
if(data.status==1) {
alertify.success(data.msg);
} else {
alertify.error(data.msg);
}
}});
}
}
}
});
});
}";
footerAddInlineJS($js, 'first');
}
// Liste des statuts disponibles
$select_statut="\n";
$select_statut.=""._t('project','statut_filter')." \n";
$select_statut.="".display_statut('P')." \n";
$select_statut.="".display_statut('D')." \n";
$select_statut.="".display_statut('PA')." \n";
$select_statut.="".display_statut('AA')." \n";
$select_statut.=" \n";
$js = " $('#statut_filter').change(function() {
if($(this).val() != -1) window.location = $(this).val();
});";
footerAddInlineJS($js);
?>
DBSelect ( SQL_getFinalities ( false ) );
if (! isset ( $finalities [0] ['finality_id'] )) return false;
foreach ( $finalities as $finality ) {
$title = '' . $finality ['finality_name'] . ' ' . PHP_EOL;
$html .= '';
$html .='';
$html .= '';
$projects = $GLOBALS ['sql_object']->DBSelect ( SQL_getProjectsList ( 0, 999, $statut, 'FINALITY', $finality['finality_id'] ) );
if (isset ( $projects [0] ['complete_project_name'] )) {
$html .= "
\n";
$html .= "\n";
$html .= "\n";
$html .= "" . mb_ucfirst ( _t ( 'project', 'name' ) ) . " \n";
if(voteEnabled('project')) {
$html .= "" . mb_ucfirst(_t('like', 'likes')) . " \n";
}
$html .= "" . mb_ucfirst ( _t ( 'project', 'priority' ) ) . " \n";
$html .= "" . mb_ucfirst ( _t ( 'project', 'progression' ) ) . " \n";
$html .= "" . mb_ucfirst ( _t ( 'divers', 'date_crea' ) ) . " \n";
// $html .= "".cutText(mb_ucfirst(_t('divers','date_publi')), 13, 1, '')." \n";
$html .= " " . mb_ucfirst ( _t ( 'divers', 'actions' ) ) . " \n";
$html .= " \n";
$html .= " \n";
$html .= "\n";
for($i = 0; $i < count ( $projects ); $i ++) {
$project_name = formatText ( cutText ( $projects [$i] ['complete_project_name'], 70 ), '2HTML' );
$complete_project_name = $projects [$i] ['complete_project_name'];
$project_owner = $projects [$i] ['project_posted_by'];
$project_statut = $projects [$i] ['project_statut'];
$project_published_date = $project_statut == 'D' ? _t ( 'statut', 'draft' ) : $projects [$i] ['project_published_date_display'];
// we get managers
$manager = getAssociatedManagers($projects[$i]['project_id']);
// getting votes number
if(voteEnabled('project')) {
$nbVotes = getNbVotes(array('module' => 'project', 'module_id' => $projects [$i] ['project_id']));
}
// getting tags
$otag = new tag ();
$display_tags = $otag->getTags ( 'project', $projects [$i] ['project_id'], true, ';' );
// getting finalities
$display_finalities = get_finalities($projects[$i]['project_id'], true, ';');
if($projects [$i] ['project_parent_id'] != 0) {
$class='sub-project';
$parentName = '[' . mb_ucfirst(_t('project','parent')) . ' : ' . $projects [$i] ['parent_project_name'] . ']';
} else {
$class = 'project';
$parentName = '';
}
if($l21auth->isProjectManager($l21auth->GetSessionElement( 'id' ), $sql_object, $projects[$i]['project_id'])) $pclass = 'is-mine'; else $pclass = 'is-not-mine';
$html .= "\n";
$html .= "";
$html .= "".$project_name." ";
if(!empty($display_tags)) $html .= " \n";
$html .= " \n";
if(voteEnabled('project')) {
$html .= "".$nbVotes." ";
}
$html .= "" . $projects [$i] ['priority_name'] . " \n";
$html .= "" . $projects [$i] ['project_completed'] . " %
\n";
$html .= "" . $projects [$i] ['project_date_crea_display'] . " \n";
// $html .= "".$project_published_date." \n";
$html .= "\n";
if ($l21auth->isProjectManager ( $l21auth->GetSessionElement ( 'id' ), $sql_object, $projects [$i] ['project_id'] ) || $l21auth->isSuperAdmin ()) {
$html .= "\n";
}
$html .= " \n";
$html .= " \n";
}
$html .= " ";
$html .= "
";
} else {
$html .= "
"._t('project','noresult')."
";
}
$html .= '
';
}
return $html;
}
/**
* get_flat_list()
* return flat list of projects
* @param array $result_projects_list
*/
function get_flat_list($status) {
global $l21auth;
global $sql_object;
$projects=$sql_object->DBSelect(SQL_getProjectsList(0, 999, $status));
$html = '';
$rub_link = "index.php?rub=project";
$link_sup=$rub_link."&todo=sup&id=";
$link_mod=$rub_link."&todo=mod&id=";
$link_det=$rub_link."&todo=det&id=";
$finality ['finality_id'] = '1';
$html .= '';
$html .='';
$html .= '';
if(isset($projects[0]['project_posted_by'])) {
$html .="
\n";
$html .="\n";
$html .="\n";
$html .="".mb_ucfirst(_t('project','name'))." \n";
if(voteEnabled('project')) {
$html .= "" . mb_ucfirst(_t('like', 'likes')) . " \n";
}
$html .="".mb_ucfirst(_t('project','priority'))." \n";
$html .="".mb_ucfirst(_t('project','progression'))." \n";
$html .="".mb_ucfirst(_t('divers','date_crea'))." \n";
// $html .="".cutText(mb_ucfirst(_t('divers','date_publi')), 13, 1, '')." \n";
$html .=" ".mb_ucfirst(_t('divers','actions'))." \n";
$html .=" \n";
$html .=" \n";
$html .="\n";
for($i=0; $i 'project', 'module_id' => $projects [$i] ['project_id']));
}
if($projects [$i] ['project_parent_id'] != 0) {
$class='sub-project';
$parentName = '[' . mb_ucfirst(_t('project','parent')) . ' : ' . $projects [$i] ['parent_project_name'] . ']';
} else {
$class = 'project';
$parentName = '';
}
// we display only wanted status
if($status == -1 || $project_statut == get_sql_status($status)) {
// getting tags
$otag = new tag();
$display_tags =$otag->getTags('project', $projects[$i]['project_id'], true, ';' );
// getting finalities
$display_finalities = get_finalities($projects[$i]['project_id'], true, ';');
if($l21auth->isProjectManager($l21auth->GetSessionElement( 'id' ), $sql_object, $projects[$i]['project_id'])) $pclass = 'is-mine'; else $pclass = 'is-not-mine';
$html .="\n";
$html .="".$project_name." ";
if(!empty($display_tags)) $html .= " ";
$html .= " \n";
if(voteEnabled('project')) {
$html .= "".$nbVotes." ";
}
$html .="".$projects[$i]['priority_name']." \n";
$html .="".$projects[$i]['project_completed']." %
\n";
$html .="".$projects[$i]['project_date_crea_display']." \n";
// $html .="".$project_published_date." \n";
$html .="\n";
if ($l21auth->isProjectManager($l21auth->GetSessionElement('id'), $sql_object, $projects[$i]['project_id']) || $l21auth->isSuperAdmin()) {
$html .="\n";
} else $html .='';
$html .=" \n";
$html .=" \n";
}
}
$html .=" ";
$html .="
";
} else {
$html .="
"._t('project','noresult')."
";
}
$html .="
";
return $html;
}
/**
*
* @param array $data
* @param string $statut
* @param string $filter
* @param integer $id_filter
* @param integer $depth
* @return string
*/
function generate_html_recursive($data, $statut, $filter, $id_filter, $depth)
{
global $l21auth;
global $sql_object;
// begin with an empty html string
$html = '';
$rub_link = "index.php?rub=project";
$link_sup=$rub_link."&todo=sup&id=";
$link_mod=$rub_link."&todo=mod&id=";
$link_det=$rub_link."&todo=det&id=";
$link_statut=$rub_link."&todo=list&statut=";
$link_self=$link_statut.$statut;
// 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 prepare timeline if needed only
$timeline = get_timeline_info();
if(is_array($timeline) && $depth == $timeline['depth']) {
$timelineLink = ' ';
} else $timelineLink ='';
echo '';
// we display link only on main levels
$link_level = 'index.php?rub=level&todo=det&id='. $item['level_id'];
if(!empty($item['level_code'])) $code = ' ['.$item['level_code'].'] '; else $code = '';
$level_label = $item['level_name'] . $code;
$title = '' . formatText($level_label, '2HTML') . ' ' . PHP_EOL;
$html .='';
if($item['level_parent'] == 0) {
$html .='';
}
$html .= '';
$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(isset($projects[0]['complete_project_name'])) {
$html .= "
\n";
$html .= "\n";
$html .= "\n";
$html .= "".mb_ucfirst(_t('project','name'))." \n";
if(voteEnabled('project')) {
$html .= "" . mb_ucfirst(_t('like', 'likes')) . " \n";
}
$html .= "".mb_ucfirst(_t('project','priority'))." \n";
$html .= "".mb_ucfirst(_t('project','progression'))." \n";
$html .= "".mb_ucfirst(_t('divers','date_crea'))." \n";
//$html .= "".cutText(mb_ucfirst(_t('divers','date_publi')), 13, 1, '')." \n";
$html .= " ".mb_ucfirst(_t('divers','actions'))." \n";
$html .= " \n";
$html .= " \n";
$html .= "\n";
for($i=0; $i 'project', 'module_id' => $projects [$i] ['project_id']));
}
// getting tags
$otag = new tag();
$display_tags = $otag->getTags('project', $projects[$i]['project_id'], true, ';' );
// getting finalities
$display_finalities = get_finalities($projects[$i]['project_id'], true, ';');
if($projects [$i] ['project_parent_id'] != 0) {
$class='sub-project';
$parentName = '[' . mb_ucfirst(_t('project','parent')) . ' : ' . $projects [$i] ['parent_project_name'] . ']';
} else {
$class = 'project';
$parentName = '';
}
if($l21auth->isProjectManager($l21auth->GetSessionElement( 'id' ), $sql_object, $projects[$i]['project_id'])) $pclass = 'is-mine'; else $pclass = 'is-not-mine';
$html .= "\n";
$html .= "".$project_name." ";
if(!empty($display_tags)) $html .= " ";
$html .= " \n";
if(voteEnabled('project')) {
$html .= "".$nbVotes." ";
}
$html .= "".$projects[$i]['priority_name']." \n";
$html .= "".$projects[$i]['project_completed']." %
\n";
$html .= "".$projects[$i]['project_date_crea_display']." \n";
// $html .= "".$project_published_date." \n";
$html .= "\n";
if ($l21auth->isProjectManager($l21auth->GetSessionElement('id'), $sql_object, $projects[$i]['project_id']) || $l21auth->isSuperAdmin()) {
$html .= "\n";
}
$html .= " \n";
$html .= " \n";
}
$html .= " ";
$html .= "
";
}
// 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_recursive($item['children'], $statut, $filter, $id_filter, $depth+1);
$html .= '
';
}
// return the resulting html
return $html;
}
?>
isSuperAdmin()) echo $actors_content;
// Ability to sort table
addDynamicCSS('../lib/js/jquery.tablesorter/theme.default.css');
footerAddJS('../lib/js/jquery.tablesorter/jquery.tablesorter.min.js');
$str = '$("table.multisort").tablesorter({ });';
footerAddInlineJS($str);
?>
isSuperAdmin()) {
footerAddJS('../lib/js/TableDnD/dist/jquery.tablednd.1.0.5.min.js');
dragTableSettings();
}
?>