ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailTemplateDataProvider Class Reference

Class ilMailTemplateDataProvider. More...

+ Collaboration diagram for ilMailTemplateDataProvider:

Public Member Functions

 __construct ()
 ilMailTemplateDataProvider constructor. More...
 
 getTableData ()
 
 getTemplateById ($tpl_id)
 
 getTemplateByContextId ($context_id)
 
 deleteTemplates ($tpl_ids=array())
 

Protected Attributes

 $mail_templates = array()
 
 $db
 

Private Member Functions

 read ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailTemplateDataProvider::__construct ( )

ilMailTemplateDataProvider constructor.

Definition at line 25 of file class.ilMailTemplateDataProvider.php.

References $DIC, and read().

26  {
27  global $DIC;
28 
29  $this->db = $DIC->database();
30 
31  $this->read();
32  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteTemplates()

ilMailTemplateDataProvider::deleteTemplates (   $tpl_ids = array())
Parameters
array$tpl_ids

Definition at line 86 of file class.ilMailTemplateDataProvider.php.

87  {
88  if (count($tpl_ids) > 0) {
89  $this->db->manipulate(
90  '
91  DELETE FROM mail_man_tpl WHERE ' .
92  $this->db->in('tpl_id', $tpl_ids, false, 'integer')
93  );
94  }
95  }

◆ getTableData()

ilMailTemplateDataProvider::getTableData ( )
Returns
array

Definition at line 48 of file class.ilMailTemplateDataProvider.php.

References $list, and array.

49  {
50  $list = array();
51  foreach ($this->mail_templates as $objMailTpl) {
52  $list[] = array(
53  'tpl_id' => $objMailTpl->getTplId(),
54  'title' => $objMailTpl->getTitle(),
55  'context' => $objMailTpl->getContext(),
56  'lang' => $objMailTpl->getLang()
57  );
58  }
59 
60  return $list;
61  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
Create styles array
The data for the language used.

◆ getTemplateByContextId()

ilMailTemplateDataProvider::getTemplateByContextId (   $context_id)
Parameters
int$context_id
Returns
ilMailTemplate[]

Definition at line 76 of file class.ilMailTemplateDataProvider.php.

References $template, and ilMailTemplate\getContext().

77  {
78  return array_filter($this->mail_templates, function (ilMailTemplate $template) use ($context_id) {
79  return $context_id === $template->getContext();
80  });
81  }
$template
Class ilMailTemplate.
+ Here is the call graph for this function:

◆ getTemplateById()

ilMailTemplateDataProvider::getTemplateById (   $tpl_id)
Parameters
int$tpl_id
Returns
ilMailTemplate

Definition at line 67 of file class.ilMailTemplateDataProvider.php.

68  {
69  return $this->mail_templates[$tpl_id];
70  }

◆ read()

ilMailTemplateDataProvider::read ( )
private

Definition at line 37 of file class.ilMailTemplateDataProvider.php.

References $res, and $row.

Referenced by __construct().

38  {
39  $res = $this->db->query('SELECT * FROM mail_man_tpl');
40  while ($row = $this->db->fetchAssoc($res)) {
41  $this->mail_templates[$row['tpl_id']] = new ilMailTemplate($row);
42  }
43  }
Class ilMailTemplate.
foreach($_POST as $key=> $value) $res
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilMailTemplateDataProvider::$db
protected

Definition at line 20 of file class.ilMailTemplateDataProvider.php.

◆ $mail_templates

ilMailTemplateDataProvider::$mail_templates = array()
protected

Definition at line 15 of file class.ilMailTemplateDataProvider.php.


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