Exemple #1
0
 /**
  * Show tabs content
  *
  * @since version 0.85
  *
  * @param $options array of parameters to add to URLs and ajax
  *     - withtemplate is a template view ?
  *
  * @return Nothing ()
  **/
 function showTabsContent($options = array())
 {
     global $CFG_GLPI;
     // for objects not in table like central
     if (isset($this->fields['id'])) {
         $ID = $this->fields['id'];
     } else {
         if (isset($options['id'])) {
             $ID = $options['id'];
         } else {
             $ID = 0;
         }
     }
     $target = $_SERVER['PHP_SELF'];
     $extraparamhtml = "";
     $extraparam = "";
     $withtemplate = "";
     if (is_array($options) && count($options)) {
         if (isset($options['withtemplate'])) {
             $withtemplate = $options['withtemplate'];
         }
         $cleaned_options = $options;
         if (isset($cleaned_options['id'])) {
             unset($cleaned_options['id']);
         }
         if (isset($cleaned_options['stock_image'])) {
             unset($cleaned_options['stock_image']);
         }
         $extraparamhtml = "&" . Toolbox::append_params($cleaned_options, '&');
         $extraparam = "&" . Toolbox::append_params($cleaned_options);
     }
     echo "<div class='glpi_tabs " . ($this->isNewID($ID) ? "new_form_tabs" : "") . "'>";
     echo "<div id='tabspanel' class='center-h'></div>";
     $current_tab = 0;
     $onglets = $this->defineAllTabs($options);
     $display_all = true;
     if (isset($onglets['no_all_tab'])) {
         $display_all = false;
         unset($onglets['no_all_tab']);
     }
     if (count($onglets)) {
         $tabpage = $this->getTabsURL();
         $tabs = array();
         foreach ($onglets as $key => $val) {
             $tabs[$key] = array('title' => $val, 'url' => $tabpage, 'params' => "_target={$target}&amp;_itemtype=" . $this->getType() . "&amp;_glpi_tab={$key}&amp;id={$ID}{$extraparamhtml}");
         }
         // Not all tab for templates and if only 1 tab
         if ($display_all && empty($withtemplate) && count($tabs) > 1) {
             $tabs[-1] = array('title' => __('All'), 'url' => $tabpage, 'params' => "_target={$target}&amp;_itemtype=" . $this->getType() . "&amp;_glpi_tab=-1&amp;id={$ID}{$extraparamhtml}");
         }
         Ajax::createTabs('tabspanel', 'tabcontent', $tabs, $this->getType(), $ID, $this->taborientation);
     }
     echo "</div>";
 }
