public function __toString() { if ($this->type == null) { return null; } $notificationRulesClassName = $this->type . 'NotificationRules'; if (@class_exists($notificationRulesClassName)) { $rule = NotificationRulesFactory::createNotificationRulesByType($this->type); return $rule->getDisplayName(); } else { return Zurmo::t('Core', '(Unnamed)'); } }
public function attributeLabels() { $labels = array(); foreach ($this->attributeNames() as $name) { list($settingName, $type) = UserNotificationUtil::getSettingNameAndTypeBySuffixedConfigurationAttribute($name); $notificationRulesClassName = str_replace('enable', '', $settingName) . 'Rules'; if (@class_exists($notificationRulesClassName)) { $rule = NotificationRulesFactory::createNotificationRulesByType(str_replace('NotificationRules', '', $notificationRulesClassName)); $labels[$settingName] = $rule->getDisplayName(); } } return $labels; }
public function testCreateNotificationRulesByType() { $rules = NotificationRulesFactory::createNotificationRulesByType('Simple'); $this->assertEquals('SimpleNotificationRules', get_class($rules)); }
/** * The tooltip title used on @see UserNotificationConfigurationEditView * @param $attribute * @return string */ public static function getTooltipTitleByAttribute($attribute) { assert('is_string($attribute)'); $notificationType = preg_replace("/enable(.*)Notification/", "\$1", $attribute); $rule = NotificationRulesFactory::createNotificationRulesByType($notificationType); return $rule->getTooltipTitle(); }