ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Settings\NewAccountMail\MailImplementation Class Reference
+ Inheritance diagram for ILIAS\User\Settings\NewAccountMail\MailImplementation:
+ Collaboration diagram for ILIAS\User\Settings\NewAccountMail\MailImplementation:

Public Member Functions

 __construct (private readonly string $lang_code, private readonly string $subject='', private readonly string $body='', private readonly string $salutation_none_specific='', private readonly string $salutation_male='', private readonly string $salutation_female='', private readonly ?string $attachment_rid=null, private readonly ?string $legacy_attachment_filename=null)
 
 getLangCode ()
 
 getSubject ()
 
 getBody ()
 
 getSalutationNoneSpecific ()
 
 getSalutationMale ()
 
 getSalutationFemale ()
 
 getAttachmentRid ()
 
 getAttachment (ResourceStorage $irss)
 
 deleteAttachmentTempFile ()
 
 toStorage ()
 
 getLangCode ()
 
 getSubject ()
 
 getBody ()
 
 getSalutationNoneSpecific ()
 
 getSalutationMale ()
 
 getSalutationFemale ()
 
 getAttachment (ResourceStorage $irss)
 

Private Member Functions

 ensureAttachmentFileExists (ResourceStorage $irss, ResourceIdentification $rid)
 

Private Attributes

string $temp_file_path
 

Detailed Description

Definition at line 26 of file MailImplementation.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Settings\NewAccountMail\MailImplementation::__construct ( private readonly string  $lang_code,
private readonly string  $subject = '',
private readonly string  $body = '',
private readonly string  $salutation_none_specific = '',
private readonly string  $salutation_male = '',
private readonly string  $salutation_female = '',
private readonly ?string  $attachment_rid = null,
private readonly ?string  $legacy_attachment_filename = null 
)

Definition at line 29 of file MailImplementation.php.

38 {
39 $this->temp_file_path = CLIENT_DATA_DIR . '/temp/namas/';
40 }
const CLIENT_DATA_DIR
Definition: constants.php:46

References CLIENT_DATA_DIR.

Member Function Documentation

◆ deleteAttachmentTempFile()

ILIAS\User\Settings\NewAccountMail\MailImplementation::deleteAttachmentTempFile ( )

Definition at line 109 of file MailImplementation.php.

109 : void
110 {
111 if (file_exists($this->temp_file_path . $this->lang_code)) {
112 unlink($this->temp_file_path . $this->lang_code);
113 }
114 }

◆ ensureAttachmentFileExists()

ILIAS\User\Settings\NewAccountMail\MailImplementation::ensureAttachmentFileExists ( ResourceStorage  $irss,
ResourceIdentification  $rid 
)
private

Definition at line 128 of file MailImplementation.php.

131 : void {
132 if (file_exists($this->temp_file_path . $this->lang_code)) {
133 return;
134 }
135
136 if (!file_exists($this->temp_file_path)) {
137 mkdir($this->temp_file_path);
138 }
139
140 file_put_contents(
141 $this->temp_file_path . $this->lang_code,
142 $irss->consume()->stream($rid)->getStream()->getContents()
143 );
144 }

Referenced by ILIAS\User\Settings\NewAccountMail\MailImplementation\getAttachment().

+ Here is the caller graph for this function:

◆ getAttachment()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getAttachment ( ResourceStorage  $irss)

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 77 of file MailImplementation.php.

77 : ?array
78 {
79 if ($this->attachment_rid !== null) {
80 $rid = $irss->manage()->find($this->attachment_rid);
81 if ($rid === null) {
82 return null;
83 }
84 $this->ensureAttachmentFileExists($irss, $rid);
85 return [
86 $this->temp_file_path . $this->lang_code,
87 $irss->manage()->getCurrentRevision($rid)->getTitle()
88 ];
89 }
90
91 if ($this->legacy_attachment_filename !== null) {
92 $path = '/' . implode(
93 '/',
94 array_map(
95 static fn(string $path_part): string => trim($path_part, '/'),
96 [
97 CLIENT_DATA_DIR . '/ilReg/reg_' . USER_FOLDER_ID,
98 $this->lang_code,
99 ]
100 )
101 );
102
103 return [$path, $this->legacy_attachment_filename];
104 }
105
106 return null;
107 }
ensureAttachmentFileExists(ResourceStorage $irss, ResourceIdentification $rid)
const USER_FOLDER_ID
Definition: constants.php:33
$path
Definition: ltiservices.php:30

References $path, CLIENT_DATA_DIR, ILIAS\User\Settings\NewAccountMail\MailImplementation\ensureAttachmentFileExists(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ getAttachmentRid()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getAttachmentRid ( )

Definition at line 72 of file MailImplementation.php.

72 : ?string
73 {
74 return $this->attachment_rid;
75 }

◆ getBody()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getBody ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 52 of file MailImplementation.php.

52 : string
53 {
54 return $this->body;
55 }

◆ getLangCode()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getLangCode ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 42 of file MailImplementation.php.

42 : string
43 {
44 return $this->lang_code;
45 }

◆ getSalutationFemale()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getSalutationFemale ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 67 of file MailImplementation.php.

67 : string
68 {
69 return $this->salutation_female;
70 }

◆ getSalutationMale()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getSalutationMale ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 62 of file MailImplementation.php.

62 : string
63 {
64 return $this->salutation_male;
65 }

◆ getSalutationNoneSpecific()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getSalutationNoneSpecific ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 57 of file MailImplementation.php.

57 : string
58 {
59 return $this->salutation_none_specific;
60 }

◆ getSubject()

ILIAS\User\Settings\NewAccountMail\MailImplementation::getSubject ( )

Implements ILIAS\User\Settings\NewAccountMail\Mail.

Definition at line 47 of file MailImplementation.php.

47 : string
48 {
49 return $this->subject;
50 }

◆ toStorage()

ILIAS\User\Settings\NewAccountMail\MailImplementation::toStorage ( )

Definition at line 116 of file MailImplementation.php.

116 : array
117 {
118 return [
119 'subject' => [\ilDBConstants::T_TEXT, $this->subject],
120 'body' => [\ilDBConstants::T_TEXT, $this->body],
121 'sal_f' => [\ilDBConstants::T_TEXT, $this->salutation_female],
122 'sal_m' => [\ilDBConstants::T_TEXT, $this->salutation_male],
123 'sal_g' => [\ilDBConstants::T_TEXT, $this->salutation_none_specific],
124 'att_rid' => [\ilDBConstants::T_TEXT, $this->attachment_rid]
125 ];
126 }

References ilDBConstants\T_TEXT.

Field Documentation

◆ $temp_file_path

string ILIAS\User\Settings\NewAccountMail\MailImplementation::$temp_file_path
private

Definition at line 28 of file MailImplementation.php.


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