ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNotificationOSDHandler Class Reference
+ Inheritance diagram for ilNotificationOSDHandler:
+ Collaboration diagram for ilNotificationOSDHandler:

Public Member Functions

 notify (ilNotificationObject $notification)
 showSettings ($item)

Static Public Member Functions

static getNotificationsForUser ($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static removeNotification ($notification_osd_id)
static cleanup ()
static cleanupOnRandom ()

Static Private Member Functions

static appendOsdIdToLinks ($subject, $osd_id)
static appendParamToLink ($link, $param, $value)

Detailed Description

Definition at line 6 of file class.ilNotificationOSDHandler.php.

Member Function Documentation

static ilNotificationOSDHandler::appendOsdIdToLinks (   $subject,
  $osd_id 
)
staticprivate

Definition at line 73 of file class.ilNotificationOSDHandler.php.

References appendParamToLink().

Referenced by getNotificationsForUser().

{
$matches = array();
preg_match_all('/href="(.*?)"/', $subject, $matches);
if($matches[1]) {
foreach($matches[1] as $match) {
$match_appended = self::appendParamToLink($match, 'osd_id', $osd_id);
$subject = str_replace($match, $match_appended, $subject);
}
}
return $subject;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilNotificationOSDHandler::appendParamToLink (   $link,
  $param,
  $value 
)
staticprivate

Definition at line 126 of file class.ilNotificationOSDHandler.php.

Referenced by appendOsdIdToLinks(), and getNotificationsForUser().

{
if (strpos($link, '?') !== false) {
$link .= '&' . $param . '=' . $value;
}
else {
$link .= '?' . $param . '=' . $value;
}
return $link;
}

+ Here is the caller graph for this function:

static ilNotificationOSDHandler::cleanup ( )
static

Definition at line 113 of file class.ilNotificationOSDHandler.php.

References $ilDB, $query, and ilNotificationSetupHelper\$tbl_notification_osd_handler.

Referenced by cleanupOnRandom().

{
global $ilDB;
$query = 'DELETE FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler . ' WHERE valid_until < ' . $ilDB->quote( time() ,'integer');
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

static ilNotificationOSDHandler::cleanupOnRandom ( )
static

Definition at line 119 of file class.ilNotificationOSDHandler.php.

References cleanup().

Referenced by getNotificationsForUser().

{
$rnd = rand(0, 10000);
if ($rnd == 500) {
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilNotificationOSDHandler::getNotificationsForUser (   $user_id,
  $append_osd_id_to_link = true,
  $max_age_seconds = 0 
)
static

Definition at line 37 of file class.ilNotificationOSDHandler.php.

References $ilDB, $query, $row, ilNotificationSetupHelper\$tbl_notification_osd_handler, appendOsdIdToLinks(), appendParamToLink(), and cleanupOnRandom().

Referenced by ilNotificationGUI\getOSDNotificationsObject(), and ilMainMenuGUI\setTemplateVars().

{
global $ilDB;
$query = 'SELECT notification_osd_id, serialized, valid_until, type FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler
. ' WHERE usr_id = %s AND (valid_until = 0 OR valid_until > ' . $ilDB->quote( time() ,'integer') . ') AND time_added > %s';
$types = array('integer', 'integer');
$values = array($user_id, $max_age_seconds ? (time() - $max_age_seconds) : 0);
$rset = $ilDB->queryF($query, $types, $values);
$notifications = array();
while($row = $ilDB->fetchAssoc($rset)) {
$row['data'] = unserialize($row['serialized']);
unset($row['serialized']);
$row['data']->handlerParams = array('general' => $row['data']->handlerParams[''], 'osd' => $row['data']->handlerParams['osd']);
if ($append_osd_id_to_link) {
if ($row['data']->link) {
$row['data']->link = self::appendParamToLink($row['data']->link, 'osd_id', $row['notification_osd_id']);
}
$row['data']->shortDescription = self::appendOsdIdToLinks($row['data']->shortDescription, $row['notification_osd_id']);
$row['data']->longDescription = self::appendOsdIdToLinks($row['data']->longDescription, $row['notification_osd_id']);
}
$notifications[] = $row;
}
return $notifications;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNotificationOSDHandler::notify ( ilNotificationObject  $notification)

Reimplemented from ilNotificationEchoHandler.

Definition at line 7 of file class.ilNotificationOSDHandler.php.

References $ilDB, and ilNotificationSetupHelper\$tbl_notification_osd_handler.

{
global $ilDB;
$ilDB->insert(
array(
'notification_osd_id' => array('integer', $id),
'usr_id' => array('integer', $notification->user->getId()),
'serialized' => array('text', serialize($notification)),
'valid_until' => array('integer', $notification->baseNotification->getValidForSeconds() ? ($notification->baseNotification->getValidForSeconds() + time()) : 0),
'type' => array('text', $notification->baseNotification->getType()),
'time_added' => array('integer', time()),
)
);
}
static ilNotificationOSDHandler::removeNotification (   $notification_osd_id)
static

Definition at line 85 of file class.ilNotificationOSDHandler.php.

References $ilDB, $query, $row, ilNotificationSetupHelper\$tbl_notification_osd_handler, and ilNotificationSystem\sendNotificationToUsers().

Referenced by ilNotificationGUI\removeOSDNotificationsObject().

{
global $ilDB;
$query = 'SELECT usr_id FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler . ' WHERE notification_osd_id = %s';
$types = array('integer');
$values = array($notification_osd_id);
$rset = $ilDB->queryF($query, $types, $values);
if ($row = $ilDB->fetchAssoc($rset)) {
$query = 'DELETE FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler . ' WHERE notification_osd_id = %s';
$types = array('integer');
$values = array($notification_osd_id);
$ilDB->manipulateF($query, $types, $values);
$deletedNotification = new ilNotificationConfig('osd_maint');
$deletedNotification->setValidForSeconds(120);
$deletedNotification->setTitleVar('deleted');
$deletedNotification->setShortDescriptionVar($notification_osd_id);
$deletedNotification->setLongDescriptionVar('dummy');
require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
ilNotificationSystem::sendNotificationToUsers($deletedNotification, array($row['usr_id']));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNotificationOSDHandler::showSettings (   $item)

Reimplemented from ilNotificationHandler.

Definition at line 25 of file class.ilNotificationOSDHandler.php.

References $lng, and ilFormPropertyGUI\setRequired().

{
global $lng;
$txt = new ilTextInputGUI($lng->txt('polling_intervall'), 'osd_polling_intervall');
$txt->setRequired(true);
$txt->setInfo($lng->txt('polling_in_seconds'));
$txt->setValue('300');
$item->addSubItem($txt);
return array('osd_polling_intervall');
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: