NotificationTarget::countForGroup PHP Method

countForGroup() static public method

Count Notification for a group
static public countForGroup ( Group $group ) : integer
$group Group Group object
return integer
    static function countForGroup(Group $group)
    {
        global $DB;
        $sql = "SELECT COUNT(*)AS cpt\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);
        $data = $DB->request($sql)->next();
        return $data['cpt'];
    }