當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_Key類代碼示例

本文整理匯總了PHP中CRM_Core_Key的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_Key類的具體用法?PHP CRM_Core_Key怎麽用?PHP CRM_Core_Key使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CRM_Core_Key類的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 '';
}
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:40,代碼來源:function.crmNavigationMenu.php

示例2: smarty_function_crmSigner

/**
 * Generate a secure signature
 *
 * {code}
 * {crmSigner var=mySig extra=123}
 * var urlParams = ts={$mySig.ts}&extra={$mySig.extra}&sig={$mySig.signature}
 * {endcode}
 *
 * @param $params array with keys:
 *   - var: string, a smarty variable to generate
 *   - ts: int, the current time (if omitted, autogenerated)
 *   - any other vars are put into the signature (sorted)
 */
function smarty_function_crmSigner($params, &$smarty)
{
    $var = $params['var'];
    unset($params['var']);
    $params['ts'] = CRM_Utils_Time::getTimeRaw();
    $fields = array_keys($params);
    sort($fields);
    $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), $fields);
    $params['signature'] = $signer->sign($params);
    $smarty->assign($var, $params);
}
開發者ID:hguru,項目名稱:224Civi,代碼行數:24,代碼來源:function.crmSigner.php

示例3: 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'));
 }
開發者ID:JSProffitt,項目名稱:civicrm-website-org,代碼行數:12,代碼來源:ProfileEditor.php

示例4: 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']);
}
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:13,代碼來源:function.crmKey.php

示例5: 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'));
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:25,代碼來源:ProfileEditor.php

示例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);
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:94,代碼來源:AJAX.php

示例7: 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;
 }
開發者ID:bhirsch,項目名稱:voipdev,代碼行數:20,代碼來源:Controller.php

示例8: checkMenuItem

 static function checkMenuItem(&$item)
 {
     if (!array_key_exists('access_callback', $item)) {
         CRM_Core_Error::backtrace();
         CRM_Core_Error::fatal();
     }
     // if component_id is present, ensure it is enabled
     if (isset($item['component_id']) && $item['component_id']) {
         $config = CRM_Core_Config::singleton();
         if (is_array($config->enableComponentIDs) && in_array($item['component_id'], $config->enableComponentIDs)) {
             // continue with process
         } else {
             return FALSE;
         }
     }
     // the following is imitating drupal 6 code in includes/menu.inc
     if (empty($item['access_callback']) || is_numeric($item['access_callback'])) {
         return (bool) $item['access_callback'];
     }
     // check whether the following Ajax requests submitted the right key
     // FIXME: this should be integrated into ACLs proper
     if (CRM_Utils_Array::value('page_type', $item) == 3) {
         if (!CRM_Core_Key::validate($_REQUEST['key'], $item['path'])) {
             return FALSE;
         }
     }
     // check if callback is for checkMenu, if so optimize it
     if (is_array($item['access_callback']) && $item['access_callback'][0] == 'CRM_Core_Permission' && $item['access_callback'][1] == 'checkMenu') {
         $op = CRM_Utils_Array::value(1, $item['access_arguments'], 'and');
         return self::checkMenu($item['access_arguments'][0], $op);
     } else {
         return call_user_func_array($item['access_callback'], $item['access_arguments']);
     }
 }
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:34,代碼來源:Permission.php

示例9: checkToken

 /**
  * @param string $token
  *   A token supplied by the user.
  * @return bool
  *   TRUE if the token is valid for submitting attachments
  * @throws Exception
  */
 public static function checkToken($token)
 {
     list($signature, $ts) = explode(';;;', $token);
     $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts'));
     if (!is_numeric($ts) || CRM_Utils_Time::getTimeRaw() > $ts + self::ATTACHMENT_TOKEN_TTL) {
         return FALSE;
     }
     return $signer->validate($signature, array('for' => 'crmAttachment', 'ts' => $ts));
 }
開發者ID:utkarshsharma,項目名稱:civicrm-core,代碼行數:16,代碼來源:Attachment.php

