本文整理汇总了PHP中Dropdown::showItemTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showItemTypes方法的具体用法?PHP Dropdown::showItemTypes怎么用?PHP Dropdown::showItemTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showItemTypes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAllItems
static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types, $locations_id = -1, $action = 'showItem')
{
global $DB, $CFG_GLPI;
$rand = mt_rand();
$plugin = new Plugin();
echo "<table border='0'><tr><td>\n";
if ($myname == 'type') {
$newtypes = array_flip($types);
unset($newtypes['Location']);
unset($newtypes['Netpoint']);
if ($plugin->isActivated("resources")) {
unset($newtypes['PluginResourcesResource']);
}
$types = array_flip($newtypes);
}
$rand = Dropdown::showItemTypes($myname, $types, array('emptylabel' => Dropdown::EMPTY_VALUE, 'width' => 150));
$params = array('type' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'action' => $action, 'entity_restrict' => $entity_restrict, 'locations_id' => $locations_id);
Ajax::updateItemOnSelectEvent("dropdown_{$myname}{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
echo "</td><td>\n";
echo "<span id='show_{$myname}{$rand}'> </span>\n";
echo "</td></tr></table>\n";
if ($value > 0) {
echo "<script type='text/javascript' >\n";
echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
echo "</script>\n";
$params["typetable"] = $value_type;
Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
}
return $rand;
}
示例2: displayCriteriaSelectPattern
/**
* Display item used to select a pattern for a criteria
*
* @param $name criteria name
* @param $ID the given criteria
* @param $condition condition used
* @param $value the pattern (default '')
* @param $test Is to test rule ? (false by default)
**/
function displayCriteriaSelectPattern($name, $ID, $condition, $value = "", $test = false)
{
$crit = $this->getCriteria($ID);
$display = false;
$tested = false;
if (isset($crit['type']) && ($test || in_array($condition, array(self::PATTERN_IS, self::PATTERN_IS_NOT, self::PATTERN_NOT_UNDER, self::PATTERN_UNDER)))) {
switch ($crit['type']) {
case "yesonly":
Dropdown::showYesNo($name, $crit['table'], 0);
$display = true;
break;
case "yesno":
Dropdown::showYesNo($name, $crit['table']);
$display = true;
break;
case "dropdown":
$param = array('name' => $name, 'value' => $value);
if (isset($crit['condition'])) {
$param['condition'] = $crit['condition'];
}
Dropdown::show(getItemTypeForTable($crit['table']), $param);
$display = true;
break;
case "dropdown_users":
User::dropdown(array('value' => $value, 'name' => $name, 'right' => 'all'));
$display = true;
break;
case "dropdown_tracking_itemtype":
Dropdown::showItemTypes($name, array_keys(Ticket::getAllTypesForHelpdesk()));
$display = true;
break;
case "dropdown_urgency":
Ticket::dropdownUrgency(array('name' => $name, 'value' => $value));
$display = true;
break;
case "dropdown_impact":
Ticket::dropdownImpact(array('name' => $name, 'value' => $value));
$display = true;
break;
case "dropdown_priority":
Ticket::dropdownPriority(array('name' => $name, 'value' => $value));
$display = true;
break;
case "dropdown_status":
Ticket::dropdownStatus(array('name' => $name, 'value' => $value));
$display = true;
break;
case "dropdown_tickettype":
Ticket::dropdownType($name, array('value' => $value));
$display = true;
break;
}
$tested = true;
}
//Not a standard condition
if (!$tested) {
$display = $this->displayAdditionalRuleCondition($condition, $crit, $name, $value, $test);
}
if ($condition == self::PATTERN_EXISTS || $condition == self::PATTERN_DOES_NOT_EXISTS) {
echo "<input type='hidden' name='{$name}' value='1'>";
$display = true;
}
if (!$display && ($rc = getItemForItemtype($this->rulecriteriaclass))) {
Html::autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
}
}
示例3: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!Config::canUpdate()) {
return false;
}
$spotted = false;
if (empty($ID)) {
if ($this->getEmpty()) {
$spotted = true;
}
} else {
if ($this->getFromDB($ID)) {
$spotted = true;
}
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
echo "<td colspan='3'>";
Html::autocompletionTextField($this, "name");
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td><td colspan='3'>";
Dropdown::showItemTypes('itemtype', $CFG_GLPI["notificationtemplates_types"], array('value' => $this->fields['itemtype'] ? $this->fields['itemtype'] : 'Ticket'));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>";
echo "<td colspan='3'>";
echo "<textarea cols='60' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('CSS') . "</td>";
echo "<td colspan='3'>";
echo "<textarea cols='60' rows='5' name='css' >" . $this->fields["css"] . "</textarea></td></tr>";
$this->showFormButtons($options);
return true;
}
示例4: array
$value = '';
if (isset($metacriteria["link"])) {
$value = $metacriteria["link"];
}
Dropdown::showFromArray("metacriteria[" . $_POST["num"] . "][link]", Search::getLogicalOperators(), array('value' => $value, 'width' => '40%'));
// Display select of the linked item type available
foreach ($linked as $key) {
if (!isset($metanames[$key])) {
if ($linkitem = getItemForItemtype($key)) {
$metanames[$key] = $linkitem->getTypeName();
}
}
}
$value = '';
if (isset($metacriteria['itemtype']) && !empty($metacriteria['itemtype'])) {
$value = $metacriteria['itemtype'];
}
$rand = Dropdown::showItemTypes("metacriteria[" . $_POST["num"] . "][itemtype]", $linked, array('width' => '50%', 'value' => $value));
$field_id = Html::cleanId("dropdown_metacriteria[" . $_POST["num"] . "][itemtype]{$rand}");
echo "</td><td>";
// Ajax script for display search met& item
echo "<span id='show_" . $_POST["itemtype"] . "_" . $_POST["num"] . "_{$rand}'> </span>\n";
$params = array('itemtype' => '__VALUE__', 'num' => $_POST["num"], 'field' => isset($metacriteria['field']) ? $metacriteria['field'] : "", 'value' => isset($metacriteria['value']) ? stripslashes($metacriteria['value']) : "", 'searchtype' => isset($metacriteria['searchtype']) ? $metacriteria['searchtype'] : "");
Ajax::updateItemOnSelectEvent($field_id, "show_" . $_POST["itemtype"] . "_" . $_POST["num"] . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/updateMetaSearch.php", $params);
if (isset($metacriteria['itemtype']) && !empty($metacriteria['itemtype'])) {
$params['itemtype'] = $metacriteria['itemtype'];
Ajax::updateItem("show_" . $_POST["itemtype"] . "_" . $_POST["num"] . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/updateMetaSearch.php", $params);
}
echo "</td></tr></table>";
echo "</td></tr>\n";
}
示例5: showHardware
//.........这里部分代码省略.........
echo self::showItem(Html::convDateTime($hardware[$i]["date"]));
if (isset($_SESSION["OCS"]["IpdiscoverMacConstructors"])) {
$macs = unserialize($_SESSION["OCS"]["IpdiscoverMacConstructors"]);
if (isset($macs[mb_strtoupper(substr($hardware[$i]["mac"], 0, 8))])) {
$macConstructor = $macs[mb_strtoupper(substr($hardware[$i]["mac"], 0, 8))];
} else {
$macConstructor = __("unknow");
}
}
$mac = $hardware[$i]["mac"] . "<small> ( " . $macConstructor . " )</small>";
echo self::showItem($mac);
echo self::showItem($ip = $hardware[$i]["ip"]);
echo self::showItem($hardware[$i]["mask"]);
echo self::showItem($hardware[$i]["DNS"]);
echo "<td><input type=\"text\" name='itemsdescription[" . $i . "]' value=\"\" ></td>";
echo "<td>";
Dropdown::showFromArray("ocsitemstype[{$i}]", $ocstypes);
echo "</td>";
if ($action == "import") {
echo "<td><input type=\"text\" name='itemsname[" . $i . "]' value=\"\"></td>";
if (Session::isMultiEntitiesMode()) {
echo "<td>";
Entity::dropdown(array('name' => "entities[{$i}]", 'entity' => $_SESSION["glpiactiveentities"]));
echo "</td>";
}
echo "<td>";
Dropdown::showFromArray("glpiitemstype[{$i}]", $itemstypes);
echo "</td>";
} else {
echo "<td width='10'>";
$mtrand = mt_rand();
$mynamei = "itemtype";
$myname = "tolink_items[" . $i . "]";
$rand = Dropdown::showItemTypes($mynamei, self::$hardwareItemTypes, array('rand' => $mtrand));
$p = array('itemtype' => '__VALUE__', 'entity_restrict' => $_SESSION["glpiactiveentities"], 'id' => $i, 'rand' => $rand, 'myname' => $myname);
//print_r($p);
Ajax::updateItemOnSelectEvent("dropdown_{$mynamei}{$rand}", "results_{$mynamei}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/ajax/dropdownitems.php", $p);
echo "<span id='results_{$mynamei}{$rand}'>\n";
echo "</span>\n";
//}
echo "</td>";
}
echo self::showItem($hardware[$i]["mac"], "", "", "", true, "", $i);
echo "<tbody style=\"display:none\">";
echo "<tr><td><input type=\"hidden\" name='itemsip[" . $i . "]' value=\"{$ip}\" >\n <input type=\"hidden\" name='subnet' value=\"{$ipAdress}\" ></td></tr>";
echo "</tbody>";
}
}
echo "</table>\n";
echo "<div class='center' style=\"width=100%\">";
if ($action == "import") {
echo "<input type='submit' class='submit' name='IdentifyAndImport' value=\"" . _sx('button', 'Import') . "\">";
echo " ";
} else {
echo "<input type='submit' class='submit' name='IdentifyAndLink' value=\"" . _sx('button', 'Link', 'ocsinventoryng') . "\">";
echo " ";
}
echo "<input type='submit' class='submit' name='delete' value=\"" . _sx('button', 'Delete from OCSNG', 'ocsinventoryng') . "\"></div>";
Html::closeForm();
self::checkBox($target);
break;
default:
$link = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.php";
$target = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php" . $backValues;
$macConstructor = "";
self::checkBox($target);
示例6: showMassiveActionsSubForm
/**
* @since version 0.85
*
* @see CommonDBTM::showMassiveActionsSubForm()
**/
static function showMassiveActionsSubForm(MassiveAction $ma)
{
global $CFG_GLPI;
switch ($ma->getAction()) {
case 'transform_to':
Dropdown::showItemTypes('transform_to', NetworkPort::getNetworkPortInstantiations(), array('value' => 'NetworkPortEthernet'));
echo "<br><br>";
echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . "</span>";
return true;
}
return parent::showMassiveActionsSubForm($ma);
}
示例7: showVisibility
/**
* Show visibility config for a reminder
**/
function showVisibility()
{
global $DB, $CFG_GLPI;
$ID = $this->fields['id'];
$canedit = Session::haveRight('reminder_public', 'w');
echo "<div class='center'>";
$rand = mt_rand();
$nb = count($this->users) + count($this->groups) + count($this->profiles) + count($this->entities);
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='remindervisibility_form{$rand}' id='remindervisibility_form{$rand}' ";
echo " method='post' action='" . Toolbox::getItemTypeFormURL('Reminder') . "'>";
echo "<input type='hidden' name='reminders_id' value='{$ID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Add a target') . "</tr>";
echo "<tr class='tab_bg_2'><td width='100px'>";
$types = array('Entity', 'Group', 'Profile', 'User');
$addrand = Dropdown::showItemTypes('_type', $types);
$params = array('type' => '__VALUE__', 'right' => 'reminder_public');
Ajax::updateItemOnSelectEvent("dropdown__type" . $addrand, "visibility{$rand}", $CFG_GLPI["root_doc"] . "/ajax/visibility.php", $params);
echo "</td>";
echo "<td><span id='visibility{$rand}'></span>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $nb) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$paramsma = array('num_displayed' => $nb, 'specific_actions' => array('deletevisibility' => _x('button', 'Delete permanently')));
if ($this->fields['users_id'] != Session::getLoginUserID()) {
$paramsma['confirm'] = __('Caution! You are not the author of this element. Delete targets can result in loss of access to that element.');
}
Html::showMassiveActions(__CLASS__, $paramsma);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
if ($canedit && $nb) {
echo "<th width='10'>";
echo Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
echo "</th>";
}
echo "<th>" . __('Type') . "</th>";
echo "<th>" . _n('Recipient', 'Recipients', 2) . "</th>";
echo "</tr>";
// Users
if (count($this->users)) {
foreach ($this->users as $key => $val) {
foreach ($val as $data) {
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
echo "<input type='checkbox' name='item[Reminder_User][" . $data["id"] . "]'\n value='1' >";
echo "</td>";
}
echo "<td>" . __('User') . "</td>";
echo "<td>" . getUserName($data['users_id']) . "</td>";
echo "</tr>";
}
}
}
// Groups
if (count($this->groups)) {
foreach ($this->groups as $key => $val) {
foreach ($val as $data) {
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
echo "<input type='checkbox' name='item[Group_Reminder][" . $data["id"] . "]'\n value='1'>";
echo "</td>";
}
echo "<td>" . __('Group') . "</td>";
$names = Dropdown::getDropdownName('glpi_groups', $data['groups_id'], 1);
$entname = sprintf(__('%1$s %2$s'), $names["name"], Html::showToolTip($names["comment"], array('display' => false)));
if ($data['entities_id'] >= 0) {
$entname = sprintf(__('%1$s / %2$s'), $entname, Dropdown::getDropdownName('glpi_entities', $data['entities_id']));
if ($data['is_recursive']) {
//TRANS: R for Recursive
sprintf(__('%1$s %2$s'), $entname, "<span class='b'>(" . __('R') . ")</span>");
}
}
echo "<td>" . $entname . "</td>";
echo "</tr>";
}
}
}
// Entity
if (count($this->entities)) {
foreach ($this->entities as $key => $val) {
foreach ($val as $data) {
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
echo "<input type='checkbox' name='item[Entity_Reminder][" . $data["id"] . "]'\n value='1'>";
echo "</td>";
}
//.........这里部分代码省略.........
示例8: displayCriteriaSelectPattern
function displayCriteriaSelectPattern($name, $ID, $condition, $value = "", $test = FALSE)
{
$crit = $this->getCriteria($ID);
$display = FALSE;
$tested = FALSE;
foreach ($this->criterias as $criteria) {
if ($criteria->fields['criteria'] == $name) {
if ($criteria->fields['condition'] == Rule::PATTERN_CONTAIN || $criteria->fields['condition'] == Rule::PATTERN_NOT_CONTAIN || $criteria->fields['condition'] == Rule::PATTERN_BEGIN || $criteria->fields['condition'] == Rule::PATTERN_END || $criteria->fields['condition'] == Rule::REGEX_MATCH || $criteria->fields['condition'] == Rule::REGEX_NOT_MATCH) {
$rc = new $this->rulecriteriaclass();
Html::autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
return;
}
if ($criteria->fields['condition'] == Rule::PATTERN_IS || $criteria->fields['condition'] == Rule::PATTERN_IS_NOT and ($name != "itemtype" and $name != 'states_id')) {
$rc = new $this->rulecriteriaclass();
Html::autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
return;
}
}
}
if (isset($crit['type']) && ($test || $condition == Rule::PATTERN_IS || $condition == Rule::PATTERN_IS_NOT)) {
switch ($crit['type']) {
case "yesonly":
Dropdown::showYesNo($name, $value, 0);
$display = TRUE;
break;
case "yesno":
Dropdown::showYesNo($name, $value);
$display = TRUE;
break;
case "dropdown":
Dropdown::show(getItemTypeForTable($crit['table']), array('name' => $name, 'value' => $value));
$display = TRUE;
break;
case "dropdown_users":
User::dropdown(array('value' => $value, 'name' => $name, 'right' => 'all'));
$display = TRUE;
break;
case "dropdown_itemtype":
$types = $this->getTypes();
ksort($types);
Dropdown::showItemTypes($name, array_keys($types), array('value' => $value));
$display = TRUE;
break;
}
$tested = TRUE;
}
//Not a standard condition
if (!$tested) {
$display = $this->displayAdditionalRuleCondition($condition, $crit, $name, $value);
}
if (!$display) {
$rc = new $this->rulecriteriaclass();
Html::autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
}
}
示例9: showForm
/**
* Display form for unmanaged device
*
* @param $id integer id of the unmanaged device
* @param $options array
*
* @return bool TRUE if form is ok
*
**/
function showForm($id, $options = array())
{
$this->initForm($id, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('Name') . " :</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'name', array('size' => 35));
echo "</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td align='center'>" . __('Entity') . " :</td>";
echo "</td>";
echo "<td align='center'>";
Dropdown::show("Entity", array('name' => 'entities_id', 'value' => $this->fields["entities_id"]));
echo "</td>";
echo "</tr>";
echo "</tr>";
} else {
echo "<td align='center'></td>";
echo "</td>";
echo "<td align='center'></td>";
echo "</tr>";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('Type') . " :</td>";
echo "<td align='center'>";
$type_list = array();
$type_list[] = 'Computer';
$type_list[] = 'NetworkEquipment';
$type_list[] = 'Printer';
$type_list[] = 'Peripheral';
$type_list[] = 'Phone';
Dropdown::showItemTypes('item_type', $type_list, array('value' => $this->fields["item_type"]));
echo "</td>";
echo "<td align='center'>" . __('Alternate username') . " :</td>";
echo "</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'contact', array('size' => 35));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('Location') . " :</td>";
echo "<td align='center'>";
Dropdown::show("Location", array('name' => "locations_id", 'value' => $this->fields["locations_id"]));
echo "</td>";
echo "<td align='center'>" . __('Domain') . " :</td>";
echo "</td>";
echo "<td align='center'>";
Dropdown::show("Domain", array('name' => "domain", 'value' => $this->fields["domain"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('Approved devices', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo("accepted", $this->fields["accepted"]);
echo "</td>";
echo "<td align='center'>" . __('Serial Number') . " :</td>";
echo "</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'serial', array('size' => 35));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('Network hub', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo Dropdown::getYesNo($this->fields["hub"]);
echo "</td>";
echo "<td align='center'>" . __('Inventory number') . " :</td>";
echo "</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'otherserial', array('size' => 35));
echo "</td>";
echo "</tr>";
if (!empty($this->fields["ip"]) or !empty($this->fields["mac"])) {
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('IP') . " :</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'ip', array('size' => 35));
echo "</td>";
echo "<td colspan='2'></td>";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td align='center' rowspan='2'>";
echo __('Sysdescr', 'fusioninventory') . " :";
echo "</td>";
echo "<td rowspan='2'>";
echo "<textarea name='sysdescr' cols='45' rows='5'>" . $this->fields["sysdescr"] . "</textarea>";
echo "<td align='center'></td>";
echo "<td align='center'>";
//.........这里部分代码省略.........
示例10: showSnmpDeviceToAdd
//.........这里部分代码省略.........
echo Search::showHeaderItem($output_type, __('Contact SNMP', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Location SNMP', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Type SNMP', 'ocsinventoryng'), $header_num);
if (!$tolinked) {
echo Search::showHeaderItem($output_type, __('Item type to create', 'ocsinventoryng'), $header_num, "", 0, "", 'width=15%');
echo Search::showHeaderItem($output_type, "", $header_num);
} else {
echo Search::showHeaderItem($output_type, __('Item to link', 'ocsinventoryng'), $header_num, "", 0, "", 'width=15%');
}
// End Line for column headers
echo Search::showEndLine($output_type);
$row_num = 1;
foreach ($hardware as $ID => $tab) {
$row_num++;
$item_num = 1;
if ($tab["type"] == "Network") {
$tab["type"] = "NetworkEquipment";
}
echo Search::showNewLine($output_type, $row_num % 2);
echo Search::showItem($output_type, $tab["name"], $item_num, $row_num);
echo Search::showItem($output_type, $tab["description"], $item_num, $row_num, 'width=15%');
echo Search::showItem($output_type, $tab["ipaddr"], $item_num, $row_num, 'width=5%');
echo Search::showItem($output_type, Html::convDateTime($tab["date"]), $item_num, $row_num, 'width=15%');
echo Search::showItem($output_type, $tab["contact"], $item_num, $row_num, 'width=5%');
echo Search::showItem($output_type, $tab["location"], $item_num, $row_num, 'width=15%');
echo Search::showItem($output_type, $tab["type"], $item_num, $row_num);
if (!$tolinked) {
echo "<td width='15%'>";
$value = false;
if (getItemForItemtype($tab["type"])) {
$value = $tab["type"];
}
$type = "toimport_itemtype[" . $tab["id"] . "]";
Dropdown::showItemTypes($type, self::$snmptypes, array('value' => $value));
echo "</td>\n";
}
/* if ($p['change_import_mode'] && !$tolinked){
if (!isset ($data['entities_id']) || $data['entities_id'] == -1){
echo "<td class='center'><img src=\"".$CFG_GLPI['root_doc']. "/pics/redbutton.png\"></td>\n";
$data['entities_id'] = -1;
} else{
echo "<td class='center'>";
$tmprule = new RuleImportEntity();
if ($tmprule->can($data['_ruleid'],READ)){
echo "<a href='". $tmprule->getLinkURL()."'>".$tmprule->getName()."</a>";
} else{
echo $tmprule->getName();
}
echo "</td>\n";
}
echo "<td width='30%'>";
$ent = "toimport_entities[".$tab["id"]."]";
Entity::dropdown(array('name' => $ent,
'value' => $data['entities_id'],
'comments' => 0));
echo "</td>\n";
} */
echo "<td width='10'>";
if (!$tolinked) {
echo "<input type='checkbox' name='toimport[" . $tab["id"] . "]' " . ($p['check'] == "all" ? "checked" : "") . ">";
} else {
/* $tab['entities_id'] = $p['glpiactiveentities'];
$rulelink = new RuleImportComputerCollection();
$rulelink_results = array();
$params = array('entities_id' => $p['glpiactiveentities'],
'plugin_ocsinventoryng_ocsservers_id'
示例11: getValueToSelect
//.........这里部分代码省略.........
case "date":
case "date_delay":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('min', 'max', 'maybeempty', 'showyear');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateField($name, $options);
case "datetime":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
$options['with_time'] = true;
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('mindate', 'maxdate', 'mintime', 'maxtime', 'maybeempty', 'timestep');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateTimeField($name, $options);
case "timestamp":
$copytooption = array('addfirstminutes', 'emptylabel', 'inhours', 'max', 'min', 'step', 'toadd', 'display_emptychoice');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Dropdown::showTimeStamp($name, $options);
case "itemlink":
// Do not use dropdown if wanted to select string value instead of ID
if (isset($options['itemlink_as_string']) && $options['itemlink_as_string']) {
break;
}
case "dropdown":
$copytooption = array('condition', 'displaywith', 'emptylabel', 'right', 'toadd');
$options['name'] = $name;
$options['value'] = $value;
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
if (!isset($options['entity'])) {
$options['entity'] = $_SESSION['glpiactiveentities'];
}
$itemtype = getItemTypeForTable($searchoptions['table']);
return $itemtype::dropdown($options);
case "right":
return Profile::dropdownRights(Profile::getRightsFor($searchoptions['rightclass']), $name, $value, array('multiple' => false, 'display' => false));
case "itemtypename":
if (isset($searchoptions['itemtype_list'])) {
$options['types'] = $CFG_GLPI[$searchoptions['itemtype_list']];
}
$copytooption = array('types');
$options['value'] = $value;
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
if (isset($options['types'])) {
return Dropdown::showItemTypes($name, $options['types'], $options);
}
return false;
case "language":
$copytooption = array('emptylabel', 'display_emptychoice');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Dropdown::showLanguages($name, $options);
}
// Get specific display if available
$itemtype = getItemTypeForTable($searchoptions['table']);
if ($item = getItemForItemtype($itemtype)) {
$specific = $item->getSpecificValueToSelect($searchoptions['field'], $name, $values, $options);
if (strlen($specific)) {
return $specific;
}
}
}
// default case field text
$this->fields[$name] = $value;
return Html::autocompletionTextField($this, $name, $options);
}
示例12: plugin_fusioninventory_MassiveActionsFieldsDisplay
function plugin_fusioninventory_MassiveActionsFieldsDisplay($options = array())
{
$table = $options['options']['table'];
$field = $options['options']['field'];
$linkfield = $options['options']['linkfield'];
switch ($table . "." . $field) {
case "glpi_plugin_fusioninventory_unmanageds.item_type":
$type_list = array();
$type_list[] = 'Computer';
$type_list[] = 'NetworkEquipment';
$type_list[] = 'Printer';
$type_list[] = 'Peripheral';
$type_list[] = 'Phone';
Dropdown::showItemTypes($linkfield, $type_list, array('value' => 0));
return TRUE;
break;
case 'glpi_plugin_fusioninventory_configsecurities.name':
Dropdown::show("PluginFusioninventoryConfigSecurity", array('name' => $linkfield));
return TRUE;
break;
case 'glpi_plugin_fusioninventory_agents.id':
Dropdown::show("PluginFusinvsnmpAgent", array('name' => $linkfield, 'comment' => FALSE));
return TRUE;
break;
case 'glpi_plugin_fusioninventory_agents.threads_networkdiscovery':
Dropdown::showNumber("threads_networkdiscovery", array('value' => $linkfield, 'min' => 1, 'max' => 400));
return TRUE;
break;
case 'glpi_plugin_fusioninventory_agents.threads_networkinventory':
Dropdown::showNumber("threads_networkinventory", array('value' => $linkfield, 'min' => 1, 'max' => 400));
return TRUE;
break;
case 'glpi_entities.name':
if (Session::isMultiEntitiesMode()) {
Dropdown::show("Entities", array('name' => "entities_id", 'value' => $_SESSION["glpiactive_entity"]));
}
return TRUE;
break;
}
return FALSE;
}
示例13: showSpecificMassiveActionsParameters
/**
* @see CommonDBTM::showSpecificMassiveActionsParameters()
**/
function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "transform_to":
Dropdown::showItemTypes('transform_to', NetworkPort::getNetworkPortInstantiations(), array('value' => 'NetworkPortEthernet'));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Save') . "'>";
return true;
default:
return parent::showSpecificMassiveActionsParameters($input);
}
return false;
}
示例14: showSpecificMassiveActionsParameters
/**
* Display specific options add action button for massive actions
*
* Parameters must not be : itemtype, action, is_deleted, check_itemtype or check_items_id
* @param $input array of input datas
* @since version 0.84
*
* @return boolean if parameters displayed ?
**/
public function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "InstallTEST":
Dropdown::showItemTypes("item_item", self::getTypes(true));
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
return true;
break;
case "Desinstall":
Dropdown::showItemTypes("item_item", self::getTypes(true));
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
return true;
break;
default:
return parent::showSpecificMassiveActionsParameters($input);
break;
}
return false;
}
示例15: dropdownConnect
/**
* Make a select box for connected port
*
* @param $ID ID of the current port to connect
* @param $options array of possible options:
* - name : string / name of the select (default is networkports_id)
* - comments : boolean / is the comments displayed near the dropdown (default true)
* - entity : integer or array / restrict to a defined entity or array of entities
* (default -1 : no restriction)
* - entity_sons : boolean / if entity restrict specified auto select its sons
* only available if entity is a single value not an array (default false)
*
* @return nothing (print out an HTML select box)
**/
static function dropdownConnect($ID, $options = array())
{
global $CFG_GLPI;
$p['name'] = 'networkports_id';
$p['comments'] = 1;
$p['entity'] = -1;
$p['entity_sons'] = false;
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$p[$key] = $val;
}
}
// Manage entity_sons
if (!($p['entity'] < 0) && $p['entity_sons']) {
if (is_array($p['entity'])) {
echo "entity_sons options is not available with entity option as array";
} else {
$p['entity'] = getSonsOf('glpi_entities', $p['entity']);
}
}
echo "<input type='hidden' name='NetworkPortConnect_networkports_id_1'value='{$ID}'>";
$rand = Dropdown::showItemTypes('NetworkPortConnect_itemtype', $CFG_GLPI["networkport_types"]);
$params = array('itemtype' => '__VALUE__', 'entity_restrict' => $p['entity'], 'networkports_id' => $ID, 'comments' => $p['comments'], 'myname' => $p['name'], 'instantiation_type' => get_called_class());
Ajax::updateItemOnSelectEvent("dropdown_NetworkPortConnect_itemtype{$rand}", "show_" . $p['name'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownConnectNetworkPortDeviceType.php", $params);
echo "<span id='show_" . $p['name'] . "{$rand}'> </span>\n";
return $rand;
}