function showUsersAssociated($type, $canedit, array $options = array())
{
global $CFG_GLPI;
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 2;
}
$usericon = self::getActorIcon('user', $type);
$user = new User();
$linkuser = new $this->userlinkclass();
$itemtype = $this->getType();
$typename = self::getActorFieldNameType($type);
$candelete = true;
$mandatory = '';
// For ticket templates : mandatories
if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
$mandatory = $options['_tickettemplate']->getMandatoryMark("_users_id_" . $typename);
if ($options['_tickettemplate']->isMandatoryField("_users_id_" . $typename) && isset($this->users[$type]) && count($this->users[$type]) == 1) {
$candelete = false;
}
}
if (isset($this->users[$type]) && count($this->users[$type])) {
foreach ($this->users[$type] as $d) {
echo "<div class='actor_row'>";
$k = $d['users_id'];
echo "{$mandatory}{$usericon} ";
if ($k) {
$userdata = getUserName($k, 2);
} else {
$email = $d['alternative_email'];
$userdata = "<a href='mailto:{$email}'>{$email}</a>";
}
if ($k) {
$param = array('display' => false);
if ($showuserlink) {
$param['link'] = $userdata["link"];
}
echo $userdata['name'] . " " . Html::showToolTip($userdata["comment"], $param);
} else {
echo $userdata;
}
if ($CFG_GLPI['use_mailing']) {
$text = __('Email followup') . " " . Dropdown::getYesNo($d['use_notification']) . '<br>';
if ($d['use_notification']) {
$uemail = $d['alternative_email'];
if (empty($uemail) && $user->getFromDB($d['users_id'])) {
$uemail = $user->getDefaultEmail();
}
$text .= sprintf(__('%1$s: %2$s'), __('Email'), $uemail);
if (!NotificationMail::isUserAddressValid($uemail)) {
$text .= " <span class='red'>" . __('Invalid email address') . "</span>";
}
}
echo " ";
if ($canedit || $d['users_id'] == Session::getLoginUserID()) {
$opt = array('img' => $CFG_GLPI['root_doc'] . '/pics/edit.png', 'popup' => $linkuser->getFormURL() . "?id=" . $d['id']);
Html::showToolTip($text, $opt);
}
}
if ($canedit && $candelete) {
echo " ";
Html::showSimpleForm($linkuser->getFormURL(), 'delete', _x('button', 'Delete permanently'), array('id' => $d['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png");
}
echo "</div>";
}
}
}