Open Journal Systems  3.3.0
EmailTemplateDAO Class Reference
Inheritance diagram for EmailTemplateDAO:
SchemaDAO DAO

Public Member Functions

 _fromRow ($primaryRow)
 
 defaultTemplateIsInstalled ($key)
 
 deleteDefaultEmailTemplatesByLocale ($locale)
 
 deleteEmailTemplatesByLocale ($locale)
 
 getMainEmailTemplatesFilename ()
 
 insertObject ($object)
 
 installEmailTemplateData ($templateDataFile, $locale, $returnSql=false, $emailKey=null)
 
 installEmailTemplateLocaleData ($templatesFile, $locales=array(), $returnSql=false, $emailKey=null)
 
 installEmailTemplates ($templatesFile, $locales=array(), $returnSql=false, $emailKey=null, $skipExisting=false)
 
 newDataObject ()
 
 updateObject ($object)
 
- Public Member Functions inherited from SchemaDAO
 deleteById ($objectId)
 
 deleteObject ($object)
 
 getById ($objectId)
 
 getInsertId ()
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAdditionalFieldNames ()
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getLocaleFieldNames ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Data Fields

 $primaryKeyColumn = 'email_id'
 
 $primaryTableColumns
 
 $schemaName = SCHEMA_EMAIL_TEMPLATE
 
 $settingsTableName = 'email_templates_settings'
 
 $tableName = 'email_templates'
 
- Data Fields inherited from SchemaDAO
 $primaryKeyColumn
 
 $primaryTableColumns = array()
 
 $schemaName
 
 $settingsTableName
 
 $tableName
 
- Data Fields inherited from DAO
 $_dataSource
 

Additional Inherited Members

- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 
- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Detailed Description

Operations for retrieving and modifying Email Template objects.

See also
EmailTemplate

Definition at line 21 of file EmailTemplateDAO.inc.php.

Member Function Documentation

◆ _fromRow()

EmailTemplateDAO::_fromRow (   $primaryRow)

Extend SchemaDAO::_fromRow() to add data from the email template defaults

Parameters
$primaryRowarray The result row from the primary table lookup
Returns
BaseEmailTemplate

Reimplemented from SchemaDAO.

Definition at line 99 of file EmailTemplateDAO.inc.php.

References DAO\convertFromDB(), PKPServices\get(), and DAO\retrieve().

◆ defaultTemplateIsInstalled()

EmailTemplateDAO::defaultTemplateIsInstalled (   $key)

Check if a template exists with the given email key for a journal/ conference/...

Parameters
$keystring
$contextIdint optional
Returns
boolean

Definition at line 158 of file EmailTemplateDAO.inc.php.

◆ deleteDefaultEmailTemplatesByLocale()

EmailTemplateDAO::deleteDefaultEmailTemplatesByLocale (   $locale)

Delete all default email templates for a specific locale.

Parameters
$localestring

Definition at line 145 of file EmailTemplateDAO.inc.php.

◆ deleteEmailTemplatesByLocale()

EmailTemplateDAO::deleteEmailTemplatesByLocale (   $locale)

Delete all email templates for a specific locale.

Parameters
$localestring

Definition at line 135 of file EmailTemplateDAO.inc.php.

◆ getMainEmailTemplatesFilename()

EmailTemplateDAO::getMainEmailTemplatesFilename ( )

Get the main email template path and filename.

Returns
string

Definition at line 174 of file EmailTemplateDAO.inc.php.

◆ insertObject()

EmailTemplateDAO::insertObject (   $object)

Insert a new object

Parameters
DataObject$objectThe object to insert into the database
Returns
int The new object's id

Reimplemented from SchemaDAO.

Definition at line 60 of file EmailTemplateDAO.inc.php.

◆ installEmailTemplateData()

EmailTemplateDAO::installEmailTemplateData (   $templateDataFile,
  $locale,
  $returnSql = false,
  $emailKey = null 
)

Install email template localized data from an XML file. NOTE: Uses qstr instead of ? bindings so that SQL can be fetched rather than executed.

