CommonITILObject::showGroupsAssociated PHP Метод

showGroupsAssociated() публичный Метод

show groups asociated
public showGroupsAssociated ( $type, $canedit, array $options = [] ) : nothing
$type integer : user type
$canedit boolean : can edit ?
$options array array options for default values ($options of showForm)
Результат nothing display
    function showGroupsAssociated($type, $canedit, array $options = array())
    {
        global $CFG_GLPI;
        $groupicon = self::getActorIcon('group', $type);
        $group = new Group();
        $linkclass = new $this->grouplinkclass();
        $itemtype = $this->getType();
        $typename = self::getActorFieldNameType($type);
        $candelete = true;
        $mandatory = '';
        // For ticket templates : mandatories
        if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
            $mandatory = $options['_tickettemplate']->getMandatoryMark("_groups_id_" . $typename);
            if ($options['_tickettemplate']->isMandatoryField("_groups_id_" . $typename) && isset($this->groups[$type]) && count($this->groups[$type]) == 1) {
                $candelete = false;
            }
        }
        if (isset($this->groups[$type]) && count($this->groups[$type])) {
            foreach ($this->groups[$type] as $d) {
                echo "<div class='actor_row'>";
                $k = $d['groups_id'];
                echo "{$mandatory}{$groupicon}&nbsp;";
                if ($group->getFromDB($k)) {
                    echo $group->getLink(array('comments' => true));
                }
                if ($canedit && $candelete) {
                    echo "&nbsp;";
                    Html::showSimpleForm($linkclass->getFormURL(), 'delete', _x('button', 'Delete permanently'), array('id' => $d['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png");
                }
                echo "</div>";
            }
        }
    }
CommonITILObject