Example #1
0
 function getSearchOptions()
 {
     $tab = array();
     $tab['common'] = PluginProjetProjet::getTypeName(2) . " - " . self::getTypeName(2);
     $tab[1]['table'] = $this->getTable();
     $tab[1]['field'] = 'name';
     $tab[1]['name'] = __('Name');
     $tab[1]['datatype'] = 'itemlink';
     $tab[1]['itemlink_type'] = $this->getType();
     $tab[2]['table'] = 'glpi_users';
     $tab[2]['field'] = 'name';
     $tab[2]['name'] = __('User');
     $tab[2]['datatype'] = 'dropdown';
     $tab[2]['massiveaction'] = false;
     $tab[3]['table'] = 'glpi_groups';
     $tab[3]['field'] = 'completename';
     $tab[3]['name'] = _n('Group', 'Groups', 1);
     $tab[3]['condition'] = '`is_assign`';
     $tab[3]['massiveaction'] = false;
     $tab[2]['datatype'] = 'dropdown';
     $tab[4]['table'] = 'glpi_contacts';
     $tab[4]['field'] = 'name';
     $tab[4]['name'] = _n('Supplier', 'Suppliers', 1);
     $tab[4]['massiveaction'] = false;
     $tab[4]['datatype'] = 'dropdown';
     $tab[5]['table'] = 'glpi_plugin_projet_tasktypes';
     $tab[5]['field'] = 'name';
     $tab[5]['name'] = PluginProjetTaskType::getTypeName(1);
     $tab[5]['datatype'] = 'dropdown';
     $tab[6]['table'] = 'glpi_plugin_projet_taskstates';
     $tab[6]['field'] = 'name';
     $tab[6]['name'] = PluginProjetTaskState::getTypeName(1);
     $tab[6]['massiveaction'] = false;
     $tab[6]['datatype'] = 'dropdown';
     $tab[7]['table'] = 'glpi_plugin_projet_taskplannings';
     $tab[7]['field'] = 'id';
     $tab[7]['name'] = __('Planning');
     $tab[7]['massiveaction'] = false;
     $tab[7]['datatype'] = 'number';
     $tab[9]['table'] = $this->getTable();
     $tab[9]['field'] = 'advance';
     $tab[9]['name'] = __('Progress');
     $tab[9]['datatype'] = 'integer';
     $tab[10]['table'] = $this->getTable();
     $tab[10]['field'] = "priority";
     $tab[10]['name'] = __('Priority');
     $tab[10]['datatype'] = 'dropdown';
     $tab[11]['table'] = $this->getTable();
     $tab[11]['field'] = 'comment';
     $tab[11]['name'] = __('Comments');
     $tab[11]['datatype'] = 'text';
     $tab[12]['table'] = $this->getTable();
     $tab[12]['field'] = 'sub';
     $tab[12]['name'] = __('Results');
     $tab[12]['datatype'] = 'text';
     $tab[13]['table'] = $this->getTable();
     $tab[13]['field'] = 'others';
     $tab[13]['name'] = __('Others participants', 'projet');
     $tab[13]['datatype'] = 'text';
     $tab[14]['table'] = $this->getTable();
     $tab[14]['field'] = 'affect';
     $tab[14]['name'] = __('Affected people', 'projet');
     $tab[14]['datatype'] = 'text';
     $tab[15]['table'] = 'glpi_plugin_projet_tasks_tasks';
     $tab[15]['field'] = 'plugin_projet_tasks_id_1';
     $tab[15]['name'] = __('Parent task', 'projet');
     $tab[15]['massiveaction'] = false;
     $tab[15]['searchtype'] = 'equals';
     $tab[15]['joinparams'] = array('jointype' => 'item_item');
     $tab[15]['forcegroupby'] = true;
     $tab[15]['datatype'] = 'number';
     $tab[16]['table'] = $this->getTable();
     $tab[16]['field'] = 'show_gantt';
     $tab[16]['name'] = __('Display on the Gantt', 'projet');
     $tab[16]['datatype'] = 'bool';
     $tab[18]['table'] = $this->getTable();
     $tab[18]['field'] = 'depends';
     $tab[18]['name'] = __('Dependent', 'projet');
     $tab[18]['datatype'] = 'bool';
     $tab[19]['table'] = $this->getTable();
     $tab[19]['field'] = 'actiontime';
     $tab[19]['name'] = __('Effective duration', 'projet');
     $tab[19]['datatype'] = 'timestamp';
     $tab[19]['massiveaction'] = false;
     $tab[19]['nosearch'] = true;
     $tab[21]['table'] = 'glpi_plugin_projet_tasks_items';
     $tab[21]['field'] = 'items_id';
     $tab[21]['name'] = _n('Associated item', 'Associated items', 2);
     $tab[21]['massiveaction'] = false;
     $tab[21]['forcegroupby'] = true;
     $tab[21]['joinparams'] = array('jointype' => 'child');
     $tab[22]['table'] = 'glpi_locations';
     $tab[22]['field'] = 'completename';
     $tab[22]['name'] = _n('Location', 'Locations', 1);
     $tab[22]['datatype'] = 'dropdown';
     $tab[23]['table'] = 'glpi_plugin_projet_projets';
     $tab[23]['field'] = 'id';
     $tab[23]['name'] = PluginProjetProjet::getTypeName(1) . " " . __('ID');
     $tab[23]['massiveaction'] = false;
     $tab[23]['datatype'] = 'number';
     $tab[24]['table'] = 'glpi_plugin_projet_projets';
     $tab[24]['field'] = 'name';
     $tab[24]['name'] = PluginProjetProjet::getTypeName(2);
     $tab[24]['massiveaction'] = false;
     $tab[25]['table'] = $this->getTable();
     $tab[25]['field'] = 'date_mod';
     $tab[25]['name'] = __('Last update');
     $tab[25]['datatype'] = 'datetime';
     $tab[25]['massiveaction'] = false;
     $tab[30]['table'] = $this->getTable();
     $tab[30]['field'] = 'id';
     $tab[30]['name'] = __('ID');
     $tab[30]['massiveaction'] = false;
     $tab[30]['datatype'] = 'number';
     $tab[80]['table'] = 'glpi_entities';
     $tab[80]['field'] = 'completename';
     $tab[80]['name'] = __('Entity');
     $tab[80]['datatype'] = 'dropdown';
     return $tab;
 }
 /**
  * Display a Planning Item
  *
  * @param $parm Array of the item to display
  * @return Nothing (display function)
  **/
 static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/task.form.php?id=" . $val["id"] . "'";
     echo " onmouseout=\"cleanhide('content_task_" . $val["id"] . $rand . "')\" \n               onmouseover=\"cleandisplay('content_task_" . $val["id"] . $rand . "')\"";
     echo ">";
     switch ($type) {
         case "in":
             //TRANS: %1$s is the start time of a planned item, %2$s is the end
             $beginend = sprintf(__('From %1$s to %2$s :'), date("H:i", strtotime($val["begin"])), date("H:i", strtotime($val["end"])));
             printf(__('%1$s %2$s'), $beginend, Html::resume_text($val["name"], 80));
             break;
         case "begin":
             $start = sprintf(__('Start at %s'), date("H:i", strtotime($val["begin"])));
             printf(__('%1$s: %2$s'), $start, Html::resume_text($val["name"], 80));
             break;
         case "end":
             $end = sprintf(__('End at %s'), date("H:i", strtotime($val["end"])));
             printf(__('%1$s: %2$s'), $end, Html::resume_text($val["name"], 80));
             break;
     }
     if ($val["users_id"] && $who == 0) {
         echo " - " . __('User') . " " . getUserName($val["users_id"]);
     }
     echo "</a><br>";
     echo PluginProjetProjet::getTypeName(1) . " : <a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php?id=" . $val["plugin_projet_projets_id"] . "'";
     echo ">" . $val["project"] . "</a>";
     echo "<div class='over_link' id='content_task_" . $val["id"] . $rand . "'>";
     if ($val["end"]) {
         echo "<strong>" . __('End date') . "</strong> : " . Html::convdatetime($val["end"]) . "<br>";
     }
     if ($val["type"]) {
         echo "<strong>" . PluginProjetTaskType::getTypeName(1) . "</strong> : " . $val["type"] . "<br>";
     }
     if ($val["state"]) {
         echo "<strong>" . __('State') . "</strong> : " . $val['state'] . "<br>";
     }
     if ($val["location"]) {
         echo "<strong>" . _n('Location', 'Locations', 1) . "</strong>: " . $val["location"] . "<br>";
     }
     if ($val["priority"]) {
         echo "<strong>" . __('Priority') . "</strong> : " . Ticket::getPriorityName($val["priority"]) . "<br>";
     }
     if ($val["content"]) {
         echo "<strong>" . __('Description') . "</strong> : " . $val["content"];
     }
     echo "</div>";
 }