コード例 #1
0
 function run()
 {
     // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
     CRM_Utils_System::setTitle(ts(SM_EXT_NAME));
     $ckeditorUrl = simplemail_civicrm_getExtensionUrl() . '/js/vendors/ckeditor/';
     CRM_Core_Resources::singleton()->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/jquery.min.js', 20, 'page-footer')->addScript("CKEDITOR_BASEPATH='{$ckeditorUrl}'", 30, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/ckeditor/ckeditor.js', 40, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/angular.min.js', 60, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/angular-route.min.js', 70, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/angular-file-upload.min.js', 75, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/angular-animate.min.js', 80, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/select.min.js', 90, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/date.sugar.min.js', 91, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/vendors/ng-quick-date.min.js', 92, 'page-footer')->addScriptFile('uk.co.compucorp.civicrm.simplemail', 'js/dist/script.js', 100, 'page-footer')->addStyleFile('uk.co.compucorp.civicrm.simplemail', 'css/vendors/select.min.css')->addStyleFile('uk.co.compucorp.civicrm.simplemail', 'css/vendors/select2.css')->addStyleFile('uk.co.compucorp.civicrm.simplemail', 'css/dist/style.css')->addStyleFile('uk.co.compucorp.civicrm.simplemail', 'css/vendors/ng-quick-date-plus-default-theme.css')->addStyleFile('uk.co.compucorp.civicrm.simplemail', 'css/vendors/font-awesome-4.2.0/css/font-awesome.min.css')->addSetting(array('resourceUrls' => simplemail_civicrm_getActiveModuleUrls()))->addSetting(array('API_URL' => CIVICRM_UF_BASEURL));
     parent::run();
 }
コード例 #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);
}