ocs  2.3.6
About: OCS (Open Conference System) is a Web publishing tool that will create a complete Web presence for your scholarly conference.
  Fossies Dox: ocs-2.3.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

PKPEmailTemplateDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 // $Id$
17 
18 
19 class PKPEmailTemplateDAO extends DAO {
27  function &getBaseEmailTemplate($emailKey, $assocType, $assocId) {
28  $result =& $this->retrieve(
29  'SELECT d.email_key,
30  d.can_edit,
31  d.can_disable,
32  COALESCE(e.enabled, 1) AS enabled,
33  e.email_id,
34  e.assoc_type,
35  e.assoc_id,
36  d.from_role_id,
37  d.to_role_id
38  FROM email_templates_default d
39  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
40  WHERE d.email_key = ?',
41  array($assocType, $assocId, $emailKey)
42  );
43 
44  $returner = null;
45  if ($result->RecordCount() != 0) {
46  $returner =& $this->_returnBaseEmailTemplateFromRow($result->GetRowAssoc(false));
47  }
48 
49  $result->Close();
50  unset($result);
51 
52  return $returner;
53  }
54 
62  function &getLocaleEmailTemplate($emailKey, $assocType, $assocId) {
63  $result =& $this->retrieve(
64  'SELECT d.email_key,
65  d.can_edit,
66  d.can_disable,
67  COALESCE(e.enabled, 1) AS enabled,
68  e.email_id,
69  e.assoc_type,
70  e.assoc_id,
71  d.from_role_id,
72  d.to_role_id
73  FROM email_templates_default d
74  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
75  WHERE d.email_key = ?',
76  array($assocType, $assocId, $emailKey)
77  );
78 
79  $returner = null;
80  if ($result->RecordCount() != 0) {
81  $returner =& $this->_returnLocaleEmailTemplateFromRow($result->GetRowAssoc(false));
82  } else {
83  $result->Close();
84  unset($result);
85 
86  // Check to see if there's a custom email template. This is done in PHP to avoid
87  // having to do a full outer join or union in SQL.
88  $result =& $this->retrieve(
89  'SELECT e.email_key,
90  1 AS can_edit,
91  1 AS can_disable,
92  e.enabled,
93  e.email_id,
94  e.assoc_type,
95  e.assoc_id,
96  NULL AS from_role_id,
97  NULL AS to_role_id
98  FROM email_templates e
99  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
100  WHERE d.email_key IS NULL AND
101  e.assoc_type = ? AND
102  e.assoc_id = ? AND
103  e.email_key = ?',
104  array($assocType, $assocId, $emailKey)
105  );
106  if ($result->RecordCount() != 0) {
107  $returner =& $this->_returnLocaleEmailTemplateFromRow($result->GetRowAssoc(false));
108  }
109  }
110 
111  $result->Close();
112  unset($result);
113 
114  return $returner;
115  }
116 
125  function &getEmailTemplate($emailKey, $locale, $assocType, $assocId) {
126  $primaryLocale = AppLocale::getPrimaryLocale();
127 
128  $result =& $this->retrieve(
129  'SELECT COALESCE(edl.subject, ddl.subject, edpl.subject, ddpl.subject) AS subject,
130  COALESCE(edl.body, ddl.body, edpl.body, ddpl.body) AS body,
131  COALESCE(e.enabled, 1) AS enabled,
132  d.email_key, d.can_edit, d.can_disable,
133  e.assoc_type, e.assoc_id, e.email_id,
134  COALESCE(ddl.locale, ddpl.locale) AS locale,
135  d.from_role_id, d.to_role_id
136  FROM email_templates_default d
137  LEFT JOIN email_templates_default_data ddpl ON (ddpl.email_key = d.email_key AND ddpl.locale = ?)
138  LEFT JOIN email_templates_default_data ddl ON (ddl.email_key = d.email_key AND ddl.locale = ?)
139  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
140  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 = ?)
141  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 = ?)
142  WHERE d.email_key = ?',
143  array($primaryLocale, $locale, $assocType, $assocId, $primaryLocale, $locale, $emailKey)
144  );
145 
146  $returner = null;
147  if ($result->RecordCount() != 0) {
148  $returner =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false));
149  $returner->setCustomTemplate(false);
150  } else {
151  $result->Close();
152  unset($result);
153 
154  // Check to see if there's a custom email template. This is done in PHP to avoid
155  // having to do a full outer join or union in SQL.
156  $result =& $this->retrieve(
157  'SELECT ed.subject,
158  ed.body,
159  1 AS enabled,
160  e.email_key,
161  1 AS can_edit,
162  0 AS can_disable,
163  e.assoc_type,
164  e.assoc_id,
165  e.email_id,
166  ed.locale,
167  NULL AS from_role_id,
168  NULL AS to_role_id
169  FROM email_templates e
170  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)
171  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
172  WHERE d.email_key IS NULL AND
173  e.assoc_type = ? AND
174  e.assoc_id = ? AND
175  e.email_key = ? AND
176  ed.locale = ?',
177  array($assocType, $assocId, $emailKey, $locale)
178  );
179  if ($result->RecordCount() != 0) {
180  $returner =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false));
181  $returner->setCustomTemplate(true);
182  }
183  }
184 
185  $result->Close();
186  unset($result);
187 
188  return $returner;
189  }
190 
197  $emailTemplate = new BaseEmailTemplate();
198  $emailTemplate->setEmailId($row['email_id']);
199  $emailTemplate->setAssocType($row['assoc_type']);
200  $emailTemplate->setAssocId($row['assoc_id']);
201  $emailTemplate->setEmailKey($row['email_key']);
202  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
203  $emailTemplate->setCanDisable($row['can_disable']);
204  $emailTemplate->setFromRoleId($row['from_role_id']);
205  $emailTemplate->setToRoleId($row['to_role_id']);
206 
207  HookRegistry::call('EmailTemplateDAO::_returnBaseEmailTemplateFromRow', array(&$emailTemplate, &$row));
208 
209  return $emailTemplate;
210  }
211 
218  $emailTemplate = new LocaleEmailTemplate();
219  $emailTemplate->setEmailId($row['email_id']);
220  $emailTemplate->setAssocType($row['assoc_type']);
221  $emailTemplate->setAssocId($row['assoc_id']);
222  $emailTemplate->setEmailKey($row['email_key']);
223  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
224  $emailTemplate->setCanDisable($row['can_disable']);
225  $emailTemplate->setFromRoleId($row['from_role_id']);
226  $emailTemplate->setToRoleId($row['to_role_id']);
227 
228  $emailTemplate->setCustomTemplate(false);
229 
230  if (!HookRegistry::call('EmailTemplateDAO::_returnLocaleEmailTemplateFromRow', array(&$emailTemplate, &$row))) {
231  $result =& $this->retrieve(
232  'SELECT dd.locale,
233  dd.description,
234  COALESCE(ed.subject, dd.subject) AS subject,
235  COALESCE(ed.body, dd.body) AS body
236  FROM email_templates_default_data dd
237  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 = ?)
238  WHERE dd.email_key = ?',
239  array($row['assoc_type'], $row['assoc_id'], $row['email_key'])
240  );
241 
242  while (!$result->EOF) {
243  $dataRow =& $result->GetRowAssoc(false);
244  $emailTemplate->addLocale($dataRow['locale']);
245  $emailTemplate->setSubject($dataRow['locale'], $dataRow['subject']);
246  $emailTemplate->setBody($dataRow['locale'], $dataRow['body']);
247  $emailTemplate->setDescription($dataRow['locale'], $dataRow['description']);
248  $result->MoveNext();
249  }
250  $result->Close();
251  unset($result);
252 
253  // Retrieve custom email contents as well; this is done in PHP to avoid
254  // using a SQL outer join or union.
255  $result =& $this->retrieve(
256  'SELECT ed.locale,
257  ed.subject,
258  ed.body
259  FROM email_templates_data ed
260  LEFT JOIN email_templates_default_data dd ON (ed.email_key = dd.email_key AND dd.locale = ed.locale)
261  WHERE ed.assoc_type = ? AND
262  ed.assoc_id = ? AND
263  ed.email_key = ? AND
264  dd.email_key IS NULL',
265  array($row['assoc_type'], $row['assoc_id'], $row['email_key'])
266  );
267 
268  while (!$result->EOF) {
269  $dataRow =& $result->GetRowAssoc(false);
270  $emailTemplate->addLocale($dataRow['locale']);
271  $emailTemplate->setSubject($dataRow['locale'], $dataRow['subject']);
272  $emailTemplate->setBody($dataRow['locale'], $dataRow['body']);
273  $result->MoveNext();
274 
275  $emailTemplate->setCustomTemplate(true);
276  }
277 
278  $result->Close();
279  unset($result);
280  }
281 
282  return $emailTemplate;
283  }
284 
290  function &_returnEmailTemplateFromRow(&$row, $isCustomTemplate=null) {
291  $emailTemplate = new EmailTemplate();
292  $emailTemplate->setEmailId($row['email_id']);
293  $emailTemplate->setAssocType($row['assoc_type']);
294  $emailTemplate->setAssocId($row['assoc_id']);
295  $emailTemplate->setEmailKey($row['email_key']);
296  $emailTemplate->setLocale($row['locale']);
297  $emailTemplate->setSubject($row['subject']);
298  $emailTemplate->setBody($row['body']);
299  $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
300  $emailTemplate->setCanDisable($row['can_disable']);
301  $emailTemplate->setFromRoleId($row['from_role_id']);
302  $emailTemplate->setToRoleId($row['to_role_id']);
303 
304  if ($isCustomTemplate !== null) {
305  $emailTemplate->setCustomTemplate($isCustomTemplate);
306  }
307 
308  HookRegistry::call('EmailTemplateDAO::_returnEmailTemplateFromRow', array(&$emailTemplate, &$row));
309 
310  return $emailTemplate;
311  }
312 
317  function insertBaseEmailTemplate(&$emailTemplate) {
318  return $this->update(
319  'INSERT INTO email_templates
320  (assoc_type, assoc_id, email_key, enabled)
321  VALUES
322  (?, ?, ?, ?)',
323  array(
324  $emailTemplate->getAssocType(),
325  $emailTemplate->getAssocId(),
326  $emailTemplate->getEmailKey(),
327  $emailTemplate->getEnabled() == null ? 0 : 1
328  )
329  );
330  $emailTemplate->setEmailId($this->getInsertEmailId());
331  return $emailTemplate->getEmailId();
332  }
333 
338  function updateBaseEmailTemplate(&$emailTemplate) {
339  return $this->update(
340  'UPDATE email_templates
341  SET enabled = ?
342  WHERE email_id = ?',
343  array(
344  $emailTemplate->getEnabled() == null ? 0 : 1,
345  $emailTemplate->getEmailId()
346  )
347  );
348  }
349 
354  function insertLocaleEmailTemplate(&$emailTemplate) {
355  $this->insertBaseEmailTemplate($emailTemplate);
356  return $this->updateLocaleEmailTemplateData($emailTemplate);
357  }
358 
363  function updateLocaleEmailTemplate(&$emailTemplate) {
364  $this->updateBaseEmailTemplate($emailTemplate);
365  return $this->updateLocaleEmailTemplateData($emailTemplate);
366  }
367 
372  function updateLocaleEmailTemplateData(&$emailTemplate) {
373  foreach ($emailTemplate->getLocales() as $locale) {
374  $result =& $this->retrieve(
375  'SELECT COUNT(*)
376  FROM email_templates_data
377  WHERE email_key = ? AND
378  locale = ? AND
379  assoc_type = ? AND
380  assoc_id = ?',
381  array(
382  $emailTemplate->getEmailKey(),
383  $locale,
384  $emailTemplate->getAssocType(),
385  $emailTemplate->getAssocId()
386  )
387  );
388 
389  if ($result->fields[0] == 0) {
390  $this->update(
391  'INSERT INTO email_templates_data
392  (email_key, locale, assoc_type, assoc_id, subject, body)
393  VALUES
394  (?, ?, ?, ?, ?, ?)',
395  array(
396  $emailTemplate->getEmailKey(),
397  $locale,
398  $emailTemplate->getAssocType(),
399  $emailTemplate->getAssocId(),
400  $emailTemplate->getSubject($locale),
401  $emailTemplate->getBody($locale)
402  )
403  );
404 
405  } else {
406  $this->update(
407  'UPDATE email_templates_data
408  SET subject = ?,
409  body = ?
410  WHERE email_key = ? AND
411  locale = ? AND
412  assoc_type = ? AND
413  assoc_id = ?',
414  array(
415  $emailTemplate->getSubject($locale),
416  $emailTemplate->getBody($locale),
417  $emailTemplate->getEmailKey(),
418  $locale,
419  $emailTemplate->getAssocType(),
420  $emailTemplate->getAssocId()
421  )
422  );
423  }
424 
425  $result->Close();
426  unset($result);
427  }
428  }
429 
436  function deleteEmailTemplateByKey($emailKey, $assocType, $assocId) {
437  $this->update(
438  'DELETE FROM email_templates_data WHERE email_key = ? AND assoc_type = ? AND assoc_id = ?',
439  array($emailKey, $assocType, $assocId)
440  );
441  return $this->update(
442  'DELETE FROM email_templates WHERE email_key = ? AND assoc_type = ? AND assoc_id = ?',
443  array($emailKey, $assocType, $assocId)
444  );
445  }
446 
455  function &getEmailTemplates($locale, $assocType, $assocId, $rangeInfo = null) {
456  $emailTemplates = array();
457 
458  $result =& $this->retrieveRange(
459  'SELECT COALESCE(ed.subject, dd.subject) AS subject,
460  COALESCE(ed.body, dd.body) AS body,
461  COALESCE(e.enabled, 1) AS enabled,
462  d.email_key, d.can_edit, d.can_disable,
463  e.assoc_type, e.assoc_id, e.email_id,
464  dd.locale,
465  d.from_role_id, d.to_role_id
466  FROM email_templates_default d
467  LEFT JOIN email_templates_default_data dd ON (dd.email_key = d.email_key)
468  LEFT JOIN email_templates e ON (d.email_key = e.email_key AND e.assoc_type = ? AND e.assoc_id = ?)
469  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)
470  WHERE dd.locale = ?',
471  array($assocType, $assocId, $locale),
472  $rangeInfo
473  );
474 
475  while (!$result->EOF) {
476  $emailTemplates[] =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false), false);
477  $result->moveNext();
478  }
479  $result->Close();
480  unset($result);
481 
482  // Fetch custom email templates as well; this is done in PHP
483  // to avoid a union or full outer join call in SQL.
484  $result =& $this->retrieve(
485  'SELECT ed.subject,
486  ed.body,
487  e.enabled,
488  e.email_key,
489  1 AS can_edit,
490  1 AS can_disable,
491  e.assoc_type,
492  e.assoc_id,
493  e.email_id,
494  ed.locale,
495  NULL AS from_role_id,
496  NULL AS to_role_id
497  FROM email_templates e
498  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 = ?)
499  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
500  WHERE e.assoc_type = ? AND
501  e.assoc_id = ? AND
502  d.email_key IS NULL',
503  array($locale, $assocType, $assocId)
504  );
505 
506  while (!$result->EOF) {
507  $row = $result->getRowAssoc(false);
508  $emailTemplates[] =& $this->_returnEmailTemplateFromRow($result->GetRowAssoc(false), true);
509  $result->moveNext();
510  }
511  $result->Close();
512  unset($result);
513 
514  // Sort all templates by email key.
515  $compare = create_function('$t1, $t2', 'return strcmp($t1->getEmailKey(), $t2->getEmailKey());');
516  usort ($emailTemplates, $compare);
517 
518  return $emailTemplates;
519  }
520 
525  function getInsertEmailId() {
526  return $this->getInsertId('email_templates', 'emailId');
527  }
528 
534  function deleteEmailTemplatesByAssoc($assocType, $assocId) {
535  $this->update(
536  'DELETE FROM email_templates_data WHERE assoc_type = ? AND assoc_id = ?', array($assocType, $assocId)
537  );
538  return $this->update(
539  'DELETE FROM email_templates WHERE assoc_type = ? AND assoc_id = ?', array($assocType, $assocId)
540  );
541  }
542 
547  function deleteEmailTemplatesByLocale($locale) {
548  $this->update(
549  'DELETE FROM email_templates_data WHERE locale = ?', $locale
550  );
551  }
552 
558  $this->update(
559  'DELETE FROM email_templates_default_data WHERE locale = ?', $locale
560  );
561  }
562 
571  function templateExistsByKey($emailKey, $assocType, $assocId) {
572  $result =& $this->retrieve(
573  'SELECT COUNT(*)
574  FROM email_templates
575  WHERE email_key = ? AND
576  assoc_type = ? AND
577  assoc_id = ?',
578  array(
579  $emailKey,
580  $assocType,
581  $assocId
582  )
583  );
584  if (isset($result->fields[0]) && $result->fields[0] != 0) {
585  $result->Close();
586  unset($result);
587  return true;
588  }
589 
590  $result->Close();
591  unset($result);
592 
593  $result =& $this->retrieve(
594  'SELECT COUNT(*)
595  FROM email_templates_default
596  WHERE email_key = ?',
597  $emailKey
598  );
599  if (isset($result->fields[0]) && $result->fields[0] != 0) {
600  $returner = true;
601  } else {
602  $returner = false;
603  }
604 
605  $result->Close();
606  unset($result);
607 
608  return $returner;
609  }
610 
619  function customTemplateExistsByKey($emailKey, $assocType, $assocId) {
620  $result =& $this->retrieve(
621  'SELECT COUNT(*)
622  FROM email_templates e
623  LEFT JOIN email_templates_default d ON (e.email_key = d.email_key)
624  WHERE e.email_key = ? AND
625  d.email_key IS NULL AND
626  e.assoc_type = ? AND
627  e.assoc_id = ?',
628  array(
629  $emailKey,
630  $assocType,
631  $assocId
632  )
633  );
634  $returner = (isset($result->fields[0]) && $result->fields[0] != 0);
635 
636  $result->Close();
637  unset($result);
638 
639  return $returner;
640  }
641 
643  return 'registry/emailTemplates.xml';
644  }
645 
646  function getMainEmailTemplateDataFilename($locale = null) {
647  if ($locale !== null && !PKPLocale::isLocaleValid($locale)) return null;
648  if ($locale === null) $locale = '{$installedLocale}';
649  return "locale/$locale/emailTemplates.xml";
650  }
651 
661  function installEmailTemplates($templatesFile, $returnSql = false) {
662  $xmlDao = new XMLDAO();
663  $sql = array();
664  $data = $xmlDao->parseStruct($templatesFile, array('email'));
665  if (!isset($data['email'])) return false;
666  foreach ($data['email'] as $entry) {
667  $attrs = $entry['attributes'];
668  $sql[] = 'INSERT INTO email_templates_default
669  (email_key, can_disable, can_edit, from_role_id, to_role_id)
670  VALUES
671  (' .
672  $this->_dataSource->qstr($attrs['key']) . ', ' .
673  ($attrs['can_disable']?1:0) . ', ' .
674  ($attrs['can_edit']?1:0) . ', ' .
675  (isset($attrs['from_role_id'])?((int) $attrs['from_role_id']):'null') . ', ' .
676  (isset($attrs['to_role_id'])?((int) $attrs['to_role_id']):'null') .
677  ")";
678  if (!$returnSql) {
679  $this->update(array_shift($sql));
680  }
681  }
682  if ($returnSql) return $sql;
683  return true;
684  }
685 
695  function installEmailTemplateData($templateDataFile, $returnSql = false) {
696  $xmlDao = new XMLDAO();
697  $sql = array();
698  $data = $xmlDao->parse($templateDataFile, array('email_texts', 'email_text', 'subject', 'body', 'description'));
699  if (!$data) return false;
700  $locale = $data->getAttribute('locale');
701 
702  foreach ($data->getChildren() as $emailNode) {
703  $sql[] = 'DELETE FROM email_templates_default_data WHERE email_key = ' . $this->_dataSource->qstr($emailNode->getAttribute('key')) . ' AND locale = ' . $this->_dataSource->qstr($locale);
704  if (!$returnSql) {
705  $this->update(array_shift($sql));
706  }
707 
708  $sql[] = 'INSERT INTO email_templates_default_data
709  (email_key, locale, subject, body, description)
710  VALUES
711  (' .
712  $this->_dataSource->qstr($emailNode->getAttribute('key')) . ', ' .
713  $this->_dataSource->qstr($locale) . ', ' .
714  $this->_dataSource->qstr($emailNode->getChildValue('subject')) . ', ' .
715  $this->_dataSource->qstr($emailNode->getChildValue('body')) . ', ' .
716  $this->_dataSource->qstr($emailNode->getChildValue('description')) .
717  ")";
718  if (!$returnSql) {
719  $this->update(array_shift($sql));
720  }
721  }
722  if ($returnSql) return $sql;
723  return true;
724  }
725 }
726 
727 ?>
isLocaleValid($locale)
config TEMPLATE inc php
Definition: config.inc.php:4
& getEmailTemplate($emailKey, $locale, $assocType, $assocId)
updateLocaleEmailTemplate(&$emailTemplate)
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
Operations for retrieving and modifying Email Template objects.
updateBaseEmailTemplate(&$emailTemplate)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
getMainEmailTemplateDataFilename($locale=null)
Operations for retrieving and modifying objects from an XML data source.
Definition: XMLDAO.inc.php:20
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
& getEmailTemplates($locale, $assocType, $assocId, $rangeInfo=null)
customTemplateExistsByKey($emailKey, $assocType, $assocId)
installEmailTemplates($templatesFile, $returnSql=false)
& getBaseEmailTemplate($emailKey, $assocType, $assocId)
deleteEmailTemplateByKey($emailKey, $assocType, $assocId)
installEmailTemplateData($templateDataFile, $returnSql=false)
templateExistsByKey($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:186
insertBaseEmailTemplate(&$emailTemplate)
Describes basic email template properties.
insertLocaleEmailTemplate(&$emailTemplate)
& getLocaleEmailTemplate($emailKey, $assocType, $assocId)