CMS  Version 3.9
event_invitation.inc
Go to the documentation of this file.
1 <?php
7 Fakoli::using("settings");
8 
9 class EventInvitation extends DataItem
10 {
11  var $fields = array(
12  "event_invitation_id" => Number,
13  "event_id" => Number,
14  "sender_email" => String,
15  "sender_name" => String,
16  "subject" => String,
17  "message" => HTML,
18  "sequence_id" => Number,
19  );
20 
21  var $relations = array(
22  "Event" => Event,
23  "Recipients" => EventRecipient,
24  );
25 
26 
27  function Event()
28  {
29  return $this->getRelated(Event);
30  }
31 
32  function Recipients($constraint = "")
33  {
34  return $this->getRelatedList(EventRecipient, "", $constraint);
35  }
36 
37  static function create(&$event)
38  {
39  global $user;
40 
41  $invitation = new EventInvitation();
42  $invitation->event_id = $event->event_id;
43  $invitation->sender_email = $user->email;
44  $invitation->sender_name = $user->format("{first_name} {last_name}");
45  $invitation->subject = Settings::getValue("settings", "sitename") . " Event Invitation: {$event->title}";
46  $invitation->save();
47 
48  $event->event_invitation_id = $invitation->event_invitation_id;
49  $event->filter = new InclusionFilter("event_invitation_id");
50  $event->save();
51 
52  return $invitation;
53  }
54 
55  function __construct()
56  {
57  $this->table = "event_invitation";
58  $this->primary_key = "event_invitation_id";
59  $this->DataItem(func_get_args());
60  }
61 }?>
$constraint
$event
Definition: event_form.inc:46
Defines the Event class.
Definition: event.inc:43
Recipients($constraint="")
static create(&$event)
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104
global $user