コード例 #1
0
 /**
  * Prints search form
  *
  * @param $manufacturer the supplier choice
  * @param $type the device type
  * @return nothing (print out a table)
  *
  */
 static function searchForm($params)
 {
     global $DB, $CFG_GLPI;
     // Default values of parameters
     $p['itemtype'] = '';
     $p['manufacturers_id'] = '';
     $p['imported'] = '';
     foreach ($params as $key => $val) {
         $p[$key] = $val;
     }
     echo "<form name='form' method='post' action='" . $CFG_GLPI["root_doc"] . "/plugins/manufacturersimports/front/import.php'>";
     echo "<div align='center'><table class='tab_cadre_fixe' cellpadding='5'>";
     echo "<tr><th colspan='4'>" . __('Choose inventory type and manufacturer', 'manufacturersimports') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='center'>";
     //Manufacturer choice
     $query = "SELECT `glpi_plugin_manufacturersimports_configs`.*\n                 FROM `glpi_plugin_manufacturersimports_configs` ";
     $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_manufacturersimports_configs`.`entities_id`)" . " WHERE `glpi_plugin_manufacturersimports_configs`.`manufacturers_id` != '0'";
     $query .= "" . getEntitiesRestrictRequest(" AND", "glpi_plugin_manufacturersimports_configs", '', '', true);
     $query .= " ORDER BY `glpi_plugin_manufacturersimports_configs`.`entities_id`, \n                            `glpi_plugin_manufacturersimports_configs`.`name`";
     $iterator = $DB->request($query);
     $number = $iterator->numrows();
     if ($number > 0) {
         self::showAllItems("itemtype", 0, $p['itemtype'], -1, PluginManufacturersimportsConfig::getTypes());
         echo "</td><td>";
         echo "<select name=\"manufacturers_id\">";
         echo "<option value=\"0\">" . Dropdown::EMPTY_VALUE . "</option>";
         foreach ($iterator as $data) {
             echo "<option value='" . $data["id"] . "' " . ($p['manufacturers_id'] == "" . $data["id"] . "" ? " selected " : "") . ">";
             if (Session::isMultiEntitiesMode()) {
                 echo Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . " > ";
             }
             echo $data["name"];
             if (empty($data["name"]) || $_SESSION["glpiis_ids_visible"]) {
                 echo " (";
                 echo $data["id"] . ")";
             }
             echo "</option>";
         }
         echo "</select>";
         echo "</td><td>";
         echo "<select name=\"imported\">";
         echo "<option value='" . self::NOT_IMPORTED . "' " . ($p['imported'] == self::NOT_IMPORTED ? " selected " : "") . ">";
         echo __('Devices not imported', 'manufacturersimports') . "</option>";
         echo "<option value='" . self::IMPORTED . "' " . ($p['imported'] == self::IMPORTED ? " selected " : "") . ">";
         echo __('Devices already imported', 'manufacturersimports') . "</option>";
         echo "</select>";
     } else {
         if (Session::haveRight('config', UPDATE)) {
             //Please configure a supplier
             echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/manufacturersimports/front/config.form.php'>";
             echo __('No manufacturer available. Please configure at least one manufacturer', 'manufacturersimports');
             echo "</a>";
         } else {
             echo __('No manufacturer available. Please configure at least one manufacturer', 'manufacturersimports');
         }
     }
     echo "</td><td>";
     if ($number > 0) {
         echo "<input type=\"submit\" name=\"typechoice\" class=\"submit\" value='" . _sx('button', 'Post') . "' >";
     }
     echo "</td>";
     echo "</tr>";
     echo "</table></div>";
     Html::closeForm();
 }
コード例 #2
0
function plugin_manufacturersimports_MassiveActions($type)
{
    if (in_array($type, PluginManufacturersimportsConfig::getTypes(true))) {
        return array('PluginManufacturersimportsModel' . MassiveAction::CLASS_ACTION_SEPARATOR . "add_model" => __('Add new material brand number', 'manufacturersimports'));
    }
    return array();
}
コード例 #3
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_manufacturersimports_MassiveActionsDisplay($options = array())
{
    if (in_array($options['itemtype'], PluginManufacturersimportsConfig::getTypes(true))) {
        echo "<input type=\"text\" name=\"model_name\">&nbsp;";
        echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . __s('Post') . "' >";
    }
    return "";
}