/** * Dropdown for display hours * * @return type */ static function showHours($name, $options = array()) { $p['value'] = ''; $p['display'] = true; $p['width'] = '80%'; $p['step'] = 5; $p['begin'] = 0; $p['end'] = 24 * 3600; if (is_array($options) && count($options)) { foreach ($options as $key => $val) { $p[$key] = $val; } } if ($p['step'] <= 0) { $p['step'] = 5; } $values = array(); $p['step'] = $p['step'] * 60; // to have in seconds for ($s = $p['begin']; $s < $p['end']; $s += $p['step']) { $values[$s] = PluginFusioninventoryToolbox::getHourMinute($s); } return Dropdown::showFromArray($name, $values, $p); }
/** * TODO: rename this method in showTimeslots() since it's not only used to delete but also to * show the list of Timeslot Entries. -- Kevin 'kiniou' Roy */ function formDeleteEntry($timeslots_id) { $dbentries = getAllDatasFromTable('glpi_plugin_fusioninventory_timeslotentries', "`plugin_fusioninventory_timeslots_id`='" . $timeslots_id . "'", '', '`day`, `begin` ASC'); $options = array(); $this->initForm(key($dbentries), $options); $this->showFormHeader($options); foreach ($dbentries as $dbentry) { echo "<tr class='tab_bg_3'>"; echo "<td>"; $daysofweek = Toolbox::getDaysOfWeekArray(); $daysofweek[7] = $daysofweek[0]; unset($daysofweek[0]); echo $daysofweek[$dbentry['day']]; echo "</td>"; echo "<td>"; echo PluginFusioninventoryToolbox::getHourMinute($dbentry['begin']); echo " - "; echo PluginFusioninventoryToolbox::getHourMinute($dbentry['end']); echo "</td>"; echo "<td colspan='2'>"; echo "<input type='submit' class='submit' name='purge-" . $dbentry['id'] . "' value='delete' />"; echo "</td>"; echo "</tr>"; } $this->showFormButtons(array('canedit' => false)); }