示例10: checkUserName

 /**
  *  check the CMS username.
  */
 public static function checkUserName()
 {
     $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts'));
     $sig = CRM_Utils_Request::retrieve('sig', 'String', CRM_Core_DAO::$_nullObject);
     $for = CRM_Utils_Request::retrieve('for', 'String', CRM_Core_DAO::$_nullObject);
     if (CRM_Utils_Time::getTimeRaw() > $_REQUEST['ts'] + self::CHECK_USERNAME_TTL || $for != 'civicrm/ajax/cmsuser' || !$signer->validate($sig, $_REQUEST)) {
         $user = array('name' => 'error');
         CRM_Utils_JSON::output($user);
     }
     $config = CRM_Core_Config::singleton();
     $username = trim(CRM_Utils_Array::value('cms_name', $_REQUEST));
     $params = array('name' => $username);
     $errors = array();
     $config->userSystem->checkUserNameEmailExists($params, $errors);
     if (isset($errors['cms_name']) || isset($errors['name'])) {
         //user name is not available
         $user = array('name' => 'no');
         CRM_Utils_JSON::output($user);
     } else {
         //user name is available
         $user = array('name' => 'yes');
         CRM_Utils_JSON::output($user);
     }
     // Not reachable: JSON::output() above exits.
     CRM_Utils_System::civiExit();
 }
開發者ID:kcristiano,項目名稱:civicrm-core,代碼行數:29,代碼來源:AJAX.php

示例11: browse


//.........這裏部分代碼省略.........
                 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%%";
                     }
                 }
             }
             $linkAction = array_sum(array_keys($this->links()));
             if ($reached) {
                 unset($links[CRM_Core_Action::COPY]);
             }
             $newCgCount = !$reached ? count($result) + 1 : NULL;
             foreach ($result as $recId => &$value) {
                 foreach ($value as $fieldId => &$val) {
                     if (is_numeric($fieldId)) {
                         $customValue =& $val;
                         if (!empty($dateFields) && array_key_exists($fieldId, $dateFields)) {
                             // formated date capture value capture
                             $dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
                         } else {
                             // assign to $result
                             $customValue = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
                         }
                         if (!$customValue) {
                             $customValue = "";
                         }
                         $op = NULL;
                         if ($this->_pageViewType == 'profileDataView') {
                             $actionParams = array('recordId' => $recId, 'gid' => $this->_profileId, 'id' => $this->_contactId);
                             $op = 'profile.multiValue.row';
                         } else {
                             // different set of url params
                             $actionParams['gid'] = $actionParams['groupID'] = $this->_customGroupId;
                             $actionParams['cid'] = $actionParams['entityID'] = $this->_contactId;
                             $actionParams['recId'] = $recId;
                             $actionParams['type'] = $this->_contactType;
                             $actionParams['cgcount'] = $cgcount;
                             $actionParams['newCgCount'] = $newCgCount;
                             // DELETE action links
                             $deleteData = array('valueID' => $recId, 'groupID' => $this->_customGroupId, 'contactId' => $this->_contactId, 'key' => CRM_Core_Key::get('civicrm/ajax/customvalue'));
                             $links[CRM_Core_Action::DELETE]['url'] = '#';
                             $links[CRM_Core_Action::DELETE]['extra'] = ' data-delete_params="' . htmlspecialchars(json_encode($deleteData)) . '"';
                             $links[CRM_Core_Action::DELETE]['class'] = 'delete-custom-row';
                         }
                         if (!empty($pageCheckSum)) {
                             $actionParams['cs'] = $pageCheckSum;
                         }
                         $value['action'] = CRM_Core_Action::formLink($links, $linkAction, $actionParams, ts('more'), FALSE, $op, 'customValue', $fieldId);
                     }
                 }
                 $cgcount++;
             }
         }
     }
     $headers = array();
     if (!empty($fieldIDs)) {
         foreach ($fieldIDs as $fieldID) {
             $headers[$fieldID] = $this->_pageViewType == 'profileDataView' ? $customGroupInfo[$fieldID]['fieldLabel'] : $fieldLabels[$fieldID]['label'];
         }
     }
     $this->assign('dateFields', $dateFields);
     $this->assign('dateFieldsVals', $dateFieldsVals);
     $this->assign('cgcount', $cgcount);
     $this->assign('customGroupTitle', $this->_customGroupTitle);
     $this->assign('headers', $headers);
     $this->assign('records', $result);
 }
開發者ID:ruchirapingale,項目名稱:civicrm-core,代碼行數:101,代碼來源:MultipleRecordFieldsListing.php

示例12: 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;
 }
開發者ID:hguru,項目名稱:224Civi,代碼行數:18,代碼來源:Controller.php

示例13: 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');
}
開發者ID:GinkgoFJG,項目名稱:org.civicrm.angularprofiles,代碼行數:14,代碼來源:Getangularsettings.php

示例14: browse


