/**
  * Display each history line
  *
  * @param $taskjobstates_id integer id of the taskjobstate
  *
  * @return nothing
  *
  **/
 function showHistoryLines($taskjobstates_id, $displayprocess = 1, $displaytaskjob = 0, $nb_td = '5')
 {
     global $CFG_GLPI;
     $pfTaskjobstate = new PluginFusioninventoryTaskjobstate();
     $pfAgent = new PluginFusioninventoryAgent();
     $pfTaskjobstate->getFromDB($taskjobstates_id);
     $displayforceend = 0;
     $a_history = $this->find('`plugin_fusioninventory_taskjobstates_id` = "' . $pfTaskjobstate->fields['id'] . '"', 'id DESC', '1');
     echo "<tr class='tab_bg_1'>";
     echo "<td width='40' id='plusmoins" . $pfTaskjobstate->fields["id"] . "'><img src='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics/expand.png' " . "onClick='document.getElementById(\"viewfollowup" . $pfTaskjobstate->fields["id"] . "\").show();close_array(" . $pfTaskjobstate->fields["id"] . ");' /></td>";
     echo "<td>";
     echo $pfTaskjobstate->fields['uniqid'];
     echo "</td>";
     if ($displayprocess == '1') {
         echo "<td>";
         echo $pfTaskjobstate->fields['id'];
         echo "</td>";
     }
     if ($displaytaskjob == '1') {
         $pfTaskjob = new PluginFusioninventoryTaskjob();
         $pfTask = new PluginFusioninventoryTask();
         $pfTaskjob->getFromDB($pfTaskjobstate->fields['plugin_fusioninventory_taskjobs_id']);
         $pfTask->getFromDB($pfTaskjob->fields['plugin_fusioninventory_tasks_id']);
         echo "<td>";
         echo $pfTaskjob->getLink(1) . " (" . $pfTask->getLink() . ")";
         echo "</td>";
     }
     echo "<td>";
     $pfAgent->getFromDB($pfTaskjobstate->fields['plugin_fusioninventory_agents_id']);
     echo $pfAgent->getLink(1);
     Ajax::UpdateItemOnEvent('plusmoins' . $pfTaskjobstate->fields["id"], 'viewfollowup' . $pfTaskjobstate->fields["id"], $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/ajax/showtaskjoblogdetail.php", array('agents_id' => $pfTaskjobstate->fields['plugin_fusioninventory_agents_id'], 'uniqid' => $pfTaskjobstate->fields['uniqid']), array("click"));
     echo "</td>";
     $a_return = $this->displayHistoryDetail(array_pop($a_history), 0);
     $count = $a_return[0];
     $displayforceend += $count;
     echo $a_return[1];
     if ($displayforceend == "0") {
         echo "<td align='center'>";
         echo "<form name='form' method='post' action='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/taskjob.form.php'>";
         echo "<input type='hidden' name='taskjobstates_id' value='" . $pfTaskjobstate->fields['id'] . "' />";
         echo "<input type='hidden' name='taskjobs_id' value='" . $pfTaskjobstate->fields['plugin_fusioninventory_taskjobs_id'] . "' />";
         echo '<input name="forceend" value="' . __('Force the end', 'fusioninventory') . '"
          class="submit" type="submit">';
         Html::closeForm();
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='" . $nb_td . "' style='display: none;' id='viewfollowup" . $pfTaskjobstate->fields["id"] . "' class='tab_bg_4'>";
     echo "</td>";
     echo "</tr>";
 }
 /**
  * Display actions value with preselection of action type
  *
  * @param $myname value name of dropdown
  * @param $actiontype value name of the action type selected
  * @param $method value name of the method selected
  * @param $actiontypeid value dropdown name of action type
  * @param $value value name of the definition (used for edit taskjob)
  * @param $entity_restrict restriction of entity if required
  *
  * @return value rand of the dropdown
  *
  **/
 function dropdownAction($myname, $actiontype, $method, $actiontypeid, $value = 0, $entity_restrict = '')
 {
     global $CFG_GLPI;
     $a_methods = PluginFusioninventoryStaticmisc::getmethods();
     $module = '';
     foreach ($a_methods as $datas) {
         if ($method == $datas['method']) {
             $module = $datas['module'];
         }
     }
     $rand = '';
     $class = PluginFusioninventoryStaticmisc::getStaticMiscClass($module);
     if ($actiontype == "PluginFusioninventoryAgent") {
         $actionselection_method = "task_actionselection_PluginFusioninventoryAgent_" . $method;
         if (is_callable(array($class, $actionselection_method))) {
             $rand = call_user_func(array($class, $actionselection_method));
         } else {
             $a_data = $this->get_agents($method);
             $rand = Dropdown::showFromArray('actionselectiontoadd', $a_data);
         }
     } else {
         $definitionselection_method = "task_definitionselection_" . $actiontype . "_" . $method;
         if (is_callable(array($class, $definitionselection_method))) {
             $rand = call_user_func(array($class, $definitionselection_method));
         }
     }
     $params = array('selection' => '__VALUE__', 'entity_restrict' => $entity_restrict, 'myname' => $myname, 'actionselectadd' => 'dropdown_actionselectiontoadd' . $rand, 'actiontypeid' => $actiontypeid);
     Ajax::UpdateItemOnEvent('addAObject', 'show_ActionListEmpty', $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownactionselection.php", $params, array("click"));
 }