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


PHP CRM_Core_Component::getEnabledComponents方法代码示例

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


在下文中一共展示了CRM_Core_Component::getEnabledComponents方法的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;
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:50,代码来源:Manager.php

示例2: __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;
     // if navigated from count link of activity summary reports.
     $this->_resetDateFilter = CRM_Utils_Request::retrieve('resetDateFilter', 'Boolean', CRM_Core_DAO::$_nullObject);
     $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) {
         // CRM-19201: Add support for reporting CiviCampaign activities
         // For CiviCase, "access all cases and activities" is required here
         // rather than "access my cases and activities" to prevent those with
         // only the later permission from seeing a list of all cases which might
         // present a privacy issue.
         if (CRM_Core_Permission::access($componentName, TRUE, TRUE)) {
             $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 Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target 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 Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target 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 Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('contact_source_phone' => array('name' => 'phone', 'title' => ts('Source Phone'), 'alias' => 'civicrm_phone_source'), 'contact_assignee_phone' => array('name' => 'phone', 'title' => ts('Assignee Phone'), 'alias' => 'civicrm_phone_assignee'), 'contact_target_phone' => array('name' => 'phone', 'title' => ts('Target Phone'), 'alias' => 'civicrm_phone_target'))), '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'), 'type' => CRM_Utils_Type::T_STRING, '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' => ts('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' => ts('Campaign'), 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         }
         if (!empty($this->engagementLevels)) {
             $this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => ts('Engagement Index'), 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
         }
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_tagFilterTable = 'civicrm_activity';
     parent::__construct();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:59,代码来源:Activity.php

示例3: 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;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:16,代码来源:ManagedEntities.php

示例4: 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;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:18,代码来源:Angular.php

示例5: 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);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:16,代码来源:ConfigSettingTest.php

