当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Extension_System::singleton方法代码示例

本文整理汇总了PHP中CRM_Extension_System::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Extension_System::singleton方法的具体用法?PHP CRM_Extension_System::singleton怎么用?PHP CRM_Extension_System::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Extension_System的用法示例。


在下文中一共展示了CRM_Extension_System::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addResources

 /**
  * Load needed JS, CSS and settings for the backend Volunteer Management UI
  */
 public static function addResources($entity_id, $entity_table)
 {
     static $loaded = FALSE;
     if ($loaded) {
         return;
     }
     $loaded = TRUE;
     $config = CRM_Core_Config::singleton();
     $ccr = CRM_Core_Resources::singleton();
     // Vendor libraries
     $ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header');
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
     // Our stylesheet
     $ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
     // Add all scripts for our js app
     $weight = 0;
     $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
     // This glob pattern will recurse the js directory up to 4 levels deep
     foreach (glob($baseDir . 'js/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
         $fileName = substr($file, strlen($baseDir));
         $ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
     }
     // Add our template
     CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
     CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
     // Fetch event so we can set the default start time for needs
     // FIXME: Not the greatest for supporting non-events
     $entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
     // Static variables
     $ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat)));
     // Check for problems
     _volunteer_civicrm_check_resource_url();
 }
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:37,代码来源:Manage.php

