* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html * 'Home' module is used into the back-office */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')){ include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// include_once(override('../vote/display.php')); $user_projects = array(); // to set user project if any and use to display indicator to update ! // Comments if(defined('MOD_COMMENT') && MOD_COMMENT == 1) { include_once(override('../comment/display.php')); include_once(override('../comment/'.SQL.'.inc.php')); include_once('../class/class.comment.php'); if(COMMENT_MODERATION == 1) { $status = array('D'); $comm = new comment(); $data = $comm->getAllByModule($status, $sql_object, false, 'date'); $nb_comments = count($data); $html_comments = getMarkup($data, true, false, false); } else { $status = array('P'); $comm = new comment(); $data = $comm->getAllByModule($status, $sql_object, 10, 'date'); $nb_comments = count($data); $html_comments = getMarkup($data, false, false, false); } echo getAjaxFunction(); } // workgroups users moderation if(defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) { include_once(override('../languages/'.U_L.'/lang_workshop.'.CHARSET.'.php')); $r = $sql_object -> DBSelect(SQL_getWorkgroupsPendingUsers()); if (!is_array($r)) $nb_pendingusers=0; else $nb_pendingusers = count($r); $cnt_pending_users = 0; $liste_pendingusers = ''; if ($nb_pendingusers != 0) { for ($i = 0;$i < count($r);$i++) { // we display only workgroups current user is in charge of if ($l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id'), $sql_object, $r[$i]['workshop_id']) || $l21auth->isSuperAdmin()){ $cnt_pending_users++; $link_accept = '../workshop/_user.php?action=accept&id='. $r[$i]['workshop_id'].'&u_id='.$r[$i]['user_id']; $link_revoke = '../workshop/_user.php?action=unaccept&id='. $r[$i]['workshop_id'].'&u_id='.$r[$i]['user_id']; // we display user link only if admin if($l21auth->isSuperAdmin()) { $username = ''.$r[$i]['user_login'].''; } else { $username = $r[$i]['user_login']; } if(!empty($r[$i]['profile_firstname']) || !empty($r[$i]['profile_lastname'])) { $username .= ' ('.$r[$i]['profile_firstname']. ' ' . $r[$i]['profile_lastname'] .')'; } $username .= ' - '.$r[$i]['profile_email'].''; // $liste_pendingusers .= "\t
  • ". formatText($username, '2HTML') . "
    " .sprintf(_t('workshop', 'workshop_join'), formatText(''.$r[$i]['workshop_denomination'].'', '2HTML')). "" . _t('workshop','del_user') . "" . _t('workshop','del_user') . "
  • \n\n"; $liste_pendingusers .= "\t
  • " . _t('workshop','add_new_user') . "" . _t('workshop','del_user') . "
    ". formatText($username, '2HTML') . "
    " .sprintf(_t('workshop', 'workshop_join'), formatText(''.$r[$i]['workshop_denomination'].'', '2HTML')). "
  • \n\n"; } } if(empty($liste_pendingusers)) $liste_pendingusers .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; // ajax code $js = '$("a.user-action").click(function() { var el = this; var url = $(this).attr("href") + "&mode=ajax"; $.ajax({ type: "GET", url: url, dataType: "json", success: function(data){ if(data.status==1) { // we update the user counter $("#cu").text( parseInt($("#cu").text()) - 1); alertify.success(data.msg); $(el).closest("li").fadeOut(); } else { alertify.error(data.msg); } } }); return false; }); '; footerAddInlineJS($js); } else $liste_pendingusers .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; } // Directory : entries to validate $result_yp = $sql_object -> DBSelect($req_yp); if (!is_array($result_yp)) $nb_yp=0; else $nb_yp = count($result_yp); $link_yp = "index.php?rub=yellowpages&todo=det&id="; $liste_yp = ''; if ($nb_yp<>0) { for ($i = 0;$i < count($result_yp);$i++) { $liste_yp .= "\t
  • " . formatText($result_yp[$i]['yellowp_name'], '2HTML') . "
  • \n\n"; } }else $liste_yp .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; // task you are involved in if(defined('PROJECT_TASK') && PROJECT_TASK == 1) { $projectsTasks = ''; $link = "index.php?rub=project&todo=det&id="; $r = $sql_object -> DBSelect(SQL_get_project_tasks_by_user($l21auth->GetSessionElement('id'), array('todo'))); if(is_array($r)) { for ($i = 0;$i < count($r);$i++) { $projectsTasks .= "\t
  • " . formatText($r[$i]['task_label']) . "" ._t('home','into_project'). " " . formatText($r[$i]['project_name']) . "
  • \n\n"; } } else $projectsTasks .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; // $projectsTasks = print_r($r, true); } // project you are involved in if ($l21auth->hasRight('project') && defined('MOD_PROJECT') && MOD_PROJECT == 1) { $myProjects = ''; $link = "index.php?rub=project&todo=det&id="; $r = $sql_object -> DBSelect(SQL_get_user_projects($l21auth->GetSessionElement('id'))); if(is_array($r)) { for ($i = 0;$i < count($r);$i++) { array_push($user_projects, $r[$i]['project_id']); $myProjects .= "\t
  • " . formatText($r[$i]['project_name']) . "
  • \n\n"; } } else $myProjects .= "\t
  • " ._t('home','noresult'). "
  • \n\n"; } // Indicators to update $result_sdi = $sql_object -> DBSelect(SQL_get_indicators_to_update()); $nb_dashboard=0; $liste_dashboard = ''; $link_dashboard = "index.php?rub=dashboard&todo=det&id="; if(is_array($result_sdi)) { if ($l21auth->isSuperAdmin() || $l21auth->hasRight('dashboard') || $l21auth->hasRight('sdi')) { $nb_dashboard = count($result_sdi); if (count($result_sdi) != 0) { for ($i = 0;$i < count($result_sdi);$i++) { $liste_dashboard .= "\t
  • " . formatText($result_sdi[$i]['sdii_name'], '2HTML') . " (" . formatText($result_sdi[$i]['scale_denomination'], '2HTML') . ")
  • \n\n"; } } else $liste_dashboard .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; } else { if ($l21auth->hasRight('project')) { if ($result_sdi != 0) { for ($i = 0;$i < count($result_sdi);$i++) { $ap = $sql_object -> DBSelect(SQL_get_associated_projects($result_sdi[$i]['sdii_id'])); // we get associated project to each indicator if(is_array($ap)) $arrayCompare = array_extract($ap, 'project_id', true); else $arrayCompare = []; // to ckeck if value are in two arrays, we intersects them ! $intersection = array_intersect($arrayCompare, $user_projects); if (!empty($intersection)) { $liste_dashboard .= "\t
  • " . formatText($result_sdi[$i]['sdii_name'], '2HTML') . " (" . formatText($result_sdi[$i]['scale_denomination'], '2HTML') . ")
  • \n\n"; $nb_dashboard++; } } } else $liste_dashboard .= "\t
  • " ._t('home','noupdate'). "
  • \n\n"; } } } // New users since last connexion if (isset($_SESSION['lastcon'])){ $req_user = SQL_getUser($_SESSION['lastcon']); $resultu = $sql_object -> DBSelect($req_user); if (!is_array($resultu)) $nb_user=0; else $nb_user = count($resultu); $liste_user = ''; $link_user = "index.php?rub=user&todo=det&id="; if ($nb_user<>0) { for ($i = 0;$i < count($resultu);$i++) { $fullname = ''; if(!empty($resultu[$i]['profile_firstname']) || $resultu[$i]['profile_lastname']) { $fullname = ' - '. $resultu[$i]['profile_firstname'].' '.$resultu[$i]['profile_lastname']; } $liste_user .= "\t
  • " . formatText($resultu[$i]['user_login'], '2HTML') . "".$fullname."
  • \n\n"; } }else $liste_user .= "\t
  • " ._t('home','noresult'). "
  • \n\n"; } // Latest news $result_news = $sql_object -> DBSelect($req_news); $liste_news = ''; if (!is_array($result_news)) $nb_news=0; else $nb_news = count($result_news); $link_news = "index.php?rub=news&todo=det&id="; if ($nb_news<>0) { for ($i = 0;$i < count($result_news);$i++) { $liste_news .= "\t
  • " . formatText($result_news[$i]['news_title'], '2HTML') . "
  • \n\n"; } } else $liste_news .= "\t
  • " ._t('home','noresult'). "
  • \n\n"; // Latest connected users $r = $sql_object -> DBSelect(SQL_Get_LatestConnectedUsers(100)); $connected_users = ''; if (!is_array($r)) $nb_connected_users = 0; else $nb_connected_users = count($r); $link = "index.php?rub=user&todo=det&id="; if ($nb_connected_users <> 0) { for ($i = 0;$i < count($r);$i++) { $connected_users .= "\t
  • " . formatText($r[$i]['user_login'], '2HTML') .' ('. $r[$i]['user_last_con_display'] . ")
  • \n\n"; } } else $connected_users .= "\t
  • " ._t('home','noresult'). "
  • \n\n"; // Latest publications $result_publi = $sql_object -> DBSelect($req_publi); $link_publi = "index.php?rub=publication&todo=det&id="; if (!is_array($result_publi)) $nb_publi=0; else $nb_publi = count($result_publi); if ($nb_publi<>0) $liste_publi = "\t
  • " . formatText($result_publi[0]['publi_title'], '2HTML') . "
  • \n\n"; else $liste_publi = "\t
  • " ._t('home','noresult'). "
  • \n\n"; // Latest workgroups reports $result_rep = $sql_object -> DBSelect($req_rep); if (!is_array($result_rep)) $nb_rep=0; else $nb_rep = count($result_rep); $link_rep = "index.php?rub=workshoprep&todo=det&id="; if ($nb_rep<>0) $liste_rep = "\t
  • " . formatText($result_rep[0]['workrep_title'], '2HTML') . "
  • \n\n"; else $liste_rep = "\t
  • " ._t('home','noresult'). "
  • \n\n"; // Projects with a close deadline $rProjects = $sql_object->DBSelect(SQL_getProjects(), 'OBJECT'); $lProjects = ''; if (!is_array($rProjects)) $nbProjects=0; else $nbProjects = count($rProjects); $link_projects = "index.php?rub=project&todo=det&id="; if ($nbProjects > 0) { for ($i = 0;$i < count($rProjects);$i++) { $lProjects .= "\t
  • project_id . "\" title=\"" . formatText($rProjects[$i]->project_name, '2ATT') . "\">" . formatText($rProjects[$i]->project_name, '2HTML') .' ('. $rProjects[$i]->project_estimated_date_display . ")
  • \n\n"; } } else $lProjects .= "\t
  • " ._t('home','noresult'). "
  • \n\n"; ?>
    isSuperAdmin() && defined('MOD_COMMENT') && MOD_COMMENT == 1) { if($nb_comments > 0) $class='block'; else $class='none'; $c = ($class == 'block') ? 'open' : ''; if(COMMENT_MODERATION == 1) { $title = sprintf(_t('home','comment_to_moderate'), ''.$nb_comments.''); } else { $title = sprintf(_t('home','comment'), $nb_comments); } $listing .= ""; $listing .= "
    \n"; if(!empty($html_comments)) $listing .= $html_comments; else $listing .= "
    "._t('home','noresult')."
    "; $listing .= "
    \n"; } if ($l21auth->hasRight('workshop') && defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) { if($cnt_pending_users > 0) $class='block'; else $class='none'; $c = ($class == 'block') ? 'open' : ''; $title = sprintf(_t('home','workshop_pending_users'), ''.$cnt_pending_users.''); $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_pendingusers; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->isSuperAdmin() && defined('MOD_YELLOWPAGES') && MOD_YELLOWPAGES == 1) { if($nb_yp > 0) $class='block'; else $class='none'; $c = ($class == 'block') ? 'open' : ''; $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_yp; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->hasRight('project') && defined('MOD_PROJECT') && MOD_PROJECT == 1) { $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $myProjects; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->hasRight('project') && defined('MOD_PROJECT') && MOD_PROJECT == 1) { if(defined('PROJECT_TASK') && PROJECT_TASK == 1) { $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $projectsTasks; $listing .= "
    \n"; $listing .= "
    \n"; } } if ($l21auth->isSuperAdmin() && defined('MOD_PROJECT') && MOD_PROJECT == 1) { $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $lProjects; $listing .= "
    \n"; $listing .= "
    \n"; } if (($l21auth->hasRight('dashboard') || $l21auth->hasRight('sdi') || $l21auth->hasRight('project') ) && defined('MOD_DASHBOARD') && MOD_DASHBOARD == 1) { if($nb_dashboard > 0) $class='block'; else $class='none'; $c = ($class == 'block') ? 'open' : ''; $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_dashboard; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->isSuperAdmin() && defined('MOD_USER') && MOD_USER == 1) { if($nb_user > 0) $class='block'; else $class='none'; $c = ($class == 'block') ? 'open' : ''; $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_user; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->isSuperAdmin() && defined('MOD_USER') && MOD_USER == 1) { if($nb_connected_users > 1) { $class='block'; $ulclass='col-3'; } else { $class='none'; $ulclass=''; } $c = ($class == 'block') ? 'open' : ''; $listing .= ""; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $connected_users; $listing .= "
    \n"; $listing .= "
    \n"; } $listing .= "
    \n"; if ($l21auth->hasRight('news') && defined('MOD_NEWS') && MOD_NEWS == 1){ $listing .= "

    " . mb_ucfirst(_t('home','news')) . "

    "; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_news; $listing .= "
    \n"; $listing .= "
    \n"; } if ($l21auth->hasRight('publication') && defined('MOD_PUBLICATION') && MOD_PUBLICATION == 1) { $listing .= "

    " . mb_ucfirst(_t('home','publi')) . "

    "; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_publi; $listing .= "
    \n"; // $listing .= "
    " . formatText($result_publi[0]['publi_resume'], '2HTML') . "
    "; $listing .= "
    \n"; } if ($l21auth->hasRight('workshop') && defined('MOD_WORKSHOP') && MOD_WORKSHOP == 1) { $listing .= "

    " . mb_ucfirst(_t('home','report')) . "

    "; $listing .= "
    \n"; $listing .= "
      \n"; $listing .= $liste_rep; $listing .= "
    \n"; $listing .= "
    \n"; } $listing .= "
    \n"; // closing grid echo "

    " . _t('home','accueil') . "


    "; // we create a hook $dispatcher->notify(new sfEvent('home', 'admin_mainpage.top')); echo $listing; // we create a hook $dispatcher->notify(new sfEvent('home', 'admin_mainpage.bottom')); ?>