本文整理汇总了PHP中Toolbox::getItemTypeSearchURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::getItemTypeSearchURL方法的具体用法?PHP Toolbox::getItemTypeSearchURL怎么用?PHP Toolbox::getItemTypeSearchURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::getItemTypeSearchURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenuContent
static function getMenuContent()
{
global $CFG_GLPI;
$menu = array();
$menu['title'] = self::getMenuName();
$menu['page'] = '/plugins/connections/front/connection.php';
$menu['links'] = array('add' => Toolbox::getItemTypeFormURL('PluginConnectionsConnection', false), 'search' => Toolbox::getItemTypeSearchURL('PluginConnectionsConnection', false));
if (Session::haveRight(static::$rightname, READ)) {
$menu['options']['connections'] = array('title' => self::getMenuName(), 'page' => Toolbox::getItemTypeFormURL('PluginConnectionsConnection', false), 'links' => array('add' => Toolbox::getItemTypeFormURL('PluginConnectionsConnection', false), 'search' => Toolbox::getItemTypeSearchURL('PluginConnectionsConnection', false)));
}
return $menu;
}
示例2: title
/**
* Print a good title for group pages
*
*@return nothing (display)
**/
function title()
{
global $CFG_GLPI;
$buttons = array();
$title = "";
if (Session::haveRight(static::$rightname, UPDATE)) {
$url = Toolbox::getItemTypeSearchURL('PluginDatainjectionModel');
$buttons[$url] = PluginDatainjectionModel::getTypeName();
$title = "";
Html::displayTitle($CFG_GLPI["root_doc"] . "/plugins/datainjection/pics/datainjection.png", PluginDatainjectionModel::getTypeName(), $title, $buttons);
}
}
示例3: showForItemtype
static function showForItemtype($type)
{
global $DB;
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
echo "<form action='" . Toolbox::getItemTypeSearchURL(__CLASS__) . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
$itemtype = $type->fields['itemtype'];
echo "<tr><th colspan='2' align='center'><strong>";
echo __("Rights assignment") . ": ";
echo $itemtype::getTypeName();
echo "</strong></th></tr>";
foreach (getAllDatasFromTable('glpi_profiles') as $profile) {
echo "<tr><th colspan='2' align='center'><strong>";
echo __("Profile") . " " . $profile['name'] . "</strong></th></tr>";
$pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
if (!count($pgf_find) > 0) {
self::createAccess($profile['id']);
$pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
}
$PluginGenericobjectProfile = new self();
$PluginGenericobjectProfile->getFromDB($pgf_find['id']);
$prefix = "profiles[" . $pgf_find['id'] . "]";
if ($profile['interface'] == 'central') {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __("Access object", "genericobject") . ":</td><td>";
Profile::dropdownNoneReadWrite($prefix . "[right]", $PluginGenericobjectProfile->fields['right'], 1, 1, 1);
echo "</td></tr>";
}
if ($type->canUseTickets()) {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __("Associate tickets to this object", "genericobject") . ":</td><td>";
Dropdown::showYesNo($prefix . "[open_ticket]", $PluginGenericobjectProfile->fields['open_ticket']);
echo "</td></tr>";
}
}
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td align='center' colspan='2'>";
echo "<input type='submit' name='update_all_rights' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
示例4: plugin_init_genericobject
function plugin_init_genericobject()
{
global $PLUGIN_HOOKS, $CFG_GLPI, $GO_BLACKLIST_FIELDS, $GO_FIELDS, $GENERICOBJECT_PDF_TYPES, $GO_LINKED_TYPES, $GO_READONLY_FIELDS;
$GO_READONLY_FIELDS = array("is_helpdesk_visible", "comment");
$GO_BLACKLIST_FIELDS = array("itemtype", "table", "is_deleted", "id", "entities_id", "is_recursive", "is_template", "notepad", "template_name", "date_mod", "name", "is_helpdesk_visible", "comment");
$GO_LINKED_TYPES = array('Computer', 'Phone', 'Peripheral', 'Software', 'Monitor', 'Printer', 'NetworkEquipment');
$PLUGIN_HOOKS['csrf_compliant']['genericobject'] = true;
$GENERICOBJECT_PDF_TYPES = array();
$plugin = new Plugin();
if ($plugin->isInstalled("genericobject") && $plugin->isActivated("genericobject")) {
plugin_genericobject_includeCommonFields();
$PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1;
/* load changeprofile function */
$PLUGIN_HOOKS['change_profile']['genericobject'] = array('PluginGenericobjectProfile', 'changeProfile');
// Display a menu entry ?
$PLUGIN_HOOKS['menu_entry']['genericobject'] = true;
//Do not display icon if not using the genericobject plugin
if (isset($_GET['id']) && $_GET['id'] != '' && strpos($_SERVER['REQUEST_URI'], Toolbox::getItemTypeFormURL("PluginGenericobjectType")) !== false) {
$url = '/plugins/genericobject/index.php';
$type = new PluginGenericobjectType();
$type->getFromDB($_GET['id']);
if ($type->fields['is_active']) {
$url .= '?itemtypes_id=' . $_GET['id'];
$image = "<img src='" . $CFG_GLPI["root_doc"] . "/pics/stats_item.png' title=\"" . __("Go to objects list", "genericobject") . "\" alt=\"" . __("Go to objects list", "genericobject") . "\">";
$PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links'][$image] = $url;
}
}
$PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['add'] = Toolbox::getItemTypeFormURL('PluginGenericobjectType', false);
$PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['search'] = Toolbox::getItemTypeSearchURL('PluginGenericobjectType', false);
// Config page
if (Session::haveRight('config', 'w')) {
$PLUGIN_HOOKS['submenu_entry']['genericobject']['config'] = 'front/type.php';
$PLUGIN_HOOKS['config_page']['genericobject'] = 'front/type.php';
$PLUGIN_HOOKS['submenu_entry']['genericobject']['add']['type'] = 'front/type.form.php';
$PLUGIN_HOOKS['submenu_entry']['genericobject']['search']['type'] = 'front/type.php';
}
$PLUGIN_HOOKS['assign_to_ticket']['genericobject'] = true;
$PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1;
$PLUGIN_HOOKS['post_init']['genericobject'] = 'plugin_post_init_genericobject';
$PLUGIN_HOOKS['plugin_datainjection_populate']['genericobject'] = "plugin_datainjection_populate_genericobject";
}
}
示例5: showForTicketTemplate
/**
* @param $tt TicketTemplate object
* @param $withtemplate (default '')
**/
static function showForTicketTemplate(TicketTemplate $tt, $withtemplate = '')
{
global $DB, $CFG_GLPI;
$itilcategory = new self();
$ID = $tt->fields['id'];
if (!$tt->getFromDB($ID) || !$tt->can($ID, READ)) {
return false;
}
$ttm = new self();
$rand = mt_rand();
echo "<div class='center'>";
$query = "SELECT `glpi_itilcategories`.*\n FROM `glpi_itilcategories`\n WHERE (`tickettemplates_id_incident` = '{$ID}')\n OR (`tickettemplates_id_demand` = '{$ID}')\n ORDER BY `name`";
if ($result = $DB->query($query)) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='3'>";
echo "<a href='" . Toolbox::getItemTypeSearchURL($itilcategory->getType()) . "'>";
echo self::getTypeName($DB->numrows($result));
echo "</a>";
echo "</th></tr>";
$used_incident = array();
$used_demand = array();
if ($DB->numrows($result)) {
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Incident') . "</th>";
echo "<th>" . __('Request') . "</th>";
echo "</tr>";
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_2'>";
$itilcategory->getFromDB($data['id']);
echo "<td>" . $itilcategory->getLink(array('comments' => true)) . "</td>";
if ($data['tickettemplates_id_incident'] == $ID) {
echo "<td class='center'>\n <img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' alt=\"" . __('OK') . "\" width='14' height='14'>\n </td>";
$used_incident[] = $data["id"];
} else {
echo "<td> </td>";
}
if ($data['tickettemplates_id_demand'] == $ID) {
echo "<td class='center'>\n <img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' alt=\"" . __('OK') . "\" width='14' height='14'>\n </td>";
$used_demand[] = $data["id"];
} else {
echo "<td> </td>";
}
}
} else {
echo "<tr><th colspan='3'>" . __('No item found') . "</th></tr>";
}
echo "</table></div>";
}
}
示例6: showMinimalList
static function showMinimalList($params = array())
{
global $DB, $CFG_GLPI;
$item = new self();
$itemtype = $item->getType();
$itemtable = $item->getTable();
// Default values of parameters
$p['link'] = array();
//
$p['field'] = array();
//
$p['contains'] = array();
//
$p['searchtype'] = array();
//
$p['sort'] = '1';
//
$p['order'] = 'ASC';
//
$p['start'] = 0;
//
$p['is_deleted'] = 0;
$p['id'] = 0;
$p['export_all'] = 0;
$p['link2'] = '';
//
$p['contains2'] = '';
//
$p['field2'] = '';
//
$p['itemtype2'] = '';
$p['searchtype2'] = '';
$p['withtemplate'] = 0;
foreach ($params as $key => $val) {
$p[$key] = $val;
}
$PluginResourcesResource = new PluginResourcesResource();
$PluginResourcesResource->getFromDB($p['id']);
$canedit = $PluginResourcesResource->can($p['id'], 'w');
if (isset($_POST["start"])) {
$p['start'] = $_POST["start"];
} else {
$p['start'] = 0;
}
if (isset($_POST["sort"])) {
$p['sort'] = $_POST["sort"];
} else {
$p['sort'] = 1;
}
if (isset($_POST["order"]) && $_POST["order"] == "DESC") {
$p['order'] = "DESC";
} else {
$p['order'] = "ASC";
}
// Manage defautll seachtype value : for bookmark compatibility
if (count($p['contains'])) {
foreach ($p['contains'] as $key => $val) {
if (!isset($p['searchtype'][$key])) {
$p['searchtype'][$key] = 'contains';
}
}
}
if (is_array($p['contains2']) && count($p['contains2'])) {
foreach ($p['contains2'] as $key => $val) {
if (!isset($p['searchtype2'][$key])) {
$p['searchtype2'][$key] = 'contains';
}
}
}
$target = Toolbox::getItemTypeSearchURL($itemtype);
$limitsearchopt = Search::getCleanedOptions($itemtype);
$LIST_LIMIT = $_SESSION['glpilist_limit'];
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET['display_type'])) {
$output_type = $_GET['display_type'];
// Limit to 10 element
if ($_GET['display_type'] == Search::GLOBAL_SEARCH) {
$LIST_LIMIT = Search::GLOBAL_DISPLAY_COUNT;
}
}
$entity_restrict = $item->isEntityAssign();
// Get the items to display
$toview = Search::addDefaultToView($itemtype);
// Add items to display depending of personal prefs
$displaypref = DisplayPreference::getForTypeUser($itemtype, Session::getLoginUserID());
if (count($displaypref)) {
foreach ($displaypref as $val) {
array_push($toview, $val);
}
}
// Add searched items
if (count($p['field']) > 0) {
foreach ($p['field'] as $key => $val) {
if (!in_array($val, $toview) && $val != 'all' && $val != 'view') {
array_push($toview, $val);
}
}
}
// Add order item
//.........这里部分代码省略.........
示例7: getSearchURL
/**
* Get the search page URL for the current class
*
* @param $full path or relative one (true by default)
**/
static function getSearchURL($full = true)
{
return Toolbox::getItemTypeSearchURL(get_called_class(), $full);
}
示例8: showList
/**
* Print out list kb item
*
* @param $options $_GET
* @param $type string search type : browse / search (default search)
**/
static function showList($options, $type = 'search')
{
global $DB, $CFG_GLPI;
// Default values of parameters
$params['faq'] = !Session::haveRight(self::$rightname, READ);
$params["start"] = "0";
$params["knowbaseitemcategories_id"] = "0";
$params["contains"] = "";
$params["target"] = $_SERVER['PHP_SELF'];
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$ki = new self();
switch ($type) {
case 'myunpublished':
if (!Session::haveRightsOr(self::$rightname, array(UPDATE, self::PUBLISHFAQ))) {
return false;
}
break;
case 'allunpublished':
if (!Session::haveRight(self::$rightname, self::KNOWBASEADMIN)) {
return false;
}
break;
default:
break;
}
if (!$params["start"]) {
$params["start"] = 0;
}
$query = self::getListRequest($params, $type);
// Get it from database
if ($result = $DB->query($query)) {
$KbCategory = new KnowbaseItemCategory();
$title = "";
if ($KbCategory->getFromDB($params["knowbaseitemcategories_id"])) {
$title = empty($KbCategory->fields['name']) ? "(" . $params['knowbaseitemcategories_id'] . ")" : $KbCategory->fields['name'];
$title = sprintf(__('%1$s: %2$s'), __('Category'), $title);
}
Session::initNavigateListItems('KnowbaseItem', $title);
$numrows = $DB->numrows($result);
$list_limit = $_SESSION['glpilist_limit'];
$showwriter = in_array($type, array('myunpublished', 'allunpublished', 'allmy'));
// Limit the result, if no limit applies, use prior result
if ($numrows > $list_limit && !isset($_GET['export_all'])) {
$query_limit = $query . " LIMIT " . intval($params["start"]) . ", " . intval($list_limit) . " ";
$result_limit = $DB->query($query_limit);
$numrows_limit = $DB->numrows($result_limit);
} else {
$numrows_limit = $numrows;
$result_limit = $result;
}
if ($numrows_limit > 0) {
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq=" . $params['faq'];
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$parameters .= "&item_items_id=" . $options['item_items_id'] . "&item_itemtype=" . $options['item_itemtype'];
}
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Subject'), $header_num);
if ($output_type != Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, __('Content'), $header_num);
}
if ($showwriter) {
echo Search::showHeaderItem($output_type, __('Writer'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Category'), $header_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_assoc($result_limit);
Session::addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
$item = new self();
//.........这里部分代码省略.........
示例9: submitForm
public function submitForm($postvars)
{
if (isset($postvars['forcestart'])) {
Session::checkRight('plugin_fusioninventory_task', UPDATE);
/**
* TODO: forcing the task execution should be done in the task object
*/
$pfTaskjob = new PluginFusioninventoryTaskjob();
$pfTaskjob->forceRunningTask($postvars['id']);
Html::back();
} else {
if (isset($postvars["add"])) {
Session::checkRight('plugin_fusioninventory_task', CREATE);
$items_id = $this->add($postvars);
Html::redirect(str_replace("add=1", "", $_SERVER['HTTP_REFERER']) . "?id=" . $items_id);
} else {
if (isset($postvars["purge"])) {
Session::checkRight('plugin_fusioninventory_task', PURGE);
$pfTaskJob = new PluginFusioninventoryTaskjob();
$taskjobs = $pfTaskJob->find("`plugin_fusioninventory_tasks_id` = '" . $postvars['id'] . "' ");
foreach ($taskjobs as $taskjob) {
$pfTaskJob->delete($taskjob);
}
$this->delete($postvars);
Html::redirect(Toolbox::getItemTypeSearchURL(get_class($this)));
} else {
if (isset($_POST["update"])) {
Session::checkRight('plugin_fusioninventory_task', UPDATE);
$this->getFromDB($postvars['id']);
//Ensure empty value are set to NULL for datetime fields
if (isset($postvars['datetime_start']) and $postvars['datetime_start'] === '') {
$postvars['datetime_start'] = 'NULL';
}
if (isset($postvars['datetime_end']) and $postvars['datetime_end'] === '') {
$postvars['datetime_end'] = 'NULL';
}
$this->update($postvars);
Html::back();
}
}
}
}
}
示例10: getMenuContent
/**
* @see CommonGLPI::getMenuContent()
*
* @since version 0.85
**/
static function getMenuContent()
{
global $CFG_GLPI;
$menu = array();
if (Session::haveRight("rule_ldap", READ) || Session::haveRight("rule_ocs", READ) || Session::haveRight("entity_rule_ticket", READ) || Session::haveRight("rule_softwarecategories", READ) || Session::haveRight("rule_mailcollector", READ)) {
$menu['rule']['title'] = static::getTypeName(Session::getPluralNumber());
$menu['rule']['page'] = static::getSearchURL(false);
foreach ($CFG_GLPI["rulecollections_types"] as $rulecollectionclass) {
$rulecollection = new $rulecollectionclass();
if ($rulecollection->canList()) {
$ruleclassname = $rulecollection->getRuleClassName();
$menu['rule']['options'][$rulecollection->menu_option]['title'] = $rulecollection->getRuleClass()->getTitle();
$menu['rule']['options'][$rulecollection->menu_option]['page'] = Toolbox::getItemTypeSearchURL($ruleclassname, false);
$menu['rule']['options'][$rulecollection->menu_option]['links']['search'] = Toolbox::getItemTypeSearchURL($ruleclassname, false);
if ($rulecollection->canCreate()) {
$menu['rule']['options'][$rulecollection->menu_option]['links']['add'] = Toolbox::getItemTypeFormURL($ruleclassname, false);
}
}
}
}
if (Transfer::canView() && Session::isMultiEntitiesMode()) {
$menu['rule']['title'] = static::getTypeName(Session::getPluralNumber());
$menu['rule']['page'] = static::getSearchURL(false);
$menu['rule']['options']['transfer']['title'] = __('Transfer');
$menu['rule']['options']['transfer']['page'] = "/front/transfer.php";
$menu['rule']['options']['transfer']['links']['search'] = "/front/transfer.php";
if (Session::haveRightsOr("transfer", array(CREATE, UPDATE))) {
$menu['rule']['options']['transfer']['links']['summary'] = "/front/transfer.action.php";
$menu['rule']['options']['transfer']['links']['add'] = "/front/transfer.form.php";
}
}
if (Session::haveRight("rule_dictionnary_dropdown", READ) || Session::haveRight("rule_dictionnary_software", READ) || Session::haveRight("rule_dictionnary_printer", READ)) {
$menu['dictionnary']['title'] = _n('Dictionary', 'Dictionaries', Session::getPluralNumber());
$menu['dictionnary']['shortcut'] = '';
$menu['dictionnary']['page'] = '/front/dictionnary.php';
$menu['dictionnary']['options']['manufacturers']['title'] = _n('Manufacturer', 'Manufacturers', Session::getPluralNumber());
$menu['dictionnary']['options']['manufacturers']['page'] = '/front/ruledictionnarymanufacturer.php';
$menu['dictionnary']['options']['manufacturers']['links']['search'] = '/front/ruledictionnarymanufacturer.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['manufacturers']['links']['add'] = '/front/ruledictionnarymanufacturer.form.php';
}
$menu['dictionnary']['options']['software']['title'] = _n('Software', 'Software', Session::getPluralNumber());
$menu['dictionnary']['options']['software']['page'] = '/front/ruledictionnarysoftware.php';
$menu['dictionnary']['options']['software']['links']['search'] = '/front/ruledictionnarysoftware.php';
if (RuleDictionnarySoftware::canCreate()) {
$menu['dictionnary']['options']['software']['links']['add'] = '/front/ruledictionnarysoftware.form.php';
}
$menu['dictionnary']['options']['model.computer']['title'] = _n('Computer model', 'Computer models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.computer']['page'] = '/front/ruledictionnarycomputermodel.php';
$menu['dictionnary']['options']['model.computer']['links']['search'] = '/front/ruledictionnarycomputermodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.computer']['links']['add'] = '/front/ruledictionnarycomputermodel.form.php';
}
$menu['dictionnary']['options']['model.monitor']['title'] = _n('Monitor model', 'Monitor models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.monitor']['page'] = '/front/ruledictionnarymonitormodel.php';
$menu['dictionnary']['options']['model.monitor']['links']['search'] = '/front/ruledictionnarymonitormodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.monitor']['links']['add'] = '/front/ruledictionnarymonitormodel.form.php';
}
$menu['dictionnary']['options']['model.printer']['title'] = _n('Printer model', 'Printer models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.printer']['page'] = '/front/ruledictionnaryprintermodel.php';
$menu['dictionnary']['options']['model.printer']['links']['search'] = '/front/ruledictionnaryprintermodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.printer']['links']['add'] = '/front/ruledictionnaryprintermodel.form.php';
}
$menu['dictionnary']['options']['model.peripheral']['title'] = _n('Peripheral model', 'Peripheral models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.peripheral']['page'] = '/front/ruledictionnaryperipheralmodel.php';
$menu['dictionnary']['options']['model.peripheral']['links']['search'] = '/front/ruledictionnaryperipheralmodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.peripheral']['links']['add'] = '/front/ruledictionnaryperipheralmodel.form.php';
}
$menu['dictionnary']['options']['model.networking']['title'] = _n('Networking equipment model', 'Networking equipment models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.networking']['page'] = '/front/ruledictionnarynetworkequipmentmodel.php';
$menu['dictionnary']['options']['model.networking']['links']['search'] = '/front/ruledictionnarynetworkequipmentmodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.networking']['links']['add'] = '/front/ruledictionnarynetworkequipmentmodel.form.php';
}
$menu['dictionnary']['options']['model.phone']['title'] = _n('Phone model', 'Phone models', Session::getPluralNumber());
$menu['dictionnary']['options']['model.phone']['page'] = '/front/ruledictionnaryphonemodel.php';
$menu['dictionnary']['options']['model.phone']['links']['search'] = '/front/ruledictionnaryphonemodel.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['model.phone']['links']['add'] = '/front/ruledictionnaryphonemodel.form.php';
}
$menu['dictionnary']['options']['type.computer']['title'] = _n('Computer type', 'Computer types', Session::getPluralNumber());
$menu['dictionnary']['options']['type.computer']['page'] = '/front/ruledictionnarycomputertype.php';
$menu['dictionnary']['options']['type.computer']['links']['search'] = '/front/ruledictionnarycomputertype.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['type.computer']['links']['add'] = '/front/ruledictionnarycomputertype.form.php';
}
$menu['dictionnary']['options']['type.monitor']['title'] = _n('Monitor type', 'Monitors types', Session::getPluralNumber());
$menu['dictionnary']['options']['type.monitor']['page'] = '/front/ruledictionnarymonitortype.php';
$menu['dictionnary']['options']['type.monitor']['links']['search'] = '/front/ruledictionnarymonitortype.php';
if (RuleDictionnaryDropdown::canCreate()) {
$menu['dictionnary']['options']['type.monitor']['links']['add'] = '/front/ruledictionnarymonitortype.form.php';
}
//.........这里部分代码省略.........
示例11: getNodesFromDb
//.........这里部分代码省略.........
if ($r['comment'] != "") {
$l_name .= ' (' . $r['comment'] . ')';
}
}
}
}
}
// Is this location requested by the user to be opened
if (in_array($r['id'], $nodes)) {
echo "d.add(" . $r['id'] . ", " . $r['locations_id'] . ", \"" . strtr($l_name, $trans) . "\", true, -1,'');\n";
$dontLoad = 'true';
// Then add aloso its items
foreach (self::$types as $type) {
$item = new $type();
$itemtable = getTableForItemType($type);
$query = "SELECT *\n FROM `{$itemtable}`\n WHERE `locations_id` = '" . $r['id'] . "'";
if ($item->maybeTemplate()) {
$query .= " AND `{$itemtable}`.`is_template` = '0'";
}
if ($item->maybeDeleted()) {
$query .= " AND `{$itemtable}`.`is_deleted` = '0'";
}
if ($this->isEntityAssign()) {
$query .= " AND `{$itemtable}`.`entities_id` = '" . $_SESSION["glpiactive_entity"] . "'";
}
$query .= " ORDER BY `{$itemtable}`.`name`";
$result_1 = $DB->query($query);
if ($DB->numrows($result_1)) {
$pid = $tv_id;
$field_num = 3;
$query_location = "SELECT `completename`\n FROM `glpi_locations`\n WHERE `id` = '" . $r['id'] . "'";
$result_location = $DB->query($query_location);
while ($row = $DB->fetch_assoc($result_location)) {
$name_location = $row['completename'];
}
$getParam = '?is_deleted=0' . '&criteria[0][field]=' . $field_num . '&criteria[0][searchtype]=equals&criteria[0][value]=' . $r['id'] . '&itemtype=' . $type;
// Add items parent node
echo "d.add({$tv_id}," . $r['id'] . ",\"" . strtr($item::getTypeName(2), $trans) . "\", {$dontLoad}, '" . $type . "', '" . Toolbox::getItemTypeSearchURL($type) . $getParam . "', '', '', '" . self::getPicbyType($type) . "', '" . self::getPicbyType($type) . "');\n";
if ($openedType == $type && $nodes[count($nodes) - 1] == $tv_id) {
$openedType = $tv_id;
}
$tv_id++;
}
while ($r_1 = $DB->fetch_assoc($result_1)) {
// Item's name schema
if ($itemName == 0 || $type == 'Software') {
$i_name = $r_1['name'];
} else {
if ($itemName == 1) {
if (isset($r_1['otherserial']) && !empty($r_1['otherserial'])) {
$i_name = $r_1['otherserial'];
} else {
$i_name = $r_1['name'];
}
} else {
if ($itemName == 2) {
$i_name = $r_1['name'] != "" ? $r_1['name'] : "";
if (isset($r_1['otherserial']) && !empty($r_1['otherserial'])) {
$i_name .= $r_1['otherserial'] != "" ? $r_1['name'] != "" ? ' / ' . $r_1['otherserial'] : $r_1['otherserial'] : "";
} else {
$i_name .= '';
}
} else {
if ($itemName == 3) {
if (isset($r_1['otherserial']) && !empty($r_1['otherserial'])) {
$i_name = $r_1['otherserial'] != "" ? $r_1['otherserial'] : "";
$i_name .= $r_1['name'] != "" ? $r_1['otherserial'] != "" ? ' / ' . $r_1['name'] : $r_1['name'] : "";
} else {
$i_name = $r_1['name'];
}
}
}
}
}
$url = Toolbox::getItemTypeFormURL($type) . "?id=" . $r_1['id'];
$pic = "pics/node.gif";
$name = strtr($i_name, $trans);
$opt = array('url' => $url, 'pic' => $pic, 'name' => $name);
$params = array('itemtype' => $type, 'id' => $r_1['id'], 'url' => $url, 'pic' => $pic, 'name' => $name);
$opt = Plugin::doHookFunction('treeview_params', $params);
// Add the item
echo "d.add(" . $tv_id++ . ", {$pid}, \"" . $opt['name'] . "\", true, -1, '" . $opt['url'] . "', '', '', '" . $opt['pic'] . "','" . $opt['pic'] . "');\n";
}
}
// Add only the location without its items
} else {
echo "d.add(" . $r['id'] . "," . $r['locations_id'] . ",\"" . strtr($l_name, $trans) . "\", false, -1,'', '', '', '', '', false, true);\n";
}
}
}
}
// Print the node from JavaScript
echo "document.write(d);\n";
// Open the tree to the desired node
if ($openedType != -1) {
echo "d.openTo(" . $openedType . ");\n";
} else {
echo "d.openTo(" . $nodes[count($nodes) - 1] . ");\n";
}
}
示例12: getSearchURL
static function getSearchURL($full = true)
{
return Toolbox::getItemTypeSearchURL(get_parent_class(), $full) . "?itemtype=" . get_called_class();
}
示例13: showItemTypeList
/**
* Display a list to select a itemtype with link to search form
*
* @param $optgroup array (group of dropdown) of array (itemtype => localized name)
*/
static function showItemTypeList($optgroup)
{
echo "<div id='list_nav'>";
$nb = 0;
foreach ($optgroup as $label => $dp) {
$nb += count($dp);
}
$step = $nb > 15 ? $nb / 3 : $nb;
echo "<table class='tab_glpi'><tr class='top'><td width='33% class='center'>";
echo "<table class='tab_cadre'>";
$i = 1;
foreach ($optgroup as $label => $dp) {
echo "<tr><th>{$label}</th></tr>\n";
foreach ($dp as $key => $val) {
$class = "class='tab_bg_4'";
if (($itemtype = getItemForItemtype($key)) && $itemtype->isEntityAssign()) {
$class = "class='tab_bg_2'";
}
echo "<tr {$class}><td><a href='" . Toolbox::getItemTypeSearchURL($key) . "'>";
echo "{$val}</a></td></tr>\n";
$i++;
}
if ($i >= $step) {
echo "</table></td><td width='25'> </td><td><table class='tab_cadre'>";
$step += $step;
}
}
echo "</table></td></tr></table></div>";
}
示例14: showForContract
/**
* Print the HTML array for Items linked to current contract
*
* @since version 0.84
*
* @param $contract Contract object
*
* @return Nothing (display)
**/
static function showForContract(Contract $contract)
{
global $DB, $CFG_GLPI;
$instID = $contract->fields['id'];
if (!$contract->can($instID, READ)) {
return false;
}
$canedit = $contract->can($instID, UPDATE);
$rand = mt_rand();
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_contracts_items`\n WHERE `glpi_contracts_items`.`contracts_id` = '{$instID}'\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
$data = array();
$totalnb = 0;
for ($i = 0; $i < $number; $i++) {
$itemtype = $DB->result($result, $i, "itemtype");
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
if ($item->canView()) {
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `{$itemtable}`.*,\n `glpi_contracts_items`.`id` AS IDD,\n `glpi_entities`.`id` AS entity\n FROM `glpi_contracts_items`,\n `{$itemtable}`";
if ($itemtype != 'Entity') {
$query .= " LEFT JOIN `glpi_entities`\n ON (`{$itemtable}`.`entities_id`=`glpi_entities`.`id`) ";
}
$query .= " WHERE `{$itemtable}`.`id` = `glpi_contracts_items`.`items_id`\n AND `glpi_contracts_items`.`itemtype` = '{$itemtype}'\n AND `glpi_contracts_items`.`contracts_id` = '{$instID}'";
if ($item->maybeTemplate()) {
$query .= " AND `{$itemtable}`.`is_template` = '0'";
}
$query .= getEntitiesRestrictRequest(" AND", $itemtable, '', '', $item->maybeRecursive()) . "\n ORDER BY `glpi_entities`.`completename`, `{$itemtable}`.`name`";
$result_linked = $DB->query($query);
$nb = $DB->numrows($result_linked);
if ($nb > $_SESSION['glpilist_limit']) {
$opt = array('order' => 'ASC', 'is_deleted' => 0, 'reset' => 'reset', 'start' => 0, 'sort' => 80, 'criteria' => array(0 => array('value' => '$$$$' . $instID, 'searchtype' => 'contains', 'field' => 29)));
$link = "<a href='" . Toolbox::getItemTypeSearchURL($itemtype) . "?" . Toolbox::append_params($opt) . "'>" . __('Device list') . "</a>";
$data[$itemtype] = array('longlist' => true, 'name' => sprintf(__('%1$s: %2$s'), $item->getTypeName($nb), $nb), 'link' => $link);
} else {
if ($nb > 0) {
for ($prem = true; $objdata = $DB->fetch_assoc($result_linked); $prem = false) {
$data[$itemtype][$objdata['id']] = $objdata;
}
}
}
$totalnb += $nb;
}
}
if ($canedit && ($contract->fields['max_links_allowed'] == 0 || $contract->fields['max_links_allowed'] > $totalnb)) {
echo "<div class='firstbloc'>";
echo "<form name='contract_form{$rand}' id='contract_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add an item') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
Dropdown::showSelectItemFromItemtypes(array('itemtypes' => $CFG_GLPI["contract_types"], 'entity_restrict' => $contract->fields['is_recursive'] ? getSonsOf('glpi_entities', $contract->fields['entities_id']) : $contract->fields['entities_id'], 'checkright' => true));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "<input type='hidden' name='contracts_id' value='{$instID}'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $totalnb) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $totalnb) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Type') . "</th>";
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Serial number') . "</th>";
$header_end .= "<th>" . __('Inventory number') . "</th>";
$header_end .= "<th>" . __('Status') . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
$totalnb = 0;
foreach ($data as $itemtype => $datas) {
if (isset($datas['longlist'])) {
echo "<tr class='tab_bg_1'>";
if ($canedit) {
//.........这里部分代码省略.........
示例15: displayMenu
/**
* Display the menu of FusionInventory
*
*@param type value "big" or "mini"
*
*@return nothing
**/
static function displayMenu($type = "big")
{
global $CFG_GLPI;
if (PLUGIN_FUSIONINVENTORY_OFFICIAL_RELEASE != 1) {
echo "<center>";
echo "<a href='http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/" . "wiki/Beta_test'>";
echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/beta.png'/></a>";
echo " <a href='https://www.transifex.com/projects/p/FusionInventory/resource/" . "plugin-fusioninventory-084/'>";
echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/Translate.png'/>" . "</a>";
echo "<H1>Version '" . PLUGIN_FUSIONINVENTORY_REALVERSION . "'</H1></center><br/>\n";
}
$pfEntity = new PluginFusioninventoryEntity();
if (strlen($pfEntity->getValue('agent_base_url', 0)) < 10 && !strstr($_SERVER['PHP_SELF'], 'front/config.form.php')) {
echo "<div class='msgboxmonit msgboxmonit-red'>";
print "<center><a href=\"" . $CFG_GLPI['root_doc'] . "/front/entity.form.php?id=0&forcetab=PluginFusioninventoryEntity\$0\">";
print __('The server needs to kown the URL the agents use to access the server. Please ' . 'configure it in the General Configuration page.', 'fusioninventory');
print "</a></center>";
echo "</div>";
exit;
}
$width_status = 0;
echo "<div align='center' style='height: 35px; display: inline-block; width: 100%; margin: 0 auto;'>";
echo "<table width='100%'>";
echo "<tr>";
echo "<td align='center'>";
echo "<table>";
echo "<tr>";
echo "<td>";
/*
* General
*/
$a_menu = array();
if (Session::haveRight('plugin_fusioninventory_agent', READ)) {
$a_menu[0]['name'] = __('Agents management', 'fusioninventory');
$a_menu[0]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_agents.png";
$a_menu[0]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryAgent');
}
if (Session::haveRight('plugin_fusioninventory_group', READ)) {
$a_menu[2]['name'] = __('Groups of computers', 'fusioninventory');
$a_menu[2]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_group.png";
$a_menu[2]['link'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/deploygroup.php";
}
if (Session::haveRight('config', UPDATE) || Session::haveRight('plugin_fusioninventory_configuration', UPDATE)) {
$a_menu[3]['name'] = __('General configuration', 'fusioninventory');
$a_menu[3]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_agents.png";
$a_menu[3]['link'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/config.form.php";
}
if (!empty($a_menu)) {
$width_status = PluginFusioninventoryMenu::htmlMenu(__('General', 'fusioninventory'), $a_menu, $type, $width_status);
}
/*
* Tasks
*/
$a_menu = array();
if (Session::haveRight('plugin_fusioninventory_task', READ)) {
//$a_menu[1]['name'] = __('Task management', 'fusioninventory')." (".__s('Summary').")";
//$a_menu[1]['pic'] = $CFG_GLPI['root_doc']."/plugins/fusioninventory/pics/menu_task.png";
//$a_menu[1]['link'] = $CFG_GLPI['root_doc'].
// "/plugins/fusioninventory/front/tasksummary.php";
$a_menu[2]['name'] = __('Task management', 'fusioninventory');
$a_menu[2]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_task.png";
$a_menu[2]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryTask');
$a_menu[3]['name'] = __('Monitoring / Logs', 'fusioninventory');
$a_menu[3]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_runningjob.png";
$a_menu[3]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryTaskJob');
}
if (Session::haveRight('plugin_fusioninventory_importxml', CREATE)) {
$a_menu[0]['name'] = __('Import agent XML file', 'fusioninventory');
$a_menu[0]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_importxml.png";
$a_menu[0]['link'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/inventorycomputerimportxml.php";
}
if (Session::haveRight("plugin_fusioninventory_collect", READ)) {
$a_menu[11]['name'] = __('Additional computer information', 'fusioninventory');
$a_menu[11]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_task.png";
$a_menu[11]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryCollect');
}
if (Session::haveRight('plugin_fusioninventory_task', READ)) {
$a_menu[12]['name'] = __('Time slot', 'fusioninventory');
$a_menu[12]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_timeslot.png";
$a_menu[12]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryTimeslot');
}
if (!empty($a_menu)) {
$width_status = PluginFusioninventoryMenu::htmlMenu(__('Tasks', 'fusioninventory'), $a_menu, $type, $width_status);
}
/*
* Rules
*/
$a_menu = array();
if (Session::haveRight('plugin_fusioninventory_ruleimport', READ)) {
$a_menu[1]['name'] = __('Equipment import and link rules', 'fusioninventory');
$a_menu[1]['pic'] = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/menu_rules.png";
$a_menu[1]['link'] = Toolbox::getItemTypeSearchURL('PluginFusioninventoryInventoryRuleImport');
}
//.........这里部分代码省略.........