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


PHP CRM_Utils_Array::makeNonAssociative方法代码示例

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


在下文中一共展示了CRM_Utils_Array::makeNonAssociative方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAngularModules

 /**
  * Get AngularJS modules and their dependencies
  *
  * @return array
  *   list of modules; same format as CRM_Utils_Hook::angularModules(&$angularModules)
  * @see CRM_Utils_Hook::angularModules
  */
 public function getAngularModules()
 {
     // load angular files only if valid permissions are granted to the user
     if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings') && !CRM_Core_Permission::check('schedule mailings') && !CRM_Core_Permission::check('approve mailings')) {
         return array();
     }
     $result = array();
     $result['crmMailing'] = array('ext' => 'civicrm', 'js' => array('ang/crmMailing.js', 'ang/crmMailing/*.js'), 'css' => array('ang/crmMailing.css'), 'partials' => array('ang/crmMailing'));
     $result['crmMailingAB'] = array('ext' => 'civicrm', 'js' => array('ang/crmMailingAB.js', 'ang/crmMailingAB/*.js', 'ang/crmMailingAB/*/*.js'), 'css' => array('ang/crmMailingAB.css'), 'partials' => array('ang/crmMailingAB'));
     $result['crmD3'] = array('ext' => 'civicrm', 'js' => array('ang/crmD3.js', 'bower_components/d3/d3.min.js'));
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     // Get past mailings
     // CRM-16155 - Limit to a reasonable number
     $civiMails = civicrm_api3('Mailing', 'get', array('is_completed' => 1, 'mailing_type' => array('IN' => array('standalone', 'winner')), 'return' => array('id', 'name', 'scheduled_date'), 'sequential' => 1, 'options' => array('limit' => 500, 'sort' => 'is_archived asc, scheduled_date desc')));
     // Generic params
     $params = array('options' => array('limit' => 0), 'sequential' => 1);
     $groupNames = civicrm_api3('Group', 'get', $params + array('is_active' => 1, 'check_permissions' => TRUE, 'return' => array('title', 'visibility', 'group_type', 'is_hidden')));
     $headerfooterList = civicrm_api3('MailingComponent', 'get', $params + array('is_active' => 1, 'return' => array('name', 'component_type', 'is_default', 'body_html', 'body_text')));
     $emailAdd = civicrm_api3('Email', 'get', array('sequential' => 1, 'return' => "email", 'contact_id' => $contactID));
     $mesTemplate = civicrm_api3('MessageTemplate', 'get', $params + array('sequential' => 1, 'is_active' => 1, 'return' => array("id", "msg_title"), 'workflow_id' => array('IS NULL' => "")));
     $mailTokens = civicrm_api3('Mailing', 'gettokens', array('entity' => array('contact', 'mailing'), 'sequential' => 1));
     $fromAddress = civicrm_api3('OptionValue', 'get', $params + array('option_group_id' => "from_email_address", 'domain_id' => CRM_Core_Config::domainID()));
     CRM_Core_Resources::singleton()->addSetting(array('crmMailing' => array('civiMails' => $civiMails['values'], 'campaignEnabled' => in_array('CiviCampaign', $config->enableComponents), 'groupNames' => $groupNames['values'], 'headerfooterList' => $headerfooterList['values'], 'mesTemplate' => $mesTemplate['values'], 'emailAdd' => $emailAdd['values'], 'mailTokens' => $mailTokens['values'], 'contactid' => $contactID, 'requiredTokens' => CRM_Utils_Token::getRequiredTokens(), 'enableReplyTo' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo'), 'disableMandatoryTokensCheck' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check'), 'fromAddress' => $fromAddress['values'], 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array('id' => 'user_contact_id', 'return' => 'email')), 'visibility' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::groupVisibility()), 'workflowEnabled' => CRM_Mailing_Info::workflowEnabled())))->addPermissions(array('view all contacts', 'access CiviMail', 'create mailings', 'schedule mailings', 'approve mailings', 'delete in CiviMail', 'edit message templates'));
     return $result;
 }
开发者ID:vincent1892,项目名称:contact_report,代码行数:34,代码来源:Info.php

示例2: civicrm_api3_generic_getoptions

/**
 * API wrapper for getoptions function.
 *
 * @param array $apiRequest
 *   Api request as an array.
 *
 * @return array
 *   Array of results
 */