//.........這裏部分代碼省略.........
                         if (!empty($dateFields) && array_key_exists($fieldId, $dateFields)) {
                             // formated date capture value capture
                             $dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
                             //set date and time format
                             switch ($timeFormat) {
                                 case 1:
                                     $dateFormat[1] = 'g:iA';
                                     break;
                                 case 2:
                                     $dateFormat[1] = 'G:i';
                                     break;
                                 default:
                                     // if time is not selected remove time from value
                                     $result[$recId][$fieldId] = substr($result[$recId][$fieldId], 0, 10);
                             }
                             $result[$recId][$fieldId] = CRM_Utils_Date::processDate($result[$recId][$fieldId], NULL, FALSE, implode(" ", $dateFormat));
                         } else {
                             // assign to $result
                             $customValue = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
                         }
                         // FIXME: getDisplayValue should always return a string so why is this necessary?
                         if (!$customValue && $customValue !== '0') {
                             $customValue = "";
                         }
                         // Set field attributes to support crmEditable
                         // Note that $fieldAttributes[data-type] actually refers to the html type not the sql data type
                         // TODO: Not all widget types and validation rules are supported by crmEditable so some fields will not be in-place editable
                         $fieldAttributes = array('class' => "crmf-custom_{$fieldId}_{$recId}");
                         $editable = FALSE;
                         if ($linkAction & CRM_Core_Action::UPDATE) {
                             $spec = $options[$fieldId]['attributes'];
                             switch ($spec['html_type']) {
                                 case 'Text':
                                     // Other data types like money would require some extra validation
                                     // FIXME: crmEditable currently does not support any validation rules :(
                                     $supportedDataTypes = array('Float', 'String', 'Int');
                                     $editable = in_array($spec['data_type'], $supportedDataTypes);
                                     break;
                                 case 'TextArea':
                                     $editable = TRUE;
                                     $fieldAttributes['data-type'] = 'textarea';
                                     break;
                                 case 'Radio':
                                 case 'Select':
                                 case 'Select Country':
                                 case 'Select State/Province':
                                     $editable = TRUE;
                                     $fieldAttributes['data-type'] = $spec['data_type'] == 'Boolean' ? 'boolean' : 'select';
                                     if (!$spec['is_required']) {
                                         $fieldAttributes['data-empty-option'] = ts('- none -');
                                     }
                                     break;
                             }
                         }
                         if ($editable) {
                             $fieldAttributes['class'] .= ' crm-editable';
                         }
                         $attributes[$fieldId][$recId] = $fieldAttributes;
                         $op = NULL;
                         if ($this->_pageViewType == 'profileDataView') {
                             $actionParams = array('recordId' => $recId, 'gid' => $this->_profileId, 'id' => $this->_contactId);
                             $op = 'profile.multiValue.row';
                         } else {
                             // different set of url params
                             $actionParams['gid'] = $actionParams['groupID'] = $this->_customGroupId;
                             $actionParams['cid'] = $actionParams['entityID'] = $this->_contactId;
                             $actionParams['recId'] = $recId;
                             $actionParams['type'] = $this->_contactType;
                             $actionParams['cgcount'] = $cgcount;
                             $actionParams['newCgCount'] = $newCgCount;
                             // DELETE action links
                             $deleteData = array('valueID' => $recId, 'groupID' => $this->_customGroupId, 'contactId' => $this->_contactId, 'key' => CRM_Core_Key::get('civicrm/ajax/customvalue'));
                             $links[CRM_Core_Action::DELETE]['url'] = '#';
                             $links[CRM_Core_Action::DELETE]['extra'] = ' data-delete_params="' . htmlspecialchars(json_encode($deleteData)) . '"';
                             $links[CRM_Core_Action::DELETE]['class'] = 'delete-custom-row';
                         }
                         if (!empty($pageCheckSum)) {
                             $actionParams['cs'] = $pageCheckSum;
                         }
                         $value['action'] = CRM_Core_Action::formLink($links, $linkAction, $actionParams, ts('more'), FALSE, $op, 'customValue', $fieldId);
                     }
                 }
                 $cgcount++;
             }
         }
     }
     $headers = array();
     if (!empty($fieldIDs)) {
         foreach ($fieldIDs as $fieldID) {
             $headers[$fieldID] = $this->_pageViewType == 'profileDataView' ? $customGroupInfo[$fieldID]['fieldLabel'] : $fieldLabels[$fieldID]['label'];
         }
     }
     $this->assign('dateFields', $dateFields);
     $this->assign('dateFieldsVals', $dateFieldsVals);
     $this->assign('cgcount', $cgcount);
     $this->assign('customGroupTitle', $this->_customGroupTitle);
     $this->assign('headers', $headers);
     $this->assign('records', $result);
     $this->assign('attributes', $attributes);
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:101,代碼來源:MultipleRecordFieldsListing.php

示例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)
{
    return CRM_Core_Key::get($params['name'], CRM_Utils_Array::value('addSequence', $params, 0));
}
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:12,代碼來源:function.crmKey.php


注:本文中的CRM_Core_Key類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。