本文整理汇总了PHP中Computer::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Computer::dropdown方法的具体用法?PHP Computer::dropdown怎么用?PHP Computer::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer::dropdown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showComputersToAdd
//.........这里部分代码省略.........
echo "<th>" . __('Destination entity') . "</th>\n";
echo "<th>" . __('Target location', 'ocsinventoryng') . "</th>\n";
}
echo "<th width='20%'> </th></tr>\n";
$rule = new RuleImportEntityCollection();
foreach ($hardware as $ID => $tab) {
$comp = new Computer();
$comp->fields["id"] = $tab["id"];
$data = array();
if ($advanced && !$tolinked) {
$data = $rule->processAllRules(array('ocsservers_id' => $serverId, '_source' => 'ocsinventoryng'), array(), array('ocsid' => $tab["id"]));
}
echo "<tr class='tab_bg_2'><td>" . $tab["name"] . "</td>\n";
echo "<td>" . $tab["manufacturer"] . "</td><td>" . $tab["model"] . "</td>";
echo "<td>" . $tab["serial"] . "</td>\n";
echo "<td>" . Html::convDateTime($tab["date"]) . "</td>\n";
echo "<td>" . $tab["TAG"] . "</td>\n";
if ($advanced && !$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='30%'>";
if (!isset($data['locations_id'])) {
$data['locations_id'] = 0;
}
$loc = "toimport_locations[" . $tab["id"] . "]";
Location::dropdown(array('name' => $loc, 'value' => $data['locations_id'], 'comments' => 0));
echo "</td>\n";
}
echo "<td>";
if (!$tolinked) {
echo "<input type='checkbox' name='toimport[" . $tab["id"] . "]' " . ($check == "all" ? "checked" : "") . ">";
} else {
$tab['entities_id'] = $entity;
$rulelink = new RuleImportComputerCollection();
$rulelink_results = array();
$params = array('entities_id' => $entity, 'plugin_ocsinventoryng_ocsservers_id' => $serverId);
$rulelink_results = $rulelink->processAllRules(Toolbox::stripslashes_deep($tab), array(), $params);
//Look for the computer using automatic link criterias as defined in OCSNG configuration
$options = array('name' => "tolink[" . $tab["id"] . "]");
$show_dropdown = true;
//If the computer is not explicitly refused by a rule
if (!isset($rulelink_results['action']) || $rulelink_results['action'] != self::LINK_RESULT_NO_IMPORT) {
if (!empty($rulelink_results['found_computers'])) {
$options['value'] = $rulelink_results['found_computers'][0];
$options['entity'] = $entity;
}
$options['width'] = "100%";
Computer::dropdown($options);
} else {
echo "<img src='" . $CFG_GLPI['root_doc'] . "/pics/redbutton.png'>";
}
示例2: showAdditionalInformation
/**
* @param $info array
* @param $option array
**/
function showAdditionalInformation($info = array(), $option = array())
{
$name = "info[" . $option['linkfield'] . "]";
switch ($option['displaytype']) {
case 'computer':
Computer::dropdown(array('name' => $name, 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => false));
break;
case 'software':
Software::dropdown(array('name' => $name, 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => false));
break;
default:
break;
}
}
示例3: showForLicense
/**
* Show computers linked to a License
*
* @param $license SoftwareLicense object
*
* @return nothing
**/
static function showForLicense(SoftwareLicense $license)
{
global $DB, $CFG_GLPI;
$searchID = $license->getField('id');
if (!Software::canView() || !$searchID) {
return false;
}
$canedit = Session::haveRightsOr("software", array(CREATE, UPDATE, DELETE, PURGE));
$canshowcomputer = Computer::canView();
if (isset($_GET["start"])) {
$start = $_GET["start"];
} else {
$start = 0;
}
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (isset($_GET["sort"]) && !empty($_GET["sort"])) {
// manage several param like location,compname : order first
$tmp = explode(",", $_GET["sort"]);
$sort = "`" . implode("` {$order},`", $tmp) . "`";
} else {
$sort = "`entity` {$order}, `compname`";
}
//SoftwareLicense ID
$query_number = "SELECT COUNT(*) AS cpt\n FROM `glpi_computers_softwarelicenses`\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwarelicenses`.`computers_id`\n = `glpi_computers`.`id`)\n WHERE `glpi_computers_softwarelicenses`.`softwarelicenses_id` = '{$searchID}'" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwarelicenses`.`is_deleted` = '0'";
$number = 0;
if ($result = $DB->query($query_number)) {
$number = $DB->result($result, 0, 0);
}
echo "<div class='center'>";
if ($canedit) {
echo "<form method='post' action='" . $CFG_GLPI["root_doc"] . "/front/computer_softwarelicense.form.php'>";
echo "<input type='hidden' name='softwarelicenses_id' value='{$searchID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'>";
echo "<td>";
Computer::dropdown(array('entity' => $license->fields['entities_id'], 'entity_sons' => $license->fields['is_recursive']));
echo "</td>";
echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
}
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table></div>\n";
return;
}
// Display the pager
Html::printAjaxPager(__('Affected computers'), $start, $number);
$query = "SELECT `glpi_computers_softwarelicenses`.*,\n `glpi_computers`.`name` AS compname,\n `glpi_computers`.`id` AS cID,\n `glpi_computers`.`serial`,\n `glpi_computers`.`otherserial`,\n `glpi_users`.`name` AS username,\n `glpi_users`.`id` AS userid,\n `glpi_users`.`realname` AS userrealname,\n `glpi_users`.`firstname` AS userfirstname,\n `glpi_softwarelicenses`.`name` AS license,\n `glpi_softwarelicenses`.`id` AS vID,\n `glpi_softwarelicenses`.`name` AS vername,\n `glpi_entities`.`completename` AS entity,\n `glpi_locations`.`completename` AS location,\n `glpi_states`.`name` AS state,\n `glpi_groups`.`name` AS groupe,\n `glpi_softwarelicenses`.`name` AS lname,\n `glpi_softwarelicenses`.`id` AS lID,\n `glpi_softwarelicenses`.`softwares_id` AS softid\n FROM `glpi_computers_softwarelicenses`\n INNER JOIN `glpi_softwarelicenses`\n ON (`glpi_computers_softwarelicenses`.`softwarelicenses_id`\n = `glpi_softwarelicenses`.`id`)\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwarelicenses`.`computers_id` = `glpi_computers`.`id`)\n LEFT JOIN `glpi_entities` ON (`glpi_computers`.`entities_id` = `glpi_entities`.`id`)\n LEFT JOIN `glpi_locations`\n ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)\n LEFT JOIN `glpi_states` ON (`glpi_computers`.`states_id` = `glpi_states`.`id`)\n LEFT JOIN `glpi_groups` ON (`glpi_computers`.`groups_id` = `glpi_groups`.`id`)\n LEFT JOIN `glpi_users` ON (`glpi_computers`.`users_id` = `glpi_users`.`id`)\n WHERE (`glpi_softwarelicenses`.`id` = '{$searchID}') " . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwarelicenses`.`is_deleted` = '0'\n ORDER BY {$sort} {$order}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$rand = mt_rand();
if ($result = $DB->query($query)) {
if ($data = $DB->fetch_assoc($result)) {
if ($canedit) {
$rand = mt_rand();
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $_SESSION['glpilist_limit'], 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
// show transfer only if multi licenses for this software
if (self::countLicenses($data['softid']) > 1) {
$massiveactionparams['specific_actions'][__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'move_license'] = _x('button', 'Move');
}
// Options to update license
$massiveactionparams['extraparams']['options']['move']['used'] = array($searchID);
$massiveactionparams['extraparams']['options']['move']['softwares_id'] = $license->fields['softwares_id'];
Html::showMassiveActions($massiveactionparams);
}
$soft = new Software();
$soft->getFromDB($license->fields['softwares_id']);
$showEntity = $license->isRecursive();
$linkUser = User::canView();
$text = sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $soft->fields["name"]);
$text = sprintf(__('%1$s - %2$s'), $text, $data["vername"]);
Session::initNavigateListItems('Computer', $text);
$sort_img = "<img src='" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "' alt='' title=''>";
echo "<table class='tab_cadre_fixehov'>";
$columns = array('compname' => __('Name'), 'entity' => __('Entity'), 'serial' => __('Serial number'), 'otherserial' => __('Inventory number'), 'location,compname' => __('Location'), 'state,compname' => __('Status'), 'groupe,compname' => __('Group'), 'username,compname' => __('User'));
if (!$showEntity) {
unset($columns['entity']);
}
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
//.........这里部分代码省略.........
示例4: showComputersToAdd
//.........这里部分代码省略.........
echo "<tr><th>" . __('Name') . "</th>\n";
echo "<th>" . __('Manufacturer') . "</th>\n";
echo "<th>" . __('Model') . "</th>\n";
echo "<th>" . __('Serial number') . "</th>\n";
echo "<th>" . __('Date') . "</th>\n";
echo "<th>" . __('OCSNG TAG', 'ocsinventoryng') . "</th>\n";
if ($advanced && !$tolinked) {
echo "<th>" . __('Match the rule ?', 'ocsinventoryng') . "</th>\n";
echo "<th>" . __('Destination entity') . "</th>\n";
echo "<th>" . __('Target location', 'ocsinventoryng') . "</th>\n";
}
echo "<th> </th></tr>\n";
$rule = new RuleImportEntityCollection();
foreach ($hardware as $ID => $tab) {
$comp = new Computer();
$comp->fields["id"] = $tab["id"];
$data = array();
if ($advanced && !$tolinked) {
$data = $rule->processAllRules(array('ocsservers_id' => $plugin_ocsinventoryng_ocsservers_id, '_source' => 'ocsinventoryng'), array(), array('ocsid' => $tab["id"]));
}
echo "<tr class='tab_bg_2'><td>" . $tab["name"] . "</td>\n";
echo "<td>" . $tab["manufacturer"] . "</td><td>" . $tab["model"] . "</td>";
echo "<td>" . $tab["serial"] . "</td>\n";
echo "<td>" . Html::convDateTime($tab["date"]) . "</td>\n";
echo "<td>" . $tab["TAG"] . "</td>\n";
if ($advanced && !$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'], 'r')) {
echo "<a href='" . $tmprule->getLinkURL() . "'>" . $tmprule->getName() . "</a>";
} else {
echo $tmprule->getName();
}
echo "</td>\n";
}
echo "<td>";
Entity::dropdown(array('name' => "toimport_entities[" . $tab["id"] . "]=" . $data['entities_id'], 'value' => $data['entities_id'], 'comments' => 0));
echo "</td>\n";
echo "<td>";
if (!isset($data['locations_id'])) {
$data['locations_id'] = 0;
}
Location::dropdown(array('name' => "toimport_locations[" . $tab["id"] . "]=" . $data['locations_id'], 'value' => $data['locations_id'], 'comments' => 0));
echo "</td>\n";
}
echo "<td>";
if (!$tolinked) {
echo "<input type='checkbox' name='toimport[" . $tab["id"] . "]' " . ($check == "all" ? "checked" : "") . ">";
} else {
$rulelink = new RuleImportComputerCollection();
$rulelink_results = array();
$params = array('entities_id' => $entity, 'plugin_ocsinventoryng_ocsservers_id' => $plugin_ocsinventoryng_ocsservers_id);
$rulelink_results = $rulelink->processAllRules(Toolbox::stripslashes_deep($tab), array(), $params);
//Look for the computer using automatic link criterias as defined in OCSNG configuration
$options = array('name' => "tolink[" . $tab["id"] . "]");
$show_dropdown = true;
//If the computer is not explicitly refused by a rule
if (!isset($rulelink_results['action']) || $rulelink_results['action'] != self::LINK_RESULT_NO_IMPORT) {
if (!empty($rulelink_results['found_computers'])) {
$options['value'] = $rulelink_results['found_computers'][0];
$options['entity'] = $entity;
}
Computer::dropdown($options);
} else {
echo "<img src='" . $CFG_GLPI['root_doc'] . "/pics/redbutton.png'>";
}
}
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_1'><td colspan='" . ($advanced || $tolinked ? 10 : 7) . "' class='center'>";
echo "<input class='submit' type='submit' name='import_ok' value=\"" . _sx('button', 'Import', 'ocsinventoryng') . "\">\n";
echo "<input type=hidden name='plugin_ocsinventoryng_ocsservers_id' " . "value='{$plugin_ocsinventoryng_ocsservers_id}'>";
echo "</td></tr>";
echo "</table>\n";
Html::closeForm();
if (!$tolinked) {
self::checkBox($target);
}
Html::printPager($start, $numrows, $target, $parameters);
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Import new computers') . "</th></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td class='center b'>" . __('No new computer to be imported', 'ocsinventoryng') . "</td></tr>\n";
echo "</table>";
}
echo "</div>";
} else {
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Import new computers', 'ocsinventoryng') . "</th></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td class='center b'>" . __('No new computer to be imported', 'ocsinventoryng') . "</td></tr>\n";
echo "</table></div>";
}
}
示例5: plugin_ocsinventoryng_MassiveActionsDisplay
/**
* @param $options array
*/
function plugin_ocsinventoryng_MassiveActionsDisplay($options = array())
{
switch ($options['itemtype']) {
case 'PluginOcsinventoryngNotimportedcomputer':
switch ($options['action']) {
case "plugin_ocsinventoryng_import":
Entity::dropdown(array('name' => 'entity'));
break;
case "plugin_ocsinventoryng_link":
Computer::dropdown(array('name' => 'computers_id'));
break;
case "plugin_ocsinventoryng_replayrules":
case "plugin_ocsinventoryng_delete":
break;
}
echo " <input type='submit' name='massiveaction' class='submit' " . "value='" . _sx('button', 'Post') . "'>";
break;
case 'Computer':
switch ($options['action']) {
case "plugin_ocsinventoryng_force_ocsng_update":
echo "<input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Post') . "'>\n";
break;
case "plugin_ocsinventoryng_unlock_ocsng_field":
$fields['all'] = __('All');
$fields += PluginOcsinventoryngOcsServer::getLockableFields();
Dropdown::showFromArray("field", $fields);
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Post') . "'>";
break;
}
}
return "";
}