ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSAppEventListener Class Reference
+ Inheritance diagram for ilECSAppEventListener:
+ Collaboration diagram for ilECSAppEventListener:

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 Handle an event in a listener.

Static Protected Member Functions

static _sendNotification ($user_obj)
 send notification about new user accounts

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 36 of file class.ilECSAppEventListener.php.

Member Function Documentation

static ilECSAppEventListener::_sendNotification (   $user_obj)
staticprotected

send notification about new user accounts

protected

Definition at line 139 of file class.ilECSAppEventListener.php.

References $lang, ilMail\_getAutoGeneratedMessageString(), ilECSSettings\_getInstance(), and ilLanguageFactory\_getLanguage().

Referenced by handleEvent().

{
if(!count($settings->getUserRecipients()))
{
return true;
}
include_once('./Services/Language/classes/class.ilLanguageFactory.php');
$lang->loadLanguageModule('ecs');
include_once('./Services/Mail/classes/class.ilMail.php');
$mail = new ilMail(6);
$mail->enableSoap(false);
$subject = $lang->txt('ecs_new_user_subject');
// build body
$body = $lang->txt('ecs_new_user_body')."\n\n";
$body .= $lang->txt('ecs_new_user_profile')."\n\n";
$body .= $user_obj->getProfileAsString($lang)."\n\n";
$mail->sendMail($settings->getUserRecipientsAsString(),"","",$subject,$body,array(),array("normal"));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilECSAppEventListener::handleEvent (   $a_component,
  $a_event,
  $a_parameter 
)
static

Handle an event in a listener.

Parameters
string$a_componentcomponent, e.g. "Services/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array$a_parameterparameter array (assoc), array("name" => ..., "phone_office" => ...)

Implements ilAppEventListener.

Definition at line 45 of file class.ilECSAppEventListener.php.

References $desc, $error, $ilLog, $lang, ilMail\_getAutoGeneratedMessageString(), ilECSSettings\_getInstance(), ilLanguageFactory\_getLanguage(), ilLink\_getStaticLink(), ilObjUser\_lookupAuthMode(), _sendNotification(), ilObjectFactory\getInstanceByObjId(), IL_CAL_MONTH, and IL_CAL_UNIX.

{
global $ilLog;
$ilLog->write(__METHOD__.': Listening to event from: '.$a_component);
switch($a_component)
{
case 'Modules/Course':
switch($a_event)
{
case 'addSubscriber':
case 'addParticipant':
if(ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs')
{
if(!$user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))
{
return true;
}
include_once('Services/WebServices/ECS/classes/class.ilECSSettings.php');
$end = new ilDateTime(time(),IL_CAL_UNIX);
$end->increment(IL_CAL_MONTH,$settings->getDuration());
if($user->getTimeLimitUntil() < $end->get(IL_CAL_UNIX))
{
$user->setTimeLimitUntil($end->get(IL_CAL_UNIX));
$user->update();
$start = $user->getTimeLimitFrom();
$end = $user->getTimeLimitUntil();
// send notification only for non session accounts
if(($end - $start) > (60 * 60 * 24))
{
}
}
unset($user);
}
break;
}
break;
case 'Modules/RemoteCourse':
switch($a_event)
{
case 'create':
include_once('Services/WebServices/ECS/classes/class.ilECSSettings.php');
if(!count($rcps = $settings->getEContentRecipients()))
{
return true;
}
include_once('./Services/Mail/classes/class.ilMail.php');
include_once('./Services/Language/classes/class.ilLanguageFactory.php');
$lang->loadLanguageModule('ecs');
$mail = new ilMail(6);
$message = $lang->txt('ecs_rcrs_created_body_a')."\n\n";
$rcrs = $a_parameter['rcrs'];
$message .= $lang->txt('title').': '.$rcrs->getTitle()."\n";
if(strlen($desc = $rcrs->getDescription()))
{
$message .= $lang->txt('desc').': '.$desc."\n";
}
include_once('classes/class.ilLink.php');
$href = ilLink::_getStaticLink($rcrs->getRefId(),'rcrs',true);
$message .= $lang->txt("perma_link").': '.$href."\n\n";
$error = $mail->sendMail($settings->getEContentRecipientsAsString(),
'','',
$lang->txt('ecs_new_econtent_subject'),
$message,array(),array('normal'));
return true;
}
break;
}
}

+ Here is the call graph for this function:


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