callCron() static public method

Call cron if time since last launch elapsed
static public callCron ( ) : nothing
return nothing
Example #1
0
    /**
     * Print a simple HTML head with links
     *
     * @param $title        title of the page
     * @param $links array  of links to display
     **/
    static function simpleHeader($title, $links = array())
    {
        global $CFG_GLPI, $HEADER_LOADED;
        // Print a nice HTML-head for help page
        if ($HEADER_LOADED) {
            return;
        }
        $HEADER_LOADED = true;
        self::includeHeader($title);
        // Body
        echo "<body>";
        echo '
<nav class="navbar navbar-default" id="menuHeader">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="' . $CFG_GLPI["root_doc"] . '/front/central.php">
      	<img src="' . $CFG_GLPI["root_doc"] . '/pics/fd_logo1.png" style="margin-top:-4px;" />
      	<span class=\'invisible\'>Logo</span>
      </a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul class="nav navbar-nav" >';
        echo "<li id='menu1'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
        echo "</li>";
        // Main Headline
        echo "<div id='header'>";
        echo "<div id='c_logo'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/' accesskey='1' title=\"" . __s('Home') . "\">" . "<span class='invisible'>Logo</span></a></div>";
        // Les préférences + lien déconnexion
        echo "<div id='c_preference'>";
        echo "<div class='sep'></div>";
        echo "</div>";
        //-- Le moteur de recherche --
        echo "<div id='c_recherche'>";
        echo "<div class='sep'></div>";
        echo "</div>";
        //-- Le menu principal --
        echo "<div id='c_menu'>";
        echo "<ul id='menu'>";
        // Build the navigation-elements
        if (count($links)) {
            $i = 1;
            foreach ($links as $name => $link) {
                echo "<li id='menu{$i}'>";
                echo "<a href='{$link}' title=\"" . $name . "\" class='itemP'>" . $name . "</a>";
                echo "</li>";
                $i++;
            }
        }
        //echo "</ul></div>";
        echo '
			      </ul>
			    </div><!-- /.navbar-collapse -->
			  </div><!-- /.container-fluid -->
			</nav> ';
        // End navigation bar
        // End headline
        ///Le sous menu contextuel 1
        //echo "<div id='c_ssmenu1'></div>";
        //  Le fil d ariane
        /*echo "<div id='c_ssmenu2'></div>";
          echo "</div>"; // fin header
          */
        echo "<div id='page'>";
        // call static function callcron() every 5min
        CronTask::callCron();
    }
