3require_once 
'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
 
   12    public static function getTranslatedLanguageVariablesOfNotificationParameters($vars = array())
 
   20        $langVarToTypeDict = array();
 
   22        foreach ($vars as 
$type => $var) {
 
   30            $where[]                            = 
sprintf(
'module = %s AND identifier = %s', 
$ilDB->quote($var->getLanguageModule()), 
$ilDB->quote($var->getName()));
 
   31            $langVarToTypeDict[$var->getName()] = 
$type;
 
   38        $query   = 
'SELECT identifier, lang_key, value FROM lng_data WHERE (' . join(
') OR (', $where) . 
')';
 
   63        $pattern_old = 
'/##(.+?)##/im';
 
   64        $pattern     = 
'/\[(.+?)\]/im';
 
   67            $placeholdersStack = array();
 
   70            foreach (
$res->lang_untouched as $iso2shorthandle => $translation) {
 
   71                $translation = str_replace(
"\\n", 
"\n", $translation);
 
   73                $translation = 
self::replaceFields($translation, $placeholdersStack[count($placeholdersStack) - 1], $vars[$langVarToTypeDict[$langVar]]->getParameters(), 
'[', 
']');
 
   75                $res->lang[$iso2shorthandle] = 
self::replaceFields($translation, $placeholdersStack[count($placeholdersStack) - 1], $vars[$langVarToTypeDict[$langVar]]->getParameters(), 
'##', 
'##');
 
   78            $res->params = array_diff(
 
   80                    call_user_func_array(
'array_merge', $placeholdersStack)
 
   82                array_keys($vars[$langVarToTypeDict[$langVar]]->getParameters())
 
   97        $foundPlaceholders = array();
 
   98        preg_match_all($pattern, $translation, $foundPlaceholders);
 
   99        return (array) $foundPlaceholders[1];
 
  113        foreach ($foundPlaceholders as $placeholder) {
 
  114            if (array_key_exists(strtoupper($placeholder), 
$params)) {
 
  115                $string = str_ireplace($startTag . $placeholder . $endTage, 
$params[strtoupper($placeholder)], $string);
 
  117            if (array_key_exists(strtolower($placeholder), 
$params)) {
 
  118                $string = str_ireplace($startTag . $placeholder . $endTage, 
$params[strtolower($placeholder)], $string);
 
  160        $types = array(
'integer');
 
  166        foreach ($configArray as 
$type => $channels) {
 
  167            foreach ($channels as $channel => $value) {
 
  174                            'usr_id' => array(
'integer', 
$userid),
 
  175                            'module' => array(
'text', 
$type),
 
  176                            'channel' => array(
'text', $channel),
 
  188        $types = array(
'integer');
 
  221                    'notification_id' => array(
'integer', $notification_id),
 
  222                    'usr_id'          => array(
'integer', 
$userid),
 
  223                    'valid_until'     => array(
'integer', $valid_until),
 
  240        $types = array(
'integer', 
'integer', 
'integer', 
'text', 
'integer');
 
  278                    'notification_id' => array(
'integer', 
$id),
 
  279                    'serialized' => array(
'text', serialize($notification)),
 
  291        $types = array(
'integer');
 
  292        $values = array(
$id);
 
  302        $types = array(
'text', 
'integer');
 
  303        $values = array(
$module, $sender_id);
 
  308        while (
$row = 
$ilDB->fetchAssoc($rset)) {
 
  319        $types = array(
'text', 
'integer');
 
  320        $values = array(
$module, $sender_id);
 
  335        $types = array(
'text', 
'integer');
 
  336        $values = array(
$module, $sender_id);
 
  360                    'channel_name' => array(
'text', 
$name),
 
  361                    'title' => array(
'text', 
$title),
 
  363                    'class' => array(
'text', $class),
 
  364                    'include' => array(
'text', $classfile),
 
  365                    'config_type' => array(
'text', $config_type),
 
  388                    'type_name' => array(
'text', 
$name),
 
  389                    'title' => array(
'text', 
$title),
 
  391                    'notification_group' => array(
'text', $notification_group),
 
  392                    'config_type' => array(
'text', $config_type),
 
  403            $query .= 
' WHERE ' . 
$ilDB->in(
'config_type', $config_types, 
false, 
'text');
 
  410        $settings = 
new ilSetting(
'notifications');
 
  412        while (
$row = 
$ilDB->fetchAssoc($rset)) {
 
  413            if (!$includeDisabled && !$settings->get(
'enable_' . 
$row[
'channel_name'])) {
 
  418                'name' => 
$row[
'channel_name'],
 
  419                'title' => 
$row[
'title'],
 
  420                'description' => 
$row[
'description'],
 
  421                'handler' => 
$row[
'class'],
 
  422                'include' => 
$row[
'include'],
 
  423                'config_type' => 
$row[
'config_type'],
 
  436            $query .= 
' WHERE ' . 
$ilDB->in(
'config_type', $config_types, 
false, 
'text');
 
  444        while (
$row = 
$ilDB->fetchAssoc($rset)) {
 
  446                'name' => 
$row[
'type_name'],
 
  447                'title' => 
$row[
'title'],
 
  448                'description' => 
$row[
'description'],
 
  449                'group' => 
$row[
'notification_group'],
 
  450                'config_type' => 
$row[
'config_type'],
 
  461        $types = array(
'text', 
'text');
 
  462        $values = array($config_name, $type_name);
 
  470        $types = array(
'text', 
'text');
 
  471        $values = array($config_name, $channel_name);
 
  479        $query = 
'SELECT usr_id, value FROM usr_pref WHERE ' . 
$ilDB->in(
'usr_id', 
$userid, 
false, 
'integer') . 
' AND keyword="use_custom_notification_setting" AND value="1"';
 
  482        while (
$row = 
$ilDB->fetchAssoc($rset)) {
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Describes a notification and provides methods for publishing this notification.
static getUsersByListener($module, $sender_id)
static getUsersWithCustomConfig(array $userid)
static registerChannel($name, $title, $description, $class, $classfile, $config_type)
Registers a new notification channel for distributing notifications.
static getAvailableChannels($config_types=array(), $includeDisabled=false)
static replaceFields($string, $foundPlaceholders, $params, $startTag, $endTage)
static storeNotification(ilNotificationConfig $notification)
static loadUserConfig($userid)
static setConfigTypeForType($type_name, $config_name)
static registerType($name, $title, $description, $notification_group, $config_type)
Registers a new notification type.
static enqueueByListener(ilNotificationConfig $notification, $ref_id)
static getAvailableTypes($config_types=array())
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.
static setConfigTypeForChannel($channel_name, $config_name)
static fillPlaceholders($results, $vars, $langVarToTypeDict)
static disableListeners($module, $sender_id)
static enableListeners($module, $sender_id, array $users=array())
static findPlaceholders($pattern, $translation)
static enqueueByUsers(ilNotificationConfig $notification, array $userids)
static removeNotification($id)
static $tbl_notification_queue
static $tbl_notification_data
static $tbl_notification_channels
static $tbl_notification_types
if(empty($userids)) $userid
if(!array_key_exists('StateId', $_REQUEST)) $id
if($modEnd===false) $module
foreach($_POST as $key=> $value) $res