本文整理汇总了PHP中CRM_Core_Key::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Key::get方法的具体用法?PHP CRM_Core_Key::get怎么用?PHP CRM_Core_Key::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Key
的用法示例。
在下文中一共展示了CRM_Core_Key::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_crmNavigationMenu
/**
* Output navigation script tag
*
* @param array $params
* - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
* @param CRM_Core_Smarty $smarty
* The Smarty object.
*
* @return string
* HTML
*/
function smarty_function_crmNavigationMenu($params, &$smarty)
{
$config = CRM_Core_Config::singleton();
//check if logged in user has access CiviCRM permission and build menu
$buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
$buildNavigation = FALSE;
}
if ($config->userFrameworkFrontend) {
$buildNavigation = FALSE;
}
if ($buildNavigation) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($contactID) {
// These params force the browser to refresh the js file when switching user, domain, or language
// We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
// @see CRM_Admin_Page_AJAX::getNavigationMenu
$lang = $config->lcMessages;
$domain = CRM_Core_Config::domainID();
$key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
$src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}");
// CRM-15493 QFkey needed for quicksearch bar - must be unique on each page refresh so adding it directly to markup
$qfKey = CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE);
return '<script id="civicrm-navigation-menu" type="text/javascript" src="' . $src . '" data-qfkey=' . json_encode($qfKey) . '></script>';
}
}
return '';
}
示例2: registerProfileScripts
public static function registerProfileScripts()
{
static $loaded = FALSE;
if ($loaded || CRM_Core_Resources::isAjaxMode()) {
return;
}
$loaded = TRUE;
CRM_Core_Resources::singleton()->addSettingsFactory(function () {
return array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id')), 'initialProfileList' => civicrm_api('UFGroup', 'get', array('version' => 3, 'sequential' => 1, 'is_active' => 1, 'rowCount' => 1000)), 'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(), 'profilePreviewKey' => CRM_Core_Key::get('CRM_UF_Form_Inline_Preview', TRUE));
})->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.js', 120, 'html-header')->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.collectionsubset.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/backbone-forms.js', 130, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/adapters/backbone.bootstrap-modal.min.js', 140, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/editors/list.min.js', 140, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/backbone-forms/distribution/templates/default.css', 140, 'html-header')->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header')->addStyleFile('civicrm', 'css/crm.designer.css', 140, 'html-header')->addScriptFile('civicrm', 'js/crm.backbone.js', 150)->addScriptFile('civicrm', 'js/model/crm.schema-mapped.js', 200)->addScriptFile('civicrm', 'js/model/crm.uf.js', 200)->addScriptFile('civicrm', 'js/model/crm.designer.js', 200)->addScriptFile('civicrm', 'js/model/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/view/crm.designer.js', 200)->addScriptFile('civicrm', 'js/view/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/jquery/jquery.crmProfileSelector.js', 250)->addScriptFile('civicrm', 'js/crm.designerapp.js', 250);
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/UF/Page/ProfileTemplates.tpl'));
}
示例3: registerProfileScripts
/**
* Register profile scripts.
*/
public static function registerProfileScripts()
{
static $loaded = FALSE;
if ($loaded || CRM_Core_Resources::isAjaxMode()) {
return;
}
$loaded = TRUE;
CRM_Core_Resources::singleton()->addSettingsFactory(function () {
$ufGroups = civicrm_api3('UFGroup', 'get', array('sequential' => 1, 'is_active' => 1, 'options' => array('limit' => 0)));
//CRM-16915 - insert 'module' param for the profile used by CiviEvent.
if (CRM_Core_Permission::check('manage event profiles') && !CRM_Core_Permission::check('administer CiviCRM')) {
foreach ($ufGroups['values'] as $key => $value) {
$ufJoin = CRM_Core_BAO_UFGroup::getUFJoinRecord($value['id']);
if (in_array('CiviEvent', $ufJoin) || in_array('CiviEvent_Additional', $ufJoin)) {
$ufGroups['values'][$key]['module'] = 'CiviEvent';
}
}
}
return array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id')), 'initialProfileList' => $ufGroups, 'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(), 'profilePreviewKey' => CRM_Core_Key::get('CRM_UF_Form_Inline_Preview', TRUE));
})->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.js', 120, 'html-header')->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.collectionsubset.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/backbone-forms.js', 130, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/adapters/backbone.bootstrap-modal.min.js', 140, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/editors/list.min.js', 140, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/backbone-forms/distribution/templates/default.css', 140, 'html-header')->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header')->addStyleFile('civicrm', 'css/crm.designer.css', 140, 'html-header')->addScriptFile('civicrm', 'js/crm.backbone.js', 150)->addScriptFile('civicrm', 'js/model/crm.schema-mapped.js', 200)->addScriptFile('civicrm', 'js/model/crm.uf.js', 200)->addScriptFile('civicrm', 'js/model/crm.designer.js', 200)->addScriptFile('civicrm', 'js/model/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/view/crm.designer.js', 200)->addScriptFile('civicrm', 'js/view/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/jquery/jquery.crmProfileSelector.js', 250)->addScriptFile('civicrm', 'js/crm.designerapp.js', 250);
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/UF/Page/ProfileTemplates.tpl'));
}
示例4: key
function key($name, $addSequence = FALSE, $ignoreKey = FALSE)
{
$config = CRM_Core_Config::singleton();
if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
return NULL;
}
$key = CRM_Utils_Array::value('qfKey', $_REQUEST, NULL);
if (!$key && $_SERVER['REQUEST_METHOD'] === 'GET') {
$key = CRM_Core_Key::get($name, $addSequence);
} else {
$key = CRM_Core_Key::validate($key, $name, $addSequence);
}
if (!$key) {
$this->invalidKey();
}
$this->_key = $key;
return $key;
}
示例5: key
function key($name, $addSequence = false, $ignoreKey = false)
{
$config =& CRM_Core_Config::singleton();
if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
return null;
}
require_once 'CRM/Core/Key.php';
$key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
if (!$key) {
$key = CRM_Core_Key::get($name, $addSequence);
} else {
$key = CRM_Core_Key::validate($key, $name, $addSequence);
}
if (!$key) {
CRM_Core_Error::fatal('Could not find valid Key');
}
$this->_key = $key;
return $key;
}
示例6: getCaseRoles
public static function getCaseRoles()
{
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
$caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
$hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
foreach ($caseRelationships as $key => $value) {
// This role has been filled
unset($caseRoles[$value['relation_type']]);
// mark original case relationships record to use on setting edit links below
$caseRelationships[$key]['source'] = 'caseRel';
}
$caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
// move/transform caseRoles array data to caseRelationships
// for sorting and display
// CRM-14466 added cid to the non-client array to avoid php notice
foreach ($caseRoles as $id => $value) {
if ($id != "client") {
$rel = array();
$rel['relation'] = $value;
$rel['relation_type'] = $id;
$rel['name'] = '(not assigned)';
$rel['phone'] = '';
$rel['email'] = '';
$rel['source'] = 'caseRoles';
$caseRelationships[] = $rel;
} else {
foreach ($value as $clientRole) {
$relClient = array();
$relClient['relation'] = 'Client';
$relClient['name'] = $clientRole['sort_name'];
$relClient['phone'] = $clientRole['phone'];
$relClient['email'] = $clientRole['email'];
$relClient['cid'] = $clientRole['contact_id'];
$relClient['source'] = 'contact';
$caseRelationships[] = $relClient;
}
}
}
// sort clientRelationships array using jquery call params
foreach ($caseRelationships as $key => $row) {
$sortArray[$key] = $row[$params['_raw_values']['sort'][0]];
}
$sort_type = "SORT_" . strtoupper($params['_raw_values']['order'][0]);
array_multisort($sortArray, constant($sort_type), $caseRelationships);
$relationships = array();
// set user name, email and edit columns links
foreach ($caseRelationships as $key => &$row) {
$typeLabel = $row['relation'];
// Add "<br />(Case Manager)" to label
if ($row['relation_type'] == $managerRoleId) {
$row['relation'] .= '<br />' . '(' . ts('Case Manager') . ')';
}
// view user links
if (!empty($row['cid'])) {
$row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view', 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
}
// email column links/icon
if ($row['email']) {
$row['email'] = '<a class="crm-hover-button crm-popup" href="' . CRM_Utils_System::url('civicrm/activity/email/add', 'reset=1&action=add&atype=3&cid=' . $row['cid']) . '&caseid=' . $caseID . '" title="' . ts('Send an Email') . '"><i class="crm-i fa-envelope"></i></a>';
}
// edit links
$row['actions'] = '';
if ($hasAccessToAllCases) {
$contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
$contactType = $contactType == 'Contact' ? '' : $contactType;
switch ($row['source']) {
case 'caseRel':
$row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . $row['cid'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<i class="crm-i fa-pencil"></i>' . '</a>' . '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . $row['cid'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' . '<span class="icon delete-icon"></span>' . '</a>';
break;
case 'caseRoles':
$row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_b_a" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<i class="crm-i fa-pencil"></i>' . '</a>';
break;
}
}
unset($row['cid']);
unset($row['relation_type']);
unset($row['rel_id']);
unset($row['client_id']);
unset($row['source']);
array_push($relationships, $row);
}
$params['total'] = count($relationships);
$caseRelationshipsDT = array();
$caseRelationshipsDT['data'] = $relationships;
$caseRelationshipsDT['recordsTotal'] = $params['total'];
$caseRelationshipsDT['recordsFiltered'] = $params['total'];
CRM_Utils_JSON::output($caseRelationshipsDT);
}
示例7: invoke
/**
* handle the export case. this is a hack, so please fix soon
*
* @param $args array this array contains the arguments of the url
*
* @static
* @access public
*/
static function invoke($args)
{
// FIXME: 2005-06-22 15:17:33 by Brian McFee <brmcfee@gmail.com>
// This function is a dirty, dirty hack. It should live in its own
// file.
$session =& CRM_Core_Session::singleton();
$type = $_GET['type'];
if ($type == 1) {
$varName = 'errors';
$saveFileName = 'Import_Errors.csv';
} else {
if ($type == 2) {
$varName = 'conflicts';
$saveFileName = 'Import_Conflicts.csv';
} else {
if ($type == 3) {
$varName = 'duplicates';
$saveFileName = 'Import_Duplicates.csv';
} else {
if ($type == 4) {
$varName = 'mismatch';
$saveFileName = 'Import_Mismatch.csv';
} else {
if ($type == 5) {
$varName = 'pledgePaymentErrors';
$saveFileName = 'Import_Pledge_Payment_Errors.csv';
} else {
if ($type == 6) {
$varName = 'softCreditErrors';
$saveFileName = 'Import_Soft_Credit_Errors.csv';
} else {
/* FIXME we should have an error here */
return;
}
}
}
}
}
}
// FIXME: a hack until we have common import
// mechanisms for contacts and contributions
$realm = CRM_Utils_Array::value('realm', $_GET);
if ($realm == 'contribution') {
$controller = 'CRM_Contribute_Import_Controller';
} else {
if ($realm == 'membership') {
$controller = 'CRM_Member_Import_Controller';
} else {
if ($realm == 'event') {
$controller = 'CRM_Event_Import_Controller';
} else {
if ($realm == 'activity') {
$controller = 'CRM_Activity_Import_Controller';
} else {
$controller = 'CRM_Import_Controller';
}
}
}
}
require_once 'CRM/Core/Key.php';
$qfKey = CRM_Core_Key::get($controller);
$fileName = $session->get($varName . 'FileName', "{$controller}_{$qfKey}");
$config =& CRM_Core_Config::singleton();
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Description: File Transfer');
header('Content-Type: text/csv');
header('Content-Length: ' . filesize($fileName));
header('Content-Disposition: attachment; filename=' . $saveFileName);
readfile($fileName);
exit;
}
示例8: browse
/**
* Browse the listing.
*
* @return void
*/
public function browse()
{
$dateFields = NULL;
$cgcount = 0;
$attributes = array();
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::EDIT);
$multiRecordFields = array();
$fieldIDs = NULL;
$result = NULL;
$multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE);
$multiFieldId = CRM_Core_BAO_CustomField::getKeyID(key($multiRecordFields));
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $multiFieldId, 'custom_group_id');
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('gid', $this->_profileId);
}
$this->assign('reachedMax', $reached);
if ($multiRecordFieldsWithSummaryListing && !empty($multiRecordFieldsWithSummaryListing)) {
$fieldIDs = array_keys($multiRecordFieldsWithSummaryListing);
}
} elseif ($this->_pageViewType == 'customDataView') {
// require custom group id for _pageViewType of customDataView
$customGroupId = $this->_customGroupId;
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('customGroupId', $customGroupId);
$this->assign('ctype', $this->_contactType);
}
$this->assign('reachedMax', $reached);
// custom group info : this consists of the field title of group fields
$groupDetail = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId, NULL, CRM_Core_DAO::$_nullObject, TRUE);
// field ids of fields in_selector for the custom group id provided
$fieldIDs = array_keys($groupDetail[$customGroupId]['fields']);
// field labels for headers
$fieldLabels = $groupDetail[$customGroupId]['fields'];
// from the above customGroupInfo we can get $this->_customGroupTitle
$this->_customGroupTitle = $groupDetail[$customGroupId]['title'];
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
$returnProperities = array('html_type', 'data_type', 'date_format', 'time_format', 'default_value', 'is_required');
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID;
$param = array('id' => $fieldIDs[$key]);
$returnValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
$dateFormat = (array) CRM_Utils_Array::value($returnValues['date_format'], $actualPHPFormats);
$timeFormat = CRM_Utils_Array::value('time_format', $returnValues);
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (!empty($optionValuePairs)) {
foreach ($optionValuePairs as $optionPairs) {
$options[$fieldIDs[$key]][$optionPairs['value']] = $optionPairs['label'];
}
}
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['is_required'] = !empty($returnValues['is_required']);
$options[$fieldIDs[$key]]['attributes']['default_value'] = CRM_Utils_Array::value('default_value', $returnValues);
$options[$fieldIDs[$key]]['attributes']['format'] = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
// commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView)
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE);
if ($this->_pageViewType == 'profileDataView') {
if (!empty($fieldIDs)) {
//get the group info of multi rec fields in listing view
$fieldInput = $fieldIDs;
$fieldIdInput = $fieldIDs[0];
} else {
//if no listing fields exist, take the group title for display
$nonListingFieldIds = array_keys($multiRecordFields);
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
}
// $cgcount is defined before 'if' condition as enitiy may have no record
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
$links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
//.........这里部分代码省略.........
示例9: civicrm_api3_profile_getangularsettings
/**
* Profile.GetAngularSettings API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_profile_getangularsettings($params)
{
$returnValues = array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id')), 'initialProfileList' => civicrm_api('UFGroup', 'get', array('version' => 3, 'sequential' => 1, 'is_active' => 1, 'rowCount' => 1000)), 'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(), 'profilePreviewKey' => CRM_Core_Key::get('CRM_UF_Form_Inline_Preview', TRUE));
return civicrm_api3_create_success($returnValues, $params, 'Profile', 'getangularsettings');
}
示例10: getCaseRoles
public static function getCaseRoles()
{
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$sortMapper = array(0 => 'relation', 1 => 'name', 2 => 'phone', 3 => 'email', 4 => 'actions');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
if ($sort && $sortOrder) {
$sortSQL = $sort . ' ' . $sortOrder;
}
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
$caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
$hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
if (!empty($managerRoleId)) {
$caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
}
foreach ($caseRelationships as $key => $value) {
//calculate roles that don't have relationships
if (!empty($caseRoles[$value['relation_type']])) {
//keep naming from careRoles array
$caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']];
unset($caseRoles[$value['relation_type']]);
}
// mark orginal case relationships record to use on setting edit links below
$caseRelationships[$key]['source'] = 'caseRel';
}
$caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
// move/transform caseRoles array data to caseRelationships
// for sorting and display
// CRM-14466 added cid to the non-client array to avoid php notice
foreach ($caseRoles as $id => $value) {
if ($id != "client") {
$rel = array();
$rel['relation'] = $value;
$rel['relation_type'] = $id;
$rel['name'] = '(not assigned)';
$rel['phone'] = '';
$rel['email'] = '';
$rel['source'] = 'caseRoles';
$caseRelationships[] = $rel;
} else {
foreach ($value as $clientRole) {
$relClient = array();
$relClient['relation'] = 'Client';
$relClient['name'] = $clientRole['sort_name'];
$relClient['phone'] = $clientRole['phone'];
$relClient['email'] = $clientRole['email'];
$relClient['cid'] = $clientRole['contact_id'];
$relClient['source'] = 'contact';
$caseRelationships[] = $relClient;
}
}
}
// sort clientRelationships array using jquery call params
foreach ($caseRelationships as $key => $row) {
$sortArray[$key] = $row[$sort];
}
$sort_type = "SORT_" . strtoupper($sortOrder);
array_multisort($sortArray, constant($sort_type), $caseRelationships);
//limit rows display
$allCaseRelationships = $caseRelationships;
$caseRelationships = array_slice($allCaseRelationships, $offset, $rowCount, TRUE);
// set user name, email and edit columns links
// idx will count number of current row / needed by edit links
$idx = 1;
foreach ($caseRelationships as &$row) {
// Get rid of the "<br />(Case Manager)" from label
list($typeLabel) = explode('<', $row['relation']);
// view user links
if (!empty($row['cid'])) {
$row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view', 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
}
// email column links/icon
if ($row['email']) {
$row['email'] = '<a class="crm-hover-button crm-popup" href="' . CRM_Utils_System::url('civicrm/activity/email/add', 'reset=1&action=add&atype=3&cid=' . $row['cid']) . '&caseid=' . $caseID . '" title="' . ts('Send an Email') . '"><span class="icon ui-icon-mail-closed"></span></a>';
}
// edit links
$row['actions'] = '';
if ($hasAccessToAllCases) {
$contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
$contactType = $contactType == 'Contact' ? '' : $contactType;
switch ($row['source']) {
case 'caseRel':
$row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<span class="icon ui-icon-pencil"></span>' . '</a>' . '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' . '<span class="icon delete-icon"></span>' . '</a>';
break;
case 'caseRoles':
$row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<span class="icon ui-icon-pencil"></span>' . '</a>';
break;
}
}
$idx++;
}
$iFilteredTotal = $iTotal = $params['total'] = count($allCaseRelationships);
//.........这里部分代码省略.........
示例11: key
function key($name, $addSequence = false, $ignoreKey = false)
{
$config =& CRM_Core_Config::singleton();
if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
return null;
}
require_once 'CRM/Core/Key.php';
$key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
if (!$key) {
$key = CRM_Core_Key::get($name, $addSequence);
} else {
$key = CRM_Core_Key::validate($key, $name, $addSequence);
}
if (!$key) {
$msg = ts('We can\'t load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.') . '<br /><br />' . ts('Error type: Could not find a valid key.');
CRM_Core_Error::fatal($msg);
}
$this->_key = $key;
return $key;
}
示例12: key
function key($name, $addSequence = false, $ignoreKey = false)
{
$config = CRM_Core_Config::singleton();
if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
return null;
}
require_once 'CRM/Core/Key.php';
$key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
if (!$key) {
$key = CRM_Core_Key::get($name, $addSequence);
} else {
$key = CRM_Core_Key::validate($key, $name, $addSequence);
}
if (!$key) {
$msg = ts('We can\'t load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.') . '<br /><br />' . ts('Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.') . '<br /><br />' . ts('Error type: Could not find a valid session key.');
CRM_Core_Error::fatal($msg);
}
$this->_key = $key;
return $key;
}
示例13: smarty_function_crmKey
/**
* Generate a CRM_Core_Key of a given name
*
* @param string $params params of the {crmKey} call, with the ‘name’ key holding the name of the key
* @param object $smarty the Smarty object
*
* @return string the generated key
*/
function smarty_function_crmKey($params, &$smarty)
{
return CRM_Core_Key::get($params['name'], CRM_Utils_Array::value('addSequence', $params, 0));
}
示例14: browse
/**
* Browse the listing
*
* @return void
* @access public
*/
function browse()
{
$dateFields = NULL;
$cgcount = 0;
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::EDIT);
$multiRecordFields = array();
$fieldIDs = NULL;
$result = NULL;
$multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE);
$multiFieldId = CRM_Core_BAO_CustomField::getKeyID(key($multiRecordFields));
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $multiFieldId, 'custom_group_id');
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('gid', $this->_profileId);
}
$this->assign('reachedMax', $reached);
if ($multiRecordFieldsWithSummaryListing && !empty($multiRecordFieldsWithSummaryListing)) {
$fieldIDs = array_keys($multiRecordFieldsWithSummaryListing);
}
} elseif ($this->_pageViewType == 'customDataView') {
// require custom group id for _pageViewType of customDataView
$customGroupId = $this->_customGroupId;
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('customGroupId', $customGroupId);
$this->assign('ctype', $this->_contactType);
}
$this->assign('reachedMax', $reached);
// custom group info : this consists of the field title of group fields
$groupDetail = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId, NULL, CRM_Core_DAO::$_nullObject, TRUE);
// field ids of fields in_selector for the custom group id provided
$fieldIDs = array_keys($groupDetail[$customGroupId]['fields']);
// field labels for headers
$fieldLabels = $groupDetail[$customGroupId]['fields'];
// from the above customGroupInfo we can get $this->_customGroupTitle
$this->_customGroupTitle = $groupDetail[$customGroupId]['title'];
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
$returnProperities = array('html_type', 'data_type', 'date_format', 'time_format');
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID;
$param = array('id' => $fieldIDs[$key]);
$returnValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (!empty($optionValuePairs)) {
foreach ($optionValuePairs as $optionPairs) {
$options[$fieldIDs[$key]][$optionPairs['value']] = $optionPairs['label'];
}
}
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['format'] = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
// commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView)
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE);
if ($this->_pageViewType == 'profileDataView') {
if (!empty($fieldIDs)) {
//get the group info of multi rec fields in listing view
$fieldInput = $fieldIDs;
$fieldIdInput = $fieldIDs[0];
} else {
//if no listing fields exist, take the group title for display
$nonListingFieldIds = array_keys($multiRecordFields);
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
}
// $cgcount is defined before 'if' condition as enitiy may have no record
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
$links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
foreach ($links as $key => $link) {
$links[$key] = $link['qs'] . "&cs=%%cs%%";
}
}
}
//.........这里部分代码省略.........
示例15: smarty_function_crmKey
/**
* Generate a CRM_Core_Key of a given name
*
* @param string $params params of the {crmKey} call, with the ‘name’ key holding the name of the key
* @param object $smarty the Smarty object
*
* @return string the generated key
*/
function smarty_function_crmKey($params, &$smarty)
{
require_once 'CRM/Core/Key.php';
return CRM_Core_Key::get($params['name']);
}