46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
class stNotificationConfiguration
|
|
{
|
|
/**
|
|
* Dodaje nową grupę notyfikacji
|
|
*
|
|
* @param string $name
|
|
* @param string $label
|
|
* @param string $i18n
|
|
* @return void
|
|
*/
|
|
public static function addGroup($name, array $options = array())
|
|
{
|
|
$groups = self::getGroups();
|
|
|
|
$defaults = array(
|
|
'label' => null,
|
|
'i18n_catalogue' => 'stNotificationBackend',
|
|
);
|
|
|
|
if ($options)
|
|
{
|
|
$diff = array_diff_key($options, $defaults);
|
|
|
|
if (!empty($diff))
|
|
{
|
|
throw new \stNotificationConfigurationException(sprintf('The options "%s" do not exist. Available options are "%s"', implode(", ", array_keys($diff)), implode(", ", array_keys($defaults))));
|
|
}
|
|
}
|
|
|
|
$groups[$name] = $options;
|
|
|
|
sfConfig::set('app_st_notification_groups', $groups);
|
|
}
|
|
|
|
/**
|
|
* Zwraca grupy notyfikacji
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function getGroups()
|
|
{
|
|
return sfConfig::get('app_st_notification_groups', array());
|
|
}
|
|
} |