showYesNo() static public method

Make a select box for a boolean choice (Yes/No) or display a checkbox. Add a 'use_checkbox' = true to the $params array to display a checkbox instead a select box
static public showYesNo ( $name, $value, $restrict_to, $params = [] ) : rand
$name select name
$value preselected value. (default 0)
$restrict_to allows to display only yes or no in the dropdown (default -1)
$params Array of optional options (passed to showFromArray)
return rand value
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     return;
     $profile = new Profile();
     $found_profiles = $profile->find("`interface` = 'central'");
     $tab_profile = new self();
     $found_tab_profiles = $tab_profile->find("`plugin_custom_tabs_id` = " . $item->getID());
     echo "<form method='POST' action='tabprofile.form.php' />";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __("Visibility") . "</th></tr>";
     $odd = 0;
     foreach ($found_profiles as $profiles_id => $profile_fields) {
         if ($odd % 2 === 0) {
             echo "<tr>";
         }
         echo "<td>" . $profile_fields['name'] . "</td>";
         echo "<td>";
         Dropdown::showYesNo("tab_profile[{$profiles_id}]", 0);
         echo "</td>";
         if ($odd % 2 === 1) {
             echo "</tr>";
         }
         $odd++;
     }
     if ($odd % 2 === 0) {
         echo "</tr>";
     }
     echo "<tr><td colspan='4'><div class='center'>";
     echo "<input type='submit' name='update' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
     echo "</div></td></tr>";
     echo "</table>";
     Html::closeForm();
     return true;
 }
 /**
  * @see Rule::showNewRuleForm()
  **/
 function showNewRuleForm($ID)
 {
     echo "<form method='post' action='" . Toolbox::getItemTypeFormURL('Entity') . "'>";
     echo "<table  class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>" . __('Authorizations assignment rules') . "</th></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     Html::autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
     echo '</td><td>' . __('Description') . "</td><td>";
     Html::autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
     echo "</td><td>" . __('Logical operator') . "</td><td>";
     $this->dropdownRulesMatch();
     echo "</td><td rowspan='2' class='tab_bg_2 center middle'>";
     echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
     echo "<input type=hidden name='entities_id' value='-1'>";
     echo "<input type=hidden name='affectentity' value='{$ID}'>";
     echo "<input type=hidden name='_method' value='AddRule'>";
     echo "<input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>" . _n('Profile', 'Profiles', 1) . "</td><td>";
     Profile::dropdown();
     echo "</td><td><span class='small_space'>" . __('Recursive') . "</span></td><td colspan='3'>";
     Dropdown::showYesNo("is_recursive", 0);
     echo "</td></tr>\n";
     echo "</table>";
     Html::closeForm();
 }
Example #3
0
 function showForm($ID, $options = array())
 {
     global $DB;
     $target = $this->getFormURL();
     if (isset($options['target'])) {
         $target = $options['target'];
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         $this->check(-1, 'w');
         $this->getEmpty();
     }
     $canedit = $this->can($ID, 'w');
     echo "<form action='" . $target . "' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2' class='center b'>" . sprintf(__('%1$s - %2$s'), __('Print to pdf', 'pdf'), $this->fields["profile"]);
     echo "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Print to pdf', 'pdf') . "</td><td>";
     Dropdown::showYesNo("use", isset($this->fields["use"]) ? $this->fields["use"] : '');
     echo "</td></tr>\n";
     if ($canedit) {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2' class='center'>";
         echo "<input type='hidden' name='id' value={$ID}>";
         echo "<input type='submit' name='update_user_profile' value='" . _sx('button', 'Update') . "' class='submit'>&nbsp;";
         echo "</td></tr>\n";
     }
     echo "</table>";
     Html::closeForm();
 }
Example #4
0
function plugin_barcode_MassiveActionsDisplay($options = array())
{
    switch ($options['itemtype']) {
        case 'Computer':
        case 'Monitor':
        case 'Networking':
        case 'Printer':
        case 'Peripheral':
            switch ($options['action']) {
                case "plugin_barcode_barcode":
                    $barcode = new PluginBarcodeBarcode();
                    $barcode->showFormMassiveAction();
                    break;
                case "plugin_barcode_qrcode":
                    $pbQRcode = new PluginBarcodeQRcode();
                    $pbQRcode->showFormMassiveAction();
                    break;
            }
            break;
        case 'Profile':
            switch ($options['action']) {
                case "plugin_barcode_allow":
                    Dropdown::showYesNo('generate');
                    Dropdown::showYesNo('config');
                    echo "<input type='submit' name='massiveaction' class='submit' value='" . __('Save') . "'>";
                    break;
            }
            break;
    }
    return "";
}
Example #5
0
 function showconfigForm()
 {
     global $CFG_GLPI;
     echo "<form name='form' method='post' action='" . $CFG_GLPI["root_doc"] . "/plugins/immobilizationsheets/front/config.form.php'>";
     echo "<div align=\"center\">";
     echo "<table class=\"tab_cadre_fixe\"  cellspacing=\"2\" cellpadding=\"2\">";
     echo "<tr><th colspan=\"2\">" . __('Options', 'immobilizationsheets') . "</th></tr>";
     echo "<tr class='tab_bg_1 top'>";
     echo "<td>" . __('Save sheets in GLPI', 'immobilizationsheets') . ": </td>";
     echo "<td>";
     Dropdown::showYesNo("use_backup", $this->fields["use_backup"]);
     echo "</td>";
     echo "<tr class='tab_bg_1 top'><td>";
     echo __('Default Heading for sheets', 'immobilizationsheets') . ": </td>";
     echo "<td>";
     Dropdown::show('DocumentCategory', array('name' => "documentcategories_id", 'value' => $this->fields["documentcategories_id"]));
     echo "</td>";
     echo "<tr><th colspan='2'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<input type=\"submit\" name=\"update_config\" class=\"submit\" value=\"" . __s('Post') . "\" >";
     echo "</th></tr>";
     echo "</table></div>";
     Html::closeForm();
     echo "<br>";
 }