Exemple #2
0
 function showTabs($options = array())
 {
     global $CFG_GLPI;
     // for objects not in table like central
     $ID = 0;
     if (isset($this->fields['id'])) {
         $ID = $this->fields['id'];
     }
     $target = $_SERVER['PHP_SELF'];
     $extraparamhtml = "";
     $extraparam = "";
     $withtemplate = "";
     if (is_array($options) && count($options)) {
         if (isset($options['withtemplate'])) {
             $withtemplate = $options['withtemplate'];
         }
         foreach ($options as $key => $val) {
             $extraparamhtml .= "&amp;{$key}={$val}";
             $extraparam .= "&{$key}={$val}";
         }
     }
     if (empty($withtemplate) && $ID && $this->getType() && $this->displaylist) {
         $glpilistitems =& $_SESSION['glpilistitems'][$this->getType()];
         $glpilisttitle =& $_SESSION['glpilisttitle'][$this->getType()];
         $glpilisturl =& $_SESSION['glpilisturl'][$this->getType()];
         if (empty($glpilisturl)) {
             $glpilisturl = $this->getSearchURL();
         }
         echo "<div id='menu_navigate'>";
         $next = $prev = $first = $last = -1;
         $current = false;
         if (is_array($glpilistitems)) {
             $current = array_search($ID, $glpilistitems);
             if ($current !== false) {
                 if (isset($glpilistitems[$current + 1])) {
                     $next = $glpilistitems[$current + 1];
                 }
                 if (isset($glpilistitems[$current - 1])) {
                     $prev = $glpilistitems[$current - 1];
                 }
                 $first = $glpilistitems[0];
                 if ($first == $ID) {
                     $first = -1;
                 }
                 $last = $glpilistitems[count($glpilistitems) - 1];
                 if ($last == $ID) {
                     $last = -1;
                 }
             }
         }
         $cleantarget = Html::cleanParametersURL($target);
         echo "<ul>";
         echo "<li><a href=\"javascript:showHideDiv('tabsbody','tabsbodyimg','" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png','" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png')\">";
         echo "<img alt='' name='tabsbodyimg' src=\"" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png\">";
         echo "</a></li>";
         echo "<li><a href=\"" . $glpilisturl . "\">";
         if ($glpilisttitle) {
             if (Toolbox::strlen($glpilisttitle) > $_SESSION['glpidropdown_chars_limit']) {
                 $glpilisttitle = Toolbox::substr($glpilisttitle, 0, $_SESSION['glpidropdown_chars_limit']) . "&hellip;";
             }
             echo $glpilisttitle;
         } else {
             echo __('List');
         }
         echo "</a>&nbsp;:&nbsp;</li>";
         if ($first > 0) {
             echo "<li><a href='{$cleantarget}?id={$first}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __('First') . "\" title=\"" . __('First') . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/first_off.png' alt=\"" . __('First') . "\" title=\"" . __('First') . "\"></li>";
         }
         if ($prev > 0) {
             echo "<li><a href='{$cleantarget}?id={$prev}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __('Previous') . "\" title=\"" . __('Previous') . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/left_off.png' alt=\"" . __('Previous') . "\" title=\"" . __('Previous') . "\"></li>";
         }
         if ($current !== false) {
             echo "<li>" . ($current + 1) . "/" . count($glpilistitems) . "</li>";
         }
         if ($next > 0) {
             echo "<li><a href='{$cleantarget}?id={$next}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __('Next') . "\" title=\"" . __('Next') . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/right_off.png' alt=\"" . __('Next') . "\" title=\"" . __('Next') . "\"></li>";
         }
         if ($last > 0) {
             echo "<li><a href='{$cleantarget}?id={$last}{$extraparamhtml}'><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/last.png\" alt=\"" . __('Last') . "\" title=\"" . __('Last') . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/last_off.png' alt=\"" . __('Last') . "\" title=\"" . __('Last') . "\"></li>";
         }
         echo "</ul></div>";
         echo "<div class='sep'></div>";
     }
     echo "<div id='tabspanel' class='center-h'></div>";
     $onglets = $this->defineTabs($options);
     $display_all = true;
     if (isset($onglets['no_all_tab'])) {
         $display_all = false;
         unset($onglets['no_all_tab']);
     }
     $class = $this->getType();
     if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE && ($ID > 0 || $this->showdebug) && (method_exists($class, 'showDebug') || in_array($class, $CFG_GLPI["infocom_types"]) || in_array($class, $CFG_GLPI["reservation_types"]))) {
         $onglets[-2] = __('Debug');
     }
     if (count($onglets)) {
         $tabpage = $this->getTabsURL();
         $tabs = array();
         foreach ($onglets as $key => $val) {
             $tabs[$key] = array('title' => $val, 'url' => $tabpage, 'params' => "target={$target}&itemtype=" . $this->getType() . "&glpi_tab={$key}&id={$ID}{$extraparam}");
         }
         $plug_tabs = Plugin::getTabs($target, $this, $withtemplate);
         $tabs += $plug_tabs;
         // Not all tab for templates and if only 1 tab
         if ($display_all && empty($withtemplate) && count($tabs) > 1) {
             $tabs[-1] = array('title' => __('All'), 'url' => $tabpage, 'params' => "target={$target}&itemtype=" . $this->getType() . "&glpi_tab=-1&id={$ID}{$extraparam}");
         }
         Ajax::createTabs('tabspanel', 'tabcontent', $tabs, $this->getType(), "'100%'");
     }
 }
                $end = explode(" ", microtime());
                $duree = round($end[0] + $end[1] - $start);
                Html::changeProgressBarMessage(__('Task completed.') . " (" . Html::timestampToString($duree) . ")");
                echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . __('Back') . "</a>";
            } else {
                // Need more work
                Html::redirect($_SERVER['PHP_SELF'] . "?start={$start}&replay_rule=1&offset={$offset}&manufacturer=" . "{$manufacturer}");
            }
            Html::footer(TRUE);
            exit;
        }
    }
}
Html::header(_n('Rule', 'Rules', 2), $_SERVER['PHP_SELF'], "admin", $rulecollection->menu_type, $rulecollection->menu_option);
$tabs = array();
if ($rulecollection->showInheritedTab()) {
    $tabs[0] = array('title' => __('Rules applied', 'fusioninventory') . ' : ' . Dropdown::getDropdownName('glpi_entities', $_SESSION['glpiactive_entity']), 'url' => $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/ajax/rules.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&glpi_tab=1&inherited=1&itemtype=" . get_class($rulecollection));
}
$title = _n('Rule', 'Rules', 2);
if ($rulecollection->isRuleRecursive()) {
    $title = __('Local rules', 'fusioninventory') . ' : ' . Dropdown::getDropdownName('glpi_entities', $_SESSION['glpiactive_entity']);
}
$tabs[1] = array('title' => $title, 'url' => $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/ajax/rules.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&glpi_tab=0&inherited=0&itemtype=" . get_class($rulecollection));
if ($rulecollection->showChildrensTab()) {
    $tabs[2] = array('title' => __('Rules applicable in the sub-entities'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/ajax/rules.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&glpi_tab=2&inherited=0&childrens=1&itemtype=" . get_class($rulecollection));
}
echo "<div id='tabspanel' class='center-h'></div>";
Ajax::createTabs('tabspanel', 'tabcontent', $tabs, $rulecollection->getRuleClassName());
echo "<div id='tabcontent'>&nbsp;</div>";
echo "<script type='text/javascript'>loadDefaultTab();</script>";
Html::footer();
Exemple #4
0
mreporting is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with mreporting. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Html::header($LANG['plugin_mreporting']["name"], '', "plugins", "mreporting");
$common = new PluginMreportingCommon();
/*** Regular Tab ***/
$reports = $common->getAllReports();
$tabs = array();
foreach ($reports as $classname => $report) {
    $tabs[$classname] = array('title' => $report['title'], 'url' => $CFG_GLPI['root_doc'] . "/plugins/mreporting/ajax/common.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&classname={$classname}");
}
/*** DEBUG Tab ***/
if (DEBUG_MREPORTING) {
    $tabs['debug'] = array('title' => "DEBUG", 'url' => $CFG_GLPI['root_doc'] . "/plugins/mreporting/ajax/debug.php");
}
if (count($tabs) > 0) {
    echo "<div id='tabspanel' class='center-h'></div>";
    Ajax::createTabs('tabspanel', 'tabcontent', $tabs, 'PluginMreportingCommon');
    $common->addDivForTabs();
} else {
    echo "<div class='center'><br>" . $LANG['plugin_mreporting']["error"][0] . "</div>";
}
Html::footer();
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Racks is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
$PluginRacksItemSpecification->checkGlobal("r");
if (!isset($_SESSION['glpi_plugin_racks_tab'])) {
    $_SESSION['glpi_plugin_racks_tab'] = 'ComputerModel';
}
if (isset($_GET['onglet'])) {
    $_SESSION['glpi_plugin_racks_tab'] = $_GET['onglet'];
}
Html::header(PluginRacksRack::getTypeName(2), '', "plugins", "racks");
$tabs['ComputerModel'] = array('title' => __('Servers', 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'ComputerModel');
$tabs['NetworkEquipmentModel'] = array('title' => _n('Network equipment', 'Network equipments', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'NetworkEquipmentModel');
$tabs['PeripheralModel'] = array('title' => _n('Peripheral', 'Peripherals', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'PeripheralModel');
$tabs['PluginRacksOtherModel'] = array('title' => _n('Other equipment', 'Others equipments', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'PluginRacksOtherModel');
$tabs['all'] = array('title' => __('All'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=all");
echo "<div id='tabspanel' class='center-h'></div>";
Ajax::createTabs('tabspanel', 'tabcontent', $tabs, 'PluginRacksItemSpecification');
$PluginRacksItemSpecification->addDivForTabs();
Html::footer();
Exemple #6
0
            $tabs['appliances'] = array('title' => __('Appliances', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&appliances={$appliances}&plugin_environment_tab=appliances");
        }
        if ($webapplications != 0 && plugin_environment_haveRight("webapplications", "r")) {
            $tabs['webapplications'] = array('title' => __('Web applications', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&webapplications={$webapplications}&plugin_environment_tab=webapplications");
        }
        if ($certificates != 0 && plugin_environment_haveRight("certificates", "r")) {
            $tabs['certificates'] = array('title' => __('Certificates', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&certificates={$certificates}&plugin_environment_tab=certificates");
        }
        if ($accounts != 0 && plugin_environment_haveRight("accounts", "r")) {
            $tabs['accounts'] = array('title' => __('Accounts', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&accounts={$accounts}&plugin_environment_tab=accounts");
        }
        if ($domains != 0 && plugin_environment_haveRight("domains", "r")) {
            $tabs['domains'] = array('title' => __('Domains', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&domains={$domains}&plugin_environment_tab=domains");
        }
        if ($databases != 0 && plugin_environment_haveRight("databases", "r")) {
            $tabs['databases'] = array('title' => __('Databases', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&databases={$databases}&plugin_environment_tab=databases");
        }
        if ($badges != 0 && plugin_environment_haveRight("badges", "r")) {
            $tabs['badges'] = array('title' => __('Badges', 'environment'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&badges={$badges}&plugin_environment_tab=badges");
        }
        $tabs['all'] = array('title' => __('All'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/environment/ajax/environment.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&appliances={$appliances}&webapplications={$webapplications}&certificates={$certificates}&accounts={$accounts}&domains={$domains}&databases={$databases}&badges={$badges}&plugin_environment_tab=all");
        echo "<div id='tabspanel' class='center-h'></div>";
        Ajax::createTabs('tabspanel', 'tabcontent', $tabs, 'PluginEnvironmentDisplay');
        $env->addDivForTabs();
    } else {
        Html::displayRightError();
    }
} else {
    Html::displayRightError();
}
Html::footer();