grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026. -------------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } /** * Central class **/ class Central extends CommonGLPI { static function getTypeName($nb=0) { // No plural return __('Standard interface'); } function defineTabs($options=array()) { $ong = array(); $this->addStandardTab(__CLASS__, $ong, $options); return $ong; } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { if ($item->getType() == __CLASS__) { $tabs[1] = __('Personal View'); $tabs[2] = __('Group View'); $tabs[3] = __('Global View'); $tabs[4] = _n('RSS feed', 'RSS feeds', Session::getPluralNumber()); return $tabs; } return ''; } static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { if ($item->getType() == __CLASS__) { switch ($tabnum) { case 1 : // all $item->showMyView(); break; case 2 : $item->showGroupView(); break; case 3 : $item->showGlobalView(); break; case 4 : $item->showRSSView(); break; } } return true; } /** * Show the central global view **/ static function showGlobalView() { $showticket = Session::haveRight("ticket", Ticket::READALL); $showproblem = Session::haveRight("problem", Problem::READALL); echo ""; echo ""; if (Session::haveRight("logs", READ)) { echo ""; } echo "
"; echo ""; echo ""; echo "
"; if ($showticket) { Ticket::showCentralCount(); } else { Ticket::showCentralCount(true); } if ($showproblem) { Problem::showCentralCount(); } if (Contract::canView()) { Contract::showCentral(); } echo "
"; //Show last add events Event::showForUser($_SESSION["glpiname"]); echo "
"; if ($_SESSION["glpishow_jobs_at_login"] && $showticket) { echo "
"; Ticket::showCentralNewList(); } } /** * Show the central personal view **/ static function showMyView() { global $DB, $CFG_GLPI; $showticket = Session::haveRightsOr("ticket", array(Ticket::READMY, Ticket::READALL, Ticket::READASSIGN)); $showproblem = Session::haveRightsOr('problem', array(Problem::READALL, Problem::READMY)); echo ""; Plugin::doHook('display_central'); if (Session::haveRight("config", UPDATE)) { $logins = User::checkDefaultPasswords(); $user = new User(); if (!empty($logins)) { $accounts = array(); foreach ($logins as $login) { $user->getFromDBbyName($login); $accounts[] = $user->getLink(); } $message = sprintf(__('For security reasons, please change the password for the default users: %s'), implode(" ", $accounts)); echo ""; } if (file_exists(GLPI_ROOT . "/install/install.php")) { echo ""; } } if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) { if (!DBMysql::isMySQLStrictMode($comment)) { echo ""; } } if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) { $crashedtables = DBMysql::checkForCrashedTables(); if (!empty($crashedtables)) { $tables = array(); foreach ($crashedtables as $crashedtable) { $tables[] = $crashedtable['table']; } echo ""; } } if ($DB->isSlave() && !$DB->first_connection) { echo ""; } echo ""; echo "
"; Html::displayTitle($CFG_GLPI['root_doc']."/pics/warning.png", $message, $message); echo "
"; $message = sprintf(__('For security reasons, please remove file: %s'), "install/install.php"); Html::displayTitle($CFG_GLPI['root_doc']."/pics/warning.png", $message, $message); echo "
"; $message = sprintf(__('SQL strict mode is not fully enabled, recommended for development: %s'), $comment); Html::displayTitle($CFG_GLPI['root_doc']."/pics/warning.png", $message, $message); echo "
"; $message = __('The following SQL tables are marked as crashed:'); $message.= implode(',', $tables); Html::displayTitle($CFG_GLPI['root_doc']."/pics/warning.png", $message, $message); echo "
"; Html::displayTitle($CFG_GLPI['root_doc']."/pics/warning.png", __('SQL replica: read only'), __('SQL replica: read only')); echo "
"; echo ""; echo "
"; if (Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) { Ticket::showCentralList(0,"tovalidate",false); } if ($showticket) { if (Ticket::isAllowedStatus(Ticket::SOLVED, Ticket::CLOSED)) { Ticket::showCentralList(0, "toapprove", false); } Ticket::showCentralList(0, "survey", false); Ticket::showCentralList(0, "rejected", false); Ticket::showCentralList(0, "requestbyself", false); Ticket::showCentralList(0, "observed", false); Ticket::showCentralList(0, "process", false); Ticket::showCentralList(0, "waiting", false); } if ($showproblem) { Problem::showCentralList(0, "process", false); } echo "
"; echo ""; echo "
"; Planning::showCentral(Session::getLoginUserID()); Reminder::showListForCentral(); if (Session::haveRight("reminder_public", READ)) { Reminder::showListForCentral(false); } echo "
"; } /** * Show the central RSS view * * @since version 0.84 **/ static function showRSSView() { echo ""; echo ""; echo "
"; RSSFeed::showListForCentral(); echo ""; if (RSSFeed::canView()) { RSSFeed::showListForCentral(false); } else { echo " "; } echo "
"; } /** * Show the central group view **/ static function showGroupView() { $showticket = Session::haveRightsOr("ticket", array(Ticket::READALL, Ticket::READASSIGN)); $showproblem = Session::haveRightsOr('problem', array(Problem::READALL, Problem::READMY)); echo ""; echo ""; echo "
"; echo ""; echo "
"; if ($showticket) { Ticket::showCentralList(0, "process", true); } if (Session::haveRight('ticket', Ticket::READGROUP)) { Ticket::showCentralList(0, "waiting", true); } if ($showproblem) { Problem::showCentralList(0, "process", true); } echo "
"; echo ""; echo "
"; if (Session::haveRight('ticket', Ticket::READGROUP)) { Ticket::showCentralList(0, "observed", true); Ticket::showCentralList(0, "toapprove", true); Ticket::showCentralList(0, "requestbyself", true); } else { Ticket::showCentralList(0, "waiting", true); } echo "
"; } } ?>