Deprecated:
Since OJS/OMP 3.2, this data should be supplied via the non-localized email template list and PO files. (pkp/pkp-lib#5461)
Parameters
$templateDataFilestring Filename to install
$localestring Locale of template(s) to install
$returnSqlboolean Whether or not to return SQL rather than executing it
$emailKeystring If specified, the key of the single template to install (otherwise all are installed)
Returns
array|boolean

Definition at line 299 of file EmailTemplateDAO.inc.php.

◆ installEmailTemplateLocaleData()

EmailTemplateDAO::installEmailTemplateLocaleData (   $templatesFile,
  $locales = array(),
  $returnSql = false,
  $emailKey = null 
)

Install email template contents from an XML file. NOTE: Uses qstr instead of ? bindings so that SQL can be fetched rather than executed.

Parameters
$templatesFilestring Filename to install
$localesList of locales to install data for
$returnSqlboolean Whether or not to return SQL rather than executing it
$emailKeystring Optional name of single email key to install, skipping others
Returns
array|boolean

Definition at line 241 of file EmailTemplateDAO.inc.php.

◆ installEmailTemplates()

EmailTemplateDAO::installEmailTemplates (   $templatesFile,
  $locales = array(),
  $returnSql = false,
  $emailKey = null,
  $skipExisting = false 
)

Install email templates from an XML file. NOTE: Uses qstr instead of ? bindings so that SQL can be fetched rather than executed.

Parameters
$templatesFilestring Filename to install
$localesList of locales to install data for
$returnSqlboolean Whether or not to return SQL rather than executing it
$emailKeystring Optional name of single email key to install, skipping others
$skipExistingboolean If true, do not install email templates that already exist in the database
Returns
array|boolean

Definition at line 192 of file EmailTemplateDAO.inc.php.

◆ newDataObject()

EmailTemplateDAO::newDataObject ( )

Create a new DataObject of the appropriate class

Returns
DataObject

Reimplemented from SchemaDAO.

Definition at line 53 of file EmailTemplateDAO.inc.php.

◆ updateObject()

EmailTemplateDAO::updateObject (   $object)

Update an object

When updating an object, we remove table rows for any settings which are no longer present.

Multilingual fields are an exception to this. When a locale key is missing from the object, it is not removed from the database. This is to ensure that data from a locale which is later disabled is not automatically removed from the database, and will appear if the locale is re-enabled.

To delete a value for a locale key, a null value must be passed.

Parameters
$objectDataObject The object to insert into the database

Reimplemented from SchemaDAO.

Definition at line 78 of file EmailTemplateDAO.inc.php.

Field Documentation

◆ $primaryKeyColumn

EmailTemplateDAO::$primaryKeyColumn = 'email_id'

The column name for the object id in primary and settings tables

Definition at line 32 of file EmailTemplateDAO.inc.php.

◆ $primaryTableColumns

array EmailTemplateDAO::$primaryTableColumns
Initial value:
= [
'id' => 'email_id',
'key' => 'email_key',
'contextId' => 'context_id',
'enabled' => 'enabled',
'canDisable' => 'can_disable',
'canEdit' => 'can_edit',
'fromRoleId' => 'from_role_id',
'toRoleId' => 'to_role_id',
'stageId' => 'stage_id',
]

Maps schema properties for the primary table to their column names

Definition at line 38 of file EmailTemplateDAO.inc.php.

◆ $schemaName

EmailTemplateDAO::$schemaName = SCHEMA_EMAIL_TEMPLATE

One of the SCHEMA_... constants

Definition at line 23 of file EmailTemplateDAO.inc.php.

◆ $settingsTableName

EmailTemplateDAO::$settingsTableName = 'email_templates_settings'

The name of the settings table for this object

Definition at line 29 of file EmailTemplateDAO.inc.php.

◆ $tableName

EmailTemplateDAO::$tableName = 'email_templates'

The name of the primary table for this object

Definition at line 26 of file EmailTemplateDAO.inc.php.


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