function civicrm_api3_generic_getoptions($apiRequest)
{
    // Resolve aliases.
    $fieldName = _civicrm_api3_api_resolve_alias($apiRequest['entity'], $apiRequest['params']['field']);
    if (!$fieldName) {
        return civicrm_api3_create_error("The field '{$apiRequest['params']['field']}' doesn't exist.");
    }
    // Validate 'context' from params
    $context = CRM_Utils_Array::value('context', $apiRequest['params']);
    CRM_Core_DAO::buildOptionsContext($context);
    unset($apiRequest['params']['context'], $apiRequest['params']['field']);
    $baoName = _civicrm_api3_get_BAO($apiRequest['entity']);
    $options = $baoName::buildOptions($fieldName, $context, $apiRequest['params']);
    if ($options === FALSE) {
        return civicrm_api3_create_error("The field '{$fieldName}' has no associated option list.");
    }
    // Support 'sequential' output as a non-associative array
    if (!empty($apiRequest['params']['sequential'])) {
        $options = CRM_Utils_Array::makeNonAssociative($options);
    }
    return civicrm_api3_create_success($options, $apiRequest['params'], $apiRequest['entity'], 'getoptions');
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:31,代码来源:Generic.php

示例3: getDoc

 /**
  * Ajax callback to display code docs.
  */
 public static function getDoc()
 {
     // Verify the API handler we're talking to is valid.
     $entities = civicrm_api3('Entity', 'get');
     $entity = CRM_Utils_Array::value('entity', $_GET);
     if (!empty($entity) && in_array($entity, $entities['values']) && strpos($entity, '.') === FALSE) {
         $action = CRM_Utils_Array::value('action', $_GET);
         $doc = self::getDocblock($entity, $action);
         $result = array('doc' => $doc ? self::formatDocBlock($doc[0]) : 'Not found.', 'code' => $doc ? $doc[1] : NULL, 'file' => $doc ? $doc[2] : NULL);
         if (!$action) {
             $actions = civicrm_api3($entity, 'getactions');
             $result['actions'] = CRM_Utils_Array::makeNonAssociative(array_combine($actions['values'], $actions['values']));
         }
         CRM_Utils_JSON::output($result);
     }
     CRM_Utils_System::permissionDenied();
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:20,代码来源:APIExplorer.php

示例4: buildQuickForm

 /**
  * Build form.
  *
  * @param CRM_Core_Form $form
  */
 public static function buildQuickForm(&$form)
 {
     // FIXME: this is using the following as keys rather than the standard numeric keys returned by CRM_Utils_Date
     $dayOfTheWeek = array();
     $dayKeys = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
     foreach (CRM_Utils_Date::getAbbrWeekdayNames() as $k => $label) {
         $dayOfTheWeek[$dayKeys[$k]] = $label;
     }
     $form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required'));
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
     $form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required'));
     $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
     foreach ($dayOfTheWeek as $key => $val) {
         $startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val);
     }
     $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
     $roptionTypes = array('1' => ts('day of the month'), '2' => ts('day of the week'));
     $form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL);
     $form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31));
     $dayOfTheWeekNo = array('first' => ts('First'), 'second' => ts('Second'), 'third' => ts('Third'), 'fourth' => ts('Fourth'), 'last' => ts('Last'));
     $form->add('select', 'entity_status_1', '', $dayOfTheWeekNo);
     $form->add('select', 'entity_status_2', '', $dayOfTheWeek);
     $eoptionTypes = array('1' => ts('After'), '2' => ts('On'));
     $form->addRadio('ends', ts("Ends"), $eoptionTypes, array('class' => 'required'), NULL);
     // Offset options gets key=>val pairs like 1=>2 because the BAO wants to know the number of
     // children while it makes more sense to the user to see the total number including the parent.
     $offsetOptions = range(1, 30);
     unset($offsetOptions[0]);
     $form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE);
     $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
     $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
     $form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty'));
     $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));
     $form->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     // For client-side pluralization
     $form->assign('recurringFrequencyOptions', array('single' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits()), 'plural' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits(2))));
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:42,代码来源:RecurringEntity.php

示例5: getDoc

 /**
  * Ajax callback to display code docs
  */
 public static function getDoc()
 {
     if (!empty($_GET['entity']) && strpos($_GET['entity'], '.') === FALSE) {
         $entity = _civicrm_api_get_camel_name($_GET['entity']);
         $action = CRM_Utils_Array::value('action', $_GET);
         $doc = self::getDocblock($entity, $action);
         $result = array('doc' => $doc ? self::formatDocBlock($doc[0]) : 'Not found.', 'code' => $doc ? $doc[1] : NULL, 'file' => $doc ? $doc[2] : NULL);
         if (!$action) {
             $actions = civicrm_api3($entity, 'getactions');
             $result['actions'] = CRM_Utils_Array::makeNonAssociative(array_combine($actions['values'], $actions['values']));
         }
         CRM_Utils_JSON::output($result);
     }
     CRM_Utils_System::permissionDenied();
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:18,代码来源:APIExplorer.php


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