@package   FusionInventory
  @author    David Durieux
  @co-author
  @copyright Copyright (c) 2010-2015 FusionInventory team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      http://www.fusioninventory.org/
  @link      http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
  @since     2014

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight('plugin_fusioninventory_task', READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$pfTimeslotEntry = new PluginFusioninventoryTimeslotEntry();
foreach ($_POST as $key => $value) {
    if (strstr($key, 'purge-')) {
        $split = explode('-', $key);
        $_POST['id'] = $split[1];
        $pfTimeslotEntry->check($_POST['id'], PURGE);
        $pfTimeslotEntry->delete($_POST, 1);
        Html::back();
    }
}
$pfTimeslotEntry = new PluginFusioninventoryTimeslotEntry();
$pfTimeslotEntry->addEntry($_POST);
Html::back();
 /**
  * Display form for agent configuration
  *
  * @param $computers_id integer ID of the agent
  * @param $options array
  *
  * @return bool TRUE if form is ok
  *
  **/
 function showForm($ID, $options = array())
 {
     $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>" . __('Comments') . "</td>";
     echo "<td class='middle'>";
     echo "<textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     $this->showFormButtons($options);
     if ($ID > 0) {
         $pf = new PluginFusioninventoryTimeslotEntry();
         $pf->formEntry($ID);
     }
     return true;
 }
 /**
  * @test
  */
 public function addEntryForTwoDaysYetAdded()
 {
     $pfTimeslotEntry = new PluginFusioninventoryTimeslotEntry();
     $input = array('timeslots_id' => 1, 'beginday' => 2, 'lastday' => 3, 'beginhours' => 60, 'lasthours' => 36015);
     $pfTimeslotEntry->addEntry($input);
     $references = array('3' => array('id' => '3', 'entities_id' => '0', 'plugin_fusioninventory_timeslots_id' => '1', 'is_recursive' => '0', 'day' => '3', 'begin' => '0', 'end' => '86400'), '4' => array('id' => '4', 'entities_id' => '0', 'plugin_fusioninventory_timeslots_id' => '1', 'is_recursive' => '0', 'day' => '1', 'begin' => '0', 'end' => '86400'), '5' => array('id' => '5', 'entities_id' => '0', 'plugin_fusioninventory_timeslots_id' => '1', 'is_recursive' => '0', 'day' => '2', 'begin' => '0', 'end' => '86400'), '6' => array('id' => '6', 'entities_id' => '0', 'plugin_fusioninventory_timeslots_id' => '1', 'is_recursive' => '0', 'day' => '4', 'begin' => '0', 'end' => '36000'));
     $db = getAllDatasFromTable('glpi_plugin_fusioninventory_timeslotentries');
     $this->assertEquals($references, $db, "May have 4 entries " . print_r($db, true));
     $GLPIlog = new GLPIlogs();
     $GLPIlog->testSQLlogs();
     $GLPIlog->testPHPlogs();
 }