public static function getGeneralSettingsForm() { global $lng; $form = new ilPropertyFormGUI(); require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php'; $channels = ilNotificationDatabaseHandler::getAvailableChannels(array(), true); $options = array('set_by_user' => $lng->txt('set_by_user'), 'set_by_admin' => $lng->txt('set_by_admin')); /** * @todo dirty... */ $form->restored_values = array(); $store_values = array(); foreach ($channels as $channel) { $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']); $store_values[] = 'enable_' . $channel['name']; $select = new ilSelectInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']'); $select->setOptions($options); $select->setValue($channel['config_type']); $chb->addSubItem($select); /** * @todo dirty... */ $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type']; require_once $channel['include']; // let the channel display their own settings below the "enable channel" // checkbox $result = call_user_func(array($channel['handler'], 'showSettings'), $chb); if ($result) { $store_values = array_merge($result, $store_values); } $form->addItem($chb); } /** * @todo dirty... */ $form->store_values = $store_values; return $form; }
private function saveConfigMatrixObject() { global $ilUser, $ilCtrl; require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php'; ilNotificationDatabaseHandler::setUserConfig(-1, $_REQUEST['notification'] ? $_REQUEST['notification'] : array()); $this->showConfigMatrixObject(); }
public static function enqueueByListener(ilNotificationConfig $notification, $ref_id) { global $ilDB; $notification_id = ilNotificationDatabaseHandler::storeNotification($notification); $valid_until = $notification->getValidForSeconds() ? time() + $notification->getValidForSeconds() : 0; $query = 'INSERT INTO ' . ilNotificationSetupHelper::$tbl_notification_queue . ' (notification_id, usr_id, valid_until) ' . ' (SELECT %s, usr_id, %s FROM ' . ilNotificationSetupHelper::$tbl_userlistener . ' WHERE disabled = 0 AND module = %s AND sender_id = %s)'; $types = array('integer', 'integer', 'text', 'integer'); $values = array($notification_id, $valid_until, $notification->getType(), $ref_id); $ilDB->manipulateF($query, $types, $values); }
public static function enableUserListeners($module, $ref_id, array $users) { if (!$users) { return; } require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php'; ilNotificationDatabaseHandler::enableListeners($module, $ref_id, $users); }
public static function registerType($name, $title, $description, $notification_group, $config_type = 'set_by_user') { ilNotificationDatabaseHandler::registerType($name, $title, $description, $notification_group, $config_type); }