Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
PKPEmailTemplateDAO.inc.php
1 <?php
2 
18 class PKPEmailTemplateDAO extends DAO {
22  function PKPEmailTemplateDAO() {
23  parent::DAO();
24  }
25 
33  function &getBaseEmailTemplate($emailKey, $assocType, $assocId) {
34  $result =& $this->retrieve(
35  'SELECT d.email_key,
36  d.can_edit,
37  d.can_disable,
38  COALESCE(e.enabled, 1) AS enabled,
39  e.email_id,
40  e.assoc_type,
41  e.assoc_id,
42  d.from_role_id,
43  d.to_role_id
44  FROM email_templates_default d
45  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
46  WHERE d.email_key = ?',
47  array($assocType, $assocId, $emailKey)
48  );
49 
50  $returner = null;
51  if ($result->RecordCount() != 0) {
52  $returner =& $this->_returnBaseEmailTemplateFromRow($result->GetRowAssoc(false));
53  }
54 
55  $result->Close();
56  unset($result);
57 
58  return $returner;
59  }
60 
68  function &getLocaleEmailTemplate($emailKey, $assocType, $assocId) {
69  $result =& $this->retrieve(
70  'SELECT d.email_key,
71  d.can_edit,
72  d.can_disable,
73  COALESCE(e.enabled, 1) AS enabled,
74  e.email_id,
75  e.assoc_type,
76  e.assoc_id,
77  d.from_role_id,
78  d.to_role_id
79  FROM email_templates_default d
80  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
81  WHERE d.email_key = ?',
82  array($assocType, $assocId, $emailKey)
83  );
84 
85  $returner = null;
86  if ($result->RecordCount() != 0) {
87  $returner =& $this->_returnLocaleEmailTemplateFromRow($result->GetRowAssoc(false));
88  } else {
89  $result->Close();
90  unset($result);
91 
92  // Check to see if there's a custom email template. This is done in PHP to avoid
93  // having to do a full outer join or union in SQL.
94  $result =& $this->retrieve(
95  'SELECT e.email_key,
96  1 AS can_edit,
97  1 AS can_disable,
98  e.enabled,
99  e.email_id,
100  e.assoc_type,
101  e.assoc_id,
102  NULL AS from_role_id,
103  NULL AS to_role_id
104  FROM email_templates e
105  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
106  WHERE d.email_key IS NULL AND
107  e.assoc_type = ? AND
108  e.assoc_id = ? AND
109  e.email_key = ?',
110  array($assocType, $assocId, $emailKey)
111  );
112  if ($result->RecordCount() != 0) {
113  $returner =& $this->_returnLocaleEmailTemplateFromRow($result->GetRowAssoc(false));
114  }
115  }
116 
117  $result->Close();
118  unset($result);
119 
120  return $returner;
121  }
122 
131  function &getEmailTemplate($emailKey, $locale, $assocType, $assocId) {
132  $primaryLocale = AppLocale::getPrimaryLocale();
133 
134  $result =& $this->retrieve(
135  'SELECT COALESCE(edl.subject, ddl.subject, edpl.subject, ddpl.subject) AS subject,
136  COALESCE(edl.body, ddl.body, edpl.body, ddpl.body) AS body,
137  COALESCE(e.enabled, 1) AS enabled,
138  d.email_key, d.can_edit, d.can_disable,
139  e.assoc_type, e.assoc_id, e.email_id,
140  COALESCE(ddl.locale, ddpl.locale) AS locale,
141  d.from_role_id, d.to_role_id
142  FROM email_templates_default d
143  LEFT JOIN email_templates_default_data ddpl ON (ddpl.email_key = d.email_key AND ddpl.locale = ?)
144  LEFT JOIN email_templates_default_data ddl ON (ddl.email_key = d.email_key AND ddl.locale = ?)
145  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
146  LEFT JOIN email_templates_data edpl ON (edpl.email_key = e.email_key AND edpl.assoc_type = e.assoc_type AND edpl.assoc_id = e.assoc_id AND edpl.locale = ?)
147  LEFT JOIN email_templates_data edl ON (edl.email_key = e.email_key AND edl.assoc_type = e.assoc_type AND edl.assoc_id = e.assoc_id AND edl.locale = ?)
148  WHERE d.email_key = ?',
149  array($primaryLocale, $locale, $assocType, $assocId, $primaryLocale, $locale, $emailKey)
150  );
151 
152  $returner = null;
153  if ($result->RecordCount() != 0) {
154  $returner =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false));
155  $returner->setCustomTemplate(false);
156  } else {
157  $result->Close();
158  unset($result);
159 
160  // Check to see if there's a custom email template. This is done in PHP to avoid
161  // having to do a full outer join or union in SQL.
162  $result =& $this->retrieve(
163  'SELECT ed.subject,
164  ed.body,
165  1 AS enabled,
166  e.email_key,
167  1 AS can_edit,
168  0 AS can_disable,
169  e.assoc_type,
170  e.assoc_id,
171  e.email_id,
172  ed.locale,
173  NULL AS from_role_id,
174  NULL AS to_role_id
175  FROM email_templates e
176  LEFT JOIN email_templates_data ed ON (ed.email_key = e.email_key AND ed.assoc_type = e.assoc_type AND ed.assoc_id = e.assoc_id)
177  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
178  WHERE d.email_key IS NULL AND
179  e.assoc_type = ? AND
180  e.assoc_id = ? AND
181  e.email_key = ? AND
182  ed.locale = ?',
183  array($assocType, $assocId, $emailKey, $locale)
184  );
185  if ($result->RecordCount() != 0) {
186  $returner =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false));
187  $returner->setCustomTemplate(true);
188  }
189  }
190 
191  $result->Close();
192  unset($result);
193 
194  return $returner;
195  }
196 
203  $emailTemplate = new BaseEmailTemplate();
204  $emailTemplate->setEmailId($row['email_id']);
205  $emailTemplate->setAssocType($row['assoc_type']);
206  $emailTemplate->setAssocId($row['assoc_id']);
207  $emailTemplate->setEmailKey($row['email_key']);
208  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
209  $emailTemplate->setCanDisable($row['can_disable']);
210  $emailTemplate->setFromRoleId($row['from_role_id']);
211  $emailTemplate->setToRoleId($row['to_role_id']);
212 
213  HookRegistry::call('EmailTemplateDAO::_returnBaseEmailTemplateFromRow', array(&$emailTemplate, &$row));
214 
215  return $emailTemplate;
216  }
217 
224  $emailTemplate = new LocaleEmailTemplate();
225  $emailTemplate->setEmailId($row['email_id']);
226  $emailTemplate->setAssocType($row['assoc_type']);
227  $emailTemplate->setAssocId($row['assoc_id']);
228  $emailTemplate->setEmailKey($row['email_key']);
229  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
230  $emailTemplate->setCanDisable($row['can_disable']);
231  $emailTemplate->setFromRoleId($row['from_role_id']);
232  $emailTemplate->setToRoleId($row['to_role_id']);
233 
234  $emailTemplate->setCustomTemplate(false);
235 
236  if (!HookRegistry::call('EmailTemplateDAO::_returnLocaleEmailTemplateFromRow', array(&$emailTemplate, &$row))) {
237  $result =& $this->retrieve(
238  'SELECT dd.locale,
239  dd.description,
240  COALESCE(ed.subject, dd.subject) AS subject,
241  COALESCE(ed.body, dd.body) AS body
242  FROM email_templates_default_data dd
243  LEFT JOIN email_templates_data ed ON (dd.email_key = ed.email_key AND dd.locale = ed.locale AND ed.assoc_type = ? AND ed.assoc_id = ?)
244  WHERE dd.email_key = ?',
245  array($row['assoc_type'], $row['assoc_id'], $row['email_key'])
246  );
247 
248  while (!$result->EOF) {
249  $dataRow =& $result->GetRowAssoc(false);
250  $emailTemplate->addLocale($dataRow['locale']);
251  $emailTemplate->setSubject($dataRow['locale'], $dataRow['subject']);
252  $emailTemplate->setBody($dataRow['locale'], $dataRow['body']);
253  $emailTemplate->setDescription($dataRow['locale'], $dataRow['description']);
254  $result->MoveNext();
255  }
256  $result->Close();
257  unset($result);
258 
259  // Retrieve custom email contents as well; this is done in PHP to avoid
260  // using a SQL outer join or union.
261  $result =& $this->retrieve(
262  'SELECT ed.locale,
263  ed.subject,
264  ed.body
265  FROM email_templates_data ed
266  LEFT JOIN email_templates_default_data dd ON (ed.email_key = dd.email_key AND dd.locale = ed.locale)
267  WHERE ed.assoc_type = ? AND
268  ed.assoc_id = ? AND
269  ed.email_key = ? AND
270  dd.email_key IS NULL',
271  array($row['assoc_type'], $row['assoc_id'], $row['email_key'])
272  );
273 
274  while (!$result->EOF) {
275  $dataRow =& $result->GetRowAssoc(false);
276  $emailTemplate->addLocale($dataRow['locale']);
277  $emailTemplate->setSubject($dataRow['locale'], $dataRow['subject']);
278  $emailTemplate->setBody($dataRow['locale'], $dataRow['body']);
279  $result->MoveNext();
280 
281  $emailTemplate->setCustomTemplate(true);
282  }
283 
284  $result->Close();
285  unset($result);
286  }
287 
288  return $emailTemplate;
289  }
290 
296  function &_returnEmailTemplateFromRow(&$row, $isCustomTemplate=null) {
297  $emailTemplate = new EmailTemplate();
298  $emailTemplate->setEmailId($row['email_id']);
299  $emailTemplate->setAssocType($row['assoc_type']);
300  $emailTemplate->setAssocId($row['assoc_id']);
301  $emailTemplate->setEmailKey($row['email_key']);
302  $emailTemplate->setLocale($row['locale']);
303  $emailTemplate->setSubject($row['subject']);
304  $emailTemplate->setBody($row['body']);
305  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
306  $emailTemplate->setCanDisable($row['can_disable']);
307  $emailTemplate->setFromRoleId($row['from_role_id']);
308  $emailTemplate->setToRoleId($row['to_role_id']);
309 
310  if ($isCustomTemplate !== null) {
311  $emailTemplate->setCustomTemplate($isCustomTemplate);
312  }
313 
314  HookRegistry::call('EmailTemplateDAO::_returnEmailTemplateFromRow', array(&$emailTemplate, &$row));
315 
316  return $emailTemplate;
317  }
318 
323  function insertBaseEmailTemplate(&$emailTemplate) {
324  return $this->update(
325  'INSERT INTO email_templates
326  (assoc_type, assoc_id, email_key, enabled)
327  VALUES
328  (?, ?, ?, ?)',
329  array(
330  $emailTemplate->getAssocType(),
331  $emailTemplate->getAssocId(),
332  $emailTemplate->getEmailKey(),
333  $emailTemplate->getEnabled() == null ? 0 : 1
334  )
335  );
336  $emailTemplate->setEmailId($this->getInsertEmailId());
337  return $emailTemplate->getEmailId();
338  }
339 
344  function updateBaseEmailTemplate(&$emailTemplate) {
345  return $this->update(
346  'UPDATE email_templates
347  SET enabled = ?
348  WHERE email_id = ?',
349  array(
350  $emailTemplate->getEnabled() == null ? 0 : 1,
351  $emailTemplate->getEmailId()
352  )
353  );
354  }
355 
360  function insertLocaleEmailTemplate(&$emailTemplate) {
361  $this->insertBaseEmailTemplate($emailTemplate);
362  return $this->updateLocaleEmailTemplateData($emailTemplate);
363  }
364 
369  function updateLocaleEmailTemplate(&$emailTemplate) {
370  $this->updateBaseEmailTemplate($emailTemplate);
371  return $this->updateLocaleEmailTemplateData($emailTemplate);
372  }
373 
378  function updateLocaleEmailTemplateData(&$emailTemplate) {
379  foreach ($emailTemplate->getLocales() as $locale) {
380  $result =& $this->retrieve(
381  'SELECT COUNT(*)
382  FROM email_templates_data
383  WHERE email_key = ? AND
384  locale = ? AND
385  assoc_type = ? AND
386  assoc_id = ?',
387  array(
388  $emailTemplate->getEmailKey(),
389  $locale,
390  $emailTemplate->getAssocType(),
391  $emailTemplate->getAssocId()
392  )
393  );
394 
395  if ($result->fields[0] == 0) {
396  $this->update(
397  'INSERT INTO email_templates_data
398  (email_key, locale, assoc_type, assoc_id, subject, body)
399  VALUES
400  (?, ?, ?, ?, ?, ?)',
401  array(
402  $emailTemplate->getEmailKey(),
403  $locale,
404  $emailTemplate->getAssocType(),
405  $emailTemplate->getAssocId(),
406  $emailTemplate->getSubject($locale),
407  $emailTemplate->getBody($locale)
408  )
409  );
410 
411  } else {
412  $this->update(
413  'UPDATE email_templates_data
414  SET subject = ?,
415  body = ?
416  WHERE email_key = ? AND
417  locale = ? AND
418  assoc_type = ? AND
419  assoc_id = ?',
420  array(
421  $emailTemplate->getSubject($locale),
422  $emailTemplate->getBody($locale),
423  $emailTemplate->getEmailKey(),
424  $locale,
425  $emailTemplate->getAssocType(),
426  $emailTemplate->getAssocId()
427  )
428  );
429  }
430 
431  $result->Close();
432  unset($result);
433  }
434  }
435 
442  function deleteEmailTemplateByKey($emailKey, $assocType, $assocId) {
443  $this->update(
444  'DELETE FROM email_templates_data WHERE email_key = ? AND assoc_type = ? AND assoc_id = ?',
445  array($emailKey, $assocType, $assocId)
446  );
447  return $this->update(
448  'DELETE FROM email_templates WHERE email_key = ? AND assoc_type = ? AND assoc_id = ?',
449  array($emailKey, $assocType, $assocId)
450  );
451  }
452 
461  function &getEmailTemplates($locale, $assocType, $assocId, $rangeInfo = null) {
462  $emailTemplates = array();
463 
464  $result =& $this->retrieveRange(
465  'SELECT COALESCE(ed.subject, dd.subject) AS subject,
466  COALESCE(ed.body, dd.body) AS body,
467  COALESCE(e.enabled, 1) AS enabled,
468  d.email_key, d.can_edit, d.can_disable,
469  e.assoc_type, e.assoc_id, e.email_id,
470  dd.locale,
471  d.from_role_id, d.to_role_id
472  FROM email_templates_default d
473  LEFT JOIN email_templates_default_data dd ON (dd.email_key = d.email_key)
474  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
475  LEFT JOIN email_templates_data ed ON (ed.email_key = e.email_key AND ed.assoc_type = e.assoc_type AND ed.assoc_id = e.assoc_id AND ed.locale = dd.locale)
476  WHERE dd.locale = ?',
477  array($assocType, $assocId, $locale),
478  $rangeInfo
479  );
480 
481  while (!$result->EOF) {
482  $emailTemplates[] =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false), false);
483  $result->MoveNext();
484  }
485  $result->Close();
486  unset($result);
487 
488  // Fetch custom email templates as well; this is done in PHP
489  // to avoid a union or full outer join call in SQL.
490  $result =& $this->retrieve(
491  'SELECT ed.subject,
492  ed.body,
493  e.enabled,
494  e.email_key,
495  1 AS can_edit,
496  1 AS can_disable,
497  e.assoc_type,
498  e.assoc_id,
499  e.email_id,
500  ed.locale,
501  NULL AS from_role_id,
502  NULL AS to_role_id
503  FROM email_templates e
504  LEFT JOIN email_templates_data ed ON (e.email_key = ed.email_key AND ed.assoc_type = e.assoc_type AND ed.assoc_id = e.assoc_id AND ed.locale = ?)
505  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
506  WHERE e.assoc_type = ? AND
507  e.assoc_id = ? AND
508  d.email_key IS NULL',
509  array($locale, $assocType, $assocId)
510  );
511 
512  while (!$result->EOF) {
513  $row = $result->getRowAssoc(false);
514  $emailTemplates[] =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false), true);
515  $result->MoveNext();
516  }
517  $result->Close();
518  unset($result);
519 
520  // Sort all templates by email key.
521  $compare = create_function('$t1, $t2', 'return strcmp($t1->getEmailKey(), $t2->getEmailKey());');
522  usort ($emailTemplates, $compare);
523 
524  return $emailTemplates;
525  }
526 
531  function getInsertEmailId() {
532  return $this->getInsertId('email_templates', 'emailId');
533  }
534 
540  function deleteEmailTemplatesByAssoc($assocType, $assocId) {
541  $this->update(
542  'DELETE FROM email_templates_data WHERE assoc_type = ? AND assoc_id = ?', array($assocType, $assocId)
543  );
544  return $this->update(
545  'DELETE FROM email_templates WHERE assoc_type = ? AND assoc_id = ?', array($assocType, $assocId)
546  );
547  }
548 
553  function deleteEmailTemplatesByLocale($locale) {
554  $this->update(
555  'DELETE FROM email_templates_data WHERE locale = ?', $locale
556  );
557  }
558 
564  $this->update(
565  'DELETE FROM email_templates_default_data WHERE locale = ?', $locale
566  );
567  }
568 
577  function templateExistsByKey($emailKey, $assocType = null, $assocId = null) {
578  if ($assocType !== null) {
579  $result =& $this->retrieve(
580  'SELECT COUNT(*)
581  FROM email_templates
582  WHERE email_key = ? AND
583  assoc_type = ? AND
584  assoc_id = ?',
585  array(
586  $emailKey,
587  $assocType,
588  $assocId
589  )
590  );
591  if (isset($result->fields[0]) && $result->fields[0] != 0) {
592  $result->Close();
593  unset($result);
594  return true;
595  }
596 
597  $result->Close();
598  unset($result);
599  }
600 
601  $result =& $this->retrieve(
602  'SELECT COUNT(*)
603  FROM email_templates_default
604  WHERE email_key = ?',
605  $emailKey
606  );
607  if (isset($result->fields[0]) && $result->fields[0] != 0) {
608  $returner = true;
609  } else {
610  $returner = false;
611  }
612 
613  $result->Close();
614  unset($result);
615 
616  return $returner;
617  }
618 
627  function customTemplateExistsByKey($emailKey, $assocType, $assocId) {
628  $result =& $this->retrieve(
629  'SELECT COUNT(*)
630  FROM email_templates e
631  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
632  WHERE e.email_key = ? AND
633  d.email_key IS NULL AND
634  e.assoc_type = ? AND
635  e.assoc_id = ?',
636  array(
637  $emailKey,
638  $assocType,
639  $assocId
640  )
641  );
642  $returner = (isset($result->fields[0]) && $result->fields[0] != 0);
643 
644  $result->Close();
645  unset($result);
646 
647  return $returner;
648  }
649 
650  function getMainEmailTemplatesFilename() {
651  return 'registry/emailTemplates.xml';
652  }
653 
654  function getMainEmailTemplateDataFilename($locale = null) {
655  if ($locale !== null && !PKPLocale::isLocaleValid($locale)) return null;
656  if ($locale === null) $locale = '{$installedLocale}';
657  return "locale/$locale/emailTemplates.xml";
658  }
659 
675  function installEmailTemplates($templatesFile, $returnSql = false, $emailKey = null, $skipExisting = false) {
676  $xmlDao = new XMLDAO();
677  $sql = array();
678  $data = $xmlDao->parseStruct($templatesFile, array('email'));
679  if (!isset($data['email'])) return false;
680  foreach ($data['email'] as $entry) {
681  $attrs = $entry['attributes'];
682  if ($emailKey && $emailKey != $attrs['key']) continue;
683  if ($skipExisting && $this->templateExistsByKey($attrs['key'])) continue;
684  $dataSource = $this->getDataSource();
685  $sql[] = 'INSERT INTO email_templates_default
686  (email_key, can_disable, can_edit, from_role_id, to_role_id)
687  VALUES
688  (' .
689  $dataSource->qstr($attrs['key']) . ', ' .
690  ($attrs['can_disable']?1:0) . ', ' .
691  ($attrs['can_edit']?1:0) . ', ' .
692  (isset($attrs['from_role_id'])?((int) $attrs['from_role_id']):'null') . ', ' .
693  (isset($attrs['to_role_id'])?((int) $attrs['to_role_id']):'null') .
694  ")";
695  if (!$returnSql) {
696  $this->update(array_shift($sql));
697  }
698  }
699  if ($returnSql) return $sql;
700  return true;
701  }
702 
714  function installEmailTemplateData($templateDataFile, $returnSql = false, $emailKey = null) {
715  $xmlDao = new XMLDAO();
716  $sql = array();
717  $data = $xmlDao->parse($templateDataFile, array('email_texts', 'email_text', 'subject', 'body', 'description'));
718  if (!$data) return false;
719  $locale = $data->getAttribute('locale');
720 
721  foreach ($data->getChildren() as $emailNode) {
722  if ($emailKey && $emailKey != $emailNode->getAttribute('key')) continue;
723  $dataSource = $this->getDataSource();
724  $sql[] = 'DELETE FROM email_templates_default_data WHERE email_key = ' . $dataSource->qstr($emailNode->getAttribute('key')) . ' AND locale = ' . $dataSource->qstr($locale);
725  if (!$returnSql) {
726  $this->update(array_shift($sql));
727  }
728 
729  $sql[] = 'INSERT INTO email_templates_default_data
730  (email_key, locale, subject, body, description)
731  VALUES
732  (' .
733  $dataSource->qstr($emailNode->getAttribute('key')) . ', ' .
734  $dataSource->qstr($locale) . ', ' .
735  $dataSource->qstr($emailNode->getChildValue('subject')) . ', ' .
736  $dataSource->qstr($emailNode->getChildValue('body')) . ', ' .
737  $dataSource->qstr($emailNode->getChildValue('description')) .
738  ")";
739  if (!$returnSql) {
740  $this->update(array_shift($sql));
741  }
742  }
743  if ($returnSql) return $sql;
744  return true;
745  }
746 }
747 
748 ?>
templateExistsByKey($emailKey, $assocType=null, $assocId=null)
isLocaleValid($locale)
& getEmailTemplate($emailKey, $locale, $assocType, $assocId)
updateLocaleEmailTemplate(&$emailTemplate)
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:29
Operations for retrieving and modifying Email Template objects.
updateBaseEmailTemplate(&$emailTemplate)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:83
installEmailTemplates($templatesFile, $returnSql=false, $emailKey=null, $skipExisting=false)
getInsertId($table= '', $id= '', $callHooks=true)
Definition: DAO.inc.php:252
Operations for retrieving and modifying objects from an XML data source.
Definition: XMLDAO.inc.php:19
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:176
& getEmailTemplates($locale, $assocType, $assocId, $rangeInfo=null)
customTemplateExistsByKey($emailKey, $assocType, $assocId)
& getDataSource()
Definition: DAO.inc.php:37
& getBaseEmailTemplate($emailKey, $assocType, $assocId)
deleteEmailTemplateByKey($emailKey, $assocType, $assocId)
call($hookName, $args=null)
& _returnEmailTemplateFromRow(&$row, $isCustomTemplate=null)
deleteEmailTemplatesByAssoc($assocType, $assocId)
updateLocaleEmailTemplateData(&$emailTemplate)
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:211
insertBaseEmailTemplate(&$emailTemplate)
Describes basic email template properties.
insertLocaleEmailTemplate(&$emailTemplate)
& getLocaleEmailTemplate($emailKey, $assocType, $assocId)
installEmailTemplateData($templateDataFile, $returnSql=false, $emailKey=null)