本文整理汇总了PHP中CRM_Core_Component类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Component类的具体用法?PHP CRM_Core_Component怎么用?PHP CRM_Core_Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModules
/**
* Get a list of AngularJS modules which should be autoloaded.
*
* @return array
* Each item has some combination of these keys:
* - ext: string
* The Civi extension which defines the Angular module.
* - js: array(string $relativeFilePath)
* List of JS files (relative to the extension).
* - css: array(string $relativeFilePath)
* List of CSS files (relative to the extension).
* - partials: array(string $relativeFilePath)
* A list of partial-HTML folders (relative to the extension).
* This will be mapped to "~/moduleName" by crmResource.
* - settings: array(string $key => mixed $value)
* List of settings to preload.
*/
public function getModules()
{
if ($this->modules === NULL) {
$config = \CRM_Core_Config::singleton();
$angularModules = array();
$angularModules['angularFileUpload'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-file-upload/dist/angular-file-upload.min.js'));
$angularModules['crmApp'] = array('ext' => 'civicrm', 'js' => array('ang/crmApp.js'));
$angularModules['crmAttachment'] = array('ext' => 'civicrm', 'js' => array('ang/crmAttachment.js'), 'css' => array('ang/crmAttachment.css'), 'partials' => array('ang/crmAttachment'), 'settings' => array('token' => \CRM_Core_Page_AJAX_Attachment::createToken()));
$angularModules['crmAutosave'] = array('ext' => 'civicrm', 'js' => array('ang/crmAutosave.js'));
$angularModules['crmCxn'] = array('ext' => 'civicrm', 'js' => array('ang/crmCxn.js', 'ang/crmCxn/*.js'), 'css' => array('ang/crmCxn.css'), 'partials' => array('ang/crmCxn'));
//$angularModules['crmExample'] = array(
// 'ext' => 'civicrm',
// 'js' => array('ang/crmExample.js'),
// 'partials' => array('ang/crmExample'),
//);
$angularModules['crmResource'] = array('ext' => 'civicrm', 'js' => array('js/angular-crmResource/all.js'));
$angularModules['crmUi'] = array('ext' => 'civicrm', 'js' => array('ang/crmUi.js'), 'partials' => array('ang/crmUi'), 'settings' => array('browseUrl' => $config->userFrameworkResourceURL . 'packages/kcfinder/browse.php', 'uploadUrl' => $config->userFrameworkResourceURL . 'packages/kcfinder/upload.php'));
$angularModules['crmUtil'] = array('ext' => 'civicrm', 'js' => array('ang/crmUtil.js'));
// https://github.com/jwstadler/angular-jquery-dialog-service
$angularModules['dialogService'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js'));
$angularModules['ngRoute'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-route/angular-route.min.js'));
$angularModules['ngSanitize'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-sanitize/angular-sanitize.min.js'));
$angularModules['ui.utils'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-ui-utils/ui-utils.min.js'));
$angularModules['ui.sortable'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-ui-sortable/sortable.min.js'));
$angularModules['unsavedChanges'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'));
foreach (\CRM_Core_Component::getEnabledComponents() as $component) {
$angularModules = array_merge($angularModules, $component->getAngularModules());
}
\CRM_Utils_Hook::angularModules($angularModules);
$this->modules = $this->resolvePatterns($angularModules);
}
return $this->modules;
}
示例2: initTasks
static function initTasks()
{
if (!self::$_tasks) {
self::$_tasks = array(1 => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup', 'result' => true), 2 => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup', 'result' => true), 3 => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag', 'result' => true), 4 => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag', 'result' => true), 5 => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => false), 6 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => false), 7 => array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => true), 8 => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => false), 11 => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity', 'result' => true), 13 => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => true), 14 => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => true), 15 => array('title' => ts('Print Contacts'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => false), 16 => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => true), 17 => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => true), 19 => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => true), 21 => array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => true));
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Household');
self::$_tasks[9] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold', 'result' => true);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Organization');
self::$_tasks[10] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization', 'result' => true);
}
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete contacts')) {
unset(self::$_tasks[8]);
}
//show map action only if map provider and key is set
$config =& CRM_Core_Config::singleton();
if ($config->mapProvider && $config->mapAPIKey) {
self::$_tasks[12] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => false);
}
if (CRM_Core_Permission::access('CiviEvent')) {
self::$_tasks[18] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant', 'result' => true);
}
if (CRM_Core_Permission::access('CiviMail')) {
self::$_tasks[20] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => false);
}
self::$_tasks += CRM_Core_Component::taskList();
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
asort(self::$_tasks);
}
}
示例3: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->add('text', 'label', ts('Title'), array('size' => 40), true);
$this->add('text', 'value', ts('URL'), array('size' => 40), true);
$this->add('text', 'name', ts('Class'), array('size' => 40), true);
$element = $this->add('text', 'weight', ts('Weight'), array('size' => 4), true);
// $element->freeze( );
$this->add('text', 'description', ts('Description'), array('size' => 40), true);
$this->add('checkbox', 'is_active', ts('Enabled?'));
require_once 'CRM/Core/Component.php';
$this->_components = CRM_Core_Component::getComponents();
//unset the report component
unset($this->_components['CiviReport']);
$components = array();
foreach ($this->_components as $name => $object) {
$components[$object->componentID] = $object->info['translatedName'];
}
$this->add('select', 'component_id', ts('Component'), array('' => ts('Contact')) + $components);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_Report_Form_Register', 'formRule'), $this);
}
示例4: setCreditCardFields
/**
* create all fields needed for a credit card transaction
*
* @return void
* @access public
*/
function setCreditCardFields(&$form)
{
CRM_Core_Payment_Form::_setPaymentFields($form);
$form->_paymentFields['credit_card_number'] = array('htmlType' => 'text', 'name' => 'credit_card_number', 'title' => ts('Card Number'), 'cc_field' => TRUE, 'attributes' => array('size' => 20, 'maxlength' => 20, 'autocomplete' => 'off'), 'is_required' => TRUE);
$form->_paymentFields['cvv2'] = array('htmlType' => 'text', 'name' => 'cvv2', 'title' => ts('Security Code'), 'cc_field' => TRUE, 'attributes' => array('size' => 5, 'maxlength' => 10, 'autocomplete' => 'off'), 'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'cvv_backoffice_required', CRM_Core_Component::getComponentID('CiviContribute'), 1));
$form->_paymentFields['credit_card_exp_date'] = array('htmlType' => 'date', 'name' => 'credit_card_exp_date', 'title' => ts('Expiration Date'), 'cc_field' => TRUE, 'attributes' => CRM_Core_SelectValues::date('creditCard'), 'is_required' => TRUE);
$creditCardType = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::creditCard();
$form->_paymentFields['credit_card_type'] = array('htmlType' => 'select', 'name' => 'credit_card_type', 'title' => ts('Card Type'), 'cc_field' => TRUE, 'attributes' => $creditCardType, 'is_required' => TRUE);
}
示例5: _getComponentSelectValues
/**
* @return array
*/
private function _getComponentSelectValues()
{
$ret = array();
$this->_components = CRM_Core_Component::getComponents();
foreach ($this->_components as $name => $object) {
$ret[$name] = $object->info['translatedName'];
}
return $ret;
}
示例6: asort
/**
* DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
* Get all the survey activity types
*
*
* @param string $returnColumn
*
* @return array
* array reference of all survey activity types.
*/
public static function &activityType($returnColumn = 'name')
{
$cacheKey = $returnColumn;
if (!isset(self::$activityType[$cacheKey])) {
$campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign');
if ($campaingCompId) {
self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, " AND v.component_id={$campaingCompId}", $returnColumn);
}
}
asort(self::$activityType[$cacheKey]);
return self::$activityType[$cacheKey];
}
示例7:
/**
* Get all the survey activity types
*
* @access public
* @return array - array reference of all survey activity types.
* @static
*/
public static function &activityType($returnColumn = 'name')
{
$cacheKey = $returnColumn;
if (!isset(self::$activityType[$cacheKey])) {
require_once 'CRM/Core/OptionGroup.php';
$campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign');
if ($campaingCompId) {
self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type', false, false, false, " AND v.component_id={$campaingCompId}", $returnColumn);
}
}
return self::$activityType[$cacheKey];
}
示例8: getAngularModules
/**
* Get a list of AngularJS modules which should be autoloaded
*
* @return array (string $name => array('ext' => string $key, 'js' => array $paths, 'css' => array $paths))
*/
public static function getAngularModules()
{
$angularModules = array();
$angularModules['ui.utils'] = array('ext' => 'civicrm', 'js' => array('packages/bower_components/angular-ui-utils/ui-utils.min.js'));
$angularModules['ui.sortable'] = array('ext' => 'civicrm', 'js' => array('packages/bower_components/angular-ui-sortable/sortable.min.js'));
$angularModules['unsavedChanges'] = array('ext' => 'civicrm', 'js' => array('packages/bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'));
$angularModules['crmUi'] = array('ext' => 'civicrm', 'js' => array('js/angular-crm-ui.js'));
foreach (CRM_Core_Component::getEnabledComponents() as $component) {
$angularModules = array_merge($angularModules, $component->getAngularModules());
}
CRM_Utils_Hook::angularModules($angularModules);
return $angularModules;
}
示例9: singleton
/**
* Get an instance
*/
public static function singleton($fresh = FALSE)
{
static $singleton;
if ($fresh || !$singleton) {
$declarations = array();
foreach (CRM_Core_Component::getEnabledComponents() as $component) {
$declarations = array_merge($declarations, $component->getManagedEntities());
}
CRM_Utils_Hook::managed($declarations);
$singleton = new CRM_Core_ManagedEntities(CRM_Core_Module::getAll(), $declarations);
}
return $singleton;
}
示例10: generateJoomlaConfig
/**
* @param $version
*/
function generateJoomlaConfig($version)
{
global $targetDir, $sourceCheckoutDir, $pkgType;
$smarty = new Smarty();
$smarty->template_dir = $sourceCheckoutDir . '/xml/templates';
$smarty->compile_dir = '/tmp/templates_c_u' . posix_geteuid();
createDir($smarty->compile_dir);
$smarty->assign('CiviCRMVersion', $version);
$smarty->assign('creationDate', date('F d Y'));
$smarty->assign('pkgType', $pkgType);
$xml = $smarty->fetch('joomla.tpl');
$output = $targetDir . '/civicrm.xml';
$fd = fopen($output, "w");
fwrite($fd, $xml);
fclose($fd);
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton(FALSE);
require_once 'CRM/Core/Permission.php';
require_once 'CRM/Utils/String.php';
require_once 'CRM/Core/I18n.php';
$permissions = CRM_Core_Permission::getCorePermissions(TRUE);
$crmFolderDir = $sourceCheckoutDir . DIRECTORY_SEPARATOR . 'CRM';
require_once 'CRM/Core/Component.php';
$components = CRM_Core_Component::getComponentsFromFile($crmFolderDir);
foreach ($components as $comp) {
$perm = $comp->getPermissions(FALSE, TRUE);
if ($perm) {
$info = $comp->getInfo();
foreach ($perm as $p => $attr) {
$title = $info['translatedName'] . ': ' . array_shift($attr);
array_unshift($attr, $title);
$permissions[$p] = $attr;
}
}
}
$perms_array = array();
foreach ($permissions as $perm => $attr) {
// give an empty string as default description
$attr[] = '';
//order matters here, but we deal with that later
$perms_array[CRM_Utils_String::munge(strtolower($perm))] = array('title' => array_shift($attr), 'description' => array_shift($attr));
}
$smarty->assign('permissions', $perms_array);
$output = $targetDir . '/admin/access.xml';
$xml = $smarty->fetch('access.tpl');
$fd = fopen($output, "w");
fwrite($fd, $xml);
fclose($fd);
}
示例11: __construct
/**
* Class constructor.
*/
public function __construct()
{
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
$this->_exposeContactID = FALSE;
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
$caseEnabled = in_array("CiviCase", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
$this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
}
$components = CRM_Core_Component::getEnabledComponents();
foreach ($components as $componentName => $componentInfo) {
if (CRM_Core_Permission::check("access {$componentName}")) {
$accessAllowed[] = $componentInfo->componentID;
}
}
$include = '';
if (!empty($accessAllowed)) {
$include = 'OR v.component_id IN (' . implode(', ', $accessAllowed) . ')';
}
$condition = " AND ( v.component_id IS NULL {$include} )";
$this->activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, $condition);
asort($this->activityTypes);
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Contact Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Contact Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Contact Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Contact Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Contact Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject'), 'default' => TRUE), 'activity_date_time' => array('title' => ts('Activity Date'), 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => 'field(civicrm_activity_activity_type_id, ' . implode(', ', array_keys($this->activityTypes)) . ')')), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array())) + $this->addressFields(TRUE);
if ($caseEnabled && CRM_Core_Permission::check('access all cases and activities')) {
$this->_columns['civicrm_activity']['filters']['include_case_activities'] = array('name' => 'include_case_activities', 'title' => ts('Include Case Activities'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')));
}
if ($campaignEnabled) {
// Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
$this->_columns['civicrm_activity']['fields']['result'] = array('title' => 'Survey Result', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
if (!empty($this->activeCampaigns)) {
$this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
}
if (!empty($this->engagementLevels)) {
$this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => 'Engagement Index', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
}
}
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
$this->_tagFilterTable = 'civicrm_activity';
parent::__construct();
}
示例12: testToggleComponent
public function testToggleComponent()
{
$origNames = array();
foreach (CRM_Core_Component::getEnabledComponents() as $c) {
$origNames[] = $c->name;
}
$this->assertTrue(!in_array('CiviCase', $origNames));
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
$newNames = array();
foreach (CRM_Core_Component::getEnabledComponents() as $c) {
$newNames[] = $c->name;
}
$this->assertTrue(in_array('CiviCase', $newNames));
$this->assertEquals(count($newNames), count($origNames) + 1);
}
示例13: install
public function install()
{
if (array_key_exists($this->ext->key, $this->customReports)) {
CRM_Core_Error::fatal('This report is already registered.');
}
if ($this->ext->typeInfo['component'] === 'Contact') {
$compId = 'null';
} else {
$comp = CRM_Core_Component::get($this->ext->typeInfo['component']);
$compId = $comp->componentID;
}
if (empty($compId)) {
CRM_Core_Error::fatal("Component for which you're trying to install the extension (" . $this->ext->typeInfo['component'] . ") is currently disabled.");
}
$weight = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', array('option_group_id' => $this->groupId));
$ids = array();
$params = array('label' => $this->ext->label . ' (' . $this->ext->key . ')', 'value' => $this->ext->typeInfo['reportUrl'], 'name' => $this->ext->key, 'weight' => $weight, 'description' => $this->ext->label . ' (' . $this->ext->key . ')', 'component_id' => $compId, 'option_group_id' => $this->groupId, 'is_active' => 1);
$optionValue = CRM_Core_BAO_OptionValue::add($params, $ids);
}
示例14: str_replace
static function &xmlItems()
{
if (!self::$_items) {
$config = CRM_Core_Config::singleton();
// We needs this until Core becomes a component
$coreMenuFilesNamespace = 'CRM_Core_xml_Menu';
$coreMenuFilesPath = str_replace('_', DIRECTORY_SEPARATOR, $coreMenuFilesNamespace);
global $civicrm_root;
$files = CRM_Utils_File::getFilesByExtension($civicrm_root . DIRECTORY_SEPARATOR . $coreMenuFilesPath, 'xml');
// Grab component menu files
$files = array_merge($files, CRM_Core_Component::xmlMenu());
// lets call a hook and get any additional files if needed
CRM_Utils_Hook::xmlMenu($files);
self::$_items = array();
foreach ($files as $file) {
self::read($file, self::$_items);
}
}
return self::$_items;
}
示例15: alterActionScheduleQuery
public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQueryEvent $e)
{
if ($e->mapping->getEntity() !== 'civicrm_activity') {
return;
}
// The joint expression for activities needs some extra nuance to handle.
// Multiple revisions of the activity.
// Q: Could we simplify & move the extra AND clauses into `where(...)`?
$e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0');
$e->query->select('e.*');
// FIXME: seems too broad.
$e->query->select('ov.label as activity_type, e.id as activity_id');
$e->query->join("og", "!casMailingJoinType civicrm_option_group og ON og.name = 'activity_type'");
$e->query->join("ov", "!casMailingJoinType civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id");
// if CiviCase component is enabled, join for caseId.
$compInfo = CRM_Core_Component::getEnabledComponents();
if (array_key_exists('CiviCase', $compInfo)) {
$e->query->select("civicrm_case_activity.case_id as case_id");
$e->query->join('civicrm_case_activity', "LEFT JOIN `civicrm_case_activity` ON `e`.`id` = `civicrm_case_activity`.`activity_id`");
}
}