ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarUserNotification Class Reference
+ Collaboration diagram for ilCalendarUserNotification:

Public Member Functions

 __construct ($a_cal_id=0)
 Init with calendar entry id.
 setEntryId ($a_id)
 Set calendar entry id.
 getEntryId ()
 Get calendar entry id.
 getRecipients ()
 validate ()
 save ()
 Save recipients to db.
 addRecipient ($a_type, $a_usr_id=0, $a_email= '')
 Add recipient.
 setRecipients ($a_rcps)
 Set recipients.
 deleteRecipients ()
 Delete all recipients ilDB $ilDB.

Static Public Member Functions

static deleteUser ($a_usr_id)
 Delete a singel user ilDB $ilDB.
static deleteCalendarEntry ($a_cal_id)
 Delete notification for a calendar entry ilDB $ilDB.
static createTable ()

Data Fields

const TYPE_USER = 1
const TYPE_EMAIL = 2

Protected Member Functions

 read ()
 Read recipients ilDB $ilDB.

Private Attributes

 $cal_id = 0
 $rcps = array()

Detailed Description

Constructor & Destructor Documentation

ilCalendarUserNotification::__construct (   $a_cal_id = 0)

Init with calendar entry id.

Definition at line 22 of file class.ilCalendarUserNotification.php.

References read().

{
$this->cal_id = $a_cal_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarUserNotification::addRecipient (   $a_type,
  $a_usr_id = 0,
  $a_email = '' 
)

Add recipient.

Parameters
int$a_type
int$a_usr_id
string$a_email

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

Referenced by read().

{
$this->rcps[] = array(
'type' => $a_type,
'usr_id' => $a_usr_id,
'email' => $a_email
);
}

+ Here is the caller graph for this function:

static ilCalendarUserNotification::createTable ( )
static

Definition at line 203 of file class.ilCalendarUserNotification.php.

{
global $ilDB;
if($ilDB->tableExists('cal_notification'))
{
return true;
}
// Create notification table
$ilDB->createTable(
'cal_notification',
array(
'notification_id' => array('type' => 'integer','length' => 4,'notnull' => true),
'cal_id' => array('type' => 'integer','length' => 4, 'notnull' => true, 'default' => 0),
'user_type' => array('type' => 'integer','length' => 1, 'notnull' => true, 'default' => 0),
'user_id' => array('type' => 'integer','length' => 4, 'notnull' => true, 'default' => 0),
'email' => array('type' => 'text','length' => 64, 'notnull' => false)
)
);
$ilDB->addPrimaryKey(
'cal_notification',
array(
'notification_id'
)
);
$ilDB->createSequence('cal_notification');
$ilDB->addIndex('cal_notification', array('cal_id'),'i1');
}
static ilCalendarUserNotification::deleteCalendarEntry (   $a_cal_id)
static

Delete notification for a calendar entry ilDB $ilDB.

Parameters
int$a_cal_id
Returns
bool

Definition at line 50 of file class.ilCalendarUserNotification.php.

References $query, and $res.

Referenced by ilCalendarAppointmentGUI\delete().

{
global $ilDB;
$query = 'DELETE FROM cal_notification '.
'WHERE cal_id = '.$ilDB->quote($a_cal_id,'integer');
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilCalendarUserNotification::deleteRecipients ( )

Delete all recipients ilDB $ilDB.

Returns
bool

Definition at line 162 of file class.ilCalendarUserNotification.php.

References $query, $res, and getEntryId().

Referenced by save().

{
global $ilDB;
$query = 'DELETE FROM cal_notification '.
'WHERE cal_id = '.$ilDB->quote($this->getEntryId(),'integer');
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCalendarUserNotification::deleteUser (   $a_usr_id)
static

Delete a singel user ilDB $ilDB.

Parameters
int$a_usr_id
Returns
bool

Definition at line 34 of file class.ilCalendarUserNotification.php.

References $query, and $res.

{
global $ilDB;
$query = 'DELETE FROM cal_notification '.
'WHERE user_id = '.$ilDB->quote($a_usr_id,'integer');
$res = $ilDB->manipulate($query);
return true;
}
ilCalendarUserNotification::getEntryId ( )

Get calendar entry id.

Definition at line 72 of file class.ilCalendarUserNotification.php.

References $cal_id.

Referenced by deleteRecipients(), and read().

{
return $this->cal_id;
}

+ Here is the caller graph for this function:

ilCalendarUserNotification::getRecipients ( )

Definition at line 77 of file class.ilCalendarUserNotification.php.

References $rcps.

Referenced by save(), and validate().

{
return (array) $this->rcps;
}

+ Here is the caller graph for this function:

ilCalendarUserNotification::read ( )
protected

Read recipients ilDB $ilDB.

Definition at line 178 of file class.ilCalendarUserNotification.php.

References $query, $res, $row, addRecipient(), DB_FETCHMODE_OBJECT, and getEntryId().

Referenced by __construct().

{
global $ilDB;
if(!$this->getEntryId())
{
return true;
}
$query = 'SELECT * FROM cal_notification '.
'WHERE cal_id = '.$ilDB->quote($this->getEntryId(),'integer');
$res = $ilDB->query($query);
$this->rcps = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->addRecipient(
$row->user_type,
$row->user_id,
$row->email
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarUserNotification::save ( )

Save recipients to db.

Definition at line 111 of file class.ilCalendarUserNotification.php.

References $query, deleteRecipients(), and getRecipients().

{
global $ilDB;
$this->deleteRecipients();
foreach($this->getRecipients() as $rcp)
{
$query = 'INSERT INTO cal_notification '.
'(notification_id,cal_id, user_type, user_id, email) '.
'VALUES ( '.
$ilDB->quote($ilDB->nextId('cal_notification'),'integer').', '.
$ilDB->quote((int) $this->getEntryId(),'integer').', '.
$ilDB->quote((int) $rcp['type'],'integer').', '.
$ilDB->quote((int) $rcp['usr_id'],'integer').', '.
$ilDB->quote($rcp['email'],'text').
')';
$ilDB->manipulate($query);
}
return true;
}

+ Here is the call graph for this function:

ilCalendarUserNotification::setEntryId (   $a_id)

Set calendar entry id.

Parameters
int$a_id

Definition at line 64 of file class.ilCalendarUserNotification.php.

{
$this->cal_id = $a_id;
}
ilCalendarUserNotification::setRecipients (   $a_rcps)

Set recipients.

Parameters
array$a_rcps

Definition at line 152 of file class.ilCalendarUserNotification.php.

{
$this->rcps = array();
}
ilCalendarUserNotification::validate ( )

Definition at line 82 of file class.ilCalendarUserNotification.php.

References $ilErr, $lng, getRecipients(), and ilUtil\is_email().

{
global $ilErr, $lng;
if(!count($this->getRecipients()))
{
return true;
}
foreach((array) $this->getRecipients() as $rcp_data)
{
if($rcp_data['type'] == self::TYPE_USER)
{
continue;
}
else
{
if(!ilUtil::is_email($rcp_data['email']))
{
$ilErr->appendMessage($lng->txt('cal_err_invalid_notification_rcps'));
return false;
}
}
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarUserNotification::$cal_id = 0
private

Definition at line 16 of file class.ilCalendarUserNotification.php.

Referenced by getEntryId().

ilCalendarUserNotification::$rcps = array()
private

Definition at line 17 of file class.ilCalendarUserNotification.php.

Referenced by getRecipients().


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