示例2: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     if (!CRM_Core_Permission::check('administer Reports')) {
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
     }
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl();
     $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', FALSE);
     $extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.');
     $reportClass = NULL;
     if ($extKey !== FALSE) {
         $ext = CRM_Extension_System::singleton()->getMapper();
         $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
         $templateInfo['name'] = $reportClass;
     }
     if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) {
         CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template');
         $this->assign('reportTitle', $templateInfo['label']);
         $session = CRM_Core_Session::singleton();
         $session->set('reportDescription', $templateInfo['description']);
         $wrapper = new CRM_Utils_Wrapper();
         return $wrapper->run($templateInfo['name'], NULL, NULL);
     }
     if ($optionVal) {
         CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:32,代码来源:Report.php

示例3: run

 function run()
 {
     list($ext, $suite) = $this->getRequestExtAndSuite();
     if (empty($ext) || empty($suite)) {
         throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser");
     }
     if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+$/', $suite) || strpos($suite, '..') !== FALSE) {
         throw new CRM_Core_Exception("Malformed suite name");
     }
     $path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath($ext);
     if (!is_dir("{$path}/tests/qunit/{$suite}")) {
         throw new CRM_Core_Exception("Failed to locate test suite");
     }
     // Load the test suite -- including any PHP, TPL, or JS content
     if (file_exists("{$path}/tests/qunit/{$suite}/test.php")) {
         // e.g. load resources
         require_once "{$path}/tests/qunit/{$suite}/test.php";
     }
     if (file_exists("{$path}/tests/qunit/{$suite}/test.tpl")) {
         // e.g. setup markup and/or load resources
         CRM_Core_Smarty::singleton()->addTemplateDir("{$path}/tests");
         $this->assign('qunitTpl', "qunit/{$suite}/test.tpl");
     }
     if (file_exists("{$path}/tests/qunit/{$suite}/test.js")) {
         CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/{$suite}/test.js", 1000);
     }
     CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', array(1 => $ext, 2 => $suite)));
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/qunit/qunit.js')->addStyleFile('civicrm', 'packages/qunit/qunit.css');
     parent::run();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:30,代码来源:QUnit.php

示例4: getByProcessor

 /**
  * Starting from the processor as an array retrieve the processor as an object.
  *
  * If there is no valid configuration it will not be retrieved.
  *
  * @param array $processor
  * @param bool $force
  *   Override the config check. This is required in uninstall as no valid instances exist
  *   but will deliberately not work with any valid processors.
  *
  * @return CRM_Core_Payment|NULL
  *
  * @throws \CRM_Core_Exception
  */
 public function getByProcessor($processor, $force = FALSE)
 {
     $id = $force ? 0 : $processor['id'];
     if (!isset($this->cache[$id]) || $force) {
         $ext = \CRM_Extension_System::singleton()->getMapper();
         if ($ext->isExtensionKey($processor['class_name'])) {
             $paymentClass = $ext->keyToClass($processor['class_name'], 'payment');
             require_once $ext->classToPath($paymentClass);
         } else {
             $paymentClass = 'CRM_Core_' . $processor['class_name'];
             if (empty($paymentClass)) {
                 throw new \CRM_Core_Exception('no class provided');
             }
             require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php';
         }
         $processorObject = new $paymentClass(!empty($processor['is_test']) ? 'test' : 'live', $processor);
         if (!$force && $processorObject->checkConfig()) {
             $processorObject = NULL;
         } else {
             $processorObject->setPaymentProcessor($processor);
         }
         $this->cache[$id] = $processorObject;
     }
     return $this->cache[$id];
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:39,代码来源:System.php

示例5: array

 /**
  * Singleton function used to manage this object.
  *
  * @param array $providerParams
  * @param bool $force
  *
  * @return object
  */
 public static function &singleton($providerParams = array(), $force = FALSE)
 {
     $mailingID = CRM_Utils_Array::value('mailing_id', $providerParams);
     $providerID = CRM_Utils_Array::value('provider_id', $providerParams);
     $providerName = CRM_Utils_Array::value('provider', $providerParams);
     if (!$providerID && $mailingID) {
         $providerID = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'sms_provider_id', 'id');
         $providerParams['provider_id'] = $providerID;
     }
     if ($providerID) {
         $providerName = CRM_SMS_BAO_Provider::getProviderInfo($providerID, 'name');
     }
     if (!$providerName) {
         CRM_Core_Error::fatal('Provider not known or not provided.');
     }
     $providerName = CRM_Utils_Type::escape($providerName, 'String');
     $cacheKey = "{$providerName}_" . (int) $providerID . "_" . (int) $mailingID;
     if (!isset(self::$_singleton[$cacheKey]) || $force) {
         $ext = CRM_Extension_System::singleton()->getMapper();
         if ($ext->isExtensionKey($providerName)) {
             $paymentClass = $ext->keyToClass($providerName);
             require_once "{$paymentClass}.php";
         } else {
             CRM_Core_Error::fatal("Could not locate extension for {$providerName}.");
         }
         self::$_singleton[$cacheKey] = $paymentClass::singleton($providerParams, $force);
     }
     return self::$_singleton[$cacheKey];
 }
开发者ID:kidaa30,项目名称:yes,代码行数:37,代码来源:Provider.php

示例6: addResources

 /**
  * Load needed JS, CSS and settings for the backend Volunteer Management UI
  */
 public static function addResources($entity_id, $entity_table)
 {
     static $loaded = FALSE;
     $ccr = CRM_Core_Resources::singleton();
     if ($loaded || $ccr->isAjaxMode()) {
         return;
     }
     $loaded = TRUE;
     $config = CRM_Core_Config::singleton();
     // Vendor libraries
     $ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
     // Our stylesheet
     $ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
     // Add all scripts for our js app
     $weight = 0;
     $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
     // This glob pattern will recurse the js directory up to 4 levels deep
     foreach (glob($baseDir . 'js/backbone/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
         $fileName = substr($file, strlen($baseDir));
         $ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
     }
     // Add our template
     CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
     CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
     // Fetch event so we can set the default start time for needs
     // FIXME: Not the greatest for supporting non-events
     $entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
     // Static variables
     $ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat), 'constants' => array('CRM_Core_Action' => array('NONE' => 0, 'ADD' => 1, 'UPDATE' => 2, 'VIEW' => 4, 'DELETE' => 8, 'BROWSE' => 16, 'ENABLE' => 32, 'DISABLE' => 64, 'EXPORT' => 128, 'BASIC' => 256, 'ADVANCED' => 512, 'PREVIEW' => 1024, 'FOLLOWUP' => 2048, 'MAP' => 4096, 'PROFILE' => 8192, 'COPY' => 16384, 'RENEW' => 32768, 'DETACH' => 65536, 'REVERT' => 131072, 'CLOSE' => 262144, 'REOPEN' => 524288, 'MAX_ACTION' => 1048575))));
     // Check for problems
     _volunteer_checkResourceUrl();
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:37,代码来源:Manage.php

