Central::showMyView PHP Method

showMyView() static public method

Show the central personal view
static public showMyView ( )
    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));
        $showsurvey = Session::haveRight('ticket', Ticket::SURVEY);
        echo "<table class='tab_cadre_central'>";
        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 "<tr><th colspan='2'>";
                Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
                echo "</th></tr>";
            }
            if (file_exists(GLPI_ROOT . "/install/install.php")) {
                echo "<tr><th colspan='2'>";
                $message = sprintf(__('For security reasons, please remove file: %s'), "install/install.php");
                Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
                echo "</th></tr>";
            }
        }
        if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
            if (!DBMysql::isMySQLStrictMode($comment)) {
                echo "<tr><th colspan='2'>";
                $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 "</th></tr>";
            }
        }
        if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
            $crashedtables = DBMysql::checkForCrashedTables();
            if (!empty($crashedtables)) {
                $tables = array();
                foreach ($crashedtables as $crashedtable) {
                    $tables[] = $crashedtable['table'];
                }
                echo "<tr><th colspan='2'>";
                $message = __('The following SQL tables are marked as crashed:');
                $message .= implode(',', $tables);
                Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
                echo "</th></tr>";
            }
        }
        if ($DB->isSlave() && !$DB->first_connection) {
            echo "<tr><th colspan='2'>";
            Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", __('SQL replica: read only'), __('SQL replica: read only'));
            echo "</th></tr>";
        }
        echo "<tr class='noHover'><td class='top' width='50%'><table class='central'>";
        echo "<tr class='noHover'><td>";
        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);
            }
            if ($showsurvey) {
                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 "</td></tr>";
        echo "</table></td>";
        echo "<td class='top'  width='50%'><table class='central'>";
        echo "<tr class='noHover'><td>";
        Planning::showCentral(Session::getLoginUserID());
        Reminder::showListForCentral();
        if (Session::haveRight("reminder_public", READ)) {
            Reminder::showListForCentral(false);
        }
        echo "</td></tr>";
        echo "</table></td></tr></table>";
    }

Usage Example

Example #1
0
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkCentralAccess();
$central = new Central();
if (!isset($_REQUEST['glpi_tab'])) {
    exit;
}
switch ($_REQUEST['glpi_tab']) {
    case 2:
        $central->showGroupView();
        break;
    case 3:
        $central->showGlobalView();
        break;
    case -1:
        // all
        $central->showMyView();
        echo "<br>";
        $central->showGroupView();
        echo "<br>";
        $central->showGlobalView();
        echo "<br>";
        Plugin::displayAction($central, $_REQUEST['glpi_tab']);
        break;
    default:
        if (!Plugin::displayAction($central, $_REQUEST['glpi_tab'])) {
            $central->showMyView();
        }
}
ajaxFooter();