Exemplo n.º 1
0
along with Projet. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
if (!isset($_GET["plugin_projet_projets_id"])) {
    $_GET["plugin_projet_projets_id"] = 0;
}
$task = new PluginProjetTask();
$task_item = new PluginProjetTask_Item();
$task_task = new PluginProjetTask_Task();
//add tasks
if (isset($_POST['add'])) {
    $task->check(-1, 'w', $_POST);
    $newID = $task->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $task->check($_POST['id'], 'w');
        $task->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $task->check($_POST['id'], 'w');
            $task->delete($_POST);
            Html::redirect(Toolbox::getItemTypeFormURL('PluginProjetProjet') . "?id=" . $_POST["plugin_projet_projets_id"]);
Exemplo n.º 2
0
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!$this->canView()) {
         return false;
     }
     $plugin_projet_projets_id = -1;
     if (isset($options['plugin_projet_projets_id'])) {
         $plugin_projet_projets_id = $options['plugin_projet_projets_id'];
     }
     $item = new PluginProjetProjet();
     if ($item->getFromDB($plugin_projet_projets_id)) {
         $entities_id = $item->fields["entities_id"];
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
         $plugin_projet_projets_id = $this->fields["plugin_projet_projets_id"];
     } else {
         // Create item
         $input = array('plugin_projet_projets_id' => $plugin_projet_projets_id, 'entities_id' => $entities_id);
         $this->check(-1, 'w', $input);
     }
     $options["colspan"] = 4;
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<input type='hidden' name='plugin_projet_projets_id' value='{$plugin_projet_projets_id}'>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='2'>" . PluginProjetProjet::getTypeName(2) . "</td><td colspan='2'>";
     $link = NOT_AVAILABLE;
     if ($item->getFromDB($plugin_projet_projets_id)) {
         $link = $item->getLink();
     }
     echo $link;
     echo "</td>";
     echo "<td>";
     echo __('Parent task', 'projet') . "</td><td>";
     PluginProjetTask_Task::displayLinkedProjetTasksTo($ID);
     if ($this->canCreate()) {
         $rand_linked_projettask = mt_rand();
         echo "&nbsp;";
         if (!PluginProjetTask_Task::getParentProjetTasksTo($ID)) {
             echo "<img onClick=\"Ext.get('linkedprojettask{$rand_linked_projettask}').setDisplayed('block')\"\n                       title=\"" . __('Add') . "\" alt=\"" . __('Add') . "\"\n                       class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         }
         echo "<div style='display:none' id='linkedprojettask{$rand_linked_projettask}'>";
         PluginProjetTask_Task::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
         echo "&nbsp;";
         PluginProjetTask_Task::dropdownParent("_link[plugin_projet_tasks_id_2]", isset($values["_link"]) ? $values["_link"]['plugin_projet_tasks_id_2'] : '', array('id' => $this->fields["id"], 'entities_id' => $this->fields["entities_id"], 'plugin_projet_projets_id' => $plugin_projet_projets_id));
         echo "<input type='hidden' name='_link[plugin_projet_tasks_id_1]' value='{$ID}'>\n";
         echo "&nbsp;";
         echo "</div>";
         if (isset($values["_link"]) && !empty($values["_link"]['plugin_projet_tasks_id_2'])) {
             echo "<script language='javascript'>Ext.get('linkedprojettask{$rand_linked_projettask}').\n                   setDisplayed('block');</script>";
         }
     }
     echo "</td>";
     echo "<td>";
     echo __('Dependent', 'projet') . "</td><td>";
     Dropdown::showYesNo("depends", $this->fields["depends"]);
     echo "&nbsp;";
     echo " <img alt='' src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' onmouseout=\"cleanhide('commentsup')\" onmouseover=\"cleandisplay('commentsup')\">";
     echo "<span class='over_link' id='commentsup'>" . nl2br(__('Depends on the tasks children', 'projet')) . "</span>";
     echo "</td>";
     echo "</tr>";
     $width_left = $width_right = "50%";
     $cols = 60;
     $rows = 4;
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     echo __('Name') . "</td><td  colspan='2'>";
     Html::autocompletionTextField($this, "name", array('size' => "30"));
     echo "<td >";
     echo _n('Type', 'Types', 1) . "</td><td>";
     Dropdown::show('PluginProjetTaskType', array('value' => $this->fields["plugin_projet_tasktypes_id"]));
     echo "</td>";
     echo "<td>";
     echo __('State') . "</td><td>";
     if ($ID > 0) {
         $this->dropdownState("plugin_projet_taskstates_id", $this->fields["plugin_projet_taskstates_id"], array('depends' => $this->fields["depends"], 'id' => $this->fields["id"], 'plugin_projet_projets_id' => $plugin_projet_projets_id));
     } else {
         Dropdown::show('PluginProjetTaskState', array('value' => $this->fields["plugin_projet_taskstates_id"]));
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     echo _n('Location', 'Locations', 1) . "</td><td  colspan='2'>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"]));
     echo "</td>";
     echo "<td>";
     echo __('Priority') . "</td><td>";
     Ticket::dropdownPriority(array('value' => $this->fields["priority"], 'withmajor' => true));
     echo "</td>";
     echo "<td>" . __('Progress') . "</td><td>";
     $advance = floor($this->fields["advance"]);
     echo "<select name='advance'>";
     if (empty($ID) || $this->fields["depends"] == 0) {
         for ($i = 0; $i < 101; $i += 5) {
             echo "<option value='{$i}' ";
             if ($advance == $i) {
                 echo "selected";
             }
             echo " >{$i}</option>";
         }
     } else {
         if ($this->fields["depends"] != 0) {
             for ($i = 0; $i < 100; $i += 5) {
                 echo "<option value='{$i}' ";
                 if ($advance == $i) {
                     echo "selected";
                 }
                 echo " >{$i}</option>";
             }
         }
     }
     echo "</select> %";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     echo "<td colspan='4'>" . __('Assigned to') . "</td>";
     echo "<td colspan='4'>" . __('Planification', 'projet') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>" . _n('User', 'Users', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "users_id", array(), $this->fields["users_id"], 'User');
     echo "</td></tr>";
     echo "<tr><td>" . _n('Group', 'Groups', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "groups_id", array(), $this->fields["groups_id"], 'Group');
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>" . _n('Supplier', 'Suppliers', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "contacts_id", array(), $this->fields["contacts_id"], 'Supplier');
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "<td colspan='4' width='{$width_right}' valign='top'>";
     echo "<table width='100%'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Effective duration', 'projet') . "</td><td>";
     $toadd = array();
     for ($i = 9; $i <= 100; $i++) {
         $toadd[] = $i * HOUR_TIMESTAMP;
     }
     Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planning') . "</td>";
     echo "<td>";
     $plan = new PluginProjetTaskPlanning();
     $plan->showFormForTask($plugin_projet_projets_id, $this);
     echo "</td></tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     $colspan = '8';
     if (!empty($ID)) {
         $colspan = '4';
     }
     echo "<td colspan='" . $colspan . "'>" . __('Description') . "</td>";
     if (!empty($ID)) {
         echo "<td colspan='4'>" . __('Results') . "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='" . $colspan . "' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='comment' cols='{$cols}' rows='{$rows}'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "</table>";
     if (!empty($ID)) {
         echo "</td>";
         echo "<td colspan='4' width='{$width_left}'>";
         echo "<table width='100%'>";
         echo "<tr>";
         echo "<td>";
         echo "<textarea name='sub' cols='{$cols}' rows='{$rows}'>" . $this->fields["sub"] . "</textarea>";
         echo "</td>";
         echo "</tr>";
         echo "</table>";
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     echo "<td colspan='4'>" . __('Others participants', 'projet') . "</td>";
     echo "<td colspan='4'>" . __('Affected people', 'projet') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='others' cols='{$cols}' rows='2'>" . $this->fields["others"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "<td colspan='4' width='{$width_right}' valign='top'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='affect' cols='{$cols}' rows='2'>" . $this->fields["affect"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td  colspan='2'>" . __('Send email', 'projet') . "</td><td colspan='2'>";
     echo "<input type='checkbox' name='send_notification'";
     echo " value='1'>";
     echo "</td>";
     echo "<td colspan='4' align='center'>" . __('Display on the Gantt', 'projet') . " ";
     Dropdown::showYesNo("show_gantt", $this->fields["show_gantt"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='8' align='center'>";
     $datestring = __('Last update') . ": ";
     $date = Html::convDateTime($this->fields["date_mod"]);
     echo $datestring . $date . "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI, $DB;
     if ($event == 'AlertExpiredTasks') {
         $this->datas['##projet.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
         $this->datas['##lang.projet.entity##'] = __('Entity');
         $this->datas['##projet.action##'] = __('Outdated tasks', 'projet');
         $this->datas['##lang.task.name##'] = __('Name');
         $this->datas['##lang.task.type##'] = __('Type');
         $this->datas['##lang.task.users##'] = __('User');
         $this->datas['##lang.task.groups##'] = __('Group');
         $this->datas['##lang.task.datebegin##'] = __('Start date');
         $this->datas['##lang.task.dateend##'] = __('End date');
         $this->datas['##lang.task.planned##'] = __('Used for planning', 'projet');
         $this->datas['##lang.task.realtime##'] = __('Effective duration', 'projet');
         $this->datas['##lang.task.comment##'] = __('Comments');
         $this->datas['##lang.task.projet##'] = PluginProjetProjet::getTypeName(1);
         foreach ($options['tasks'] as $id => $task) {
             $tmp = array();
             $tmp['##task.name##'] = $task['name'];
             $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_projet_tasktypes', $task['plugin_projet_tasktypes_id']);
             $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
             $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
             $restrict = " `plugin_projet_tasks_id` = '" . $task['id'] . "' ";
             $plans = getAllDatasFromTable("glpi_plugin_projet_taskplannings", $restrict);
             if (!empty($plans)) {
                 foreach ($plans as $plan) {
                     $tmp['##task.datebegin##'] = Html::convDateTime($plan["begin"]);
                     $tmp['##task.dateend##'] = Html::convDateTime($plan["end"]);
                 }
             } else {
                 $tmp['##task.datebegin##'] = '';
                 $tmp['##task.dateend##'] = '';
             }
             $tmp['##task.planned##'] = '';
             $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
             $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
             $tmp['##task.comment##'] = Html::clean($comment);
             $tmp['##task.projet##'] = Dropdown::getDropdownName('glpi_plugin_projet_projets', $task['plugin_projet_projets_id']);
             $this->datas['tasks'][] = $tmp;
         }
     } else {
         $events = $this->getAllEvents();
         $this->datas['##lang.projet.title##'] = $events[$event];
         $this->datas['##lang.projet.entity##'] = __('Entity');
         $this->datas['##projet.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->obj->getField('entities_id'));
         $this->datas['##projet.id##'] = $this->obj->getField("id");
         $this->datas['##lang.projet.name##'] = __('Name');
         $this->datas['##projet.name##'] = $this->obj->getField("name");
         $this->datas['##lang.projet.datebegin##'] = __('Start date');
         $this->datas['##projet.datebegin##'] = Html::convDate($this->obj->getField('date_begin'));
         $this->datas['##lang.projet.dateend##'] = __('End date');
         $this->datas['##projet.dateend##'] = Html::convDate($this->obj->getField('date_end'));
         $this->datas['##lang.projet.users##'] = __('User');
         $this->datas['##projet.users##'] = Html::clean(getUserName($this->obj->getField("users_id")));
         $this->datas['##lang.projet.groups##'] = __('Group');
         $this->datas['##projet.groups##'] = Dropdown::getDropdownName('glpi_groups', $this->obj->getField('groups_id'));
         $this->datas['##lang.projet.status##'] = __('State');
         $this->datas['##projet.status##'] = Dropdown::getDropdownName('glpi_plugin_projet_projetstates', $this->obj->getField('plugin_projet_projetstates_id'));
         $this->datas['##lang.projet.parent##'] = __('Parent project', 'projet');
         $this->datas['##projet.parent##'] = PluginProjetProjet_Projet::displayLinkedProjetsTo($this->obj->getField('id'), true);
         $this->datas['##lang.projet.advance##'] = __('Progress');
         $this->datas['##projet.advance##'] = PluginProjetProjet::displayProgressBar('100', $this->obj->getField('advance'), array('simple' => true));
         $this->datas['##lang.projet.gantt##'] = __('Display on the global Gantt', 'projet');
         $this->datas['##projet.gantt##'] = Dropdown::getYesNo($this->obj->getField('show_gantt'));
         $this->datas['##lang.projet.comment##'] = __('Comments');
         $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("comment")));
         $this->datas['##projet.comment##'] = Html::clean($comment);
         $this->datas['##lang.projet.description##'] = __('Description');
         $description = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("description")));
         $this->datas['##projet.description##'] = Html::clean($description);
         $this->datas['##lang.projet.helpdesk##'] = __('Associable to a ticket');
         $this->datas['##projet.helpdesk##'] = Dropdown::getYesNo($this->obj->getField('is_helpdesk_visible'));
         $this->datas['##lang.projet.url##'] = __('URL');
         $this->datas['##projet.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_projet_" . $this->obj->getField("id"));
         //old values infos
         if (isset($this->target_object->oldvalues) && !empty($this->target_object->oldvalues) && $event == 'update') {
             $this->datas['##lang.update.title##'] = __('Modifications', 'projet');
             $tmp = array();
             if (isset($this->target_object->oldvalues['name'])) {
                 if (empty($this->target_object->oldvalues['name'])) {
                     $tmp['##update.name##'] = "---";
                 } else {
                     $tmp['##update.name##'] = $this->target_object->oldvalues['name'];
                 }
             }
             if (isset($this->target_object->oldvalues['date_begin'])) {
                 if (empty($this->target_object->oldvalues['date_begin'])) {
                     $tmp['##update.datebegin##'] = "---";
                 } else {
                     $tmp['##update.datebegin##'] = Html::convDate($this->target_object->oldvalues['date_begin']);
                 }
             }
             if (isset($this->target_object->oldvalues['date_end'])) {
                 if (empty($this->target_object->oldvalues['date_end'])) {
                     $tmp['##update.dateend##'] = "---";
                 } else {
                     $tmp['##update.dateend##'] = Html::convDate($this->target_object->oldvalues['date_end']);
                 }
             }
             if (isset($this->target_object->oldvalues['users_id'])) {
                 if (empty($this->target_object->oldvalues['users_id'])) {
                     $tmp['##update.users##'] = "---";
                 } else {
                     $tmp['##update.users##'] = Html::clean(getUserName($this->target_object->oldvalues['users_id']));
                 }
             }
             if (isset($this->target_object->oldvalues['groups_id'])) {
                 if (empty($this->target_object->oldvalues['groups_id'])) {
                     $tmp['##update.groups##'] = "---";
                 } else {
                     $tmp['##update.groups##'] = Dropdown::getDropdownName('glpi_groups', $this->target_object->oldvalues['groups_id']);
                 }
             }
             if (isset($this->target_object->oldvalues['plugin_projet_projetstates_id'])) {
                 if (empty($this->target_object->oldvalues['plugin_projet_projetstates_id'])) {
                     $tmp['##update.status##'] = "---";
                 } else {
                     $tmp['##update.status##'] = Dropdown::getDropdownName('glpi_plugin_projet_projetstates', $this->target_object->oldvalues['plugin_projet_projetstates_id']);
                 }
             }
             if (isset($this->target_object->oldvalues['plugin_projet_projets_id'])) {
                 if (empty($this->target_object->oldvalues['plugin_projet_projets_id'])) {
                     $tmp['##update.plugin_projet_projets_id##'] = "---";
                 } else {
                     $tmp['##update.plugin_projet_projets_id##'] = Dropdown::getDropdownName('glpi_plugin_projet_projets', $this->target_object->oldvalues['plugin_projet_projets_id']);
                 }
             }
             if (isset($this->target_object->oldvalues['advance'])) {
                 if (empty($this->target_object->oldvalues['advance'])) {
                     $tmp['##update.advance##'] = "---";
                 } else {
                     $tmp['##update.advance##'] = PluginProjetProjet::displayProgressBar('100', $this->target_object->oldvalues['advance'], array('simple' => true));
                 }
             }
             if (isset($this->target_object->oldvalues['comment'])) {
                 if (empty($this->target_object->oldvalues['comment'])) {
                     $tmp['##update.comment##'] = "---";
                 } else {
                     $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->target_object->oldvalues['comment']));
                     $tmp['##update.comment##'] = Html::clean($comment);
                 }
             }
             if (isset($this->target_object->oldvalues['description'])) {
                 if (empty($this->target_object->oldvalues['description'])) {
                     $tmp['##update.description##'] = "---";
                 } else {
                     $description = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->target_object->oldvalues['description']));
                     $tmp['##update.description##'] = Html::clean($description);
                 }
             }
             if (isset($this->target_object->oldvalues['show_gantt'])) {
                 if (empty($this->target_object->oldvalues['show_gantt'])) {
                     $tmp['##update.gantt##'] = "---";
                 } else {
                     $tmp['##update.gantt##'] = Dropdown::getYesNo($this->target_object->oldvalues['show_gantt']);
                 }
             }
             if (isset($this->target_object->oldvalues['is_helpdesk_visible'])) {
                 if (empty($this->target_object->oldvalues['is_helpdesk_visible'])) {
                     $tmp['##update.helpdesk##'] = "---";
                 } else {
                     $tmp['##update.helpdesk##'] = Dropdown::getYesNo($this->target_object->oldvalues['is_helpdesk_visible']);
                 }
             }
             $this->datas['updates'][] = $tmp;
         }
         // Projet followup
         $restrict = "`plugin_projet_projets_id`='" . $this->obj->getField('id') . "'";
         if (isset($options['followups_id']) && $options['followups_id']) {
             $restrict .= " AND `glpi_plugin_projet_followups`.`id` = '" . $options['followups_id'] . "'";
         }
         $restrict .= " ORDER BY `date` DESC";
         $followups = getAllDatasFromTable('glpi_plugin_projet_followups', $restrict);
         $this->datas['##lang.followup.description##'] = __('Content');
         $this->datas['##lang.followup.date##'] = __('Date');
         $this->datas['##lang.followup.recipient##'] = __('Writer');
         if (!empty($followups)) {
             $this->datas['##lang.followup.title##'] = _n('Associated followup', 'Associated followups', 2, 'projet');
             foreach ($followups as $followup) {
                 $tmp = array();
                 $tmp['##followup.recipient##'] = Html::clean(getUserName($followup['users_id']));
                 $tmp['##followup.date##'] = Html::convDate($followup['date']);
                 $content = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $followup['content']));
                 $tmp['##followup.description##'] = Html::clean($content);
                 $this->datas['followups'][] = $tmp;
             }
         }
         //task infos
         $restrict = "`plugin_projet_projets_id`='" . $this->obj->getField('id') . "'";
         if (isset($options['tasks_id']) && $options['tasks_id']) {
             $restrict .= " AND `glpi_plugin_projet_tasks`.`id` = '" . $options['tasks_id'] . "'";
         }
         $restrict .= " ORDER BY `name` DESC";
         $tasks = getAllDatasFromTable('glpi_plugin_projet_tasks', $restrict);
         $this->datas['##lang.task.title##'] = _n('Associated task', 'Associated tasks', 2, 'projet');
         $this->datas['##lang.task.name##'] = __('Name');
         $this->datas['##lang.task.users##'] = __('User');
         $this->datas['##lang.task.groups##'] = __('Group');
         $this->datas['##lang.task.contacts##'] = __('Supplier');
         $this->datas['##lang.task.type##'] = __('Type');
         $this->datas['##lang.task.status##'] = __('State');
         $this->datas['##lang.task.advance##'] = __('Progress');
         $this->datas['##lang.task.priority##'] = __('Priority');
         $this->datas['##lang.task.comment##'] = __('Comments');
         $this->datas['##lang.task.sub##'] = __('Results');
         $this->datas['##lang.task.others##'] = __('Others participants', 'projet');
         $this->datas['##lang.task.affect##'] = __('Affected people', 'projet');
         $this->datas['##lang.task.parenttask##'] = __('Parent task', 'projet');
         $this->datas['##lang.task.gantt##'] = __('Display on the Gantt', 'projet');
         $this->datas['##lang.task.depends##'] = __('Dependent', 'projet');
         $this->datas['##lang.task.realtime##'] = __('Effective duration', 'projet');
         $this->datas['##lang.task.location##'] = __('Location');
         $this->datas['##lang.task.projet##'] = _n('Project', 'Projects', 2, 'projet');
         if (!empty($tasks)) {
             $this->datas['##task.title##'] = _n('Associated task', 'Associated tasks', 2, 'projet');
             foreach ($tasks as $task) {
                 $tmp = array();
                 $tmp['##task.name##'] = $task['name'];
                 $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
                 $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
                 $tmp['##task.contacts##'] = Dropdown::getDropdownName('glpi_contacts', $task['contacts_id']);
                 $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_projet_tasktypes', $task['plugin_projet_tasktypes_id']);
                 $tmp['##task.status##'] = Dropdown::getDropdownName('glpi_plugin_projet_taskstates', $task['plugin_projet_taskstates_id']);
                 $tmp['##task.advance##'] = PluginProjetProjet::displayProgressBar('100', $task['advance'], array('simple' => true));
                 $tmp['##task.priority##'] = Ticket::getPriorityName($task['priority']);
                 $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
                 $tmp['##task.comment##'] = Html::clean($comment);
                 $sub = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['sub']));
                 $tmp['##task.sub##'] = Html::clean($sub);
                 $others = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['others']));
                 $tmp['##task.others##'] = Html::clean($others);
                 $affect = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['affect']));
                 $tmp['##task.affect##'] = Html::clean($affect);
                 $tmp['##task.parenttask##'] = PluginProjetTask_Task::displayLinkedProjetTasksTo($task['id'], true);
                 $tmp['##task.gantt##'] = Dropdown::getYesNo($task['show_gantt']);
                 $tmp['##task.depends##'] = Dropdown::getYesNo($task['depends']);
                 $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
                 $tmp['##task.location##'] = Dropdown::getDropdownName('glpi_locations', $task['locations_id']);
                 $tmp['##task.projet##'] = Dropdown::getDropdownName('glpi_plugin_projet_projets', $task['plugin_projet_projets_id']);
                 $this->datas['tasks'][] = $tmp;
             }
         }
     }
 }