ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailTemplateDataProvider Class Reference

Class ilMailTemplateDataProvider. More...

+ Collaboration diagram for ilMailTemplateDataProvider:

Public Member Functions

 __construct ()
 
 getTableData ()
 
 getTemplateById ($tpl_id)
 
 getTemplateByContexId ($context_id)
 
 deleteTemplates ($tpl_ids=array())
 

Protected Attributes

 $mail_templates = array()
 

Private Member Functions

 read ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailTemplateDataProvider::__construct ( )

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

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteTemplates()

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

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

References $ilDB.

79  {
80  global $ilDB;
81 
82  if(count($tpl_ids) > 0)
83  {
84  $ilDB->manipulate('
85  DELETE FROM mail_man_tpl WHERE ' .
86  $ilDB->in('tpl_id', $tpl_ids, false, 'integer')
87  );
88  }
89  }
global $ilDB

◆ getTableData()

ilMailTemplateDataProvider::getTableData ( )
Returns
array

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

References array.

40  {
41  $list = array();
42  foreach($this->mail_templates as $objMailTpl)
43  {
44  $list[] = array(
45  'tpl_id' => $objMailTpl->getTplId(),
46  'title' => $objMailTpl->getTitle(),
47  'context' => $objMailTpl->getContext(),
48  'lang' => $objMailTpl->getLang()
49  );
50  }
51 
52  return $list;
53  }
Create styles array
The data for the language used.

◆ getTemplateByContexId()

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

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

References ilMailTemplate\getContext().

69  {
70  return array_filter($this->mail_templates, function(ilMailTemplate $template) use ($context_id) {
71  return $context_id === $template->getContext();
72  });
73  }
Class ilMailTemplate.
+ Here is the call graph for this function:

◆ getTemplateById()

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

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

60  {
61  return $this->mail_templates[$tpl_id];
62  }

◆ read()

ilMailTemplateDataProvider::read ( )
private

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

References $ilDB, $res, and $row.

Referenced by __construct().

26  {
27  global $ilDB;
28 
29  $res = $ilDB->query('SELECT * FROM mail_man_tpl');
30  while($row = $ilDB->fetchAssoc($res))
31  {
32  $this->mail_templates[$row['tpl_id']] = new ilMailTemplate($row);
33  }
34  }
Class ilMailTemplate.
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ $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: