本文整理汇总了PHP中CRM_Core_OptionGroup::values方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_OptionGroup::values方法的具体用法?PHP CRM_Core_OptionGroup::values怎么用?PHP CRM_Core_OptionGroup::values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_OptionGroup
的用法示例。
在下文中一共展示了CRM_Core_OptionGroup::values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
*
* @return void
*/
public function buildQuickForm()
{
$slots = CRM_Core_OptionGroup::values('conference_slot');
$this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
$this->addEntityRef('parent_event_id', ts('Parent Event'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
parent::buildQuickForm();
}
示例2: __construct
function __construct()
{
$this->fetchActivityTypes();
$this->fetchCaseStatusses();
$rels = CRM_Core_PseudoConstant::relationshipType();
$coach_rel_type_id = false;
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
if ($v['label_b_a'] == 'Coach') {
$coach_rel_type_id = $relid;
}
}
$coaches = array();
if ($coach_rel_type_id) {
$coaches = $this->coaches($coach_rel_type_id);
}
$this->_groupFilter = FALSE;
$this->_tagFilter = FALSE;
$this->_columns = array('civicrm_activity`' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array(), 'filters' => array('activity_type_id' => array('title' => ts('Activity type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('activity_type'), 'pseudofield' => true, 'default' => $this->_activityTypes), 'case_status' => array('title' => ts('Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('case_status'), 'pseudofield' => true, 'default' => $this->_openedCaseStatusses), 'case_role' => array('title' => ts('Role on case'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->rel_types), 'coach' => array('title' => ts('Coach'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $coaches, 'pseudofield' => true), 'my_cases' => array('title' => ts('My cases'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')), 'default' => '1', 'pseudofield' => TRUE))));
parent::__construct();
$this->fetchCaseType();
$this->fetchChequenummer();
$this->fetchStatusGroup();
$this->fetchCoachIdentifier();
}
示例3: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$links =& self::links();
$action = array_sum(array_keys($links));
$caseStatus = CRM_Core_OptionGroup::values('case_status');
$caseType = CRM_Core_OptionGroup::values('case_type');
require_once 'CRM/Case/BAO/Case.php';
$queryParams = array();
$query = "SELECT civicrm_case.id, civicrm_case.case_type_id, civicrm_case.status_id,\n civicrm_case.start_date, civicrm_case.subject \n FROM civicrm_case\n LEFT JOIN civicrm_case_contact ON civicrm_case_contact.case_id = civicrm_case.id\n WHERE civicrm_case_contact.contact_id = {$this->_contactId}";
$case = CRM_Core_DAO::executeQuery($query, $queryParams);
$values = array();
while ($case->fetch()) {
$values[$case->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $case->id, 'cid' => $this->_contactId));
$names = array();
$caseTypeIds = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, $case->case_type_id);
foreach ($caseTypeIds as $id => $val) {
if ($val) {
$names[] = $caseType[$val];
}
}
$values[$case->id]['case_type_id'] = implode(':::', $names);
$values[$case->id]['status_id'] = $caseStatus[$case->status_id];
$values[$case->id]['start_date'] = $case->start_date;
$values[$case->id]['subject'] = $case->subject;
$values[$case->id]['id'] = $case->id;
}
$this->assign('cases', $values);
}
示例4: buildQuickForm
/**
* Build the form object.
*
* It consists of
* - displaying the QILL (query in local language)
* - displaying elements for saving the search
*/
public function buildQuickForm()
{
// @todo sync this more with CRM_Group_Form_Edit.
$query = new CRM_Contact_BAO_Query($this->get('queryParams'));
$this->assign('qill', $query->qill());
// Values from the search form
$formValues = $this->controller->exportValues();
// the name and description are actually stored with the group and not the saved search
$this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
$this->addElement('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
$groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
unset($groupTypes['Access Control']);
if (!CRM_Core_Permission::access('CiviMail')) {
$isWorkFlowEnabled = CRM_Mailing_Info::workflowEnabled();
if ($isWorkFlowEnabled && !CRM_Core_Permission::check('create mailings') && !CRM_Core_Permission::check('schedule mailings') && !CRM_Core_Permission::check('approve mailings')) {
unset($groupTypes['Mailing List']);
}
}
if (!empty($groupTypes)) {
$this->addCheckBox('group_type', ts('Group Type'), $groupTypes, NULL, NULL, NULL, NULL, ' ');
}
//CRM-14190
CRM_Group_Form_Edit::buildParentGroups($this);
// get the group id for the saved search
$groupID = NULL;
if (isset($this->_id)) {
$groupID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_id, 'id', 'saved_search_id');
$this->addDefaultButtons(ts('Update Smart Group'));
} else {
$this->addDefaultButtons(ts('Save Smart Group'));
$this->assign('partiallySelected', $formValues['radio_ts'] != 'ts_all');
}
$this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupID, 'title'));
}
示例5: hrvisa_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrvisa_civicrm_install()
{
if (!CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name')) {
// create activity_type 'Visa Expiration'
$params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0);
$result = civicrm_api3('activity_type', 'create', $params);
if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Error::debug_var("Failed to create activity type 'Visa Expiration'", $result);
throw new CRM_Core_Exception('Failed to create activity type \'Visa Expiration\'');
}
$activityTypeId = $result['values'][$result['id']]['value'];
} else {
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
}
// set weekly reminder for Visa Expiration activities (not active)
// will be active when extension is enabled
if (!empty($activityTypeId)) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
// schedule reminder for Visa Expiration Creation
$result = civicrm_api3('action_schedule', 'get', array('name' => 'Visa Expiration Reminder'));
if (empty($result['id'])) {
$params = array('name' => 'Visa Expiration Reminder', 'title' => 'Visa Expiration Reminder', 'recipient' => $targetID, 'limit_to' => 1, 'entity_value' => $activityTypeId, 'entity_status' => CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'), 'start_action_offset' => 1, 'start_action_unit' => 'week', 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 0, 'is_active' => 0, 'body_html' => '<p>Your latest visa expiries on {activity.activity_date_time}</p>', 'subject' => 'Reminder for Visa Expiration', 'record_activity' => 1, 'mapping_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value'));
$result = civicrm_api3('action_schedule', 'create', $params);
}
}
return _hrvisa_civix_civicrm_install();
}
示例6: run
public function run()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, 0);
$config = CRM_Chapters_AutomatchConfig::singelton();
$sql = "SELECT id, `" . $config->getMatchTypeField('column_name') . "` AS `type`, `" . $config->getCountryField('column_name') . "` AS `country`, `" . $config->getZipCodeRangeFromField('column_name') . "` AS `zipcode_from`, `" . $config->getZipCodeRangeToField('column_name') . "` AS `zipcode_to` FROM `" . $config->getCustomGroup('table_name') . "` WHERE entity_id = %1";
$params[1] = array($cid, 'Integer');
$rows = array();
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$types = CRM_Core_OptionGroup::values('chapter_match_type');
$countries = CRM_Core_OptionGroup::values('chapter_match_country');
while ($dao->fetch()) {
$country = '';
if (!empty($countries[$dao->country])) {
$country = $countries[$dao->country];
}
$row = array();
$row['type'] = $types[$dao->type];
$row['type_value'] = $dao->type;
$row['country'] = $country;
$row['zipcode_from'] = $dao->zipcode_from;
$row['zipcode_to'] = $dao->zipcode_to;
$row['id'] = $dao->id;
$rows[] = $row;
}
$this->assign('rows', $rows);
$this->assign('cid', $cid);
parent::run();
}
示例7: preProcess
function preProcess()
{
// Make sure case types have been configured for the component
require_once 'CRM/Core/OptionGroup.php';
$caseType = CRM_Core_OptionGroup::values('case_type');
if (empty($caseType)) {
$this->assign('notConfigured', 1);
return;
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
if ($this->_contactId) {
$this->assign('contactId', $this->_contactId);
// check logged in url permission
require_once 'CRM/Contact/Page/View.php';
CRM_Contact_Page_View::checkUserPermission($this);
} else {
if ($this->_action & CRM_Core_Action::VIEW) {
CRM_Core_Error::fatal('Contact Id is required for view action.');
}
}
$activityTypes = CRM_Case_PseudoConstant::activityType();
$this->assign('openCaseId', $activityTypes['Open Case']['id']);
$this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
$this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
$this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
}
示例8: testBatchAddMembership
function testBatchAddMembership()
{
$this->webtestLogin();
$itemCount = 5;
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
$softCreditAmount = array(1 => 50, 2 => 60, 3 => 40, 4 => 70, 5 => 35);
// create contact
$contact = array();
$batchTitle = 'Batch-' . substr(sha1(rand()), 0, 7);
//Open Live Contribution Page
$this->openCiviPage("batch", "reset=1");
$this->click("xpath=//div[@class='crm-submit-buttons']/a");
$this->waitForElementPresent("_qf_Batch_next");
$this->click("title");
$this->type("title", $batchTitle);
$this->select("type_id", "Membership");
$this->type("item_count", $itemCount);
$this->type("total", 500);
$this->click("_qf_Batch_next");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Add Contact Details
$data = array();
for ($i = 1; $i <= $itemCount; $i++) {
$data[$i] = array('first_name' => 'Ma' . substr(sha1(rand()), 0, 7), 'last_name' => 'An' . substr(sha1(rand()), 0, 7), 'membership_type' => 'General', 'amount' => 100, 'financial_type' => 'Member Dues', 'soft_credit_first_name' => 'Ar' . substr(sha1(rand()), 0, 7), 'soft_credit_last_name' => 'Ki' . substr(sha1(rand()), 0, 7), 'soft_credit_amount' => $softCreditAmount[$i], 'soft_credit_type' => $softCreditTypes[$i]);
$this->_fillData($data[$i], $i, "Membership");
}
$this->click("_qf_Entry_cancel");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->_verifyData($data, "Membership");
}
示例9: setDefaultValues
/**
* This function sets the default values for the form.
* default values are retrieved from the database
*
* @access public
*
* @return None
*/
function setDefaultValues()
{
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
$formMode = FALSE;
if (in_array($this->_name, $formArray)) {
$formMode = TRUE;
}
CRM_Core_BAO_ConfigSetting::retrieve($this->_defaults);
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE, NULL, 'name'));
$cRlist = array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE, NULL, 'name'));
$listEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
$cRlistEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
$autoSearchFields = array();
if (!empty($list) && !empty($listEnabled)) {
$autoSearchFields = array_combine($list, $listEnabled);
}
$cRSearchFields = array();
if (!empty($cRlist) && !empty($cRlistEnabled)) {
$cRSearchFields = array_combine($cRlist, $cRlistEnabled);
}
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array('1' => 1) + $cRSearchFields;
$this->_defaults['enableSSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL', NULL, 0);
$this->_defaults['verifySSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL', NULL, 1);
$sql = "\nSELECT time_format\nFROM civicrm_preferences_date\nWHERE time_format IS NOT NULL\nAND time_format <> ''\nLIMIT 1\n";
$this->_defaults['timeInputFormat'] = CRM_Core_DAO::singleValueQuery($sql);
}
return $this->_defaults;
}
示例10: __construct
/**
*
*/
function __construct()
{
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'))), 'grouping' => 'contact-fields'), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('id' => array('title' => ts('Membership #'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_financial_account' => array('dao' => 'CRM_Financial_DAO_FinancialAccount', 'fields' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'name' => 'name', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'name' => 'name', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE)), 'filters' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit'), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code')), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(), 'name' => 'id', 'alias' => 'financial_account_civireport_debit'), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount()))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'fields' => array('financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE)), 'filters' => array('financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType())), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('receive_date' => array('default' => TRUE), 'invoice_id' => array('title' => ts('Invoice ID'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'default' => TRUE), 'id' => array('title' => ts('Contribution #'), 'default' => TRUE)), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1))), 'order_bys' => array('contribution_id' => array('title' => ts('Contribution #')), 'contribution_status_id' => array('title' => ts('Contribution Status'))), 'grouping' => 'contri-fields'), 'civicrm_financial_trxn' => array('dao' => 'CRM_Financial_DAO_FinancialTrxn', 'fields' => array('check_number' => array('title' => ts('Cheque #'), 'default' => TRUE), 'payment_instrument_id' => array('title' => ts('Payment Instrument'), 'default' => TRUE), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_date' => array('title' => ts('Transaction Date'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_DATE), 'trxn_id' => array('title' => ts('Trans #'), 'default' => TRUE)), 'filters' => array('payment_instrument_id' => array('title' => ts('Payment Instrument'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'trxn_date' => array('title' => ts('Transaction Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'order_bys' => array('payment_instrument_id' => array('title' => ts('Payment Instrument')))), 'civicrm_entity_financial_trxn' => array('dao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'fields' => array('amount' => array('title' => ts('Amount'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING)), 'filters' => array('amount' => array('title' => ts('Amount')))));
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
parent::__construct();
}
示例11: preProcess
function preProcess()
{
// Make sure case types have been configured for the component
require_once 'CRM/Core/OptionGroup.php';
$caseType = CRM_Core_OptionGroup::values('case_type');
if (empty($caseType)) {
$this->assign('notConfigured', 1);
return;
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
// contact id is not mandatory for case form. If not found, don't call
// parent's pre-process and proceed further.
if ($this->_contactId) {
parent::preProcess();
} else {
// we would need action to proceed further.
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
if ($this->_action & CRM_Core_Action::VIEW) {
CRM_Core_Error::fatal('Contact Id is required for view action.');
}
$this->assign('action', $this->_action);
}
$activityTypes = CRM_Case_PseudoConstant::activityType();
$this->assign('openCaseId', $activityTypes['Open Case']['id']);
$this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
$this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
$this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
}
示例12: browse
function browse()
{
require_once 'CRM/Core/Permission.php';
$surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
if (!empty($surveys)) {
require_once 'CRM/Campaign/BAO/Campaign.php';
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$activityTypes = CRM_Core_OptionGroup::values('activity_type', false, false, false, false, 'name');
foreach ($surveys as $sid => $survey) {
$surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
$surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
$surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
$action = array_sum(array_keys($this->actionLinks()));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid));
}
}
$this->assign('surveys', $surveys);
$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
}
示例13: setDefaultValues
/**
* This function sets the default values for the form.
* default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
$formMode = false;
if (in_array($this->_name, $formArray)) {
$formMode = true;
}
require_once "CRM/Core/BAO/Setting.php";
CRM_Core_BAO_Setting::retrieve($this->_defaults);
require_once "CRM/Core/Config/Defaults.php";
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
require_once "CRM/Core/OptionGroup.php";
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', false, false, true, null, 'name'));
require_once "CRM/Core/BAO/Preferences.php";
$listEnabled = CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options');
$autoSearchFields = array();
if (!empty($list) && !empty($listEnabled)) {
$autoSearchFields = array_combine($list, $listEnabled);
}
//Set sort_name for default
$this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
}
return $this->_defaults;
}
示例14: buildQuickForm
/**
* Overridden parent method to build the form
*
* @access public
*/
public function buildQuickForm()
{
$this->add('hidden', 'rule_action_id');
$this->add('select', 'activity_type_id', ts('Activity type'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_type'), true);
$this->add('select', 'status_id', ts('Status'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_status'), true);
$this->add('text', 'subject', ts('Subject'));
$this->assign('use_old_contact_ref_fields', $this->use_old_contact_ref_fields);
if ($this->use_old_contact_ref_fields) {
$data = unserialize($this->ruleAction->action_params);
$assignees = array();
if (!empty($data['assignee_contact_id'])) {
if (is_array($data['assignee_contact_id'])) {
$assignees = $data['assignee_contact_id'];
} else {
$assignees[] = $data['assignee_contact_id'];
}
}
$this->assign('selectedContacts', implode(",", $assignees));
CRM_Contact_Form_NewContact::buildQuickForm($this);
} else {
$attributes = array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)));
$this->addEntityRef('assignee_contact_id', ts('Assigned to'), $attributes, false);
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例15: __construct
/**
* Class constructor.
*/
public function __construct()
{
// don’t display the ‘Add these Contacts to Group’ button
$this->_add2groupSupported = FALSE;
$dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
$this->loggingDB = $dsn['database'];
// used for redirect back to contact summary
$this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$this->_logTables = array('log_civicrm_contact' => array('fk' => 'id'), 'log_civicrm_email' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_phone' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_address' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_note' => array('fk' => 'entity_id', 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_note_comment' => array('fk' => 'entity_id', 'table_name' => 'log_civicrm_note', 'joins' => array('table' => 'log_civicrm_note', 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'"), 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_group_contact' => array('fk' => 'contact_id', 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'), 'action_column' => 'status', 'log_type' => 'Group'), 'log_civicrm_entity_tag' => array('fk' => 'entity_id', 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'), 'entity_table' => TRUE), 'log_civicrm_relationship' => array('fk' => 'contact_id_a', 'bracket_info' => array('entity_column' => 'relationship_type_id', 'table' => 'log_civicrm_relationship_type', 'column' => 'label_a_b')), 'log_civicrm_activity_for_target' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_assignee' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_source' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_case' => array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_case_contact', 'join' => 'entity_log_civireport.id = fk_table.case_id'), 'bracket_info' => array('entity_column' => 'case_type_id', 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE))));
$logging = new CRM_Logging_Schema();
// build _logTables for contact custom tables
$customTables = $logging->entityCustomDataLogTables('Contact');
foreach ($customTables as $table) {
$this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
}
// build _logTables for address custom tables
$customTables = $logging->entityCustomDataLogTables('Address');
foreach ($customTables as $table) {
$this->_logTables[$table] = array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_address', 'join' => 'entity_log_civireport.entity_id = fk_table.id'), 'log_type' => 'Contact');
}
// Allow log tables to be extended via report hooks.
CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
parent::__construct();
}