示例7: getTemplateFileName

 function getTemplateFileName()
 {
     $ext = CRM_Extension_System::singleton()->getMapper();
     if ($ext->isExtensionClass(CRM_Utils_System::getClassName($this->_customClass))) {
         $fileName = $ext->getTemplatePath(CRM_Utils_System::getClassName($this->_customClass)) . '/' . $ext->getTemplateName(CRM_Utils_System::getClassName($this->_customClass));
     } else {
         $fileName = $this->_customClass->templateFile();
     }
     return $fileName ? $fileName : parent::getTemplateFileName();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:10,代码来源:Custom.php

示例8: run

 /**
  * Run this page (figure out the action needed and perform it).
  */
 public function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     if (!$instanceId) {
         $instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
     }
     if (is_numeric($instanceId)) {
         $instanceURL = CRM_Utils_System::url("civicrm/report/instance/{$instanceId}", 'reset=1');
         CRM_Core_Session::singleton()->replaceUserContext($instanceURL);
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('You do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceId, 'navigation_id', 'id');
         CRM_Report_BAO_ReportInstance::del($instanceId);
         //delete navigation if exists
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
         CRM_Core_Session::setStatus(ts('Selected report has been deleted.'), ts('Deleted'), 'success');
     } else {
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         if (empty($templateInfo)) {
             CRM_Core_Error::statusBounce('You have tried to access a report that does not exist.');
         }
         $extKey = strpos($templateInfo['name'], '.');
         $reportClass = NULL;
         if ($extKey !== FALSE) {
             $ext = CRM_Extension_System::singleton()->getMapper();
             $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
             $templateInfo['name'] = $reportClass;
         }
         if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
             $instanceInfo = array();
             CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], NULL, NULL);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:58,代码来源:Instance.php

示例9: getAll

 /**
  * Get a list of all known modules
  */
 public static function getAll($fresh = FALSE)
 {
     static $result;
     if ($fresh || !is_array($result)) {
         $result = CRM_Extension_System::singleton()->getMapper()->getModules();
         $config = CRM_Core_Config::singleton();
         if (is_callable(array($config->userSystem, 'getModules'))) {
             $result = array_merge($result, $config->userSystem->getModules());
         }
     }
     return $result;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:15,代码来源:Module.php

示例10: getAll

 /**
  * Get a list of all known modules.
  *
  * @param bool $fresh
  *   Force new results?
  *
  * @return array
  */
 public static function getAll($fresh = FALSE)
 {
     static $result;
     if ($fresh || !is_array($result)) {
         $result = CRM_Extension_System::singleton()->getMapper()->getModules();
         $result[] = new CRM_Core_Module('civicrm', TRUE);
         // pseudo-module for core
         $config = CRM_Core_Config::singleton();
         $result = array_merge($result, $config->userSystem->getModules());
     }
     return $result;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:20,代码来源:Module.php

示例11: registerResources

 /**
  * Register resources required by Angular.
  */
 public function registerResources($region = 'html-header', $includeExtras = true)
 {
     $modules = $this->angular->getModules();
     $page = $this;
     // PHP 5.3 does not propagate $this to inner functions.
     $page->res->addSettingsFactory(function () use(&$modules, $page) {
         // TODO optimization; client-side caching
         return array_merge($page->angular->getResources(array_keys($modules), 'settings', 'settings'), array('resourceUrls' => \CRM_Extension_System::singleton()->getMapper()->getActiveModuleUrls(), 'angular' => array('modules' => array_merge(array('ngRoute'), array_keys($modules)), 'cacheCode' => $page->res->getCacheCode())));
     });
     $page->res->addScriptFile('civicrm', 'bower_components/angular/angular.min.js', -100, $region, FALSE);
     if ($includeExtras) {
         //Civi vs 4.7 and above has reworked how wysiwyg works and we don't
         //have to side load ckeditor anymore
         $version = substr(CRM_Utils_System::version(), 0, 3);
         if ($version <= 4.6) {
             //crmUi depends on loading ckeditor, but ckeditor doesn't work properly with aggregation.
             //Add a basepath so that CKEditor works when Drupal (or other extension/cms) does the aggregation
             $basePath = $page->res->getUrl("civicrm") . "packages/ckeditor/";
             $page->res->addScript("window.CKEDITOR_BASEPATH = '{$basePath}';", 119, $region, FALSE);
             $page->res->addScriptFile('civicrm', 'packages/ckeditor/ckeditor.js', 120, $region, FALSE);
         }
         //Add jquery Notify
         $page->res->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.notify.min.js', 10, $region, FALSE);
         $page->assign("includeNotificationTemplate", true);
     }
     $headOffset = 1;
     $config = \CRM_Core_Config::singleton();
     if ($config->debug) {
         foreach ($modules as $moduleName => $module) {
             foreach ($page->angular->getResources($moduleName, 'css', 'cacheUrl') as $url) {
                 $page->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $region);
             }
             foreach ($page->angular->getResources($moduleName, 'js', 'cacheUrl') as $url) {
                 $page->res->addScriptUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $region);
                 // addScriptUrl() bypasses the normal string-localization of addScriptFile(),
                 // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
             }
         }
     } else {
         // Note: addScriptUrl() bypasses the normal string-localization of addScriptFile(),
         // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
         $aggScriptUrl = \CRM_Utils_System::url('civicrm/ajax/volunteer-angular-modules', 'format=js&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         $page->res->addScriptUrl($aggScriptUrl, 1, $region);
         // FIXME: The following CSS aggregator doesn't currently handle path-adjustments - which can break icons.
         //$aggStyleUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=css&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         //$page->res->addStyleUrl($aggStyleUrl, 1, $region);
         foreach ($page->angular->getResources(array_keys($modules), 'css', 'cacheUrl') as $url) {
             $page->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $region);
         }
     }
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:54,代码来源:Angular.php

示例12: run

 public function run($ctx)
 {
     $allKeys = \CRM_Extension_System::singleton()->getFullContainer()->getKeys();
     $names = \CRM_Utils_String::filterByWildcards($this->names, $allKeys, TRUE);
     $manager = \CRM_Extension_System::singleton()->getManager();
     switch ($this->action) {
         case 'install':
             $manager->install($names);
             break;
         case 'uninstall':
             $manager->disable($names);
             $manager->uninstall($names);
             break;
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:15,代码来源:ExtensionsStep.php

示例13: civicrm_api3_volunteer_util_loadbackbone

/**
 * This function will return the needed pieces to load up the backbone/
 * marionette project backend from within an angular page.
 *
 * @param array $params
 *   Not presently used.
 * @return array
 *   Keyed with "css," "templates," "scripts," and "settings," this array
 *   contains the dependencies of the backbone-based volunteer app.
 *
 */
function civicrm_api3_volunteer_util_loadbackbone($params)
{
    $results = array("css" => array(), "templates" => array(), "scripts" => array(), "settings" => array());
    $ccr = CRM_Core_Resources::singleton();
    $config = CRM_Core_Config::singleton();
    $results['css'][] = $ccr->getUrl('org.civicrm.volunteer', 'css/volunteer_app.css');
    $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
    // This glob pattern will recurse the js directory up to 4 levels deep
    foreach (glob($baseDir . 'js/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
        $fileName = substr($file, strlen($baseDir));
        $results['scripts'][] = $ccr->getUrl('org.civicrm.volunteer', $fileName);
    }
    $results['templates'][] = 'civicrm/volunteer/backbonetemplates';
    $results['settings'] = array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => date("Y-m-d H:i:s", strtotime('tomorrow noon'))), 'config' => array('timeInputFormat' => $config->timeInputFormat), 'constants' => array('CRM_Core_Action' => array('NONE' => 0, 'ADD' => 1, 'UPDATE' => 2, 'VIEW' => 4, 'DELETE' => 8, 'BROWSE' => 16, 'ENABLE' => 32, 'DISABLE' => 64, 'EXPORT' => 128, 'BASIC' => 256, 'ADVANCED' => 512, 'PREVIEW' => 1024, 'FOLLOWUP' => 2048, 'MAP' => 4096, 'PROFILE' => 8192, 'COPY' => 16384, 'RENEW' => 32768, 'DETACH' => 65536, 'REVERT' => 131072, 'CLOSE' => 262144, 'REOPEN' => 524288, 'MAX_ACTION' => 1048575)));
    return civicrm_api3_create_success($results, "VolunteerUtil", "loadbackbone", $params);
}
开发者ID:JohnFF,项目名称:org.civicrm.volunteer,代码行数:27,代码来源:VolunteerUtil.php

示例14: registerResources

 /**
  * @param CRM_Core_Resources $res
  */
 public function registerResources(CRM_Core_Resources $res)
 {
     $weight = self::DEFAULT_MODULE_WEIGHT;
     $res->addSettingsFactory(function () {
         // inorder to use ext resource url in JS - e.g CRM.resourceUrls
         $jsvar = array('resourceUrls' => CRM_Extension_System::singleton()->getMapper()->getActiveModuleUrls());
         return $jsvar;
     });
     $res->addStyleFile('uk.co.vedaconsulting.mosaico', 'packages/mosaico/dist/mosaico-material.min.css', $weight++, 'html-header', TRUE);
     $res->addStyleFile('uk.co.vedaconsulting.mosaico', 'packages/mosaico/dist/vendor/notoregular/stylesheet.css', $weight++, 'html-header', TRUE);
     $res->addScriptFile('uk.co.vedaconsulting.mosaico', 'packages/mosaico/dist/vendor/knockout.js', $weight++, 'html-header', TRUE);
     // civi already has jquery.min
     //$res->addScriptFile('uk.co.vedaconsulting.mosaico', 'packages/mosaico/dist/vendor/jquery.min.js', $weight++, 'html-header', TRUE);
     $res->addScriptFile('uk.co.vedaconsulting.mosaico', 'js/index.js', $weight++, 'html-header', FALSE);
     $res->addStyleFile('uk.co.vedaconsulting.mosaico', 'css/index.css', $weight++, 'html-header', TRUE);
     $res->addScriptFile('uk.co.vedaconsulting.mosaico', 'js/index2.js', $weight++, 'html-header', TRUE);
 }
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.mosaico,代码行数:20,代码来源:Index.php

示例15: registerResources

 /**
  * Register resources required by Angular.
  */
 public function registerResources()
 {
     $modules = $this->angular->getModules();
     $page = $this;
     // PHP 5.3 does not propagate $this to inner functions.
     $this->res->addSettingsFactory(function () use(&$modules, $page) {
         // TODO optimization; client-side caching
         return array_merge($page->angular->getResources(array_keys($modules), 'settings', 'settings'), array('resourceUrls' => \CRM_Extension_System::singleton()->getMapper()->getActiveModuleUrls(), 'angular' => array('modules' => array_merge(array('ngRoute'), array_keys($modules)), 'cacheCode' => $page->res->getCacheCode())));
     });
     $this->res->addScriptFile('civicrm', 'bower_components/angular/angular.min.js', 100, $this->region, FALSE);
     $headOffset = 0;
     $config = \CRM_Core_Config::singleton();
     if ($config->debug) {
         foreach ($modules as $moduleName => $module) {
             foreach ($this->angular->getResources($moduleName, 'css', 'cacheUrl') as $url) {
                 $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
             }
             foreach ($this->angular->getResources($moduleName, 'js', 'cacheUrl') as $url) {
                 $this->res->addScriptUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
                 // addScriptUrl() bypasses the normal string-localization of addScriptFile(),
                 // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
             }
         }
     } else {
         // Note: addScriptUrl() bypasses the normal string-localization of addScriptFile(),
         // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
         $aggScriptUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=js&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         $this->res->addScriptUrl($aggScriptUrl, 120, $this->region);
         // FIXME: The following CSS aggregator doesn't currently handle path-adjustments - which can break icons.
         //$aggStyleUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=css&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         //$this->res->addStyleUrl($aggStyleUrl, 120, $this->region);
         foreach ($this->angular->getResources(array_keys($modules), 'css', 'cacheUrl') as $url) {
             $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
         }
     }
     // If trying to load an Angular page via AJAX, the route must be passed as a
     // URL parameter, since the server doesn't receive information about
     // URL fragments (i.e, what comes after the #).
     \CRM_Core_Resources::singleton()->addSetting(array('angularRoute' => \CRM_Utils_Request::retrieve('route', 'String')));
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:43,代码来源:Main.php


注:本文中的CRM_Extension_System::singleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。