本文整理汇总了PHP中Html::cleanInputText方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::cleanInputText方法的具体用法?PHP Html::cleanInputText怎么用?PHP Html::cleanInputText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::cleanInputText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectGroupOnAdd
static function selectGroupOnAdd($item)
{
global $CFG_GLPI, $DB;
if (isset($item->input['_auto_import']) || isset($item->input['bypassgrouponadd'])) {
return;
}
$peGroup_group = new self();
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
$peConfig = new PluginEscalationConfig();
if ($peConfig->getValue('workflow', $item->fields['entities_id']) == '1') {
if (isset($_POST['_groups_id_assign']) && $_POST['_groups_id_assign'] > 0) {
if (isset($_SESSION['plugin_escalation_files'])) {
$_FILES = $_SESSION['plugin_escalation_files'];
}
return;
} else {
$group = new Group();
Html::header(__('Administration'), '', "maintain", "ticket");
if (isset($_POST['dropdown__groups_id_requester']) && $_POST['dropdown__groups_id_requester'] > 0) {
$_SESSION['plugin_escalation_groups_id_requester'] = $_POST['dropdown__groups_id_requester'];
}
if (isset($_FILES)) {
foreach ($_FILES['filename']['tmp_name'] as $numfile => $datafile) {
if ($datafile != '') {
$split = explode("/", $datafile);
Document::renameForce($datafile, GLPI_DOC_DIR . "/_tmp/" . end($split));
$_FILES['filename']['tmp_name'][$numfile] = GLPI_DOC_DIR . "/_tmp/" . end($split);
}
}
$_SESSION['plugin_escalation_files'] = $_FILES;
}
echo '<form action="' . $CFG_GLPI['root_doc'] . '/front/ticket.form.php"
enctype="multipart/form-data" name="form_ticket" method="post">';
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='2'>Sélection du groupe de techniciens</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Group in charge of the ticket') . " :";
echo "</td>";
echo "<td>";
$a_groups = array();
foreach ($_SESSION['glpigroups'] as $groups_id) {
$group->getFromDB($groups_id);
$a_groups[$groups_id] = $group->getName();
$queryg = "SELECT * FROM `" . $peGroup_group->getTable() . "`\n WHERE `groups_id_source` = '" . $groups_id . "' ";
$resultg = $DB->query($queryg);
while ($datag = $DB->fetch_array($resultg)) {
$group->getFromDB($datag['groups_id_destination']);
$a_groups[$groups_id . "_" . $datag['groups_id_destination']] = " > " . $group->getName();
}
}
$rand = Dropdown::showFromArray("_groups_id_assign_escalation", $a_groups);
$params = array('groups_id' => '__VALUE__', 'entity' => $_POST['entities_id'], 'rand' => $rand);
Ajax::updateItemOnSelectEvent("dropdown__groups_id_assign" . $rand, "show_assignuser{$rand}", $CFG_GLPI["root_doc"] . "/plugins/escalation/ajax/dropdownUserassign.php", $params);
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2'>";
foreach ($_POST as $key => $value) {
if (is_array($value)) {
foreach ($value as $keyy => $valuee) {
echo '<input type="hidden" name="' . $key . '[' . $keyy . ']" value="' . $valuee . '" />';
}
} else {
if ($key == 'content') {
$value = Html::cleanPostForTextArea(Toolbox::clean_cross_side_scripting_deep($value));
echo '<textarea name="' . $key . '" style="display:none;">' . $value . '</textarea>';
} else {
if ($key == 'dropdown__groups_id_requester') {
echo '<input type="hidden" name="_groups_id_requester" value="' . $value . '" />';
} else {
$value = Html::cleanInputText(Toolbox::clean_cross_side_scripting_deep(stripslashes($value)));
echo '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
}
}
}
}
if (!isset($_POST['_users_id_assign']) or $_POST['_users_id_assign'] == '0') {
echo "<span id='show_assignuser{$rand}'></span>";
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' align='center'>";
echo "<input type='submit' name='add' value=\"" . __('Add') . "\" class='submit'>";
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
Html::footer();
exit;
}
}
}
}
示例2: showForm
//.........这里部分代码省略.........
if (isset($options['problems_id'])) {
echo "<input type='hidden' name='_problems_id' value='" . $options['problems_id'] . "'>";
}
$date = $this->fields["date"];
if (!$ID) {
$date = date("Y-m-d H:i:s");
}
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
echo "<th width='{$colsize1}%'>" . __('Due date') . "</th>";
echo "<td width='{$colsize2}%' class='left'>";
if ($this->fields["due_date"] == 'NULL') {
$this->fields["due_date"] = '';
}
Html::showDateTimeField("due_date", array('value' => $this->fields["due_date"], 'timestep' => 1));
echo "</td></tr>";
if ($ID) {
echo "<tr class='tab_bg_1'><th>" . __('By') . "</th><td>";
User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<th>" . __('Last update') . "</th>";
echo "<td>" . Html::convDateTime($this->fields["date_mod"]) . "\n";
if ($this->fields['users_id_lastupdater'] > 0) {
printf(__('%1$s: %2$s'), __('By'), getUserName($this->fields["users_id_lastupdater"], $showuserlink));
}
echo "</td></tr>";
}
if ($ID && (in_array($this->fields["status"], $this->getSolvedStatusArray()) || in_array($this->fields["status"], $this->getClosedStatusArray()))) {
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Date of solving') . "</th>";
echo "<td>";
Html::showDateTimeField("solvedate", array('value' => $this->fields["solvedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
if (in_array($this->fields["status"], $this->getClosedStatusArray())) {
echo "<th>" . __('Closing date') . "</th>";
echo "<td>";
Html::showDateTimeField("closedate", array('value' => $this->fields["closedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "</tr>";
}
echo "</table>";
echo "<table class='tab_cadre_fixe' id='mainformtable2'>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . __('Status') . "</th>";
echo "<td width='{$colsize2}%'>";
self::dropdownStatus(array('value' => $this->fields["status"], 'showtype' => 'allowed'));
ChangeValidation::alertValidation($this, 'status');
echo "</td>";
echo "<th width='{$colsize1}%'>" . __('Urgency') . "</th>";
echo "<td width='{$colsize2}%'>";
// Only change during creation OR when allowed to change priority OR when user is the creator
$idurgency = self::dropdownUrgency(array('value' => $this->fields["urgency"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Category') . "</th>";
echo "<td >";
$opt = array('value' => $this->fields["itilcategories_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_change`='1'");
ITILCategory::dropdown($opt);
echo "</td>";
echo "<th>" . __('Impact') . "</th>";
echo "<td>";
$idimpact = self::dropdownImpact(array('value' => $this->fields["impact"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Total duration') . "</th>";
echo "<td>" . parent::getActionTime($this->fields["actiontime"]) . "</td>";
echo "<th class='left'>" . __('Priority') . "</th>";
echo "<td>";
$idpriority = parent::dropdownPriority(array('value' => $this->fields["priority"], 'withmajor' => true));
$idajax = 'change_priority_' . mt_rand();
echo " <span id='{$idajax}' style='display:none'></span>";
$params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => 'dropdown_priority' . $idpriority);
Ajax::updateItemOnSelectEvent(array('dropdown_urgency' . $idurgency, 'dropdown_impact' . $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params);
echo "</td>";
echo "</tr>";
echo "</table>";
$this->showActorsPartForm($ID, $options);
echo "<table class='tab_cadre_fixe' id='mainformtable3'>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . __('Title') . "</th>";
echo "<td colspan='3'>";
echo "<input type='text' size='90' maxlength=250 name='name' " . " value=\"" . Html::cleanInputText($this->fields["name"]) . "\">";
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Description') . "</th>";
echo "<td colspan='3'>";
$rand = mt_rand();
echo "<textarea id='content{$rand}' name='content' cols='90' rows='6'>" . Html::clean(Html::entity_decode_deep($this->fields["content"])) . "</textarea>";
echo "</td>";
echo "</tr>";
$options['colspan'] = 3;
$this->showFormButtons($options);
return true;
}
示例3: showGenericSearch
//.........这里部分代码省略.........
echo ">OR NOT</option>";
echo "</select> ";
}
// display select box to define search item
echo "<select id='Search{$itemtype}{$i}' name=\"field[{$i}]\" size='1'>";
echo "<option value='view' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "view") {
echo "selected";
}
echo ">" . __('Items seen') . "</option>\n";
reset($options);
$first_group = true;
$selected = 'view';
$str_limit = 28;
$nb_in_group = 0;
$group = '';
foreach ($options as $key => $val) {
// print groups
if (!is_array($val)) {
if (!$first_group) {
$group .= "</optgroup>\n";
} else {
$first_group = false;
}
if ($nb_in_group) {
echo $group;
}
$group = '';
$nb_in_group = 0;
$group .= "<optgroup label=\"" . Toolbox::substr($val, 0, $str_limit) . "\">";
} else {
if (!isset($val['nosearch']) || $val['nosearch'] == false) {
$nb_in_group++;
$group .= "<option title=\"" . Html::cleanInputText($val["name"]) . "\" value='{$key}'";
if (is_array($p['field']) && isset($p['field'][$i]) && $key == $p['field'][$i]) {
$group .= "selected";
$selected = $key;
}
$group .= ">" . Toolbox::substr($val["name"], 0, $str_limit) . "</option>\n";
}
}
}
if (!$first_group) {
$group .= "</optgroup>\n";
}
if ($nb_in_group) {
echo $group;
}
echo "<option value='all' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "all") {
echo "selected";
}
echo ">" . __('All') . "</option>";
echo "</select>\n";
echo "</td><td class='left'>";
echo "<div id='SearchSpan{$itemtype}{$i}'>\n";
$_POST['itemtype'] = $itemtype;
$_POST['num'] = $i;
$_POST['field'] = $selected;
$_POST['searchtype'] = is_array($p['searchtype']) && isset($p['searchtype'][$i]) ? $p['searchtype'][$i] : "";
$_POST['value'] = is_array($p['contains']) && isset($p['contains'][$i]) ? stripslashes($p['contains'][$i]) : "";
include GLPI_ROOT . "/ajax/searchoption.php";
echo "</div>\n";
$params = array('field' => '__VALUE__', 'itemtype' => $itemtype, 'num' => $i, 'value' => $_POST["value"], 'searchtype' => $_POST["searchtype"]);
Ajax::updateItemOnSelectEvent("Search{$itemtype}{$i}", "SearchSpan{$itemtype}{$i}", $CFG_GLPI["root_doc"] . "/ajax/searchoption.php", $params, false);
echo "</td></tr>\n";
示例4: dropdownContacts
public function dropdownContacts($suppliers_id, $value = 0, $entity_restrict = '')
{
global $DB, $CFG_GLPI;
$rand = mt_rand();
$entities = getEntitiesRestrictRequest("AND", "glpi_contacts", '', $entity_restrict, true);
$query = "SELECT `glpi_contacts`.*\n FROM `glpi_contacts`,`glpi_contacts_suppliers`\n WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id`\n AND `glpi_contacts_suppliers`.`suppliers_id` = '{$suppliers_id}'\n AND `glpi_contacts`.`is_deleted` = '0'\n {$entities}\n ORDER BY `entities_id`, `name`";
$result = $DB->query($query);
echo "<select name=\"contacts_id\">";
echo "<option value=\"0\">" . Dropdown::EMPTY_VALUE . "</option>";
if ($DB->numrows($result)) {
$prev = -1;
while ($data = $DB->fetch_array($result)) {
if ($data["entities_id"] != $prev) {
if ($prev >= 0) {
echo "</optgroup>";
}
$prev = $data["entities_id"];
echo "<optgroup label=\"" . Dropdown::getDropdownName("glpi_entities", $prev) . "\">";
}
$output = formatUserName($data["id"], "", $data["name"], $data["firstname"]);
if ($_SESSION["glpiis_ids_visible"] || empty($output)) {
$output .= " (" . $data["id"] . ")";
}
echo "<option value='" . $data["id"] . "' " . ($value == $data["id"] ? " selected " : "") . " title=\"" . Html::cleanInputText($output) . "\">" . substr($output, 0, $CFG_GLPI["dropdown_chars_limit"]) . "</option>";
}
if ($prev >= 0) {
echo "</optgroup>";
}
}
echo "</select>";
}
示例5: makeTextInput
/**
* Construit le code HTML pour un champ de saisie texte libre
*
* @param integer/string $id
* id de la règle dont fait partie le champ (integer ou tag de nouvel id)
* @param string $param
* nom du paramètre à afficher (champ name du select)
* @param array $desc
* description du paramètre à afficher
* @param string $values
* valeur à utiliser pour préremplir le champ (doit être html-échappée)
* @param boolean $can_write
* vrai ssi on doit afficher un menu sélectionnable, sinon on affiche juste le texte.
* @return string code html à afficher
*/
private static final function makeTextInput($id, $param, $desc, $value, $can_write)
{
$result = '';
$size = isset($desc['size']) ? $desc['size'] : 50;
$maxlength = $desc['maxlength'];
if ($can_write) {
$result .= '<input type="text" name="rules[' . $id . '][' . $param . ']" value="' . Html::cleanInputText($value) . '" size="' . $size . '" maxlength="' . $maxlength . '">';
} else {
$result .= $value;
}
return $result;
}
示例6: showGenericSearch
//.........这里部分代码省略.........
echo "<option value='AND NOT' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "AND NOT") {
echo "selected";
}
echo ">AND NOT</option>\n";
echo "<option value='OR NOT' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "OR NOT") {
echo "selected";
}
echo ">OR NOT</option>";
echo "</select> ";
}
// display select box to define serach item
echo "<select id='Search{$itemtype}{$i}' name=\"field[{$i}]\" size='1'>";
echo "<option value='view' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "view") {
echo "selected";
}
echo ">" . __('Items seen') . "</option>\n";
reset($options);
$first_group = true;
$selected = 'view';
foreach ($options as $key => $val) {
// print groups
if (!is_array($val)) {
if (!$first_group) {
echo "</optgroup>\n";
} else {
$first_group = false;
}
echo "<optgroup label='{$val}'>";
} else {
if (!isset($val['nosearch']) || $val['nosearch'] == false) {
echo "<option title=\"" . Html::cleanInputText($val["name"]) . "\" value='{$key}'";
if (is_array($p['field']) && isset($p['field'][$i]) && $key == $p['field'][$i]) {
echo "selected";
$selected = $key;
}
echo ">" . Toolbox::substr($val["name"], 0, 28) . "</option>\n";
}
}
}
if (!$first_group) {
echo "</optgroup>\n";
}
echo "<option value='all' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "all") {
echo "selected";
}
echo ">" . __('All') . "</option>";
echo "</select> \n";
echo "</td><td class='left'>";
echo "<div id='SearchSpan{$itemtype}{$i}'>\n";
$_POST['itemtype'] = $itemtype;
$_POST['num'] = $i;
$_POST['field'] = $selected;
$_POST['searchtype'] = is_array($p['searchtype']) && isset($p['searchtype'][$i]) ? $p['searchtype'][$i] : "";
$_POST['value'] = is_array($p['contains']) && isset($p['contains'][$i]) ? stripslashes($p['contains'][$i]) : "";
include GLPI_ROOT . "/ajax/searchoption.php";
echo "</div>\n";
$params = array('field' => '__VALUE__', 'itemtype' => $itemtype, 'num' => $i, 'value' => $_POST["value"], 'searchtype' => $_POST["searchtype"]);
Ajax::updateItemOnSelectEvent("Search{$itemtype}{$i}", "SearchSpan{$itemtype}{$i}", $CFG_GLPI["root_doc"] . "/ajax/searchoption.php", $params, false);
echo "</td></tr>\n";
}
$metanames = array();
if (is_array($linked) && count($linked) > 0) {
示例7: header
* @brief
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownSelectSoftware.php")) {
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkRight("software", "w");
// Make a select box
$rand = mt_rand();
$where = "";
if (strlen($_POST['searchText']) > 0 && $_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `name` " . Search::makeTextSearch($_POST['searchText']) . " ";
}
$where .= getEntitiesRestrictRequest(' AND', 'glpi_softwares', 'entities_id', $_POST["entity_restrict"], true);
$query = "SELECT DISTINCT `glpi_softwares`.`id`,\n `glpi_softwares`.`name`\n FROM `glpi_softwares`\n WHERE `glpi_softwares`.`is_deleted` = '0'\n AND `glpi_softwares`.`is_template` = '0'\n {$where}\n ORDER BY `glpi_softwares`.`name`";
$result = $DB->query($query);
echo "<select name='softwares_id' id='item_type{$rand}'>\n";
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$softwares_id = $data["id"];
$output = $data["name"];
echo "<option value='{$softwares_id}' title=\"" . Html::cleanInputText($output) . "\">" . Toolbox::substr($output, 0, $_SESSION["glpidropdown_chars_limit"]) . "</option>";
}
}
echo "</select>\n";
$paramsselsoft = array('softwares_id' => '__VALUE__', 'myname' => $_POST["myname"]);
Ajax::updateItemOnSelectEvent("item_type{$rand}", "show_" . $_POST["myname"] . $rand, $CFG_GLPI["root_doc"] . "/ajax/dropdownInstallVersion.php", $paramsselsoft);
echo "<span id='show_" . $_POST["myname"] . "{$rand}'> </span>\n";
示例8: showGenericSearch
static function showGenericSearch($itemtype, array $params)
{
global $LANG, $CFG_GLPI;
// Default values of parameters
$p['link'] = array();
$p['field'] = array();
$p['contains'] = array();
$p['searchtype'] = array();
$p['sort'] = '';
$p['is_deleted'] = 0;
$p['link2'] = '';
$p['contains2'] = '';
$p['field2'] = '';
$p['itemtype2'] = '';
$p['searchtype2'] = '';
foreach ($params as $key => $val) {
$p[$key] = $val;
}
$options = Search::getCleanedOptions($itemtype);
//$target = Toolbox::getItemTypeSearchURL($itemtype);
// Instanciate an object to access method
$item = NULL;
if ($itemtype != 'States' && class_exists($itemtype)) {
$item = new $itemtype();
}
// Meta search names
$metaactivated = array('Computer' => $LANG['Menu'][0], 'Printer' => $LANG['Menu'][2], 'Monitor' => $LANG['Menu'][3], 'Peripheral' => $LANG['Menu'][16], 'Software' => $LANG['Menu'][4], 'Phone' => $LANG['Menu'][34], 'Ticket' => $LANG['Menu'][5]);
//$target = substr_replace($target, '/central.php#', strrpos($target, '/'), 1);
//echo $target;
//echo "<form name='searchform$itemtype' method='get' action='$target'>";
echo "<form name='searchform{$itemtype}' method='get' action='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/search.php'>";
echo "<input type='hidden' name='menu' value='" . $_GET['menu'] . "' />";
echo "<input type='hidden' name='ssmenu' value='" . $_GET['ssmenu'] . "' />";
// Display normal search parameters
for ($i = 0; $i < $_SESSION["glpisearchcount"][$itemtype]; $i++) {
// Display link item
if ($i > 0) {
echo "<select name='link[{$i}]'>";
echo "<option value='AND' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "AND") {
echo "selected";
}
echo ">AND</option>";
echo "<option value='OR' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "OR") {
echo "selected";
}
echo ">OR</option>";
echo "<option value='AND NOT' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "AND NOT") {
echo "selected";
}
echo ">AND NOT</option>";
echo "<option value='OR NOT' ";
if (is_array($p["link"]) && isset($p["link"][$i]) && $p["link"][$i] == "OR NOT") {
echo "selected";
}
echo ">OR NOT</option>";
echo "</select>";
}
// display select box to define search item
echo "<select id='Search{$itemtype}{$i}' name=\"field[{$i}]\" size='1'>";
echo "<option value='view' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "view") {
echo "selected";
}
echo ">" . $LANG['search'][11] . "</option>";
reset($options);
$first_group = true;
$selected = 'view';
foreach ($options as $key => $val) {
// print groups
if (!is_array($val)) {
if (!$first_group) {
echo "</optgroup>";
} else {
$first_group = false;
}
echo "<optgroup label='{$val}'>";
} else {
if (!isset($val['nosearch']) || $val['nosearch'] == false) {
echo "<option title=\"" . Html::cleanInputText($val["name"]) . "\" value='{$key}'";
if (is_array($p['field']) && isset($p['field'][$i]) && $key == $p['field'][$i]) {
echo "selected";
$selected = $key;
}
echo ">" . Toolbox::substr($val["name"], 0, 28) . "</option>";
}
}
}
if (!$first_group) {
echo "</optgroup>";
}
echo "<option value='all' ";
if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "all") {
echo "selected";
}
echo ">" . $LANG['common'][66] . "</option>";
echo "</select>";
echo "<span id='SearchSpan{$itemtype}{$i}'>\n";
//.........这里部分代码省略.........
示例9: getItemTypeForTable
// No access not displayed because empty not take into account for search
Profile::dropdownNoneReadWrite($inputname, $_REQUEST['value'], 1, 1, 1);
$display = true;
break;
case "itemtypename":
Dropdown::dropdownUsedItemTypes($inputname, getItemTypeForTable($searchopt['table']), array('value' => $_REQUEST['value'], 'comments' => 0));
$display = true;
break;
}
}
// Standard field usage
if (!$display) {
switch ($searchopt['field']) {
case "name":
case "completename":
Dropdown::show(getItemTypeForTable($searchopt['table']), array('value' => $_REQUEST['value'], 'name' => $inputname, 'comments' => 0));
$display = true;
break;
}
}
}
break;
}
// static function dropdownValue($table,$myname,$value='',$display_comment=1,$entity_restrict=-1,
// $update_item="",$used=array(),$auto_submit=0) {
// Default case : text field
if (!$display) {
echo "<input type='search' size='13' name=\"{$inputname}\" value=\"" . Html::cleanInputText($_REQUEST['value']) . "\" >";
}
}
//ajaxFooter();
示例10: switch
// Standard datatype usage
if (!$display && isset($searchopt['datatype'])) {
switch ($searchopt['datatype']) {
case "date":
case "date_delay":
case "datetime":
$options2['relative_dates'] = true;
break;
}
}
$out = $item->getValueToSelect($searchopt, $inputname, $_POST['value'], $options2);
if (strlen($out)) {
echo $out;
$display = true;
}
//Could display be handled by a plugin ?
if (!$display && ($plug = isPluginItemType(getItemTypeForTable($searchopt['table'])))) {
$function = 'plugin_' . $plug['plugin'] . '_searchOptionsValues';
if (function_exists($function)) {
$params = array('name' => $inputname, 'searchtype' => $_POST['searchtype'], 'searchoption' => $searchopt, 'value' => $_POST['value']);
$display = $function($params);
}
}
}
break;
}
// Default case : text field
if (!$display) {
echo "<input type='text' size='13' style='width:180px; height:30px;' class='form-control' name='{$inputname}' value=\"" . Html::cleanInputText($_POST['value']) . "\">";
}
}
示例11: while
echo "<br>";
echo "<select name='" . $_POST['myname'] . "' size='1'>";
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>";
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
// Device name + port name
$output = $output_long = $data['cname'];
if (!empty($data['nname'])) {
$output = sprintf(__('%1$s - %2$s'), $output, $data['nname']);
//TRANS: %1$s is device name, %2$s is port name
$output_long = sprintf(__('%1$s - The port %2$s'), $output_long, $data['nname']);
}
// display netpoint (which will be copied)
if (!empty($data['npname'])) {
$output = sprintf(__('%1$s - %2$s'), $output, $data['npname']);
//TRANS: %1$s is a string (device name - port name...), %2$s is network outlet name
$output_long = sprintf(__('%1$s - Network outlet %2$s'), $output_long, $data['npname']);
}
$ID = $data['did'];
if ($_SESSION["glpiis_ids_visible"] || empty($output) || empty($output_long)) {
$output = sprintf(__('%1$s (%2$s)'), $output, $ID);
$output_long = sprintf(__('%1$s (%2$s)'), $output_long, $ID);
}
$output = Toolbox::substr($output, 0, $_SESSION["glpidropdown_chars_limit"]);
echo "<option value='{$ID}' title=\"" . Html::cleanInputText($output_long) . "\">" . $output;
echo "</option>";
}
}
echo "</select>";
// echo "<input type='submit' name='connect' value=\"".__s('Connect')."\" class='submit'>";
}
示例12: title
/**
* Show list of activated reports
*
* @param array $opt : short_classname,f_name,gtype,rand
*/
static function title($opt)
{
global $LANG;
$self = new self();
$params['classname'] = 'PluginMreporting' . $opt['short_classname'];
$reports = $self->getAllReports(true, $params);
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __("Select statistics to be displayed") . " :</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
echo "<select name='graphmenu' onchange='window.location.href=this.options\n [this.selectedIndex].value'>";
echo "<option value='-1' selected>" . Dropdown::EMPTY_VALUE . "</option>";
$i = 0;
foreach ($reports as $classname => $report) {
foreach ($report['functions'] as $function) {
if ($function['is_active']) {
$graphs[$function['category_func']][] = $function;
}
}
echo "<optgroup label=\"" . $report['title'] . "\">";
foreach ($graphs as $cat => $graph) {
echo "<optgroup label=\"" . $cat . "\">";
foreach ($graph as $k => $v) {
if ($v['is_active']) {
$comment = "";
if (isset($v["desc"])) {
$comment = $v["desc"];
$desc = " (" . $comment . ")";
}
echo "<option value='" . $v["url_graph"] . "' title=\"" . Html::cleanInputText($comment) . "\">" . $v["title"] . $desc . "</option>";
$i++;
}
}
echo "</optgroup>";
}
echo "</optgroup>";
}
echo "</select>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
示例13: displayField
function displayField($name, $fieldname, $valuedisplay, $value = '', $checked = '')
{
if ($value == '') {
$value = $valuedisplay;
}
$type = 'checkbox';
$inputname = 'checked[]';
if (strstr($fieldname, 'requester') || strstr($fieldname, 'assign')) {
$type = 'radio';
$inputname = $fieldname;
$fieldname = $value;
}
echo "<tr class='tab_bg_3'>";
echo "<td>";
echo "<input type='" . $type . "' name='" . $inputname . "' value='" . $fieldname . "' " . $checked . " />";
echo "</td>";
echo "<td>";
echo $name;
echo "</td>";
echo "<td>";
echo $valuedisplay;
if ($type == 'checkbox') {
$value = Html::cleanInputText(Toolbox::clean_cross_side_scripting_deep(stripslashes($value)));
echo '<input type="hidden" name="' . $fieldname . '" value="' . $value . '" />';
}
echo "</td>";
echo "</tr>";
}
示例14:
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
$first_group = false;
}
$items_in_group = 0;
$newgroup = "";
if (!$first_group) {
$newgroup .= "</optgroup>";
}
$val = Toolbox::substr($val, 0, $str_limit);
$newgroup .= "<optgroup label=\"{$val}\">";
} else {
// No search on plugins
echo $key . "--";
if (!isPluginItemType($key) && !isset($val["nometa"])) {
$newgroup .= "<option value='{$key}' title=\"" . Html::cleanInputText($val["name"]) . "\"";
if ($key == $_POST["field"]) {
$newgroup .= "selected";
}
$newgroup .= ">" . Toolbox::substr($val["name"], 0, $str_limit) . "</option>\n";
$items_in_group++;
}
}
}
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
}
if (!$first_group) {
echo "</optgroup>";
}
echo "</select>";
示例15: AND
if (strlen($_POST['searchText']) > 0 && $_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$search = Search::makeTextSearch($_POST['searchText']);
$where .= " AND (`name` " . $search . "\n OR `id` = '" . $_POST['searchText'] . "'";
$where .= ")";
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0, {$NBMAX}";
if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
$query = "SELECT *\n FROM `" . $_POST['table'] . "`\n {$where}\n ORDER BY `name`\n {$LIMIT}";
$result = $DB->query($query);
echo "<select name='" . $_POST['myname'] . "' id='" . $_POST['myname'] . "' size='1'>";
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"] && $DB->numrows($result) == $NBMAX) {
echo "<option value='0'>--" . __('Limited view') . "--</option>";
}
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>";
if ($DB->numrows($result)) {
while ($data = $DB->fetch_array($result)) {
$output = $data['name'];
if (empty($output) || $_SESSION['glpiis_ids_visible']) {
$output .= " (" . $data['id'] . ")";
}
$selected = "";
if ($data['id'] == $_POST['value']) {
$selected = "selected='selected'";
}
echo "<option value='" . $data['id'] . "' {$selected} title=\"" . Html::cleanInputText($output) . "\">" . Toolbox::substr($output, 0, $_SESSION["glpidropdown_chars_limit"]) . "</option>";
}
}
echo "</select>";