ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailValueObjectJsonService Class Reference
+ Collaboration diagram for ilMailValueObjectJsonService:

Public Member Functions

 convertToJson (array $mailValueObjects)
 
 convertFromJson (string $json)
 

Detailed Description

Member Function Documentation

◆ convertFromJson()

ilMailValueObjectJsonService::convertFromJson ( string  $json)
Parameters
string$json
Returns
ilMailValueObject[]

Definition at line 40 of file class.ilMailValueObjectJsonService.php.

References $result.

41  {
42  $result = array();
43  $array = json_decode($json, true);
44 
45  foreach ($array as $objectValues) {
46  $result[] = new ilMailValueObject(
47  $objectValues['from'],
48  $objectValues['recipients'],
49  $objectValues['recipients_cc'],
50  $objectValues['recipients_bcc'],
51  $objectValues['subject'],
52  $objectValues['body'],
53  $objectValues['attachments'],
54  $objectValues['is_using_placholders'],
55  $objectValues['should_save_in_sent_box']
56  );
57  }
58 
59  return $result;
60  }
$result

◆ convertToJson()

ilMailValueObjectJsonService::convertToJson ( array  $mailValueObjects)
Parameters
ilMailValueObject[]$mailValueObjects
Returns
string

Definition at line 14 of file class.ilMailValueObjectJsonService.php.

15  {
16  $mailArray = array();
17  foreach ($mailValueObjects as $mailValueObject) {
18  $array = array();
19 
20  $array['from'] = $mailValueObject->getFrom();
21  $array['recipients'] = $mailValueObject->getRecipients();
22  $array['recipients_cc'] = $mailValueObject->getRecipientsCC();
23  $array['recipients_bcc'] = $mailValueObject->getRecipientsBCC();
24  $array['attachments'] = $mailValueObject->getAttachments();
25  $array['body'] = $mailValueObject->getBody();
26  $array['subject'] = $mailValueObject->getSubject();
27  $array['is_using_placholders'] = $mailValueObject->isUsingPlaceholders();
28  $array['should_save_in_sent_box'] = $mailValueObject->shouldSaveInSentBox();
29 
30  $mailArray[] = $array;
31  }
32 
33  return json_encode($mailArray);
34  }

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