예제 #1
0
 public function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     $relation = new PluginRelationRelation();
     echo "<tr class='tab_bg_1'>";
     //Nombre de la clase en GLPI
     echo "<td>" . __('Nombre de la clase', 'Nombre de la clase') . ": </td><td>";
     //Html::autocompletionTextField($this,"name",array('size' => "15"));
     $relation->dropdownType("name", $relation->getIdDropdown($this->fields["name"]));
     echo "</td>";
     //Nombre a mostrar en los desplegables para la clase
     echo "<td>" . __('Nombre a mostrar para la clase', 'Nombre a mostrar para la clase') . ": </td>";
     echo "<td>";
     Html::autocompletionTextField($this, "viewname", array('size' => "15"));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     //Descripción
     echo "<td>" . __('Descripción', 'Descripción') . ": </td><td>";
     Html::autocompletionTextField($this, "comment", array('size' => "15"));
     echo "</td>";
     //Imagen
     echo "<td>" . __('Imagen', 'Imagen') . ": </td>";
     echo "<td>";
     //file
     //$rep = "../plugins/relation/pics/";
     $rep = '../plugins/relation/pics/';
     $dir = opendir($rep);
     echo "<select name=\"img\" id=\"img\">";
     $sel = "";
     while ($f = readdir($dir)) {
         if (is_file($rep . $f)) {
             if ($f == rtrim($this->fields["img"])) {
                 $sel = "selected";
             } else {
                 $sel = "";
             }
             echo "<option value='" . $f . "' data-image='" . $_SESSION["glpiroot"] . "/plugins/relation/pics/" . $f . "' " . $sel . ">" . $f . "</option>";
         }
     }
     echo "</select>&nbsp;";
     closedir($dir);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     //Nombre de la clase en GLPI
     echo "<td>" . __('Es visible', 'Es visible') . "</td><td>";
     //Html::autocompletionTextField($this,"name",array('size' => "15"));
     Dropdown::showYesNo('is_visible', $this->fields['is_visible']);
     echo "</td>";
     //Nombre a mostrar en los desplegables para la clase
     echo "<td></td>";
     echo "<td></td>";
     echo "</tr>";
     $this->showFormButtons($options);
     Html::scriptStart();
     echo "\$(document).ready(function(e){\n\t\t\ttry {\n\t\t\t\$('#img').msDropDown();\n\t\t\t} catch(e) {\n\t\t\talert(e.message);\n\t\t\t}\n\t\t\t});";
     echo Html::scriptEnd();
     return true;
 }