示例6: 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`");
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:21,代码来源:Tokens.php

示例7: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     // lets trim all the whitespace
     $this->applyFilter('__ALL__', 'trim');
     // add a hidden field to remember the price set id
     // this get around the browser tab issue
     $this->add('hidden', 'sid', $this->_sid);
     $this->add('hidden', 'fid', $this->_fid);
     // label
     $this->add('text', 'label', ts('Field Label'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'label'), TRUE);
     // html_type
     $javascript = 'onchange="option_html_type(this.form)";';
     $htmlTypes = CRM_Price_BAO_PriceField::htmlTypes();
     // Text box for Participant Count for a field
     // Financial Type
     $financialType = CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
     foreach ($financialType as $finTypeId => $type) {
         if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('add contributions of type ' . $type)) {
             unset($financialType[$finTypeId]);
         }
     }
     if (count($financialType)) {
         $this->assign('financialType', $financialType);
     }
     $enabledComponents = CRM_Core_Component::getEnabledComponents();
     $eventComponentId = $memberComponentId = NULL;
     if (array_key_exists('CiviEvent', $enabledComponents)) {
         $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
     }
     if (array_key_exists('CiviMember', $enabledComponents)) {
         $memberComponentId = CRM_Core_Component::getComponentID('CiviMember');
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
     $this->add('select', 'financial_type_id', ts('Financial Type'), array(' ' => ts('- select -')) + $financialType);
     $this->assign('useForMember', FALSE);
     if (in_array($eventComponentId, $this->_extendComponentId)) {
         $this->add('text', 'count', ts('Participant Count'), $attributes['count']);
         $this->addRule('count', ts('Participant Count should be a positive number'), 'positiveInteger');
         $this->add('text', 'max_value', ts('Max Participants'), $attributes['max_value']);
         $this->addRule('max_value', ts('Please enter a valid Max Participants.'), 'positiveInteger');
         $this->assign('useForEvent', TRUE);
     } else {
         if (in_array($memberComponentId, $this->_extendComponentId)) {
             $this->_useForMember = 1;
             $this->assign('useForMember', $this->_useForMember);
         }
         $this->assign('useForEvent', FALSE);
     }
     $sel = $this->add('select', 'html_type', ts('Input Field Type'), $htmlTypes, TRUE, $javascript);
     // price (for text inputs)
     $this->add('text', 'price', ts('Price'));
     $this->registerRule('price', 'callback', 'money', 'CRM_Utils_Rule');
     $this->addRule('price', ts('must be a monetary value'), 'money');
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $this->freeze('html_type');
     }
     // form fields of Custom Option rows
     $_showHide = new CRM_Core_ShowHideBlocks('', '');
     for ($i = 1; $i <= self::NUM_OPTION; $i++) {
         //the show hide blocks
         $showBlocks = 'optionField_' . $i;
         if ($i > 2) {
             $_showHide->addHide($showBlocks);
             if ($i == self::NUM_OPTION) {
                 $_showHide->addHide('additionalOption');
             }
         } else {
             $_showHide->addShow($showBlocks);
         }
         // label
         $attributes['label']['size'] = 25;
         $this->add('text', 'option_label[' . $i . ']', ts('Label'), $attributes['label']);
         // amount
         $this->add('text', 'option_amount[' . $i . ']', ts('Amount'), $attributes['amount']);
         $this->addRule('option_amount[' . $i . ']', ts('Please enter a valid amount for this field.'), 'money');
         //Financial Type
         $this->add('select', 'option_financial_type_id[' . $i . ']', ts('Financial Type'), array('' => ts('- select -')) + $financialType);
         if (in_array($eventComponentId, $this->_extendComponentId)) {
             // count
             $this->add('text', 'option_count[' . $i . ']', ts('Participant Count'), $attributes['count']);
             $this->addRule('option_count[' . $i . ']', ts('Please enter a valid Participants Count.'), 'positiveInteger');
             // max_value
             $this->add('text', 'option_max_value[' . $i . ']', ts('Max Participants'), $attributes['max_value']);
             $this->addRule('option_max_value[' . $i . ']', ts('Please enter a valid Max Participants.'), 'positiveInteger');
             // description
             //$this->add('textArea', 'option_description['.$i.']', ts('Description'), array('rows' => 1, 'cols' => 40 ));
         } elseif (in_array($memberComponentId, $this->_extendComponentId)) {
             $membershipTypes = CRM_Member_PseudoConstant::membershipType();
             $js = array('onchange' => "calculateRowValues( {$i} );");
             $this->add('select', 'membership_type_id[' . $i . ']', ts('Membership Type'), array('' => ' ') + $membershipTypes, FALSE, $js);
             $this->add('text', 'membership_num_terms[' . $i . ']', ts('Number of Terms'), CRM_Utils_Array::value('membership_num_terms', $attributes));
         }
         // weight
         $this->add('text', 'option_weight[' . $i . ']', ts('Order'), $attributes['weight']);
         // is active ?
         $this->add('checkbox', 'option_status[' . $i . ']', ts('Active?'));
         $defaultOption[$i] = $this->createElement('radio', NULL, NULL, NULL, $i);
//.........这里部分代码省略.........
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:101,代码来源:Field.php

示例8: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     $this->set('context', 'advanced');
     $this->_searchPane = CRM_Utils_Array::value('searchPane', $_GET);
     $this->_searchOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'advanced_search_options');
     if (!$this->_searchPane || $this->_searchPane == 'basic') {
         CRM_Contact_Form_Search_Criteria::basic($this);
     }
     $allPanes = array();
     $paneNames = array(ts('Address Fields') => 'location', ts('Custom Fields') => 'custom', ts('Activities') => 'activity', ts('Relationships') => 'relationship', ts('Demographics') => 'demographics', ts('Notes') => 'notes', ts('Change Log') => 'changeLog');
     //check if there are any custom data searchable fields
     $groupDetails = array();
     $extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
     $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
     // if no searchable fields unset panel
     if (empty($groupDetails)) {
         unset($paneNames[ts('Custom Fields')]);
     }
     foreach ($paneNames as $name => $type) {
         if (!$this->_searchOptions[$type]) {
             unset($paneNames[$name]);
         }
     }
     $components = CRM_Core_Component::getEnabledComponents();
     $componentPanes = array();
     foreach ($components as $name => $component) {
         if (in_array($name, array_keys($this->_searchOptions)) && $this->_searchOptions[$name] && CRM_Core_Permission::access($component->name)) {
             $componentPanes[$name] = $component->registerAdvancedSearchPane();
             $componentPanes[$name]['name'] = $name;
         }
     }
     usort($componentPanes, array('CRM_Utils_Sort', 'cmpFunc'));
     foreach ($componentPanes as $name => $pane) {
         // FIXME: we should change the use of $name here to keyword
         $paneNames[$pane['title']] = $pane['name'];
     }
     $hookPanes = array();
     CRM_Contact_BAO_Query_Hook::singleton()->registerAdvancedSearchPane($hookPanes);
     $paneNames = array_merge($paneNames, $hookPanes);
     $this->_paneTemplatePath = array();
     foreach ($paneNames as $name => $type) {
         if (!array_key_exists($type, $this->_searchOptions) && !in_array($type, $hookPanes)) {
             continue;
         }
         $allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/contact/search/advanced', "snippet=1&searchPane={$type}&qfKey={$this->controller->_key}"), 'open' => 'false', 'id' => $type);
         // see if we need to include this paneName in the current form
         if ($this->_searchPane == $type || CRM_Utils_Array::value("hidden_{$type}", $_POST) || CRM_Utils_Array::value("hidden_{$type}", $this->_formValues)) {
             $allPanes[$name]['open'] = 'true';
             if (CRM_Utils_Array::value($type, $components)) {
                 $c = $components[$type];
                 $this->add('hidden', "hidden_{$type}", 1);
                 $c->buildAdvancedSearchPaneForm($this);
                 $this->_paneTemplatePath[$type] = $c->getAdvancedSearchPaneTemplatePath();
             } else {
                 if (in_array($type, $hookPanes)) {
                     CRM_Contact_BAO_Query_Hook::singleton()->buildAdvancedSearchPaneForm($this, $type);
                     CRM_Contact_BAO_Query_Hook::singleton()->setAdvancedSearchPaneTemplatePath($this->_paneTemplatePath, $type);
                 } else {
                     CRM_Contact_Form_Search_Criteria::$type($this);
                     $template = ucfirst($type);
                     $this->_paneTemplatePath[$type] = "CRM/Contact/Form/Search/Criteria/{$template}.tpl";
                 }
             }
         }
     }
     $this->assign('allPanes', $allPanes);
     if (!$this->_searchPane) {
         parent::buildQuickForm();
     } else {
         $this->assign('suppressForm', TRUE);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:79,代码来源:Advanced.php

示例9: setTemplateShortcutValues

 /**
  * Create the list of options to create New objects for the application and format is as a block.
  *
  * @return void
  */
 private static function setTemplateShortcutValues()
 {
     $config = CRM_Core_Config::singleton();
     static $shortCuts = array();
     if (!$shortCuts) {
         if (CRM_Core_Permission::check('add contacts')) {
             if (CRM_Core_Permission::giveMeAllACLs()) {
                 $shortCuts = CRM_Contact_BAO_ContactType::getCreateNewList();
             }
         }
         // new activity (select target contact)
         $shortCuts = array_merge($shortCuts, array(array('path' => 'civicrm/activity', 'query' => 'action=add&reset=1&context=standalone', 'ref' => 'new-activity', 'title' => ts('Activity'))));
         $components = CRM_Core_Component::getEnabledComponents();
         if (!empty($config->enableComponents)) {
             // check if we can process credit card contribs
             $newCredit = CRM_Core_Config::isEnabledBackOfficeCreditCardPayments();
             foreach ($components as $componentName => $obj) {
                 if (in_array($componentName, $config->enableComponents)) {
                     $obj->creatNewShortcut($shortCuts, $newCredit);
                 }
             }
         }
         // new email (select recipients)
         $shortCuts = array_merge($shortCuts, array(array('path' => 'civicrm/activity/email/add', 'query' => 'atype=3&action=add&reset=1&context=standalone', 'ref' => 'new-email', 'title' => ts('Email'))));
         if (CRM_Core_Permission::check('edit groups')) {
             $shortCuts = array_merge($shortCuts, array(array('path' => 'civicrm/group/add', 'query' => 'reset=1', 'ref' => 'new-group', 'title' => ts('Group'))));
         }
         if (CRM_Core_Permission::check('administer CiviCRM')) {
             $shortCuts = array_merge($shortCuts, array(array('path' => 'civicrm/admin/tag', 'query' => 'reset=1&action=add', 'ref' => 'new-tag', 'title' => ts('Tag'))));
         }
         if (empty($shortCuts)) {
             return NULL;
         }
     }
     $values = array();
     foreach ($shortCuts as $key => $short) {
         $values[$key] = self::setShortCutValues($short);
     }
     // call links hook to add user defined links
     CRM_Utils_Hook::links('create.new.shorcuts', NULL, CRM_Core_DAO::$_nullObject, $values, CRM_Core_DAO::$_nullObject, CRM_Core_DAO::$_nullObject);
     foreach ($values as $key => $val) {
         if (!empty($val['title'])) {
             $values[$key]['name'] = CRM_Utils_Array::value('name', $val, $val['title']);
         }
     }
     self::setProperty(self::CREATE_NEW, 'templateValues', array('shortCuts' => $values));
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:52,代码来源:Block.php

示例10: func_get_args

 /**
  * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
  *
  * Get all Activty types.
  *
  * The static array activityType is returned
  *
  * @param boolean $all - get All Activity  types - default is to get only active ones.
  *
  * @access public
  * @static
  *
  * @return array - array reference of all activity types.
  */
 public static function &activityType()
 {
     $args = func_get_args();
     $all = CRM_Utils_Array::value(0, $args, TRUE);
     $includeCaseActivities = CRM_Utils_Array::value(1, $args, FALSE);
     $reset = CRM_Utils_Array::value(2, $args, FALSE);
     $returnColumn = CRM_Utils_Array::value(3, $args, 'label');
     $includeCampaignActivities = CRM_Utils_Array::value(4, $args, FALSE);
     $onlyComponentActivities = CRM_Utils_Array::value(5, $args, FALSE);
     $index = (int) $all . '_' . $returnColumn . '_' . (int) $includeCaseActivities;
     $index .= '_' . (int) $includeCampaignActivities;
     $index .= '_' . (int) $onlyComponentActivities;
     if (NULL === self::$activityType) {
         self::$activityType = array();
     }
     if (!isset(self::$activityType[$index]) || $reset) {
         $condition = NULL;
         if (!$all) {
             $condition = 'AND filter = 0';
         }
         $componentClause = " v.component_id IS NULL";
         if ($onlyComponentActivities) {
             $componentClause = " v.component_id IS NOT NULL";
         }
         $componentIds = array();
         $compInfo = CRM_Core_Component::getEnabledComponents();
         // build filter for listing activity types only if their
         // respective components are enabled
         foreach ($compInfo as $compName => $compObj) {
             if ($compName == 'CiviCase') {
                 if ($includeCaseActivities) {
                     $componentIds[] = $compObj->componentID;
                 }
             } elseif ($compName == 'CiviCampaign') {
                 if ($includeCampaignActivities) {
                     $componentIds[] = $compObj->componentID;
                 }
             } else {
                 $componentIds[] = $compObj->componentID;
             }
         }
         if (count($componentIds)) {
             $componentIds = implode(',', $componentIds);
             $componentClause = " ({$componentClause} OR v.component_id IN ({$componentIds}))";
             if ($onlyComponentActivities) {
                 $componentClause = " ( v.component_id IN ({$componentIds} ) )";
             }
         }
         $condition = $condition . ' AND ' . $componentClause;
         self::$activityType[$index] = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, $condition, $returnColumn);
     }
     return self::$activityType[$index];
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:67,代码来源:PseudoConstant.php

示例11: ts

 static function &basicPermissions($all = FALSE)
 {
     static $permissions = NULL;
     if (!$permissions) {
         $prefix = ts('CiviCRM') . ': ';
         $permissions = self::getCorePermissions();
         if (self::isMultisiteEnabled()) {
             $permissions['administer Multiple Organizations'] = $prefix . ts('administer Multiple Organizations');
         }
         $config = CRM_Core_Config::singleton();
         if (!$all) {
             $components = CRM_Core_Component::getEnabledComponents();
         } else {
             $components = CRM_Core_Component::getComponents();
         }
         foreach ($components as $comp) {
             $perm = $comp->getPermissions();
             if ($perm) {
                 $info = $comp->getInfo();
                 foreach ($perm as $p) {
                     $permissions[$p] = $info['translatedName'] . ': ' . $p;
                 }
             }
         }
         // Add any permissions defined in hook_civicrm_permission implementations.
         $config = CRM_Core_Config::singleton();
         $module_permissions = $config->userPermissionClass->getAllModulePermissions();
         $permissions = array_merge($permissions, $module_permissions);
     }
     return $permissions;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:31,代码来源:Permission.php

示例12: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $this->applyFilter('__ALL__', 'trim');
     $this->assign('sid', $this->_sid);
     // title
     $this->add('text', 'title', ts('Set Name'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'title'), TRUE);
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Price_DAO_PriceSet', $this->_sid, 'title'));
     $priceSetUsedTables = $extends = array();
     if ($this->_action == CRM_Core_Action::UPDATE && $this->_sid) {
         $priceSetUsedTables = CRM_Price_BAO_PriceSet::getUsedBy($this->_sid, 'table');
     }
     $config = CRM_Core_Config::singleton();
     $showContribution = FALSE;
     $enabledComponents = CRM_Core_Component::getEnabledComponents();
     foreach ($enabledComponents as $name => $compObj) {
         switch ($name) {
             case 'CiviEvent':
                 $option = $this->createElement('checkbox', $compObj->componentID, NULL, ts('Event'));
                 if (!empty($priceSetUsedTables)) {
                     foreach (array('civicrm_event', 'civicrm_participant') as $table) {
                         if (in_array($table, $priceSetUsedTables)) {
                             $option->freeze();
                             break;
                         }
                     }
                 }
                 $extends[] = $option;
                 break;
             case 'CiviContribute':
                 $option = $this->createElement('checkbox', $compObj->componentID, NULL, ts('Contribution'));
                 if (!empty($priceSetUsedTables)) {
                     foreach (array('civicrm_contribution', 'civicrm_contribution_page') as $table) {
                         if (in_array($table, $priceSetUsedTables)) {
                             $option->freeze();
                             break;
                         }
                     }
                 }
                 $extends[] = $option;
                 break;
             case 'CiviMember':
                 $option = $this->createElement('checkbox', $compObj->componentID, NULL, ts('Membership'));
                 if (!empty($priceSetUsedTables)) {
                     foreach (array('civicrm_membership', 'civicrm_contribution_page') as $table) {
                         if (in_array($table, $priceSetUsedTables)) {
                             $option->freeze();
                             break;
                         }
                     }
                 }
                 $extends[] = $option;
                 break;
         }
     }
     if (CRM_Utils_System::isNull($extends)) {
         $this->assign('extends', FALSE);
     } else {
         $this->assign('extends', TRUE);
     }
     $this->addGroup($extends, 'extends', ts('Used For'), '&nbsp;', TRUE);
     $this->addRule('extends', ts('%1 is a required field.', array(1 => ts('Used For'))), 'required');
     // financial type
     $financialType = CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
     foreach ($financialType as $finTypeId => $type) {
         if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('add contributions of type ' . $type)) {
             unset($financialType[$finTypeId]);
         }
     }
     $this->add('select', 'financial_type_id', ts('Default Financial Type'), array('' => ts('- select -')) + $financialType, 'required');
     // help text
     $this->add('textarea', 'help_pre', ts('Pre-form Help'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'help_pre'));
     $this->add('textarea', 'help_post', ts('Post-form Help'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'help_post'));
     // is this set active ?
     $this->addElement('checkbox', 'is_active', ts('Is this Price Set active?'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $this->addFormRule(array('CRM_Price_Form_Set', 'formRule'));
     // views are implemented as frozen form
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
         //$this->addElement('button', 'done', ts('Done'), array('onclick' => "location.href='civicrm/admin/price?reset=1&action=browse'"));
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:87,代码来源:Set.php

示例13: array

 /**
  * Get all Activty types.
  *
  * The static array activityType is returned
  * @param boolean $all - get All Activity  types - default is to get only active ones.
  *
  * @access public
  * @static
  *
  * @return array - array reference of all activty types.
  */
 public static function &activityType($all = true, $includeCaseActivities = false, $reset = false, $returnColumn = 'label', $includeCampaignActivities = false)
 {
     $index = (int) $all . '_' . $returnColumn . '_' . (int) $includeCaseActivities;
     $index .= '_' . (int) $includeCampaignActivities;
     if (!array_key_exists($index, self::$activityType) || $reset) {
         require_once 'CRM/Core/OptionGroup.php';
         $condition = null;
         if (!$all) {
             $condition = 'AND filter = 0';
         }
         $componentClause = " v.component_id IS NULL";
         $componentIds = array();
         require_once 'CRM/Core/Component.php';
         $compInfo = CRM_Core_Component::getEnabledComponents();
         // build filter for listing activity types only if their
         // respective components are enabled
         foreach ($compInfo as $compName => $compObj) {
             if ($compName == 'CiviCase') {
                 if ($includeCaseActivities) {
                     $componentIds[] = $compObj->componentID;
                 }
             } else {
                 if ($compName == 'CiviCampaign') {
                     if ($includeCampaignActivities) {
                         $componentIds[] = $compObj->componentID;
                     }
                 } else {
                     $componentIds[] = $compObj->componentID;
                 }
             }
         }
         if (count($componentIds)) {
             $componentIds = implode(',', $componentIds);
             $componentClause = " ({$componentClause} OR v.component_id IN ({$componentIds}))";
         }
         $condition = $condition . ' AND ' . $componentClause;
         self::$activityType[$index] = CRM_Core_OptionGroup::values('activity_type', false, false, false, $condition, $returnColumn);
     }
     return self::$activityType[$index];
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:51,代码来源:PseudoConstant.php

示例14: clauseComponent

 function clauseComponent()
 {
     $selectedContacts = implode(',', $this->_contactSelected);
     $contribution = $membership = $participant = null;
     $eligibleResult = $rows = $tempArray = array();
     foreach ($this->_component as $val) {
         if (CRM_Utils_Array::value($val, $this->_selectComponent) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) {
             $sql = "{$this->_selectComponent[$val]} {$this->_formComponent[$val]} \n                         WHERE    {$this->_aliases['civicrm_contact']}.id IN ( {$selectedContacts} )\n                         GROUP BY {$this->_aliases['civicrm_contact']}.id,{$val}.id ";
             $dao = CRM_Core_DAO::executeQuery($sql);
             while ($dao->fetch()) {
                 $countRecord = 0;
                 $eligibleResult[$val] = $val;
                 $CC = "civicrm_" . substr_replace($val, '', -11, 11) . "_contact_id";
                 $row = array();
                 foreach ($this->_columnHeadersComponent[$val] as $key => $value) {
                     $countRecord++;
                     $row[$key] = $dao->{$key};
                 }
                 //if record exist for component(except contact_id)
                 //since contact_id is selected for every component
                 if ($countRecord > 1) {
                     $rows[$dao->{$CC}][$val][] = $row;
                 }
                 $tempArray[$dao->{$CC}] = $dao->{$CC};
             }
         }
     }
     if (CRM_Utils_Array::value('relationship_civireport', $this->_selectComponent)) {
         require_once 'CRM/Contact/BAO/Relationship.php';
         $relTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, 'null', null, null, true);
         $val = 'relationship_civireport';
         $eligibleResult[$val] = $val;
         $sql = "{$this->_selectComponent[$val]},{$this->_aliases['civicrm_contact']}.display_name as contact_b_name,  contact_a.id as contact_a_id , contact_a.display_name  as contact_a_name  {$this->_formComponent[$val]} \n                         WHERE    ({$this->_aliases['civicrm_contact']}.id IN ( {$selectedContacts} )\n                                  OR \n                                  contact_a.id IN ( {$selectedContacts} ) ) AND\n                                  {$this->_aliases['civicrm_relationship']}.is_active = 1\n                         GROUP BY {$this->_aliases['civicrm_relationship']}.id";
         $dao = CRM_Core_DAO::executeQuery($sql);
         while ($dao->fetch()) {
             foreach ($this->_columnHeadersComponent[$val] as $key => $value) {
                 if ($key == 'civicrm_relationship_contact_id_b') {
                     $row[$key] = $dao->contact_b_name;
                     continue;
                 }
                 $row[$key] = $dao->{$key};
             }
             $relTitle = "" . $dao->civicrm_relationship_relationship_type_id . "_a_b";
             $row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
             $rows[$dao->contact_a_id][$val][] = $row;
             $row['civicrm_relationship_contact_id_b'] = $dao->contact_a_name;
             $relTitle = "" . $dao->civicrm_relationship_relationship_type_id . "_b_a";
             if (isset($relTypes[$relTitle])) {
                 $row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
             }
             $rows[$dao->civicrm_relationship_contact_id_b][$val][] = $row;
         }
     }
     if (CRM_Utils_Array::value('activity_civireport', $this->_selectComponent)) {
         $componentClause = "civicrm_option_value.component_id IS NULL";
         $componentsIn = null;
         $compInfo = CRM_Core_Component::getEnabledComponents();
         foreach ($compInfo as $compObj) {
             if ($compObj->info['showActivitiesInCore']) {
                 $componentsIn = $componentsIn ? $componentsIn . ', ' . $compObj->componentID : $compObj->componentID;
             }
         }
         if ($componentsIn) {
             $componentClause = "( {$componentClause} OR \n                                      civicrm_option_value.component_id IN ({$componentsIn}) )";
         }
         $val = 'activity_civireport';
         $eligibleResult[$val] = $val;
         $sql = "{$this->_selectComponent[$val]} , \n                 sourceContact.display_name as added_by {$this->_formComponent[$val]}\n\n                 WHERE ( {$this->_aliases['civicrm_activity']}.source_contact_id IN ({$selectedContacts}) OR \n                         target_contact_id IN ({$selectedContacts}) OR \n                         assignee_contact_id IN ({$selectedContacts}) OR \n                         civicrm_case_contact.contact_id IN ({$selectedContacts}) ) AND \n                        civicrm_option_group.name = 'activity_type' AND \n                        {$this->_aliases['civicrm_activity']}.is_test = 0 AND \n                        ({$componentClause})\n\n                 GROUP BY {$this->_aliases['civicrm_activity']}.id \n\n                 ORDER BY {$this->_aliases['civicrm_activity']}.activity_date_time desc  ";
         $dao = CRM_Core_DAO::executeQuery($sql);
         while ($dao->fetch()) {
             foreach ($this->_columnHeadersComponent[$val] as $key => $value) {
                 if ($key == 'civicrm_activity_source_contact_id') {
                     $row[$key] = $dao->added_by;
                     continue;
                 }
                 $row[$key] = $dao->{$key};
             }
             if (isset($dao->civicrm_activity_source_contact_id)) {
                 $rows[$dao->civicrm_activity_source_contact_id][$val][] = $row;
             }
             if (isset($dao->target_contact_id)) {
                 $rows[$dao->target_contact_id][$val][] = $row;
             }
             if (isset($dao->assignee_contact_id)) {
                 $rows[$dao->assignee_contact_id][$val][] = $row;
             }
         }
         //unset the component header if data is not present
         foreach ($this->_component as $val) {
             if (!in_array($val, $eligibleResult)) {
                 unset($this->_columnHeadersComponent[$val]);
             }
         }
     }
     return $rows;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:96,代码来源:Detail.php

示例15: enableComponent

 /**
  * takes a componentName and enables it in the config
  * Primarily used during unit testing
  *
  * @param string $componentName name of the component to be enabled, needs to be valid
  *
  * @return boolean - true if valid component name and enabling succeeds, else false
  * @static
  */
 static function enableComponent($componentName)
 {
     $config = CRM_Core_Config::singleton();
     if (in_array($componentName, $config->enableComponents)) {
         // component is already enabled
         return TRUE;
     }
     $components = CRM_Core_Component::getComponents();
     // return if component does not exist
     if (!array_key_exists($componentName, $components)) {
         return FALSE;
     }
     // get enabled-components from DB and add to the list
     $enabledComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array());
     $enabledComponents[] = $componentName;
     $enabledComponentIDs = array();
     foreach ($enabledComponents as $name) {
         $enabledComponentIDs[] = $components[$name]->componentID;
     }
     // fix the config object
     $config->enableComponents = $enabledComponents;
     $config->enableComponentIDs = $enabledComponentIDs;
     // also force reset of component array
     CRM_Core_Component::getEnabledComponents(TRUE);
     // update DB
     CRM_Core_BAO_Setting::setItem($enabledComponents, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components');
     return TRUE;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:37,代码来源:ConfigSetting.php


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