コード例 #1
0
 /**
  * Get the path of the email template to be used for rendering the email HTML body
  *
  * @return string
  */
 protected static function getEmailTemplatePath()
 {
     // TODO (robin): Probably add template dir as a constant
     $templateDir = simplemail_civicrm_getExtensionDir() . 'email-templates' . DIRECTORY_SEPARATOR;
     $templateFileName = 'wave.html';
     return $templateDir . $templateFileName;
 }
コード例 #2
0
/**
 * Initialise the extension
 */
function simplemail_civicrm_init()
{
    define('SM_SESSION_SCOPE_PREFIX', 'SimpleMail_');
    /**
     * The value of the option value for name 'mailing_category', part of the option group 'group_type'
     */
    define('SM_MAILING_CATEGORY_GROUP_TYPE_VALUE', 'mailing_category');
    // Permission
    define('SM_PERMISSION_ACCESS', 'access CiviSimpleMail');
    define('SM_PERMISSION_EDIT', 'edit CiviSimpleMail');
    define('SM_PERMISSION_DELETE', 'delete CiviSimpleMail');
    define('SM_PERMISSION_ACCESS_ADMIN', 'access admin CiviSimpleMail');
    define('SM_PERMISSION_ACCESS_LEGACY', 'access LegacyMailUi');
    define('SM_PERMISSION_MANAGE_ALL', 'manage all CiviSimpleMail mails');
    define('SM_PERMISSION_ADD_GROUPS', 'add groups to new CiviSimpleMail mails');
    /** @var SimpleXMLElement[] $infoXml */
    $infoXml = CRM_Utils_XML::parseFile(simplemail_civicrm_getExtensionDir() . 'info.xml');
    foreach ($infoXml as $element) {
        if ($element instanceof SimpleXMLElement && $element->getName() == 'extension') {
            $attributes = $element->attributes();
            /**
             * Name of the extension
             */
            define('SM_EXT_NAME', (string) $element->name);
            /**
             * Key of the extension (also the name of the extension's directory)
             */
            define('SM_EXT_KEY', (string) $attributes['key']);
            /**
             * Path to the assets directory
             */
            define('SM_ASSETS_URL', simplemail_civicrm_getExtensionUrl() . '/assets');
        }
    }
    /**
     * Whether emails should have SSL linked content or not
     * Generally set this to false because SSL linked content can break mail clients
     */
    define('SM_CONTENT_SSL', false);
}