Example #1
0
?>
         </td>
         <td>
            <label for="dropdown_show_empty<?php 
echo $rand;
?>
" id="label_show_empty">
               <?php 
echo __('Show empty', 'formcreator');
?>
            </label>
         </td>
         <td>
            <div id="show_empty">
               <?php 
dropdown::showYesNo('show_empty', $question->fields['show_empty'], -1, array('rand' => $rand));
?>
            </div>
         </td>
      </tr>

      <tr class="line1" id="values_tr">
         <td>
            <label for="dropdown_default_values<?php 
echo $rand;
?>
" id="label_default_values">
               <?php 
echo __('Default values');
?>
<br />
/**
 * Display fields for massive actions
 *
 * @param array $options Massive Actions options
 * @return bool Success
 */
function plugin_customfields_MassiveActionsFieldsDisplay($options = array())
{
    global $DB;
    $type = $options['itemtype'];
    $table = $options['options']['table'];
    $field = $options['options']['field'];
    $linkfield = $options['options']['linkfield'];
    // Get configuration of the custom field
    $query = "SELECT *\n             FROM `glpi_plugin_customfields_fields`\n             WHERE `itemtype` = '{$type}'\n                   AND `system_name` = '{$field}'";
    $result = $DB->query($query);
    if ($data = $DB->fetch_assoc($result)) {
        switch ($data['data_type']) {
            case 'dropdown':
                $dropdown_obj = new PluginCustomfieldsDropdown();
                $tmp = $dropdown_obj->find("system_name = '" . $data['system_name'] . "'");
                $dropdown = array_shift($tmp);
                Dropdown::show('PluginCustomfieldsDropdownsItem', array('condition' => $dropdown['id'] . " = plugin_customfields_dropdowns_id", 'name' => $data['system_name'], 'entity' => $_SESSION['glpiactive_entity']));
                break;
            case 'yesno':
                dropdown::showYesNo($field, 0);
                break;
            case 'date':
                Html::showDateFormItem($field, '', true, true);
                break;
            case 'money':
                echo '<input type="text" size="16" value="' . Html::formatNumber(0, true) . '" name="' . $field . '"/>';
                break;
            default:
                $item = new $type();
                Html::autocompletionTextField($item, $field);
                break;
        }
        return true;
    }
    return false;
}