Example #6
0
 /**
  * Configuration form
  **/
 function showForm($id, $options = array())
 {
     $target = $this->getFormURL();
     if (isset($options['target'])) {
         $target = $options['target'];
     }
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $canedit = Session::haveRight("profile", "w");
     $prof = new Profile();
     if ($id) {
         $this->getFromDB($id);
         $prof->getFromDB($id);
     }
     echo "<form action='" . $target . "' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2' class='center b'>" . sprintf(_('%1$s %2$s'), 'gestion Vip :', Dropdown::getDropdownName("glpi_groups", $this->fields["id"]));
     echo "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>Groupe Vip</td><td>";
     Dropdown::showYesNo("isvip", $this->fields["isvip"]);
     echo "</td></tr>";
     if ($canedit) {
         echo "<tr class='tab_bg_2'>";
         echo "<td class='center' colspan='2'>";
         echo "<input type='hidden' name='id' value={$id}>";
         echo "<input type='submit' name='update_vip_group' value='Mettre à jour' class='submit'>";
         echo "</td></tr>";
     }
     echo "</table>";
     Html::closeForm();
 }
 function showForm($id, $options = array())
 {
     if (!$this->can($id, READ)) {
         return false;
     }
     $this->showFormHeader($options);
     echo "<tr>";
     echo "<td><label>" . __('Name') . " :</label></td>";
     echo "<td style='width:30%'>";
     echo Html::autocompletionTextField($this, "name");
     echo "</td>";
     $rand = mt_rand();
     echo "<td><label for='dropdown_is_active{$rand}'>" . __('Active') . " :</label></td>";
     echo "<td style='width:30%'>";
     Dropdown::showYesNo('is_active', $this->fields['is_active'], -1, array('rand' => $rand));
     echo "</td></tr>";
     $rand = mt_rand();
     echo "<tr>";
     echo "<td><label for='dropdown_itilcategories_id{$rand}'>" . __('Category') . " :</label></td>";
     echo "<td>";
     Dropdown::show('ITILCategory', array('value' => $this->fields['itilcategories_id'], 'rand' => $rand));
     echo "</td><td colspan='2'></td></tr>";
     $rand = mt_rand();
     echo "<tr>";
     echo "<td><label for='dropdown_is_incident{$rand}'>" . __('Visible for an incident') . " :</label></td>";
     echo "<td>";
     Dropdown::showYesNo('is_incident', $this->fields['is_incident'], -1, array('rand' => $rand));
     echo "</td>";
     $rand = mt_rand();
     echo "<td><label for='dropdown_is_request{$rand}'>" . __('Visible for a request') . " :</label></td>";
     echo "<td>";
     Dropdown::showYesNo('is_request', $this->fields['is_request'], -1, array('rand' => $rand));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td><label for='comment'>" . __('Comments') . " : </label></td>";
     echo "<td align='left'>";
     echo "<textarea name='comment' id='comment' style='width:100%; height:70px;'>";
     echo $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr><td colspan='4'><hr></td></tr>";
     echo "<tr><td><label for='groups_id_level1[]'>" . ucfirst(__('Level 1', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(1, $this->fields['itilcategories_id'], $this->fields['view_all_lvl1']);
     echo "</td>";
     echo "<td><label for='groups_id_level2[]'>" . ucfirst(__('Level 2', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(2, $this->fields['itilcategories_id'], $this->fields['view_all_lvl2']);
     echo "</td></tr>";
     echo "<tr><td><label for='groups_id_level3[]'>" . ucfirst(__('Level 3', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(3, $this->fields['itilcategories_id'], $this->fields['view_all_lvl3']);
     echo "</td>";
     echo "<td><label for='groups_id_level4[]'>" . ucfirst(__('Level 4', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(4, $this->fields['itilcategories_id'], $this->fields['view_all_lvl4']);
     echo "</td></tr>";
     $this->showFormButtons($options);
     Html::closeForm();
 }
Example #8
0
    function showForm($ID, $options = array())
    {
        global $LANG;
        $target = $this->getFormURL();
        if (isset($options['target'])) {
            $target = $options['target'];
        }
        if (!Session::haveRight("profile", "r")) {
            return false;
        }
        $profil = new Profile();
        if ($ID) {
            $this->getFromDB($ID);
            $profil->getFromDB($ID);
        }
        ?>
		<form action='<?php 
        echo $target;
        ?>
' method='post'>
			<table class='tab_cadre_fixe'>
				<tr>
					<th colspan='2' class='center b'><?php 
        echo $LANG['plugin_ticketmail']['profile'][0] . " " . $profil->fields["name"];
        ?>
</th>
				</tr>
				<tr class='tab_bg_2'>
					<td><?php 
        echo $LANG['plugin_ticketmail']['profile'][1];
        ?>
:</td>
					<td>
						<?php 
        Dropdown::showYesNo("show_ticketmail_onglet", $this->fields["show_ticketmail_onglet"]);
        ?>
					</td>
				</tr>
				<tr class='tab_bg_1'>
					<td class='center' colspan='2'>
						<input type='hidden' name='id' value= '<?php 
        echo $ID;
        ?>
'>
						<input type='submit' name='update_user_profile' value='<?php 
        echo __s('Update');
        ?>
' class='submit'>
					</td>
				</tr>
			</table>

		<?php 
        Html::closeForm();
    }
function plugin_talk_MassiveActionsDisplay($options = array())
{
    switch ($options['itemtype']) {
        case 'Profile':
            switch ($options['action']) {
                case "plugin_talk_edit_profile":
                    echo _sx('button', 'Enable') . " : ";
                    Dropdown::showYesNo("is_active", 1);
                    echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . __s('Post') . "'>";
                    break;
            }
            break;
    }
    return "";
}
Example #10
0
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Name');
     echo "&nbsp;:</td>";
     echo "<td>";
     echo '<input type="text" name="name" value="' . $this->fields["name"] . '" size="54"/>';
     echo "</td>";
     echo "</td><td>";
     echo __('Active');
     echo "&nbsp;:</td><td>";
     Dropdown::showYesNo("is_active", $this->fields["is_active"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Description');
     echo "&nbsp;:</td>";
     echo "<td>";
     echo "<textarea name='content' cols='55' rows='6'>";
     echo $this->fields["content"];
     echo "</textarea>";
     echo "</td></td>";
     echo "<td>";
     echo __('Select Language');
     echo "</td><td>";
     if ($this->fields["language"]) {
         Dropdown::showLanguages("language", array('value' => $this->fields["language"]));
     } else {
         Dropdown::showLanguages("language", array('value' => $_SESSION['glpilanguage']));
     }
     echo "</td></tr>";
     echo '<tr><td>' . $LANG['plugin_formcreator']["cat"][3] . '</td><td>';
     PluginFormcreatorCat::getSelectCat($ID, $this->fields["cat"]);
     echo '</td></tr>';
     $this->showFormButtons($options);
     $this->addDivForTabs();
 }
Example #11
0
 function showForm()
 {
     $this->getFromDB('1');
     $system = $this->fields["used_system"];
     echo "<div class='center'>";
     echo "<form method='post' action='" . $this->getFormURL() . "'>";
     echo "<table class='tab_cadre_fixe' cellpadding='5'>";
     echo "<tr><th colspan='4'>" . __('System for ping', 'addressing') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td colspan='4'><div class='center'><select name='used_system'>";
     echo "<option value='0' " . ($system == 0 ? " selected " : "") . ">" . __('Linux ping', 'addressing') . "</option>";
     echo "<option value='2' " . ($system == 2 ? " selected " : "") . ">" . __('Linux fping', 'addressing') . "</option>";
     echo "<option value='1' " . ($system == 1 ? " selected " : "") . ">" . __('Windows', 'addressing') . "</option>";
     echo "<option value='3' " . ($system == 3 ? " selected " : "") . ">" . __('BSD ping', 'addressing') . "</option>";
     echo "<option value='4' " . ($system == 4 ? " selected " : "") . ">" . __('MacOSX ping', 'addressing') . "</option>";
     echo "</select>";
     echo "</div></td></tr>";
     echo "<tr><th colspan='4'>" . __('Display', 'addressing') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Assigned IP', 'addressing') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("alloted_ip", $this->fields["alloted_ip"]);
     echo "</td>";
     echo "<td>" . __('Free IP', 'addressing') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("free_ip", $this->fields["free_ip"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Same IP', 'addressing') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("double_ip", $this->fields["double_ip"]);
     echo "</td>";
     echo "<td>" . __('Reserved IP', 'addressing') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("reserved_ip", $this->fields["reserved_ip"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Use Ping', 'addressing') . "</td>";
     echo "<td colspan='2'>";
     Dropdown::showYesNo("use_ping", $this->fields["use_ping"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr><th colspan='4'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<div class='center'>" . "<input type='submit' name='update' value='" . _sx('button', 'Post') . "' class='submit'>" . "</div></th></tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
 function showForm()
 {
     echo "<form method='POST' action=\"" . $this->getFormURL() . "\">";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>";
     _e('Flags');
     echo "</th></tr>";
     echo "<tr class='tab_bg_1 top'><td>" . __('Input time on groups / users when ticket is waiting', 'timelineticket') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("add_waiting", $this->fields["add_waiting"]);
     echo "</td></tr>";
     echo "<tr><th colspan='2'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<input type=\"submit\" name=\"update\" class=\"submit\"\n         value=\"" . _sx('button', 'Save') . "\" ></th></tr>";
     echo "</table>";
     Html::closeForm();
 }
Example #13
0
 function showForm()
 {
     $this->getfromDB(1);
     $target = self::getFormURL();
     echo "<div align='center'><form method='post'  action=\"{$target}\">";
     echo "<table class='tab_cadre' cellpadding='5'><tr ><th colspan='2'>";
     echo self::getTypeName(0) . "</th></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Configuration of units', 'racks') . "</td><td>";
     echo "<select name=\"unit\" size=\"1\"> ";
     echo "<option ";
     if ($this->isMetricUnit()) {
         echo "selected ";
     }
     echo "value='" . self::METRIC_UNIT . "'>" . __('metric', 'racks') . "</option>";
     echo "<option ";
     if (!$this->isMetricUnit()) {
         echo "selected ";
     }
     echo "value='" . self::NON_METRIC_UNIT . "'>" . __('English', 'racks') . "</option>";
     echo "</select> ";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __("Copy rack's location when adding a new asset in the rack", "racks");
     echo "</td>";
     echo "<td style='width: 150px;'>";
     Dropdown::showYesNo('add_location_on_new_item', $this->fields['add_location_on_new_item']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __("Forward rack's location to linked assets on change", "racks");
     echo "</td>";
     echo "<td style='width: 150px;'>";
     Dropdown::showYesNo('forward_location_on_change', $this->fields['forward_location_on_change']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' align='center'>";
     echo Html::hidden('id', array('value' => 1));
     echo Html::submit(_sx('button', 'Post'), array('name' => 'update'));
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
 /**
  * Print the config form for display
  *
  */
 function showFormDisplay()
 {
     $options = self::getConfigValues(array('group_by_users'));
     echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<div class='center' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('FP Software config') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td width='30%'> " . __('Calculate licenses number per user instead of per computer') . "</td><td  width='20%'>";
     Dropdown::showYesNo('group_by_users', $options['group_by_users']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
     echo "</td></tr>";
     echo "</table></div>";
     Html::closeForm();
 }
Example #15
0
function plugin_pdf_MassiveActionsDisplay($options = array())
{
    global $PLUGIN_HOOKS;
    switch ($options['itemtype']) {
        case 'Profile':
            switch ($options['action']) {
                case "plugin_pdf_allow":
                    Dropdown::showYesNo('use');
                    echo "<input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Post') . "'>";
                    break;
            }
            break;
        default:
            if (isset($PLUGIN_HOOKS['plugin_pdf'][$options['itemtype']]) && $options['action'] == 'plugin_pdf_DoIt') {
                echo "<input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Post') . "'>";
            }
    }
    return "";
}
Example #16
0
 static function showForm()
 {
     global $CFG_GLPI;
     $config = new self();
     $config->getFromDB(1);
     echo "<div class='center'>";
     echo "<form method='post' action='" . Toolbox::getItemTypeFormURL('PluginPositionsConfig') . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th colspan='2'>" . __('General setup') . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Add sub-places on the map objects', 'positions');
     echo "</td>";
     echo "<td>";
     Dropdown::showYesNo('use_view_all_object', $config->fields['use_view_all_object']);
     echo "</td></tr>";
     echo "<tr><th colspan='2'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<div align='center'>";
     echo "<input type='submit' name='update_config' value=\"" . _x('button', 'Post') . "\" class='submit' >";
     echo "</div></th></tr>";
     echo "</table></div>";
     Html::closeForm();
     echo "<div class='center'><table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     _e('Setup');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>";
     echo "<a href='./imageitem.form.php'>" . __('Association : picture / types of equipment', 'positions') . "</a>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>";
     echo "<a href='./info.php'>" . __('Configuring the display materials', 'positions') . "</a>";
     echo "</td>";
     echo "</tr>";
     echo "</table></div>";
 }
Example #17
0
 function showFormUserPreference($target, $id)
 {
     $data = plugin_version_treeview();
     $this->getFromDB($id);
     echo "<form action='" . $target . "' method='post'>";
     echo "<table class='tab_cadre_fixe' cellpadding='5'>";
     echo "<tr><th colspan='2'>" . sprintf(__('%1$s - %2$s'), $data['name'], $data['version']);
     echo "</th></tr>";
     echo "<tr class='tab_bg_1 center'>";
     echo "<td>" . __('Launch the plugin Treeview with GLPI launching', 'treeview') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("show_on_load", $this->fields["show_on_load"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1 center'><td colspan='2'>";
     echo "<input type='submit' name='plugin_treeview_user_preferences_save' value='" . _sx('button', 'Post') . "' class='submit'>";
     echo "<input type='hidden' name='id' value='{$id}'></td></tr>";
     echo "<tr class='tab_bg_1 center'>";
     echo "<td colspan='2'>" . __('Warning: If there are more than one plugin which be loaded at startup, then only the first will be used', 'treeview');
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
 }
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if (in_array(get_class($item), array("AuthLDAP"))) {
         $AuthLDAP = new PluginMoreldapAuthLDAP();
         if (!$AuthLDAP->getFromDB($item->fields['id'])) {
             //The directory exists in GLPI but there is no data in the plugin
             $AuthLDAP->preconfig();
         }
         $location_enabled = $AuthLDAP->fields['location_enabled'] == 'Y' ? ' checked' : '';
         echo '<div class="spaced">';
         echo '<form id="items" name="items" method="post" action="' . Toolbox::getItemTypeFormURL(__CLASS__) . '">';
         echo '<table class="tab_cadre_fixehov">';
         echo '<tr class="tab_bg_2">';
         echo '<th colspan="2">' . __("MoreLDAP", "moreldap") . '</th>';
         echo '</tr>';
         echo '<tr class="tab_bg_1">';
         echo '<td>' . __("LDAP attribute : location of users", "moreldap") . '</td>';
         echo '<td>' . __("Enabled", "moreldap") . '&nbsp;<input type="checkbox" name="location_enabled"' . $location_enabled . ' value="location_enabled"><br />';
         echo '<input size="72" type="text" name="location" value="' . $AuthLDAP->fields['location'] . '"> ';
         echo '<br />';
         Entity::dropdown(array('value' => $AuthLDAP->fields['entities_id']));
         echo '&nbsp;' . __("recursive", "moreldap") . "&nbsp;";
         Dropdown::showYesNo('is_recursive', $AuthLDAP->fields['is_recursive']);
         echo ' </td>';
         echo '</tr>';
         echo '<tr class="tab_bg_1">';
         echo '<td colspan="2" class="center">';
         echo '<input type="hidden" value="' . $item->fields['id'] . '" name="id">';
         echo '<input type="submit" class="submit" name="update" value="' . _sx('button', 'Save') . '">';
         echo '</td>';
         echo '</tr>';
         echo '</table>';
         Html::closeForm();
         echo "</div>";
     }
     return true;
 }
Example #19
0
 function showFormExample()
 {
     global $CFG_GLPI;
     if (!Session::haveRight("config", UPDATE)) {
         return false;
     }
     $my_config = Config::getConfigurationValues('plugin:Example');
     echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL('Config') . "\" method='post'>";
     echo "<div class='center' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('Example setup') . "</th></tr>";
     echo "<td >" . __('My boolean choice :') . "</td>";
     echo "<td colspan='3'>";
     echo "<input type='hidden' name='config_class' value='" . __CLASS__ . "'>";
     echo "<input type='hidden' name='config_context' value='plugin:Example'>";
     Dropdown::showYesNo("configuration", $my_config['configuration']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
     echo "</td></tr>";
     echo "</table></div>";
     Html::closeForm();
 }
Example #20
0
 /**
  * @see CommonDBTM::showSpecificMassiveActionsParameters()
  **/
 function showSpecificMassiveActionsParameters($input = array())
 {
     global $CFG_GLPI;
     switch ($input['action']) {
         case "change_authtype":
             $rand = Auth::dropdown(array('name' => 'authtype'));
             $paramsmassaction = array('authtype' => '__VALUE__');
             Ajax::updateItemOnSelectEvent("dropdown_authtype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAuthMethods.php", $paramsmassaction);
             echo "<span id='show_massiveaction_field'><br><br>";
             echo "<input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Post') . "'>";
             echo "</span>\n";
             return true;
         case "add_user_group":
             $gu = new Group_User();
             return $gu->showSpecificMassiveActionsParameters($input);
         case "add_userprofile":
             Entity::dropdown(array('entity' => $_SESSION['glpiactiveentities']));
             echo ".&nbsp;" . _n('Profile', 'Profiles', 1) . "&nbsp;";
             Profile::dropdownUnder();
             echo ".&nbsp;" . __('Recursive') . "&nbsp;";
             Dropdown::showYesNo("is_recursive", 0);
             echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
             return true;
         default:
             return parent::showSpecificMassiveActionsParameters($input);
     }
     return false;
 }
Example #21
0
    include '../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
Session::checkLoginUser();
if (isset($_POST['type']) && !empty($_POST['type']) && isset($_POST['items_id']) && $_POST['items_id'] > 0) {
    $prefix = '';
    $suffix = '';
    if (isset($_POST['prefix']) && !empty($_POST['prefix'])) {
        $prefix = $_POST['prefix'] . '[';
        $suffix = ']';
    }
    switch ($_POST['type']) {
        case 'Group':
        case 'Profile':
            $params = array('value' => $_SESSION['glpiactive_entity'], 'name' => $prefix . 'entities_id' . $suffix);
            if (Session::isViewAllEntities()) {
                $params['toadd'] = array(-1 => __('No restriction'));
            }
            echo "<table class='tab_format'><tr><td>";
            _e('Entity');
            echo "</td><td>";
            Entity::dropdown($params);
            echo "</td><td>";
            _e('Child entities');
            echo "</td><td>";
            Dropdown::showYesNo($prefix . 'is_recursive' . $suffix);
            echo "</td></tr></table>";
            break;
    }
}
Example #22
0
 /**
  * Print the link form
  *
  * @param $ID      integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td height='23'>" . __('Valid tags') . "</td>";
     echo "<td colspan='3'>[LOGIN], [ID], [NAME], [LOCATION], [LOCATIONID], [IP], [MAC], [NETWORK],\n                            [DOMAIN], [SERIAL], [OTHERSERIAL], [USER], [GROUP], [REALNAME],\n                            [FIRSTNAME]</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Link or filename') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "link", array('size' => 84));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Open in a new window') . "</td><td>";
     Dropdown::showYesNo('open_window', $this->fields['open_window']);
     echo "</td><td colspan='2'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('File content') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea name='data' rows='10' cols='96'>" . $this->fields["data"] . "</textarea>";
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Example #23
0
 /**
  * Display changes for an item
  *
  * Will also display changes of linked items
  *
  * @param $item CommonDBTM object
  *
  * @return nothing (display a table)
  **/
 static function showListForItem(CommonDBTM $item)
 {
     global $DB, $CFG_GLPI;
     if (!Session::haveRight(self::$rightname, self::READALL)) {
         return false;
     }
     if ($item->isNewID($item->getID())) {
         return false;
     }
     $restrict = '';
     $order = '';
     $options['reset'] = 'reset';
     switch ($item->getType()) {
         case 'User':
             $restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')";
             $order = '`glpi_changes`.`date_mod` DESC';
             $options['criteria'][0]['field'] = 4;
             // status
             $options['criteria'][0]['searchtype'] = 'equals';
             $options['criteria'][0]['value'] = $item->getID();
             $options['criteria'][0]['link'] = 'OR';
             $options['criteria'][1]['field'] = 66;
             // status
             $options['criteria'][1]['searchtype'] = 'equals';
             $options['criteria'][1]['value'] = $item->getID();
             $options['criteria'][1]['link'] = 'OR';
             $options['criteria'][5]['field'] = 5;
             // status
             $options['criteria'][5]['searchtype'] = 'equals';
             $options['criteria'][5]['value'] = $item->getID();
             $options['criteria'][5]['link'] = 'OR';
             break;
         case 'Supplier':
             $restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')";
             $order = '`glpi_changes`.`date_mod` DESC';
             $options['criteria'][0]['field'] = 6;
             $options['criteria'][0]['searchtype'] = 'equals';
             $options['criteria'][0]['value'] = $item->getID();
             $options['criteria'][0]['link'] = 'AND';
             break;
         case 'Group':
             // Mini search engine
             if ($item->haveChildren()) {
                 $tree = Session::getSavedOption(__CLASS__, 'tree', 0);
                 echo "<table class='tab_cadre_fixe'>";
                 echo "<tr class='tab_bg_1'><th>" . __('Last changes') . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 _e('Child groups');
                 Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
             } else {
                 $tree = 0;
             }
             echo "</td></tr></table>";
             if ($tree) {
                 $restrict = "IN (" . implode(',', getSonsOf('glpi_groups', $item->getID())) . ")";
             } else {
                 $restrict = "='" . $item->getID() . "'";
             }
             $restrict = "(`glpi_changes_groups`.`groups_id` {$restrict}\n                            AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_changes`.`date_mod` DESC';
             $options['criteria'][0]['field'] = 71;
             $options['criteria'][0]['searchtype'] = $tree ? 'under' : 'equals';
             $options['criteria'][0]['value'] = $item->getID();
             $options['criteria'][0]['link'] = 'AND';
             break;
         default:
             $restrict = "(`items_id` = '" . $item->getID() . "'\n                            AND `itemtype` = '" . $item->getType() . "')";
             $order = '`glpi_changes`.`date_mod` DESC';
             break;
     }
     $query = "SELECT " . self::getCommonSelect() . "\n                FROM `glpi_changes`\n                LEFT JOIN `glpi_changes_items`\n                  ON (`glpi_changes`.`id` = `glpi_changes_items`.`changes_id`) " . self::getCommonLeftJoin() . "\n                WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_changes") . "\n                ORDER BY {$order}\n                LIMIT " . intval($_SESSION['glpilist_limit']);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     // Ticket for the item
     echo "<div class='firstbloc'><table class='tab_cadre_fixe'>";
     $colspan = 11;
     if (count($_SESSION["glpiactiveentities"]) > 1) {
         $colspan++;
     }
     if ($number > 0) {
         Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         echo "<tr><th colspan='{$colspan}'>";
         //TRANS : %d is the number of problems
         echo sprintf(_n('Last %d change', 'Last %d changes', $number), $number);
         //             echo "<span class='small_space'><a href='".$CFG_GLPI["root_doc"]."/front/ticket.php?".
         //                    Toolbox::append_params($options,'&amp;')."'>".__('Show all')."</a></span>";
         echo "</th></tr>";
     } else {
         echo "<tr><th>" . __('No change found.') . "</th></tr>";
     }
     // Ticket list
     if ($number > 0) {
         self::commonListHeader(Search::HTML_OUTPUT);
         while ($data = $DB->fetch_assoc($result)) {
             Session::addToNavigateListItems('Problem', $data["id"]);
             self::showShort($data["id"]);
         }
         self::commonListHeader(Search::HTML_OUTPUT);
     }
     echo "</table></div>";
     // Tickets for linked items
     $linkeditems = $item->getLinkedItems();
     $restrict = array();
     if (count($linkeditems)) {
         foreach ($linkeditems as $ltype => $tab) {
             foreach ($tab as $lID) {
                 $restrict[] = "(`itemtype` = '{$ltype}' AND `items_id` = '{$lID}')";
             }
         }
     }
     if (count($restrict)) {
         $query = "SELECT " . self::getCommonSelect() . "\n                   FROM `glpi_changes`\n                   LEFT JOIN `glpi_changes_items`\n                        ON (`glpi_changes`.`id` = `glpi_changes_items`.`changes_id`) " . self::getCommonLeftJoin() . "\n                   WHERE " . implode(' OR ', $restrict) . getEntitiesRestrictRequest(' AND ', 'glpi_changes') . "\n                   ORDER BY `glpi_changes`.`date_mod` DESC\n                   LIMIT " . intval($_SESSION['glpilist_limit']);
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         echo "<div class='spaced'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='{$colspan}'>";
         _e('Changes on linked items');
         echo "</th></tr>";
         if ($number > 0) {
             self::commonListHeader(Search::HTML_OUTPUT);
             while ($data = $DB->fetch_assoc($result)) {
                 // Session::addToNavigateListItems(TRACKING_TYPE,$data["id"]);
                 self::showShort($data["id"]);
             }
             self::commonListHeader(Search::HTML_OUTPUT);
         } else {
             echo "<tr><th>" . __('No change found.') . "</th></tr>";
         }
         echo "</table></div>";
     }
     // Subquery for linked item
 }
 /**
  * Print the phone form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_phone`='1'"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     PhoneType::dropdown(array('value' => $this->fields["phonetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     PhoneModel::dropdown(array('value' => $this->fields["phonemodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td><td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Management type') . "</td>";
     echo "<td>";
     Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["phones_management_restrict"], 'target' => $target));
     echo "</td></tr>\n";
     // Display auto inventory informations
     $rowspan = 7;
     $inventory_show = false;
     if (!empty($ID) && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 2;
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}'>\n            <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' class='form-control' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Brand') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "brand");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Power supply') . "</td>";
     echo "<td>";
     PhonePowerSupply::dropdown(array('value' => $this->fields["phonepowersupplies_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "firmware");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number of lines') . "</td><td>";
     Html::autocompletionTextField($this, "number_line");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Flags') . "</td>";
     echo "<td>";
     // micro?
     echo "\n<table><tr><td>" . __('Headset') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_headset", $this->fields["have_headset"]);
     echo "</td></tr>";
     // hp?
     echo "<tr><td>" . __('Speaker') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_hp", $this->fields["have_hp"]);
     echo "</td></tr></table>\n";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>";
         echo "<td rowspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
 /** form for Followup
  *
  *@param $ID      integer : Id of the followup
  *@param $options array of possible options:
  *     - ticket Object : the ticket
  **/
 function showForm($ID, $options = array())
 {
     global $DB, $CFG_GLPI;
     if (isset($options['parent']) && !empty($options['parent'])) {
         $ticket = $options['parent'];
     }
     if ($ID > 0) {
         $this->check($ID, READ);
     } else {
         // Create item
         $options['tickets_id'] = $ticket->getField('id');
         $this->check(-1, CREATE, $options);
     }
     $tech = Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
     $reopen_case = false;
     if ($this->isNewID($ID) && in_array($ticket->fields["status"], $ticket->getClosedStatusArray()) && $ticket->isAllowedStatus($ticket->fields['status'], Ticket::INCOMING)) {
         $reopen_case = true;
         echo "<div class='center b'>" . __('If you want to reopen the ticket, you must specify a reason') . "</div>";
     }
     if ($tech) {
         $this->showFormHeader($options);
         echo "<tr class='tab_bg_1'>";
         echo "<td rowspan='3' class='middle right'>" . __('Description') . "</td>";
         echo "<td class='center middle' rowspan='3'>";
         echo "<textarea name='content' cols='70' rows='6' class='form-control'>" . $this->fields["content"] . "</textarea>";
         if ($this->fields["date"]) {
             echo "</td><td>" . __('Date') . "</td>";
             echo "<td>" . Html::convDateTime($this->fields["date"]);
         } else {
             echo "</td><td colspan='2'>&nbsp;";
         }
         echo "<input type='hidden' name='tickets_id' value='" . $this->fields["tickets_id"] . "'>";
         // Reopen case
         if ($reopen_case) {
             echo "<input type='hidden' name='add_reopen' value='1'>";
         }
         echo "</td></tr>\n";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Source of followup') . "</td><td>";
         RequestType::dropdown(array('value' => $this->fields["requesttypes_id"]));
         echo "</td></tr>\n";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Private') . "</td><td>";
         Dropdown::showYesNo('is_private', $this->fields["is_private"]);
         echo "</td></tr>";
         $this->showFormButtons($options);
     } else {
         $options['colspan'] = 1;
         $this->showFormHeader($options);
         echo "<tr class='tab_bg_1'>";
         echo "<td class='middle right'>" . __('Description') . "</td>";
         echo "<td class='center middle'>";
         echo "<textarea name='content' cols='80' rows='6' class='form-control'>" . $this->fields["content"] . "</textarea>";
         echo "<input type='hidden' name='tickets_id' value='" . $this->fields["tickets_id"] . "'>";
         echo "<input type='hidden' name='requesttypes_id' value='" . RequestType::getDefault('helpdesk') . "'>";
         // Reopen case
         if ($reopen_case) {
             echo "<input type='hidden' name='add_reopen' value='1'>";
         }
         echo "</td></tr>\n";
         $this->showFormButtons($options);
     }
     return true;
 }
Example #26
0
    $INSELECT .= "</optgroup>";
}
echo "<div class='center'><form method='get' name='form' action='stat.tracking.php'>";
echo "<table class='tab_cadre'>";
echo "<tr class='tab_bg_2'><td rowspan='2' class='center'>";
echo "<select name='type'>" . $INSELECT . "</select></td>";
echo "<td class='right'>" . $LANG['search'][8] . "&nbsp;:</td><td>";
showDateFormItem("date1", $_REQUEST["date1"]);
echo "</td>";
echo "<td class='right'>" . $LANG['stats'][7] . "&nbsp;:</td>";
echo "<td rowspan='2' class='center'>";
echo "<input type='submit' class='button' name='submit' value=\"" . $LANG['buttons'][7] . "\"></td></tr>";
echo "<tr class='tab_bg_2'><td class='right'>" . $LANG['search'][9] . "&nbsp;:</td><td>";
showDateFormItem("date2", $_REQUEST["date2"]);
echo "</td><td class='center'>";
Dropdown::showYesNo('showgraph', $_REQUEST['showgraph']);
echo "</td></tr>";
echo "</table></form></div>";
$val = Stat::getItems($_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST["type"]);
$params = array('type' => $_REQUEST["type"], 'date1' => $_REQUEST["date1"], 'date2' => $_REQUEST["date2"], 'start' => $_REQUEST["start"]);
printPager($_REQUEST['start'], count($val), $CFG_GLPI['root_doc'] . '/front/stat.tracking.php', "date1=" . $_REQUEST["date1"] . "&amp;date2=" . $_REQUEST["date2"] . "&amp;type=" . $_REQUEST["type"] . "&amp;showgraph=" . $_REQUEST["showgraph"], 'Stat', $params);
if (!$_REQUEST['showgraph']) {
    Stat::show($_REQUEST["type"], $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val);
} else {
    $data = Stat::getDatas($_REQUEST["type"], $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val);
    if (isset($data['opened']) && is_array($data['opened'])) {
        foreach ($data['opened'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][5] => $cleandata), array('title' => $LANG['stats'][5], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
 /**
  * Form to add a solution to an ITIL object
  *
  * @param $knowbase_id_toload integer  load a kb article as solution (0 = no load by default)
  *                                     (default 0)
  **/
 function showSolutionForm($knowbase_id_toload = 0)
 {
     global $CFG_GLPI;
     $this->check($this->getField('id'), READ);
     $canedit = $this->canSolve();
     $options = array();
     if ($knowbase_id_toload > 0) {
         $kb = new KnowbaseItem();
         if ($kb->getFromDB($knowbase_id_toload)) {
             $this->fields['solution'] = $kb->getField('answer');
         }
     }
     // Alert if validation waiting
     $validationtype = $this->getType() . 'Validation';
     if (method_exists($validationtype, 'alertValidation')) {
         $validationtype::alertValidation($this, 'solution');
     }
     $this->showFormHeader($options);
     $show_template = $canedit;
     //                        && $this->getField('solutiontypes_id') == 0
     //                        && empty($this->fields['solution']);
     $rand_template = mt_rand();
     $rand_text = $rand_type = 0;
     if ($canedit) {
         $rand_text = mt_rand();
         $rand_type = mt_rand();
     }
     if ($show_template) {
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . _n('Solution template', 'Solution templates', 1) . "</td><td>";
         SolutionTemplate::dropdown(array('value' => 0, 'entity' => $this->getEntityID(), 'rand' => $rand_template, 'toupdate' => array('value_fieldname' => 'value', 'to_update' => 'solution' . $rand_text, 'url' => $CFG_GLPI["root_doc"] . "/ajax/solution.php", 'moreparams' => array('type_id' => 'dropdown_solutiontypes_id' . $rand_type))));
         echo "</td><td colspan='2'>";
         if (Session::haveRightsOr('knowbase', array(READ, KnowbaseItem::READFAQ))) {
             echo "<a class='vsubmit' title=\"" . __s('Search a solution') . "\"\n                   href='" . $CFG_GLPI['root_doc'] . "/front/knowbaseitem.php?item_itemtype=" . $this->getType() . "&amp;item_items_id=" . $this->getField('id') . "&amp;forcetab=Knowbase\$1'>" . __('Search a solution') . "</a>";
         }
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Solution type') . "</td><td>";
     $current = $this->fields['status'];
     // Settings a solution will set status to solved
     if ($canedit) {
         SolutionType::dropdown(array('value' => $this->getField('solutiontypes_id'), 'rand' => $rand_type, 'entity' => $this->getEntityID()));
     } else {
         echo Dropdown::getDropdownName('glpi_solutiontypes', $this->getField('solutiontypes_id'));
     }
     echo "</td><td colspan='2'>&nbsp;</td></tr>";
     if ($canedit && Session::haveRight('knowbase', UPDATE)) {
         echo "<tr class='tab_bg_2'><td>" . __('Save and add to the knowledge base') . "</td><td>";
         Dropdown::showYesNo('_sol_to_kb', false);
         echo "</td><td colspan='2'>&nbsp;</td></tr>";
     }
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Description') . "</td><td colspan='3'>";
     if ($canedit) {
         $rand = mt_rand();
         Html::initEditorSystem("solution{$rand}");
         echo "<div id='solution{$rand_text}'>";
         echo "<textarea id='solution{$rand}' name='solution' rows='12' cols='80' class='form-control'>" . $this->getField('solution') . "</textarea></div>";
     } else {
         echo Toolbox::unclean_cross_side_scripting_deep($this->getField('solution'));
     }
     echo "</td></tr>";
     $options['candel'] = false;
     $options['canedit'] = $canedit;
     $this->showFormButtons($options);
 }
Example #28
0
 function showForm($ID, $options = array())
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     //      $target = $this->getFormURL();
     //      if (isset($options['target'])) {
     //        $target = $options['target'];
     //      }
     $prof = new Profile();
     if ($ID) {
         $this->getFromDBByProfile($ID);
         $prof->getFromDB($ID);
     }
     $this->showFormHeader($options);
     //      echo "<form action='".$target."' method='post'>";
     //      echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'addressing'), $prof->fields["name"]) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Generate reports', 'addressing') . "</td><td>";
     Profile::dropdownNoneReadWrite("addressing", $this->fields["addressing"], 1, 1, 1);
     echo "</td>";
     echo "<td>" . __('Use ping on equipment form', 'addressing') . "</td><td>";
     Dropdown::showYesNo("use_ping_in_equipment", $this->fields["use_ping_in_equipment"]);
     echo "</td>";
     echo "</tr>";
     echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
     $options['candel'] = false;
     $this->showFormButtons($options);
 }
            }
            $options = array('name' => '_itil_' . $_POST["actortype"] . '[users_id]', 'entity' => $_POST['entity_restrict'], 'right' => $right, 'ldap_import' => TRUE);
            $withemail = FALSE;
            if ($CFG_GLPI["use_mailing"]) {
                $withemail = isset($_POST["allow_email"]) ? $_POST["allow_email"] : FALSE;
                $paramscomment = array('value' => '__VALUE__', 'allow_email' => $withemail, 'field' => "_itil_" . $_POST["actortype"]);
                // Fix rand value
                $options['rand'] = $rand;
                $options['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "notif_user_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment);
            }
            $rand = User::dropdown($options);
            if ($CFG_GLPI["use_mailing"] == 1) {
                echo "<br><span id='notif_user_{$rand}'>";
                if ($withemail) {
                    echo __('Email followup') . '&nbsp;:&nbsp;';
                    $rand = Dropdown::showYesNo('_itil_' . $_POST["actortype"] . '[use_notification]', 1);
                    echo '<br>' . __('Email') . '&nbsp;:&nbsp;';
                    echo "<input type='text' size='25' name='_itil_" . $_POST["actortype"] . "[alternative_email]'>";
                }
                echo "</span>";
            }
            break;
        case "group":
            $cond = $_POST["actortype"] == 'assign' ? $cond = '`is_assign`' : ($cond = '`is_requester`');
            Dropdown::show('Group', array('name' => '_itil_' . $_POST["actortype"] . '[groups_id]', 'entity' => $_POST['entity_restrict'], 'condition' => $cond));
            break;
        case "supplier":
            Dropdown::show('Supplier', array('name' => 'suppliers_id_assign', 'entity' => $_POST['entity_restrict']));
            break;
    }
}
Example #30
0
 function showForm($ID, $options = array())
 {
     if (!$this->canView()) {
         return false;
     }
     $plugin_resources_resources_id = -1;
     if (isset($options['plugin_resources_resources_id'])) {
         $plugin_resources_resources_id = $options['plugin_resources_resources_id'];
     }
     $item = new PluginResourcesResource();
     if ($item->getFromDB($plugin_resources_resources_id)) {
         $entities_id = $item->fields["entities_id"];
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
         $plugin_resources_resources_id = $this->fields["plugin_resources_resources_id"];
     } else {
         // Create item
         $input = array('plugin_resources_resources_id' => $plugin_resources_resources_id, 'entities_id' => $entities_id);
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<input type='hidden' name='plugin_resources_resources_id' value='{$plugin_resources_resources_id}'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . PluginResourcesResource::getTypeName(2) . "&nbsp;</td><td>";
     $user = PluginResourcesResource::getResourceName($plugin_resources_resources_id, 2);
     $out = "<a href='" . $user['link'] . "'>";
     $out .= $user["name"];
     if ($_SESSION["glpiis_ids_visible"]) {
         $out .= " (" . $plugin_resources_resources_id . ")";
     }
     $out .= "</a>";
     echo $out;
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name", array('size' => "50"));
     echo "</td>";
     echo "<td>" . PluginResourcesTaskType::getTypeName(1) . "</td><td>";
     Dropdown::show('PluginResourcesTaskType', array('value' => $this->fields["plugin_resources_tasktypes_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician') . "</td><td>";
     User::dropdown(array('name' => "users_id", 'value' => $this->fields["users_id"], 'right' => 'interface'));
     echo "</td>";
     echo "<td>" . __('Planning') . "</td>";
     echo "<td>";
     $plan = new PluginResourcesTaskPlanning();
     $plan->showFormForTask($plugin_resources_resources_id, $this);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Dropdown::show('Group', array('value' => $this->fields["groups_id"]));
     echo "</td>";
     echo "<td>" . __('Carried out task', 'resources') . "</td><td>";
     Dropdown::showYesNo("is_finished", $this->fields["is_finished"]);
     echo "</td>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Effective duration', 'resources') . "</td><td>";
     $toadd = array();
     for ($i = 9; $i <= 100; $i++) {
         $toadd[] = $i * HOUR_TIMESTAMP;
     }
     Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
     echo "</td><td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4'>" . __('Comments') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td colspan='4'>";
     echo "<textarea cols='130' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "<input type='hidden' name='withtemplate' value=\"" . $options['withtemplate'] . "\" >";
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }