NotificationTarget::showForGroup PHP 메소드

showForGroup() 정적인 공개 메소드

Display notification registered for a group
static public showForGroup ( Group $group ) : nothing
$group Group Group object
리턴 nothing
    static function showForGroup(Group $group)
    {
        global $DB;
        if (!Notification::canView()) {
            return false;
        }
        $sql = "SELECT `glpi_notifications`.`id`\n              FROM `glpi_notificationtargets`\n              INNER JOIN `glpi_notifications`\n                    ON (`glpi_notifications`.`id` = `glpi_notificationtargets`.`notifications_id`)\n              WHERE `items_id` = '" . $group->getID() . "'\n                    AND (`type` = '" . Notification::SUPERVISOR_GROUP_TYPE . "'\n                         OR `type` = '" . Notification::GROUP_TYPE . "') " . getEntitiesRestrictRequest('AND', 'glpi_notifications', '', '', true);
        $req = $DB->request($sql);
        echo "<table class='tab_cadre_fixe'>";
        if ($req->numrows()) {
            echo "<tr><th>" . __('Name') . "</th>";
            echo "<th>" . Entity::getTypeName(1) . "</th>";
            echo "<th>" . __('Active') . "</th>";
            echo "<th>" . __('Type') . "</th>";
            echo "<th>" . __('Notification method') . "</th>";
            echo "<th>" . NotificationEvent::getTypeName(1) . "</th>";
            echo "<th>" . NotificationTemplate::getTypeName(1) . "</th></tr>";
            $notif = new Notification();
            Session::initNavigateListItems('Notification', sprintf(__('%1$s = %2$s'), Group::getTypeName(1), $group->getName()));
            foreach ($req as $data) {
                Session::addToNavigateListItems('Notification', $data['id']);
                if ($notif->getFromDB($data['id'])) {
                    echo "<tr class='tab_bg_2'><td>" . $notif->getLink();
                    echo "</td><td>" . Dropdown::getDropdownName('glpi_entities', $notif->getEntityID());
                    echo "</td><td>" . Dropdown::getYesNo($notif->getField('is_active')) . "</td><td>";
                    $itemtype = $notif->getField('itemtype');
                    if ($tmp = getItemForItemtype($itemtype)) {
                        echo $tmp->getTypeName(1);
                    } else {
                        echo "&nbsp;";
                    }
                    echo "</td><td>" . Notification::getMode($notif->getField('mode'));
                    echo "</td><td>" . NotificationEvent::getEventName($itemtype, $notif->getField('event'));
                    echo "</td>" . "<td>" . Dropdown::getDropdownName('glpi_notificationtemplates', $notif->getField('notificationtemplates_id'));
                    echo "</td></tr>";
                }
            }
        } else {
            echo "<tr class='tab_bg_2'><td class='b center'>" . __('No item found') . "</td></tr>";
        }
        echo "</table>";
    }