Example #2
0
 /**
  * Print a nice HTML head for help page
  *
  * @param $title  title of the page
  * @param $url    not used anymore (default '')
  **/
 static function helpHeader($title, $url = '')
 {
     global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS;
     // Print a nice HTML-head for help page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     $body_class = "layout_" . $_SESSION['glpilayout'];
     if (strpos($_SERVER['REQUEST_URI'], "form.php") !== false && isset($_GET['id']) && $_GET['id'] > 0) {
         if (!CommonGLPI::isLayoutExcludedPage()) {
             $body_class .= " form";
         } else {
             $body_class = "";
         }
     }
     echo "<body class='{$body_class}'>";
     // Main Headline
     echo "<div id='header'>";
     echo "<div id='header_top'>";
     echo "<div id='c_logo'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' accesskey='1' title=\"" . __s('Home') . "\"><span class='invisible'>Logo</span></a>";
     echo "</div>";
     // Les préférences + lien déconnexion
     echo "<div id='c_preference' >";
     echo "<ul>";
     echo "<li id='deconnexion'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/logout.php";
     /// logout witout noAuto login for extauth
     if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
         echo "?noAUTO=1";
     }
     echo "' title=\"" . __s('Logout') . "\">";
     // check user id : header used for display messages when session logout
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/logout.png' title=\"" . __s('Logout') . "\"  alt=\"" . __s('Logout') . "\" class='button-icon'>";
     echo "</a>";
     echo "</li>\n";
     echo "<li id='preferences_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">";
     echo "<span id='preferences_icon' title=\"" . __s('My settings') . "\"  alt=\"" . __s('My settings') . "\" class='button-icon' /></span>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         echo "<span id='myname'>";
         echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
         echo "</span>";
     }
     echo "</a></li>";
     echo "<li>";
     Ajax::createIframeModalWindow('loadbookmark', $CFG_GLPI["root_doc"] . "/front/bookmark.php?action=load", array('title' => __('Load a bookmark'), 'reloadonclose' => true));
     echo "<a href='#' onClick=\"" . Html::jsGetElementbyID('loadbookmark') . ".dialog('open');\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark.png' title=\"" . __s('Load a bookmark') . "\"  alt=\"" . __s('Load a bookmark') . "\" class='button-icon'>";
     echo "</a></li>";
     echo "<li id='help_link'>" . "<a href='" . (empty($CFG_GLPI["helpdesk_doc_url"]) ? "http://glpi-project.org/help-helpdesk" : $CFG_GLPI["helpdesk_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/help.png' title=\"" . __s('Help') . "\"  alt=\"" . __s('Help') . "\" class='button-icon'>";
     "</a></li>";
     echo "</ul>";
     echo "</div>";
     //-- Le moteur de recherche --
     echo "<div id='c_recherche'></div>";
     echo "</div>";
     //-- Le menu principal --
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Build the navigation-elements
     // Home
     echo "<li id='menu1'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
     echo "</li>";
     //  Create ticket
     if (Session::haveRight("ticket", CREATE)) {
         echo "<li id='menu2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
         echo "</li>";
     }
     //  Suivi ticket
     if (Session::haveRight("ticket", Ticket::READMY) || Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
         echo "<li id='menu3'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // Reservation
     if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
         echo "<li id='menu4'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', Session::getPluralNumber()) . "\" class='itemP'>" . _n('Reservation', 'Reservations', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // FAQ
     if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
         echo "<li id='menu5' >";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
         echo "</li>";
     }
     // PLUGINS
     $plugins = array();
     if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
         foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
             if ($active) {
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
     }
     if (isset($plugins) && count($plugins) > 0) {
         $list = array();
         foreach ($plugins as $key => $val) {
             $list[$key] = $val["name"];
         }
         asort($list);
         echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
         echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
         // default none
         echo "<ul class='ssmenu'>";
         // list menu item
         foreach ($list as $key => $val) {
             $link = "";
             if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                 $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
             }
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
         }
         echo "</ul></li>";
     }
     echo "</ul>";
     echo "</div>";
     // End navigation bar
     // End headline
     //  Le fil d ariane
     echo "<div id='c_ssmenu2'>";
     echo "<ul>";
     echo "<li class='breadcrumb_item'>" . "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a></li>";
     if (TicketValidation::getValidateRights()) {
         $opt = array();
         $opt['reset'] = 'reset';
         $opt['criteria'][0]['field'] = 55;
         // validation status
         $opt['criteria'][0]['searchtype'] = 'equals';
         $opt['criteria'][0]['value'] = TicketValidation::WAITING;
         $opt['criteria'][0]['link'] = 'AND';
         $opt['criteria'][1]['field'] = 59;
         // validation aprobator
         $opt['criteria'][1]['searchtype'] = 'equals';
         $opt['criteria'][1]['value'] = Session::getLoginUserID();
         $opt['criteria'][1]['link'] = 'AND';
         $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
         $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' class='pointer'></a>";
         echo "<li class='icons_block'>{$pic_validate}</li>\n";
     }
     if (Session::haveRight('ticket', CREATE) && strpos($_SERVER['PHP_SELF'], "ticket")) {
         echo "<li class='icons_block'><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\" class='pointer'></a></li>";
     }
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
     }
     echo "</ul></div>";
     echo "</div>";
     // fin header
     echo "<div id='page' >";
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }
Example #3
0
 /**
  * Print a nice HTML head for help page
  *
  * @param $title  title of the page
  * @param $url    not used anymore (default '')
  **/
 static function helpHeader($title, $url = '')
 {
     global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS;
     // Print a nice HTML-head for help page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     echo "<body>";
     // Main Headline
     echo "<div id='header'>";
     echo "<div id='c_logo' >";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' accesskey='1' title=\"" . __s('Home') . "\"><span class='invisible'>Logo</span></a></div>";
     // Les préférences + lien déconnexion
     echo "<div id='c_preference' >";
     echo "<ul><li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/logout.php' title=\"" . __s('Logout') . "\">" . __('Logout') . "</a>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         echo "&nbsp;(";
         echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
         echo ")";
     }
     echo "</li>\n";
     echo "<li><a href='" . (empty($CFG_GLPI["helpdesk_doc_url"]) ? "http://glpi-project.org/help-helpdesk" : $CFG_GLPI["helpdesk_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\"> " . __('Help') . "</a></li>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('Settings') . "\">" . __('Settings') . "</a></li>\n";
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>";
     //-- Le moteur de recherche --
     echo "<div id='c_recherche'>";
     echo "<div class='sep'></div>";
     echo "</div>";
     //-- Le menu principal --
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Build the navigation-elements
     // Home
     echo "<li id='menu1'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
     echo "</li>";
     //  Create ticket
     if (Session::haveRight("create_ticket", "1")) {
         echo "<li id='menu2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
         echo "</li>";
     }
     //  Suivi ticket
     if (Session::haveRight("observe_ticket", "1") || Session::haveRight("create_ticket", "1")) {
         echo "<li id='menu3'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', 2) . "</a>";
         echo "</li>";
     }
     // Reservation
     if (Session::haveRight("reservation_helpdesk", "1")) {
         echo "<li id='menu4'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', 2) . "\" class='itemP'>" . _n('Reservation', 'Reservations', 2) . "</a>";
         echo "</li>";
     }
     // FAQ
     if (Session::haveRight("faq", "r")) {
         echo "<li id='menu5' >";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
         echo "</li>";
     }
     // PLUGINS
     $plugins = array();
     if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
         foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
             if ($active) {
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
     }
     if (isset($plugins) && count($plugins) > 0) {
         $list = array();
         foreach ($plugins as $key => $val) {
             $list[$key] = $val["name"];
         }
         asort($list);
         echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
         echo "<a href='#' title=\"" . __s('Plugins') . "\" class='itemP'>" . __('Plugins') . "</a>";
         // default none
         echo "<ul class='ssmenu'>";
         // list menu item
         foreach ($list as $key => $val) {
             $link = "";
             if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                 $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
             }
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
         }
         echo "</ul></li>";
     }
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>";
     // End navigation bar
     // End headline
     ///Le sous menu contextuel 1
     echo "<div id='c_ssmenu1'>&nbsp;</div>";
     //  Le fil d ariane
     echo "<div id='c_ssmenu2'>";
     echo "<ul>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "></a></li>";
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     if (Session::haveRight('validate_incident', 1) || Session::haveRight('validate_request', 1)) {
         $opt = array();
         $opt['reset'] = 'reset';
         $opt['field'][0] = 55;
         // validation status
         $opt['searchtype'][0] = 'equals';
         $opt['contains'][0] = 'waiting';
         $opt['link'][0] = 'AND';
         $opt['field'][1] = 59;
         // validation aprobator
         $opt['searchtype'][1] = 'equals';
         $opt['contains'][1] = Session::getLoginUserID();
         $opt['link'][1] = 'AND';
         $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
         $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'></a>";
         echo "<li>{$pic_validate}</li>\n";
     }
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     if (Session::haveRight('create_ticket', 1) && strpos($_SERVER['PHP_SELF'], "ticket")) {
         echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"></a></li>";
     }
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     /// Bookmark load
     echo "<li>";
     echo "<a href='#' onClick=\"var w=window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=load_bookmark' ,'glpibookmarks', 'height=400, width=600, " . "top=100, left=100, scrollbars=yes' );w.focus();\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark.png' title=\"" . __s('Load a bookmark') . "\" alt=\"" . __s('Load a bookmark') . "\">";
     echo "</a></li>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
     }
     echo "</ul></div>";
     echo "</div>";
     // fin header
     echo "<div id='page' >";
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }