function run($taskjobstate)
 {
     //get order type label
     $order_type_label = str_replace("deploy", "", $taskjobstate->method);
     //get numeric order type from label
     $order_type = PluginFusioninventoryDeployOrder::getRender($order_type_label);
     //get order by type and package id
     $order = new PluginFusioninventoryDeployOrder($order_type, $taskjobstate->fields['items_id']);
     //decode order data
     $order_data = json_decode($order->fields['json'], TRUE);
     /* TODO:
      * This has to be done properly in each corresponding classes.
      * Meanwhile, I just split the data to rebuild a proper and compliant JSON
      */
     $order_job = $order_data['jobs'];
     //add uniqid to response data
     $order_job['uuid'] = $taskjobstate->fields['uniqid'];
     /* TODO:
      * Orders should only contain job data and associatedFiles should be retrieved from the
      * list inside Orders data like the following :
      *
      * $order_files = array()
      * foreach($order_job["associatedFiles"] as $hash) {
      *    if (!isset($order_files[$hash]) {
      *       $order_files[$hash] = PluginFusioninventoryDeployFile::getByHash($hash);
      *       $order_files[$hash]['mirrors'] = $mirrors
      *    }
      * }
      */
     $order_files = $order_data['associatedFiles'];
     //Add mirrors to associatedFiles
     $mirrors = PluginFusioninventoryDeployMirror::getList($taskjobstate->fields['plugin_fusioninventory_agents_id']);
     foreach ($order_files as $hash => $params) {
         $order_files[$hash]['mirrors'] = $mirrors;
         $manifest = GLPI_PLUGIN_DOC_DIR . "/fusioninventory/files/manifests/" . $hash;
         $order_files[$hash]['multiparts'] = array();
         if (file_exists($manifest)) {
             $handle = fopen($manifest, "r");
             if ($handle) {
                 while (($buffer = fgets($handle)) !== FALSE) {
                     $order_files[$hash]['multiparts'][] = trim($buffer);
                 }
                 fclose($handle);
             }
         }
     }
     //Send an empty json dict instead of empty json list
     if (count($order_files) == 0) {
         $order_files = (object) array();
     }
     $order = array("job" => $order_job, "associatedFiles" => $order_files);
     return $order;
 }
  @co-author
  @copyright Copyright (c) 2010-2014 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     2010

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkLoginUser();
Html::header(__('Mirror servers'), $_SERVER["PHP_SELF"], "plugins", "pluginfusioninventorymenu", "deploymirror");
//PluginFusioninventoryProfile::checkRight("Fusioninventory", "agents", "r");
PluginFusioninventoryMenu::displayMenu("mini");
$mirror = new PluginFusioninventoryDeployMirror();
if (isset($_POST["add"])) {
    // PluginFusioninventoryProfile::checkRight("Fusinvdeloy", "package", "w");
    $newID = $mirror->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        // PluginFusioninventoryProfile::checkRight("Fusinvdeloy", "package", "w");
        $mirror->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            // PluginFusioninventoryProfile::checkRight("Fusinvdeloy", "package", "w");
            $mirror->delete($_POST);
            Html::redirect(Toolbox::getItemTypeFormURL('PluginFusioninventoryDeployMirror'));
        }
  You should have received a copy of the GNU Affero General Public License
  along with FusionInventory. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   FusionInventory
  @author    David Durieux
  @co-author
  @copyright Copyright (c) 2010-2014 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     2013

  ------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownlocation.php")) {
    include "../../../inc/includes.php";
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
Session::checkCentralAccess();
$pfDeployMirror = new PluginFusioninventoryDeployMirror();
if ($_POST['id'] != '') {
    $pfDeployMirror->getFromDB($_POST['id']);
} else {
    $pfDeployMirror->getEmpty();
}
Location::dropdown(array('value' => $pfDeployMirror->fields["locations_id"], 'entity' => $pfDeployMirror->fields["entities_id"], 'entity_sons' => $_POST['is_recursive']));