Print a select named $name with hours options and selected value $value
static public showHours ( $name, $options = [] ) : Nothing | ||
$name | string HTML select name | |
$options | array of options : - value default value (default '') - limit_planning limit planning to the configuration range (default false) - display boolean if false get string - width specific width needed (default auto adaptive) - step step time (defaut config GLPI) | |
return | Nothing | (display) |
function displayCriteria() { $this->getReport()->startColumn(); printf(__('Start at %s'), __('Number pending', 'reports')); echo " "; $this->getReport()->endColumn(); $this->getReport()->startColumn(); Dropdown::showHours("starttime", $this->getParameter('starttime')); $this->getReport()->endColumn(); $this->getReport()->startColumn(); printf(__('End at %s'), __('Number pending', 'reports')); echo " "; $this->getReport()->endColumn(); $this->getReport()->startColumn(); Dropdown::showHours("endtime", $this->getParameter('endtime')); $this->getReport()->endColumn(); }
/** * Show segments of a calendar * * @param $calendar Calendar object **/ static function showForCalendar(Calendar $calendar) { global $DB, $CFG_GLPI; $ID = $calendar->getField('id'); if (!$calendar->can($ID, READ)) { return false; } $canedit = $calendar->can($ID, UPDATE); $rand = mt_rand(); $query = "SELECT *\n FROM `glpi_calendarsegments`\n WHERE `calendars_id` = '{$ID}'\n ORDER BY `day`, `begin`, `end`"; $result = $DB->query($query); $numrows = $DB->numrows($result); if ($canedit) { echo "<div class='firstbloc'>"; echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n action='"; echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><th colspan='7'>" . __('Add a schedule') . "</tr>"; echo "<tr class='tab_bg_2'><td class='center'>" . __('Day') . "</td><td>"; echo "<input type='hidden' name='calendars_id' value='{$ID}'>"; Dropdown::showFromArray('day', Toolbox::getDaysOfWeekArray()); echo "</td><td class='center'>" . __('Start') . '</td><td>'; Dropdown::showHours("begin", array('value' => date('H') . ":00")); echo "</td><td class='center'>" . __('End') . '</td><td>'; Dropdown::showHours("end", array('value' => date('H') + 1 . ":00")); echo "</td><td class='center'>"; echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($canedit && $numrows) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand); Html::showMassiveActions($massiveactionparams); } echo "<table class='tab_cadre_fixehov'>"; echo "<tr>"; if ($canedit && $numrows) { echo "<th width='10'>"; Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand); echo "</th>"; } echo "<th>" . __('Day') . "</th>"; echo "<th>" . __('Start') . "</th>"; echo "<th>" . __('End') . "</th>"; echo "</tr>"; $daysofweek = Toolbox::getDaysOfWeekArray(); if ($numrows) { while ($data = $DB->fetch_assoc($result)) { echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td>"; Html::showMassiveActionCheckBox(__CLASS__, $data["id"]); echo "</td>"; } echo "<td>"; echo $daysofweek[$data['day']]; echo "</td>"; echo "<td>" . $data["begin"] . "</td>"; echo "<td>" . $data["end"] . "</td>"; } echo "</tr>"; } echo "</table>"; if ($canedit && $numrows) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } echo "</div>"; }
/** * Print the config form for connections * * @return Nothing (display) **/ function showFormHelpdesk() { global $DB, $CFG_GLPI; if (!self::canView()) { return false; } $canedit = Config::canUpdate(); if ($canedit) { echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>"; } echo "<div class='center spaced' id='tabsbody'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>" . __('Assistance') . "</th></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td width='30%'>" . __('Step for the hours (minutes)') . "</td>"; echo "<td width='20%'>"; Dropdown::showNumber('time_step', array('value' => $CFG_GLPI["time_step"], 'min' => 30, 'max' => 60, 'step' => 30, 'toadd' => array(1 => 1, 5 => 5, 10 => 10, 15 => 15, 20 => 20))); echo "</td>"; echo "<td width='30%'>" . __('Limit of the schedules for planning') . "</td>"; echo "<td width='20%'>"; Dropdown::showHours('planning_begin', array('value' => $CFG_GLPI["planning_begin"])); echo " -> "; Dropdown::showHours('planning_end', array('value' => $CFG_GLPI["planning_end"])); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Default file size limit imported by the mails receiver') . "</td><td>"; MailCollector::showMaxFilesize('default_mailcollector_filesize_max', $CFG_GLPI["default_mailcollector_filesize_max"]); echo "</td>"; echo "<td>" . __('Use rich text for helpdesk') . "</td><td>"; $id = 'alert' . mt_rand(); $param['on_change'] = '$("#' . $id . '").html(""); if ($(this).val() == 0) { $("#' . $id . '").html("<br>' . __('You will lose the formatting of your data') . '"); }'; Dropdown::showYesNo("use_rich_text", $CFG_GLPI["use_rich_text"], -1, $param); echo "<span class='red' id='" . $id . "'></span>"; echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Default heading when adding a document to a ticket') . "</td><td>"; DocumentCategory::dropdown(array('value' => $CFG_GLPI["documentcategories_id_forticket"], 'name' => "documentcategories_id_forticket")); echo "</td>"; echo "<td>" . __('By default, a software may be linked to a ticket') . "</td><td>"; Dropdown::showYesNo("default_software_helpdesk_visible", $CFG_GLPI["default_software_helpdesk_visible"]); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Keep tickets when purging hardware in the inventory') . "</td><td>"; Dropdown::showYesNo("keep_tickets_on_delete", $CFG_GLPI["keep_tickets_on_delete"]); echo "</td><td>" . __('Show personnal information in new ticket form (simplified interface)'); echo "</td><td>"; Dropdown::showYesNo('use_check_pref', $CFG_GLPI['use_check_pref']); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Allow anonymous ticket creation (helpdesk.receiver)') . "</td><td>"; Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]); echo "</td><td>" . __('Allow anonymous followups (receiver)') . "</td><td>"; Dropdown::showYesNo("use_anonymous_followups", $CFG_GLPI["use_anonymous_followups"]); echo "</td></tr>"; echo "</table>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='7'>" . __('Matrix of calculus for priority'); echo "<input type='hidden' name='_matrix' value='1'></th></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td class='b right' colspan='2'>" . __('Impact') . "</td>"; for ($impact = 5; $impact >= 1; $impact--) { echo "<td class='center'>" . Ticket::getImpactName($impact) . '<br>'; if ($impact == 3) { $isimpact[3] = 1; echo "<input type='hidden' name='_impact_3' value='1'>"; } else { $isimpact[$impact] = ($CFG_GLPI['impact_mask'] & 1 << $impact) > 0; Dropdown::showYesNo("_impact_{$impact}", $isimpact[$impact]); } echo "</td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td class='b' colspan='2'>" . __('Urgency') . "</td>"; for ($impact = 5; $impact >= 1; $impact--) { echo "<td> </td>"; } echo "</tr>"; for ($urgency = 5; $urgency >= 1; $urgency--) { echo "<tr class='tab_bg_1'>"; echo "<td>" . Ticket::getUrgencyName($urgency) . " </td>"; echo "<td>"; if ($urgency == 3) { $isurgency[3] = 1; echo "<input type='hidden' name='_urgency_3' value='1'>"; } else { $isurgency[$urgency] = ($CFG_GLPI['urgency_mask'] & 1 << $urgency) > 0; Dropdown::showYesNo("_urgency_{$urgency}", $isurgency[$urgency]); } echo "</td>"; for ($impact = 5; $impact >= 1; $impact--) { $pri = round(($urgency + $impact) / 2); if (isset($CFG_GLPI['priority_matrix'][$urgency][$impact])) { $pri = $CFG_GLPI['priority_matrix'][$urgency][$impact]; } if ($isurgency[$urgency] && $isimpact[$impact]) { $bgcolor = $_SESSION["glpipriority_{$pri}"]; echo "<td class='center' bgcolor='{$bgcolor}'>"; Ticket::dropdownPriority(array('value' => $pri, 'name' => "_matrix_{$urgency}_{$impact}")); echo "</td>"; } else { echo "<td><input type='hidden' name='_matrix_{$urgency}_{$impact}' value='{$pri}'>\n </td>"; } } echo "</tr>\n"; } if ($canedit) { echo "<tr class='tab_bg_2'>"; echo "<td colspan='7' class='center'>"; echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">"; echo "</td></tr>"; } echo "</table></div>"; Html::closeForm(); }
/** * Print the contract 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()) { $this->initForm($ID, $options); $can_edit = $this->can($ID, 'w'); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td><td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . __('Contract type') . "</td><td >"; ContractType::dropdown(array('value' => $this->fields["contracttypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('phone', 'Number') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "num"); echo "</td>"; echo "<td colspan='2'></td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Start date') . "</td>"; echo "<td>"; Html::showDateFormItem("begin_date", $this->fields["begin_date"]); echo "</td>"; echo "<td>" . __('Initial contract period') . "</td><td>"; Dropdown::showInteger("duration", $this->fields["duration"], 1, 120, 1, array(0 => Dropdown::EMPTY_VALUE), array('unit' => 'month')); if (!empty($this->fields["begin_date"])) { echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], 0, true); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notice') . "</td><td>"; Dropdown::showInteger("notice", $this->fields["notice"], 0, 120, 1, array(), array('unit' => 'month')); if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) { echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"], true); } echo "</td>"; echo "<td>" . __('Account number') . "</td><td>"; Html::autocompletionTextField($this, "accounting_number"); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Contract renewal period') . "</td><td>"; Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month')); echo "</td>"; echo "<td>" . __('Invoice period') . "</td>"; echo "<td>"; Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month')); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __('Renewal') . "</td><td>"; self::dropdownContractRenewal("renewal", $this->fields["renewal"]); echo "</td>"; echo "<td>" . __('Max number of items') . "</td><td>"; Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => __('Unlimited'))); echo "</td>"; echo "</tr>"; if (Entity::getUsedConfig("use_contracts_alert", $this->fields["entities_id"])) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Email alarms') . "</td>"; echo "<td>"; self::dropdownAlert(array('name' => "alert", 'value' => $this->fields["alert"])); Alert::displayLastAlert(__CLASS__, $ID); echo "</td>"; echo "<td colspan='2'> </td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'><td class='top'>" . __('Comments') . "</td>"; echo "<td class='center' colspan='3'>"; echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_2'><td>" . __('Support hours') . "</td>"; echo "<td colspan='3'> </td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('on week') . "</td>"; echo "<td colspan='3'>" . __('Start') . " "; Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('on Saturday') . "</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]); echo "<span class='small_space'>" . __('Start') . "</span> "; Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Sundays and holidays') . "</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_monday", $this->fields["use_monday"]); echo "<span class='small_space'>" . __('Start') . "</span> "; Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** * Print the config form for connections * * @return Nothing (display) **/ function showFormHelpdesk() { global $DB, $LANG, $CFG_GLPI; if (!haveRight("config", "w")) { return false; } echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>"; echo "<div class='center' id='tabsbody'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>" . $LANG['title'][24] . "</th></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['setup'][612] . " :</td><td>"; Dropdown::showYesNo("is_ticket_category_mandatory", $CFG_GLPI["is_ticket_category_mandatory"]); echo "</td><td>" . $LANG['setup'][148] . " :</td><td>"; Dropdown::showInteger('time_step', $CFG_GLPI["time_step"], 30, 60, 30, array(5 => 5, 10 => 10, 15 => 15, 20 => 20)); echo " " . $LANG['job'][22]; echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['setup'][610] . " :</td><td>"; Dropdown::showYesNo("is_ticket_title_mandatory", $CFG_GLPI["is_ticket_title_mandatory"]); echo "</td><td>" . $LANG['setup'][223] . " :</td><td>"; Dropdown::showHours('planning_begin', $CFG_GLPI["planning_begin"]); echo " -> "; Dropdown::showHours('planning_end', $CFG_GLPI["planning_end"]); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td> " . $LANG['setup'][611] . " :</td><td>"; Dropdown::showYesNo("is_ticket_content_mandatory", $CFG_GLPI["is_ticket_content_mandatory"]); echo "</td><td>" . $LANG['mailgate'][7] . " (" . $LANG['setup'][46] . ") :</td><td>"; MailCollector::showMaxFilesize('default_mailcollector_filesize_max', $CFG_GLPI["default_mailcollector_filesize_max"]); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td> " . $LANG['setup'][52] . " :</td><td>"; $autoassign = array(NO_AUTO_ASSIGN => $LANG['choice'][0], AUTO_ASSIGN_HARDWARE_CATEGORY => $LANG['setup'][51], AUTO_ASSIGN_CATEGORY_HARDWARE => $LANG['setup'][50]); Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $CFG_GLPI["auto_assign_mode"])); echo "</td><td>" . $LANG['setup'][409] . " :</td><td>"; Dropdown::show('DocumentCategory', array('value' => $CFG_GLPI["documentcategories_id_forticket"], 'name' => "documentcategories_id_forticket")); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['entity'][18] . " :</td><td>"; Dropdown::showInteger('autoclose_delay', $CFG_GLPI['autoclose_delay'], 0, 99, 1, array(-10 => $LANG['setup'][307])); echo " " . $LANG['stats'][31] . "</td>"; echo "<td>" . $LANG['setup'][608] . " :</td><td>"; Dropdown::showYesNo("default_software_helpdesk_visible", $CFG_GLPI["default_software_helpdesk_visible"]); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['tracking'][37] . " :</td><td>"; Dropdown::showYesNo("keep_tickets_on_delete", $CFG_GLPI["keep_tickets_on_delete"]); echo "</td><td>" . $LANG['setup'][219] . " :</td><td>"; Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]); echo "</td></tr>"; echo "</table><br>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='7'>" . $LANG['help'][1]; echo "<input type='hidden' name='_matrix' value='1'></th></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td class='b right' colspan='2'>" . $LANG['joblist'][30] . " :</td>"; for ($impact = 5, $msg = 47; $impact >= 1; $impact--, $msg++) { echo "<td>" . $LANG['help'][$msg] . " : "; if ($impact == 3) { $isimpact[3] = 1; echo "<input type='hidden' name='_impact_3' value='1'>"; } else { $isimpact[$impact] = ($CFG_GLPI['impact_mask'] & 1 << $impact) > 0; Dropdown::showYesNo("_impact_{$impact}", $isimpact[$impact]); } echo "</td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td class='b' colspan='2'>" . $LANG['joblist'][29] . " :</td>"; for ($impact = 5, $msg = 47; $impact >= 1; $impact--, $msg++) { echo "<td> </td>"; } echo "</tr>"; for ($urgency = 5, $msg = 42; $urgency >= 1; $urgency--, $msg++) { echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['help'][$msg] . " :</td>"; echo "<td>"; if ($urgency == 3) { $isurgency[3] = 1; echo "<input type='hidden' name='_urgency_3' value='1'>"; } else { $isurgency[$urgency] = ($CFG_GLPI['urgency_mask'] & 1 << $urgency) > 0; Dropdown::showYesNo("_urgency_{$urgency}", $isurgency[$urgency]); } echo "</td>"; for ($impact = 5; $impact >= 1; $impact--) { $pri = round(($urgency + $impact) / 2); if (isset($CFG_GLPI['priority_matrix'][$urgency][$impact])) { $pri = $CFG_GLPI['priority_matrix'][$urgency][$impact]; } if ($isurgency[$urgency] && $isimpact[$impact]) { $bgcolor = $_SESSION["glpipriority_{$pri}"]; echo "<td bgcolor='{$bgcolor}'>"; Ticket::dropdownPriority("_matrix_{$urgency}_{$impact}", $pri); echo "</td>"; } else { echo "<td><input type='hidden' name='_matrix_{$urgency}_{$impact}' value='{$pri}'></td>"; } } echo "</tr>\n"; } echo "<tr class='tab_bg_2'>"; echo "<td colspan='7' class='center'>"; echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>"; echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\">"; echo "</td></tr>"; echo "</table></div>"; echo "</form>"; }
/** * Show segments of a calendar * * @param $calendar Calendar object **/ static function showForCalendar(Calendar $calendar) { global $DB, $CFG_GLPI, $LANG; $ID = $calendar->getField('id'); if (!$calendar->can($ID, 'r')) { return false; } $canedit = $calendar->can($ID, 'w'); $rand = mt_rand(); echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n action='"; echo getItemTypeFormURL(__CLASS__) . "'>"; if ($canedit) { echo "<div class='spaced'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['calendar'][6] . "</tr>"; echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['calendar'][7] . " : "; echo "<input type='hidden' name='entities_id' value='" . $calendar->fields['entities_id'] . "'>"; echo "<input type='hidden' name='is_recursive' value='" . $calendar->fields['is_recursive'] . "'>"; echo "<input type='hidden' name='calendars_id' value='{$ID}'>"; Dropdown::showFromArray('day', $LANG['calendarDay']); echo "</td><td class='center'>" . $LANG['buttons'][33] . " : "; Dropdown::showHours("begin", date('H') . ":00"); echo "</td><td class='center'>" . $LANG['buttons'][32] . " : "; Dropdown::showHours("end", date('H') + 1 . ":00"); echo "</td><td class='center'>"; echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>"; echo "</td></tr>"; echo "</table></div>"; } echo "<div class='center'><table class='tab_cadre_fixehov'>"; echo "<tr><th colspan='2'>" . $LANG['calendar'][7] . "</th>"; echo "<th>" . $LANG['buttons'][33] . "</th>"; echo "<th>" . $LANG['buttons'][32] . "</th>"; echo "</tr>"; $query = "SELECT *\n FROM `glpi_calendarsegments`\n WHERE `calendars_id` = '{$ID}'\n ORDER BY `day`, `begin`, `end`"; $result = $DB->query($query); if ($DB->numrows($result) > 0) { while ($data = $DB->fetch_array($result)) { echo "<tr class='tab_bg_1'>"; echo "<td width='10'>"; if ($canedit) { echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>"; } else { echo " "; } echo "</td>"; echo "<td>"; echo $LANG['calendarDay'][$data['day']]; echo "</td>"; echo "<td>" . $data["begin"] . "</td>"; echo "<td>" . $data["end"] . "</td>"; } echo "</tr>"; } echo "</table></div>"; if ($canedit) { openArrowMassive("calendarsegment_form{$rand}", true); closeArrowMassive('delete', $LANG['buttons'][6]); } echo "</form>"; }
/** * Print the contract 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 $LANG; // Show Contract or blank form if (!haveRight("contract", "r")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); } $can_edit = $this->can($ID, 'w'); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . " :</td><td>"; autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . $LANG['financial'][6] . " :</td><td >"; Dropdown::show('ContractType', array('value' => $this->fields["contracttypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][4] . " :</td>"; echo "<td>"; autocompletionTextField($this, "num"); echo "</td>"; echo "<td colspan='2'></td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][5] . " :</td><td>"; echo "<input type='text' name='cost' value='" . formatNumber($this->fields["cost"], true) . "' size='14'></td>"; echo "<td>" . $LANG['search'][8] . " :</td>"; echo "<td>"; showDateFormItem("begin_date", $this->fields["begin_date"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][8] . " :</td><td>"; Dropdown::showInteger("duration", $this->fields["duration"], 0, 120); echo " " . $LANG['financial'][57]; if (!empty($this->fields["begin_date"])) { echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"]); } echo "</td>"; echo "<td>" . $LANG['financial'][13] . " :</td><td>"; autocompletionTextField($this, "accounting_number"); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][69] . " :</td><td>"; Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6")); echo " " . $LANG['financial'][57]; echo "</td>"; echo "<td>" . $LANG['financial'][10] . " :</td><td>"; Dropdown::showInteger("notice", $this->fields["notice"], 0, 120); echo " " . $LANG['financial'][57]; if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) { echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"]); } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][107] . " :</td><td>"; self::dropdownContractRenewal("renewal", $this->fields["renewal"]); echo "</td>"; echo "<td>" . $LANG['financial'][11] . " :</td>"; echo "<td>"; Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6")); echo " " . $LANG['financial'][57]; echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][83] . " :</td><td>"; Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => $LANG['software'][4])); echo "</td>"; echo "<td>" . $LANG['common'][41] . "</td>"; echo "<td>"; self::dropdownAlert("alert", $this->fields["alert"]); Alert::displayLastAlert('Contract', $ID); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td class='top'>" . $LANG['common'][25] . " :</td>"; echo "<td class='center' colspan='3'>"; echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_2'><td>" . $LANG['financial'][59] . " :</td>"; echo "<td colspan='3'> </td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][60] . " :</td>"; echo "<td colspan='3'>" . $LANG['buttons'][33] . " : "; Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]); echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span> : "; Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][61] . " :</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]); echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span> : "; Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]); echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span> : "; Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][62] . " :</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_monday", $this->fields["use_monday"]); echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span> : "; Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]); echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span> : "; Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }