/** * Show team for a project **/ function showTeam(Project $project) { global $DB, $CFG_GLPI; $ID = $project->fields['id']; $canedit = $project->can($ID, UPDATE); echo "<div class='center'>"; $rand = mt_rand(); $nb = 0; $nb = $project->getTeamCount(); if ($canedit) { echo "<div class='firstbloc'>"; echo "<form name='projectteam_form{$rand}' id='projectteam_form{$rand}' "; echo " method='post' action='" . Toolbox::getItemTypeFormURL('ProjectTeam') . "'>"; echo "<input type='hidden' name='projects_id' value='{$ID}'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Add a team member') . "</tr>"; echo "<tr class='tab_bg_2'><td>"; $params = array('itemtypes' => ProjectTeam::$available_types, 'entity_restrict' => $project->fields['is_recursive'] ? getSonsOf('glpi_entities', $project->fields['entities_id']) : $project->fields['entities_id']); $addrand = Dropdown::showSelectItemFromItemtypes($params); echo "</td>"; echo "<td width='20%'>"; echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\"\n class='submit'>"; echo "</td>"; echo "</tr>"; echo "</table>"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($canedit && $nb) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('num_displayed' => $nb, 'container' => 'mass' . __CLASS__ . $rand); Html::showMassiveActions($massiveactionparams); } echo "<table class='tab_cadre_fixehov'>"; $header_begin = "<tr>"; $header_top = ''; $header_bottom = ''; $header_end = ''; if ($canedit && $nb) { $header_begin .= "<th width='10'>"; $header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand); $header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand); $header_end .= "</th>"; } $header_end .= "<th>" . __('Type') . "</th>"; $header_end .= "<th>" . _n('Member', 'Members', Session::getPluralNumber()) . "</th>"; $header_end .= "</tr>"; echo $header_begin . $header_top . $header_end; foreach (ProjectTeam::$available_types as $type) { if (isset($project->team[$type]) && count($project->team[$type])) { if ($item = getItemForItemtype($type)) { foreach ($project->team[$type] as $data) { $item->getFromDB($data['items_id']); echo "<tr class='tab_bg_2'>"; if ($canedit) { echo "<td>"; Html::showMassiveActionCheckBox('ProjectTeam', $data["id"]); echo "</td>"; } echo "<td>" . $item->getTypeName(1) . "</td>"; echo "<td>" . $item->getLink() . "</td>"; echo "</tr>"; } } } } if ($nb) { echo $header_begin . $header_bottom . $header_end; } echo "</table>"; if ($canedit && $nb) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } echo "</div>"; // Add items return true; }