ILIAS  release_4-3 Revision
 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.

Protected Member Functions

 handleMembership (ilObjUser $user)
 Assign mmissing course/groups to new user accounts.

Static Protected Member Functions

static _sendNotification (ilECSSetting $server, ilObjUser $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 ( ilECSSetting  $server,
ilObjUser  $user_obj 
)
staticprotected

send notification about new user accounts

protected

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

References $lang, ilMail\_getAutoGeneratedMessageString(), ilLanguageFactory\_getLanguage(), ilObject\getId(), ilObjUser\getProfileAsString(), ilECSSetting\getServerId(), ilECSSetting\getUserRecipients(), and ilECSSetting\getUserRecipientsAsString().

Referenced by handleEvent().

{
if(!count($server->getUserRecipients()))
{
return true;
}
// If sub id is set => mail was send
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
$import = new ilECSImport($server->getServerId(),$user_obj->getId());
if($import->getSubId())
{
return false;
}
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($server->getUserRecipientsAsString(),"","",$subject,$body,array(),array("normal"));
// Store sub_id = 1 in ecs import which means mail is send
$import->setSubId(1);
$import->save();
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. "Modules/Forum" or "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 $GLOBALS, $ilLog, ilObjUser\_lookupAuthMode(), _sendNotification(), ilObjectFactory\getInstanceByObjId(), ilECSSetting\getInstanceByServerId(), handleMembership(), IL_CAL_MONTH, IL_CAL_UNIX, and ilECSImport\lookupServerId().

{
global $ilLog;
$ilLog->write(__METHOD__.': Listening to event from: '.$a_component);
switch($a_component)
{
case 'Services/User':
switch($a_event)
{
case 'afterCreation':
$user = $a_parameter['user_obj'];
$this->handleMembership($user);
break;
}
break;
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']))
{
$GLOBALS['ilLog']->write(__METHOD__.': No valid user found for usr_id '.$a_parameter['usr_id']);
return true;
}
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
$server_id = ilECSImport::lookupServerId($a_parameter['usr_id']);
$GLOBALS['ilLog']->write(__METHOD__.': Found server id: '.$server_id);
include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
$settings = ilECSSetting::getInstanceByServerId($server_id);
$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();
}
self::_sendNotification($settings,$user);
unset($user);
}
break;
}
break;
}
}

+ Here is the call graph for this function:

ilECSAppEventListener::handleMembership ( ilObjUser  $user)
protected

Assign mmissing course/groups to new user accounts.

Parameters
ilObjUser$user

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

References ilObjUser\getAuthMode(), and ilECSSetting\lookupAuthMode().

Referenced by handleEvent().

{
{
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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