本文整理汇总了PHP中CRM_Extension_System类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Extension_System类的具体用法?PHP CRM_Extension_System怎么用?PHP CRM_Extension_System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Extension_System类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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, 'html-header', FALSE);
// FIXME: crmUi depends on loading ckeditor, but ckeditor doesn't work with this aggregation.
$this->res->addScriptFile('civicrm', 'packages/ckeditor/ckeditor.js', 100, 'page-header', FALSE);
//Add jquery Notify
$this->res->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.notify.min.js', -9990, 'html-header', 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, 'html-header');
}
foreach ($this->angular->getResources($moduleName, 'js', 'cacheUrl') as $url) {
$this->res->addScriptUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, 'html-header');
// 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);
$this->res->addScriptUrl($aggScriptUrl, 120, 'html-header');
// 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, 'html-header');
foreach ($this->angular->getResources(array_keys($modules), 'css', 'cacheUrl') as $url) {
$this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, 'html-header');
}
}
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:43,代码来源:Angular.php
示例17: hrui_civicrm_buildForm
function hrui_civicrm_buildForm($formName, &$form)
{
CRM_Core_Resources::singleton()->addStyleFile('org.civicrm.hrui', 'css/hrui.css')->addScriptFile('org.civicrm.hrui', 'js/hrui.js');
if ($form instanceof CRM_Contact_Form_Contact) {
CRM_Core_Resources::singleton()->addSetting(array('formName' => 'contactForm'));
//HR-358 - Set default values
//set default value to phone location and type
$locationId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', 'Main', 'id', 'name');
$result = civicrm_api3('LocationType', 'create', array('id' => $locationId, 'is_default' => 1, 'is_active' => 1));
if ($form->elementExists('phone[2][phone_type_id]') && $form->elementExists('phone[2][phone_type_id]')) {
$phoneType = $form->getElement('phone[2][phone_type_id]');
$phoneValue = CRM_Core_OptionGroup::values('phone_type');
$phoneKey = CRM_Utils_Array::key('Mobile', $phoneValue);
$phoneType->setSelected($phoneKey);
$phoneLocation = $form->getElement('phone[2][location_type_id]');
$phoneLocation->setSelected($locationId);
}
}
$ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'type_20130502144049', 'id', 'name');
//HR-355 -- Add Government ID
if ($formName == 'CRM_Contact_Form_Contact' && $ogID && $form->_contactType == 'Individual') {
//add government fields
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $form);
$templatePath = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.hrui') . '/templates';
$form->add('text', 'GovernmentId', ts('Government ID'));
$form->addElement('select', "govTypeOptions", '', CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($ogID));
CRM_Core_Region::instance('page-body')->add(array('template' => "{$templatePath}/CRM/HRUI/Form/contactField.tpl"));
$action = CRM_Utils_Request::retrieve('action', 'String', $form);
$govVal = CRM_HRIdent_Page_HRIdent::retreiveContactFieldValue($contactID);
//set default to government type option
$default = array();
$default['govTypeOptions'] = CRM_Core_BAO_CustomField::getOptionGroupDefault($ogID, 'select');
if ($action == CRM_Core_Action::UPDATE && !empty($govVal)) {
//set key for updating specific record of contact id in custom value table
$default['govTypeOptions'] = CRM_Utils_Array::value('type', $govVal);
$default['GovernmentId'] = CRM_Utils_Array::value('typeNumber', $govVal);
}
$form->setDefaults($default);
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:40,代码来源:hrui.php
示例18: _populateDB
protected static function _populateDB($perClass = FALSE, &$object = NULL)
{
if (!parent::_populateDB($perClass, $object)) {
return FALSE;
}
//populate vacancy_status of type Application
$result = civicrm_api3('OptionGroup', 'create', array('name' => 'vacancy_status', 'title' => ts('Vacancy Status'), 'is_reserved' => 1, 'is_active' => 1));
$vacancyStatus = array('Draft' => ts('Draft'), 'Open' => ts('Open'), 'Closed' => ts('Closed'), 'Cancelled' => ts('Cancelled'), 'Rejected' => ts('Rejected'));
$weight = 1;
foreach ($vacancyStatus as $name => $label) {
$statusParam = array('option_group_id' => $result['id'], 'label' => $label, 'name' => $name, 'value' => $weight++, 'is_active' => 1);
if ($name == 'Draft') {
$statusParam['is_default'] = 1;
} elseif ($name == 'Open') {
$statusParam['is_reserved'] = 1;
}
civicrm_api3('OptionValue', 'create', $statusParam);
}
$import = new CRM_Utils_Migrate_Import();
$import->run(CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.hrrecruitment') . '/xml/auto_install.xml');
return TRUE;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:22,代码来源:HRVacancyStageTest.php
示例19: run
function run()
{
CRM_Utils_System::setTitle(ts('Extension File Overrides'));
$system = CRM_Extension_System::singleton();
$manager = $system->getManager();
$container = $system->getDefaultContainer();
$keys = $container->getKeys();
foreach ($keys as $key) {
$base_path = $container->getPath($key);
$this->find_overrides($key, $base_path, '/api');
$this->find_overrides($key, $base_path, '/Civi');
$this->find_overrides($key, $base_path, '/CRM');
$this->find_overrides($key, $base_path, '/templates');
}
$snapshot = $_SESSION['CiviCRM']['qfPrivateKey'];
$this->look_for_changes(!empty($_POST['snapshot']) && $_POST['snapshot'] == $snapshot);
$multiple = false;
foreach ($this->core as &$core) {
if (count($core['extensions']) > 1) {
$core['multiple'] = $multiple = true;
}
}
$extensions = $statuses = $friendly = array();
foreach ($this->extensions as $name => $files) {
if (count($files) > 0) {
$extensions[$name] = $files;
$statuses[$name] = $manager->getStatus($name);
$friendly[$name] = CRM_Core_DAO::singleValueQuery("SELECT name FROM civicrm_extension WHERE full_name=%1", array(1 => array($name, 'String'))) ?: $name;
}
}
$this->assign('multiple', $multiple);
$this->assign('extensions', $extensions);
$this->assign('statuses', $statuses);
$this->assign('friendly', $friendly);
$this->assign('core', $this->core);
$this->assign('snapshot', $snapshot);
$this->assign('last_snapshot', CRM_Core_BAO_Setting::getItem('com.klangsoft_overrides', 'last_snapshot'));
parent::run();
}
开发者ID:konadave,项目名称:com.klangsoft.overrides,代码行数:39,代码来源:Overrides.php
示例20: registerScripts
static function registerScripts()
{
static $loaded = FALSE;
if ($loaded) {
return;
}
$loaded = TRUE;
CRM_Core_Resources::singleton()->addSettingsFactory(function () {
$config = CRM_Core_Config::singleton();
return array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address'
|
请发表评论