本文整理汇总了PHP中Dropdown::showAllItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showAllItems方法的具体用法?PHP Dropdown::showAllItems怎么用?PHP Dropdown::showAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showAllItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
function showForm($ID)
{
global $CFG_GLPI;
echo "<form name='form' method='post' action='" . $CFG_GLPI["root_doc"] . "/plugins/immobilizationsheets/front/immobilizationsheet.php'>";
echo "<div align=\"center\">";
echo "<table class=\"tab_cadre\" cellspacing=\"2\" cellpadding=\"2\">";
echo "<tr><th>" . __('Generation of immobilization sheet', 'immobilizationsheets') . "</th></tr>";
echo "<tr>";
echo "<td class='tab_bg_2 center'>";
$immo_item = new PluginImmobilizationsheetsItem();
Dropdown::showAllItems("item_item", 0, 0, -1, $immo_item->getTypes());
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __s('Post') . "\" >";
echo "</td>";
echo "</tr>";
echo "</table></div>";
Html::closeForm();
}
示例2: plugin_appliances_MassiveActionsDisplay
function plugin_appliances_MassiveActionsDisplay($options)
{
switch ($options['itemtype']) {
case 'PluginAppliancesAppliance':
switch ($options['action']) {
// No case for add_document : use GLPI core one
case "plugin_appliances_install":
Dropdown::showAllItems("item_item", 0, 0, -1, PluginAppliancesAppliance::getTypes());
echo "<input type='submit' name='massiveaction' class='submit' " . "value='" . _x('button', 'Post') . "'>";
break;
case "plugin_appliances_desinstall":
Dropdown::showAllItems("item_item", 0, 0, -1, PluginAppliancesAppliance::getTypes());
echo "<input type='submit' name='massiveaction' class='submit' " . "value='" . _x('button', 'Post') . "'>";
break;
case "plugin_appliances_transfert":
Entity::dropdown();
echo " <input type='submit' name='massiveaction' class='submit' " . "value='" . _x('button', 'Post') . "'>";
break;
}
break;
default:
if (in_array($options['itemtype'], PluginAppliancesAppliance::getTypes(true))) {
Dropdown::show('PluginAppliancesAppliance');
echo "<input type='submit' name='massiveaction' class='submit\\' " . "value='" . _x('button', 'Post') . "'>";
}
}
return "";
}
示例3: showSpecificMassiveActionsParameters
function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "Install":
Dropdown::showAllItems("item_item", 0, 0, -1, self::getTypes());
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
return true;
break;
case "Desinstall":
Dropdown::showAllItems("item_item", 0, 0, -1, self::getTypes());
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
return true;
break;
case "Duplicate":
Dropdown::show('Entity');
echo " <input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
return true;
break;
case "Transfert":
Dropdown::show('Entity');
echo " <input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
return true;
break;
default:
return parent::showSpecificMassiveActionsParameters($input);
break;
}
return false;
}
示例4: configureNodesLinks
function configureNodesLinks($weathermaps_id) {
global $DB,$CFG_GLPI;
$networkPort = new NetworkPort();
$this->getFromDB($weathermaps_id);
$style = '';
if ($this->fields['width'] > 950) {
$style = ";position:relative;left:-".(($this->fields['width'] - 950) / 2)."px";
}
echo "<table class='tab_cadre' style='width:".
$this->fields['width']."px;height:".$this->fields['height']."px".
$style."'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='2'>";
echo __('Nodes and links', 'monitoring');
echo "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td valign='top'>";
echo "<div>";
PluginMonitoringToolbox::loadLib();
$this->drawMap($weathermaps_id, 100, 1);
echo "</div>";
echo "</td>";
echo "<td valign='top'>";
echo "<div style='position: fixed;top: 30px;right: 0;z-index:999;' >";
echo "<table class='tab_cadre' width='100%'>";
echo "<tr>";
echo "<td>";
echo "<a onClick='Ext.get(\"weathermapform\").toggle();'>
<img src='".$CFG_GLPI["root_doc"]."/pics/deplier_down.png' />
".__('Display weathermap form', 'monitoring')."
<img src='".$CFG_GLPI["root_doc"]."/pics/deplier_down.png' /></a>";
echo "</td>";
echo "</tr>";
echo"</table>";
echo "</div>";
echo "<div style='position: fixed;top: 50px;right: 0;z-index:1000;' id='weathermapform' >";
echo '<form name="pointform" method="post" action="'.$CFG_GLPI['root_doc'].'/plugins/monitoring/front/weathermapnode.form.php">';
echo "<table>";
echo "<tr>";
echo "<td>";
echo "<table class='tab_cadre' width='100%'>";
echo "<tr>";
echo "<th colspan='2'>";
echo "x : ";
echo '<input type="text" name="x" size="4" value="50" />';
echo " ";
echo "y : ";
echo '<input type="text" name="y" size="4" value="50"/>';
echo "</th>";
echo "</tr>";
// * Add node
echo "<tr>";
echo "<th colspan='2'>";
echo "<input type='hidden' name='plugin_monitoring_weathermaps_id' value='".$weathermaps_id."' />";
echo __('Add a node', 'monitoring');
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo __('Node', 'monitoring')." :";
echo "</td>";
echo "<td>";
Dropdown::showAllItems("items_id");
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo __('Name')." :";
echo "</td>";
echo "<td>";
echo "<input type='text' name='name' value='' />";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo __('Position of label', 'monitoring')." :";
echo "</td>";
echo "<td>";
$positions = array(
'middle' => __('Center', 'monitoring'),
'start' => __('Right', 'monitoring'),
'end' => __('Left', 'monitoring')
);
Dropdown::showFromArray('position', $positions);
echo "</td>";
echo "</tr>";
//.........这里部分代码省略.........
示例5: showItemFromPlugin
public function showItemFromPlugin($instID, $search = '')
{
global $DB, $CFG_GLPI;
if (!$this->canView()) {
return false;
}
$rand = mt_rand();
$PluginConnectionsConnection = new PluginConnectionsConnection();
if ($PluginConnectionsConnection->getFromDB($instID)) {
$canedit = $PluginConnectionsConnection->can($instID, UPDATE);
$query = "SELECT DISTINCT `itemtype`\n FROM `" . $this->getTable() . "`\n WHERE `plugin_connections_connections_id` = '" . (int) $instID . "'\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
if (Session::isMultiEntitiesMode()) {
$colsup = 1;
} else {
$colsup = 0;
}
echo "<form method='post' name='connections_form{$rand}' id='connections_form{$rand}'\n action=\"" . $CFG_GLPI["root_doc"] . "/plugins/connections/front/connection.form.php\">";
echo "<div class='center'><table class='tab_cadrehov'>";
echo "<tr><th colspan='" . ($canedit ? 5 + $colsup : 4 + $colsup) . "'>" . __('Associated element') . ":</th></tr><tr>";
if ($canedit) {
echo "<th> </th>";
}
echo "<th>" . __('Type') . "</th>";
echo "<th>" . __('Name') . "</th>";
if (Session::isMultiEntitiesMode()) {
echo "<th>" . __('Entity') . "</th>";
}
echo "<th>" . __('Serial Number') . "</th>";
echo "<th>" . __('Inventory number') . "</th>";
echo "</tr>";
for ($i = 0; $i < $number; $i++) {
$type = $DB->result($result, $i, "itemtype");
if (!class_exists($type)) {
continue;
}
$item = new $type();
if ($item->canView()) {
$column = "name";
$table = getTableForItemType($type);
$itemTable = $this->getTable();
$entitiesRestrict = getEntitiesRestrictRequest(" AND ", 't', '', '', $item->maybeRecursive());
$mayBeTemplate = $item->maybeTemplate() ? " AND t.`is_template` = '0'" : '';
$query = "SELECT t.*, it.`id` AS items_id, `glpi_entities`.`ID` AS entity\n FROM `{$itemTable}` it, `{$table}` t\n LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = t.`entities_id`)\n WHERE t.`id` = it.`items_id`\n AND it.`itemtype` = '{$type}'\n AND it.`plugin_connections_connections_id` = '{$instID}'\n {$entitiesRestrict}\n {$mayBeTemplate}\n ORDER BY `glpi_entities`.`completename`, t.`{$column}`;";
if ($result_linked = $DB->query($query)) {
if ($DB->numrows($result_linked)) {
Session::initNavigateListItems($type, __('Connections', 'connections') . " = " . $PluginConnectionsConnection->fields['name']);
while ($data = $DB->fetch_assoc($result_linked)) {
$item->getFromDB($data["id"]);
Session::addToNavigateListItems($type, $data["id"]);
$ID = $_SESSION["glpiis_ids_visible"] || empty($data["name"]) ? " (" . $data["id"] . ")" : "";
$link = Toolbox::getItemTypeFormURL($type);
$name = "<a href=\"" . $link . "?id=" . $data["id"] . "\">" . $data["name"] . $ID . "</a>";
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
$sel = isset($_GET["select"]) && "all" == $_GET["select"] ? "checked" : "";
echo "<input type='checkbox' name='item[" . $data["items_id"] . "]' value='1' " . $sel . ">";
echo "</td>";
}
echo "<td class='center'>" . $item->getTypeName() . "</td>";
$is_deleted = isset($data['is_deleted']) && $data['is_deleted'] ? "class='tab_bg_2_2'" : "";
echo "<td class='center' " . $is_deleted . ">" . $name . "</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_entities", $data['entity']);
echo "</td>";
}
echo "<td class='center'>";
echo isset($data["serial"]) ? $data["serial"] : "-";
echo "</td>";
echo "<td class='center'>";
echo isset($data["otherserial"]) ? $data["otherserial"] : "-";
echo "</td>";
echo "</tr>";
}
}
}
}
}
if ($canedit) {
echo "<tr class='tab_bg_1'><td colspan='" . (3 + $colsup) . "' class='center'>";
echo "<input type='hidden' name='plugin_connections_connections_id' value='{$instID}'>";
Dropdown::showAllItems("items_id", 0, 0, $PluginConnectionsConnection->fields['is_recursive'] ? -1 : $PluginConnectionsConnection->fields['entities_id'], $this->getClasses());
echo "</td>";
echo "<td colspan='2' class='center' class='tab_bg_2'>";
echo "<input type='submit' name='additem' value=\"" . __('Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table></div>";
Html::openArrowMassives("connections_form{$rand}");
Html::closeArrowMassives(array('deleteitem' => __('Delete')));
} else {
echo "</table></div>";
}
echo Html::closeForm(false);
}
}
示例6: showForCertificate
/**
* Show items links to a certificate
*
* @since version 0.84
*
* @param $certificate PluginCertificatesCertificate object
*
* @return nothing (HTML display)
**/
public static function showForCertificate(PluginCertificatesCertificate $certificate) {
global $DB,$CFG_GLPI;
// $certif=new PluginCertificatesCertificate();
$instID = $certificate->fields['id'];
if (!$certificate->can($instID, READ)){
return false;
}
$canedit=$certificate->can($instID, UPDATE);
$rand=mt_rand();
$query = "SELECT DISTINCT `itemtype`
FROM `glpi_plugin_certificates_certificates_items`
WHERE `plugin_certificates_certificates_id` = '".$instID."'
ORDER BY `itemtype`
LIMIT ".count(PluginCertificatesCertificate::getTypes(true));
$result = $DB->query($query);
$number = $DB->numrows($result);
if (Session::isMultiEntitiesMode()) {
$colsup=1;
} else {
$colsup=0;
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form method='post' name='certificates_form$rand'
id='certificates_form$rand' action='".Toolbox::getItemTypeFormURL("PluginCertificatesCertificate")."'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='".($canedit?(5+$colsup):(4+$colsup))."'>".
__('Add an item')."</th></tr>";
echo "<tr class='tab_bg_1'><td colspan='".(3+$colsup)."' class='center'>";
Dropdown::showAllItems("items_id",0,0,($certificate->fields['is_recursive']?-1:$certificate->fields['entities_id']),
PluginCertificatesCertificate::getTypes());
echo "</td><td colspan='2' class='center' class='tab_bg_1'>";
echo "<input type='hidden' name='plugin_certificates_certificates_id' value='$instID'>";
echo "<input type='submit' name='additem' value=\""._sx('button','Add')."\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>" ;
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
$massiveactionparams = array();
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit && $number) {
echo "<th width='10'>".Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand)."</th>";
}
echo "<th>".__('Type')."</th>";
echo "<th>".__('Name')."</th>";
if (Session::isMultiEntitiesMode())
echo "<th>".__('Entity')."</th>";
echo "<th>".__('Serial number')."</th>";
echo "<th>".__('Inventory number')."</th>";
echo "</tr>";
for ($i=0 ; $i < $number ; $i++) {
$itemtype=$DB->result($result, $i, "itemtype");
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
if ($item->canView()) {
$column="name";
$itemTable = getTableForItemType($itemtype);
$query = " SELECT `".$itemTable."`.*,
`glpi_plugin_certificates_certificates_items`.`id` AS items_id,
`glpi_entities`.id AS entity "
." FROM `glpi_plugin_certificates_certificates_items`, `".$itemTable
."` LEFT JOIN `glpi_entities`
ON (`glpi_entities`.`id` = `".$itemTable."`.`entities_id`) "
." WHERE `".$itemTable."`.`id` = `glpi_plugin_certificates_certificates_items`.`items_id`
AND `glpi_plugin_certificates_certificates_items`.`itemtype` = '$itemtype'
AND `glpi_plugin_certificates_certificates_items`.`plugin_certificates_certificates_id` = '$instID' "
. getEntitiesRestrictRequest(" AND ",$itemTable,'','',$item->maybeRecursive());
//.........这里部分代码省略.........
示例7: plugin_connections_MassiveActionsDisplay
function plugin_connections_MassiveActionsDisplay($options = array())
{
$PluginConnectionsConnection = new PluginConnectionsConnection();
switch ($options['itemtype']) {
case 'PluginConnectionsConnection':
switch ($options['action']) {
// No case for add_document : use GLPI core one
case "plugin_connections_install":
Dropdown::showAllItems("item_item", 0, 0, -1, PluginConnectionsConnection_Item::getClasses(true));
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
break;
case "plugin_connections_desinstall":
Dropdown::showAllItems("item_item", 0, 0, -1, PluginConnectionsConnection_Item::getClasses(true));
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
break;
case "plugin_connections_transfert":
Entity::dropdown();
echo " <input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
break;
}
break;
}
if (in_array($options['itemtype'], PluginConnectionsConnection_Item::getClasses(true))) {
$PluginConnectionsConnection->dropdownConnections("plugin_connections_connections_id");
echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __('Post') . "\" >";
}
return "";
}
示例8: array
case "unlock_ocsng_software":
case "unlock_ocsng_printer":
case "unlock_ocsng_disk":
case "unlock_ocsng_ip":
echo "<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
break;
case "install":
Software::dropdownSoftwareToInstall("softwareversions_id", $_SESSION["glpiactive_entity"], 1);
echo " <input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][4] . "'>";
break;
case "connect":
Computer_Item::dropdownConnect('Computer', $_POST["itemtype"], "connect_item");
echo " <input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
break;
case "connect_to_computer":
Dropdown::showAllItems("connect_item", 0, 0, $_SESSION["glpiactive_entity"], array('Monitor', 'Peripheral', 'Phone', 'Printer'), true);
echo " <input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
break;
case "disconnect":
echo "<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
break;
case "add_group":
Dropdown::show('Group');
echo " <input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
break;
case "add_userprofile":
Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
echo ". " . $LANG['profiles'][22] . " : ";
Profile::dropdownUnder();
echo ". " . $LANG['profiles'][28] . " : ";
Dropdown::showYesNo("is_recursive", 0);
示例9: showForComputer
/**
* Print the form for devices linked to a computer or a template
*
* @param $computer Computer object
* @param $withtemplate='' boolean : template or basic computer
*
* @return Nothing (display)
**/
static function showForComputer(Computer $computer, $withtemplate = '')
{
global $DB, $LANG;
$devtypes = self::getDeviceTypes();
$ID = $computer->getField('id');
if (!$computer->can($ID, 'r')) {
return false;
}
$canedit = $withtemplate != 2 && $computer->can($ID, 'w');
echo "<div class='spaced'>";
if ($canedit) {
echo "<form name='form_device_action' action='" . getItemTypeFormURL(__CLASS__) . "' method='post'>";
echo "<input type='hidden' name='computers_id' value='{$ID}'>";
}
echo "<table class='tab_cadre_fixe' >";
echo "<tr><th colspan='63'>" . $LANG['title'][30] . "</th></tr>";
$nb = 0;
$specificity_units = array('DeviceProcessor' => $LANG['setup'][35], 'DeviceMemory' => $LANG['common'][82], 'DeviceHardDrive' => $LANG['common'][82], 'DeviceGraphicCard' => $LANG['common'][82]);
foreach ($devtypes as $itemtype) {
initNavigateListItems($itemtype, $computer->getTypeName() . " = " . $computer->getName());
$device = new $itemtype();
$specificities = $device->getSpecifityLabel();
$specif_fields = array_keys($specificities);
$specif_text = implode(',', $specif_fields);
if (!empty($specif_text)) {
$specif_text = " ," . $specif_text . " ";
}
$linktable = getTableForItemType('Computer_' . $itemtype);
$fk = getForeignKeyFieldForTable(getTableForItemType($itemtype));
$query = "SELECT COUNT(*) AS NB,\n `id`,\n `{$fk}`\n {$specif_text}\n FROM `{$linktable}`\n WHERE `computers_id` = '{$ID}'\n GROUP BY `{$fk}` {$specif_text}";
$prev = '';
foreach ($DB->request($query) as $data) {
addToNavigateListItems($itemtype, $data[$fk]);
if ($device->getFromDB($data[$fk])) {
echo "<tr class='tab_bg_2'>";
echo "<td class='center'>";
Dropdown::showInteger("quantity_" . $itemtype . "_" . $data['id'], $data['NB']);
echo "</td><td>";
if ($device->canCreate()) {
echo "<a href='" . $device->getSearchURL() . "'>" . $device->getTypeName() . "</a>";
} else {
echo $device->getTypeName();
}
echo "</td><td>" . $device->getLink() . "</td>";
$spec = $device->getFormData();
if (isset($spec['label']) && count($spec['label'])) {
$colspan = 60 / count($spec['label']);
foreach ($spec['label'] as $i => $label) {
if (isset($spec['value'][$i])) {
echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . " : ";
echo $spec['value'][$i] . "</td>";
} else {
if ($canedit) {
// Specificity
echo "<td class='right' colspan='{$colspan}'>" . $spec['label'][$i] . " : ";
echo "<input type='text' name='value_" . $itemtype . "_" . $data['id'] . "' value='" . $data['specificity'] . "' size='" . $spec['size'] . "'>";
if (isset($specificity_units[$device->getType()])) {
echo ' ' . $specificity_units[$device->getType()];
}
echo "</td>";
} else {
echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . " : ";
echo $data['specificity'];
if (isset($specificity_units[$device->getType()])) {
echo ' ' . $specificity_units[$device->getType()];
}
echo "</td>";
}
}
}
} else {
echo "<td colspan='60'> </td>";
}
echo "</tr>";
$nb++;
}
}
}
if ($canedit) {
if ($nb > 0) {
echo "<tr><td colspan='63' class='tab_bg_1 center'>";
echo "<input type='submit' class='submit' name='updateall' value='" . $LANG['buttons'][7] . "'></td></tr>";
}
echo "<tr><td colspan='63' class='tab_bg_1 center'>";
echo $LANG['devices'][0] . " : ";
Dropdown::showAllItems('items_id', '', 0, -1, $devtypes);
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</tr></table></form>";
} else {
echo "</table>";
}
echo "</div>";
//.........这里部分代码省略.........
示例10: showForSimcard
static function showForSimcard(PluginSimcardSimcard $simcard)
{
global $DB, $LANG;
if (!$simcard->can($simcard->getID(), 'r')) {
return false;
}
$results = getAllDatasFromTable(getTableForItemType(__CLASS__), "`plugin_simcard_simcards_id` = '" . $simcard->getID() . "'");
echo "<div class='spaced'>";
echo "<form id='items' name='items' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='6'>" . $LANG['document'][19] . "</th></tr>";
if (!empty($results)) {
echo "<tr><th></th>";
echo "<th>" . $LANG['common'][17] . "</th>";
echo "<th>" . $LANG['entity'][0] . "</th>";
echo "<th>" . $LANG['common'][16] . "</th>";
echo "<th>" . $LANG['common'][19] . "</th>";
echo "<th>" . $LANG['common'][20] . "</th>";
echo "</tr>";
foreach ($results as $data) {
$item = new $data['itemtype']();
$item->getFromDB($data['items_id']);
echo "<tr>";
echo "<td>";
if (Session::haveRight('simcard', 'w')) {
echo "<input type='checkbox' name='todelete[" . $data['id'] . "]'>";
}
echo "</td>";
echo "<td>";
echo call_user_func(array($data['itemtype'], 'getTypeName'));
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName('glpi_entities', $item->fields['entities_id']);
echo "</td>";
echo "<td>";
echo $item->getLink();
echo "</td>";
echo "<td>";
echo $item->fields['serial'];
echo "</td>";
echo "<td>";
echo $item->fields['otherserial'];
echo "</td>";
echo "</tr>";
}
}
if (Session::haveRight('simcard', 'w')) {
echo "<tr class='tab_bg_1'><td colspan='4' class='center'>";
if (empty($results)) {
echo "<input type='hidden' name='plugin_simcard_simcards_id' value='" . $simcard->getID() . "'>";
Dropdown::showAllItems("items_id", 0, 0, $simcard->fields['entities_id'], self::getClasses());
echo "</td>";
echo "<td colspan='2' class='center' class='tab_bg_2'>";
echo "<input type='submit' name='additem' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>";
}
if (!empty($results)) {
Html::openArrowMassives('items');
Html::closeArrowMassives(array('delete_items' => $LANG['buttons'][10]));
}
}
echo "</table>";
Html::closeForm();
echo "</div>";
}
示例11: showSpecificMassiveActionsParameters
/**
* @see CommonDBTM::showSpecificMassiveActionsParameters()
**/
function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "connect":
if ($input['itemtype'] == 'Computer') {
Dropdown::showAllItems("items_id", 0, 0, $_SESSION["glpiactive_entity"], array('Monitor', 'Peripheral', 'Phone', 'Printer'), true, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . __s('Connect') . "'>";
} else {
Computer_Item::dropdownConnect('Computer', $input["itemtype"], "computers_id");
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . __s('Connect') . "'>";
}
return true;
case "disconnect":
echo "<input type='submit' name='massiveaction' class='submit' value='" . __s('Disconnect') . "'>";
return true;
default:
return parent::showSpecificMassiveActionsParameters($input);
}
return false;
}
示例12: showMassiveActionsParameters
/**
* Display options add action button for massive actions
*
* @since version 0.84
*
* This must not be overloaded in Class
*
* @param $input array of input datas
*
* @return nothing display
**/
function showMassiveActionsParameters($input = array())
{
global $CFG_GLPI;
switch ($input['action']) {
case "add_contract_item":
if ($input['itemtype'] == 'Contract') {
Dropdown::showAllItems("items_id", 0, 0, 1, $CFG_GLPI["contract_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
} else {
Contract::dropdown(array('name' => "contracts_id"));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
}
break;
case "remove_contract_item":
if ($input['itemtype'] == 'Contract') {
Dropdown::showAllItems("items_id", 0, 0, 1, $CFG_GLPI["contract_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
} else {
Contract::dropdown(array('name' => "contracts_id"));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
}
break;
case "add_document":
Document::dropdown(array('name' => 'documents_id'));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
break;
case "remove_document":
Document::dropdown(array('name' => 'documents_id'));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
break;
case "update":
// Specific options for update fields
if (isset($input['options'])) {
$input['options'] = Toolbox::decodeArrayFromInput($input['options']);
} else {
$input['options'] = array();
}
$first_group = true;
$newgroup = "";
$items_in_group = 0;
$show_all = true;
$show_infocoms = true;
if (in_array($input["itemtype"], $CFG_GLPI["infocom_types"]) && (!static::canUpdate() || !Infocom::canUpdate())) {
$show_all = false;
$show_infocoms = Infocom::canUpdate();
}
$searchopt = Search::getCleanedOptions($input["itemtype"], 'w');
echo "<select name='id_field' id='massiveaction_field'>";
echo "<option value='0' selected>" . Dropdown::EMPTY_VALUE . "</option>";
foreach ($searchopt as $key => $val) {
if (!is_array($val)) {
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
$first_group = false;
}
$items_in_group = 0;
$newgroup = "";
if (!$first_group) {
$newgroup .= "</optgroup>";
}
$newgroup .= "<optgroup label=\"{$val}\">";
} else {
// No id and no entities_id massive action and no first item
if ($val["field"] != 'id' && $key != 1 && ($val["linkfield"] != 'entities_id' || isset($val['massiveaction']) && $val['massiveaction'])) {
if (!isset($val['massiveaction']) || $val['massiveaction']) {
if ($show_all) {
$newgroup .= "<option value='{$key}'>" . $val["name"] . "</option>";
$items_in_group++;
} else {
// Do not show infocom items
if ($show_infocoms && Search::isInfocomOption($input["itemtype"], $key) || !$show_infocoms && !Search::isInfocomOption($input["itemtype"], $key)) {
$newgroup .= "<option value='{$key}'>" . $val["name"] . "</option>";
$items_in_group++;
}
}
}
}
}
}
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
}
if (!$first_group) {
echo "</optgroup>";
}
echo "</select>";
$paramsmassaction = array('id_field' => '__VALUE__', 'itemtype' => $input["itemtype"], 'options' => $input['options']);
foreach ($input as $key => $val) {
if (preg_match("/extra_/", $key, $regs)) {
//.........这里部分代码省略.........
示例13: showSpecificMassiveActionsParameters
/**
* @see CommonDBTM::showSpecificMassiveActionsParameters()
**/
function showSpecificMassiveActionsParameters($input = array())
{
global $CFG_GLPI;
switch ($input['action']) {
case "add_document_item":
Dropdown::showAllItems("items_id", 0, 0, -1, $CFG_GLPI["document_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
return true;
case "remove_document_item":
Dropdown::showAllItems("items_id", 0, 0, -1, $CFG_GLPI["document_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
return true;
default:
return parent::showSpecificMassiveActionsParameters($input);
}
return false;
}
示例14: addHost
function addHost($componentscatalogs_id)
{
global $DB, $LANG;
$this->getEmpty();
$this->showFormHeader();
echo "<tr>";
echo "<td colspan='2'>";
echo $LANG['plugin_monitoring']['component'][1] . " :";
echo "<input type='hidden' name='plugin_monitoring_componentscalalog_id' value='" . $componentscatalogs_id . "'/>";
echo "<input type='hidden' name='is_static' value='1'/>";
echo "</td>";
echo "<td colspan='2'>";
Dropdown::showAllItems('items_id');
echo "</td>";
echo "</tr>";
$this->showFormButtons();
}
示例15: 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, 'r')) {
return false;
}
$canedit = $contract->can($instID, 'w');
$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']) {
$link = "<a href='" . Toolbox::getItemTypeSearchURL($itemtype) . "?" . rawurlencode("contains[0]") . "=" . rawurlencode('$$$$' . $instID) . "&" . rawurlencode("field[0]") . "=29&sort=80&order=ASC&is_deleted=0" . "&start=0" . "'>" . __('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::showAllItems("items_id", 0, 0, $contract->fields['is_recursive'] ? -1 : $contract->fields['entities_id'], $CFG_GLPI["contract_types"], false, 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();
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit && $totalnb) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Type') . "</th>";
echo "<th>" . __('Entity') . "</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Serial number') . "</th>";
echo "<th>" . __('Inventory number') . "</th>";
echo "<th>" . __('Status') . "</th>";
echo "</tr>";
$totalnb = 0;
foreach ($data as $itemtype => $datas) {
if (isset($datas['longlist'])) {
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td> </td>";
}
echo "<td class='center'>" . $datas['name'] . "</td>";
echo "<td class='center' colspan='2'>" . $datas['link'] . "</td>";
echo "<td class='center'>-</td><td class='center'>-</td></tr>";
} else {
$prem = true;
$nb = count($datas);
//.........这里部分代码省略.........