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


PHP CRM_Utils_System::formatWikiURL方法代码示例

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


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

示例1: getCustomData

 function getCustomData($clientID, $activityDAO, &$activityTypeInfo)
 {
     list($typeValues, $options, $sql) = $this->getActivityTypeCustomSQL($activityTypeInfo['id'], '%Y-%m-%d');
     $params = array(1 => array($activityDAO->id, 'Integer'));
     $customGroups = array();
     foreach ($sql as $tableName => $sqlClause) {
         $dao = CRM_Core_DAO::executeQuery($sqlClause, $params);
         if ($dao->fetch()) {
             $customGroup = array();
             foreach ($typeValues[$tableName] as $columnName => $typeValue) {
                 $value = CRM_Core_BAO_CustomField::getDisplayValue($dao->{$columnName}, $typeValue['fieldID'], $options);
                 if (CRM_Utils_Array::value('type', $typeValue) == 'Date') {
                     $value = $dao->{$columnName};
                 }
                 if ($value) {
                     // Note: this is already taken care in getDisplayValue above, but sometimes
                     // strings like '^A^A' creates problem. So to fix this special case -
                     if (strstr($value, CRM_Core_DAO::VALUE_SEPARATOR)) {
                         $value = trim($value, CRM_Core_DAO::VALUE_SEPARATOR);
                     }
                     if (CRM_Utils_Array::value('type', $typeValue) == 'String' || CRM_Utils_Array::value('type', $typeValue) == 'Memo') {
                         $value = $this->redact($value);
                     } elseif (CRM_Utils_Array::value('type', $typeValue) == 'File') {
                         $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $typeValue, 'entity_table');
                         $value = CRM_Core_BAO_File::attachmentInfo($tableName, $activityDAO->id);
                     } elseif (CRM_Utils_Array::value('type', $typeValue) == 'Link') {
                         $value = CRM_Utils_System::formatWikiURL($value);
                     }
                 }
                 //$typeValue
                 $customGroup[] = array('label' => $typeValue['label'], 'value' => $value, 'type' => $typeValue['type']);
             }
             $customGroups[$dao->groupTitle] = $customGroup;
         }
     }
     return empty($customGroups) ? NULL : $customGroups;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:Report.php

示例2: formatCustomValues

 /** 
  * Format custom value according to data, view mode
  * @param array $values associated array of custom values
  * @param array $field associated array
  * @param boolean $dncOptionPerLine true if optionPerLine should not be consider
  *
  */
 static function formatCustomValues(&$values, &$field, $dncOptionPerLine = false)
 {
     $value = $values['data'];
     //changed isset CRM-4601
     if (CRM_Utils_System::isNull($value)) {
         return;
     }
     $htmlType = CRM_Utils_Array::value('html_type', $field);
     $dataType = CRM_Utils_Array::value('data_type', $field);
     $option_group_id = CRM_Utils_Array::value('option_group_id', $field);
     $timeFormat = CRM_Utils_Array::value('time_format', $field);
     $optionPerLine = CRM_Utils_Array::value('options_per_line', $field);
     $freezeString = "";
     $freezeStringChecked = "";
     switch ($dataType) {
         case 'Date':
             $customTimeFormat = '';
             $customFormat = null;
             if ($timeFormat == 1) {
                 $customTimeFormat = '%l:%M %P';
             } else {
                 if ($timeFormat == 2) {
                     $customTimeFormat = '%H:%M';
                 }
             }
             $supportableFormats = array('mm/dd' => "%B %E%f {$customTimeFormat}", 'dd-mm' => "%E%f %B {$customTimeFormat}", 'yy' => "%Y {$customTimeFormat}");
             if ($format = CRM_Utils_Array::value('date_format', $field)) {
                 if (array_key_exists($format, $supportableFormats)) {
                     $customFormat = $supportableFormats["{$format}"];
                 }
             }
             $retValue = CRM_Utils_Date::customFormat($value, $customFormat);
             break;
         case 'Boolean':
             if ($value == '1') {
                 $retValue = $freezeStringChecked . ts('Yes') . "\n";
             } else {
                 $retValue = $freezeStringChecked . ts('No') . "\n";
             }
             break;
         case 'Link':
             if ($value) {
                 $retValue = CRM_Utils_System::formatWikiURL($value);
             }
             break;
         case 'File':
             $retValue = $values;
             break;
         case 'ContactReference':
             if (CRM_Utils_Array::value('data', $values)) {
                 $retValue = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $values['data'], 'display_name');
             }
             break;
         case 'Memo':
             $retValue = $value;
             break;
         case 'Float':
             if ($htmlType == 'Text') {
                 $retValue = (double) $value;
                 break;
             }
         case 'Money':
             if ($htmlType == 'Text') {
                 require_once 'CRM/Utils/Money.php';
                 $retValue = CRM_Utils_Money::format($value, null, '%a');
                 break;
             }
         case 'String':
         case 'Int':
             if (in_array($htmlType, array('Text', 'TextArea'))) {
                 $retValue = $value;
                 break;
             }
         case 'StateProvince':
         case 'Country':
             //added check for Multi-Select in the below if-statement
             $customData[] = $value;
             //form custom data for multiple-valued custom data
             switch ($htmlType) {
                 case 'Multi-Select Country':
                 case 'Select Country':
                     $customData = $value;
                     if (!is_array($value)) {
                         $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
                     }
                     $query = "\n                    SELECT id as value, name as label  \n                    FROM civicrm_country";
                     $coDAO = CRM_Core_DAO::executeQuery($query);
                     break;
                 case 'Select State/Province':
                 case 'Multi-Select State/Province':
                     $customData = $value;
                     if (!is_array($value)) {
                         $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:CustomGroup.php

示例3: formatCustomValues

 /**
  * Format custom values.
  *
  * @param mixed $value
  * @param array $customField
  * @param array $fieldValueMap
  *
  * @return float|string|void
  */
 public function formatCustomValues($value, $customField, $fieldValueMap)
 {
     if (CRM_Utils_System::isNull($value)) {
         return NULL;
     }
     $htmlType = $customField['html_type'];
     switch ($customField['data_type']) {
         case 'Boolean':
             if ($value == '1') {
                 $retValue = ts('Yes');
             } else {
                 $retValue = ts('No');
             }
             break;
         case 'Link':
             $retValue = CRM_Utils_System::formatWikiURL($value);
             break;
         case 'File':
             $retValue = $value;
             break;
         case 'Memo':
             $retValue = $value;
             break;
         case 'Float':
             if ($htmlType == 'Text') {
                 $retValue = (double) $value;
                 break;
             }
         case 'Money':
             if ($htmlType == 'Text') {
                 $retValue = CRM_Utils_Money::format($value, NULL, '%a');
                 break;
             }
         case 'String':
         case 'Int':
             if (in_array($htmlType, array('Text', 'TextArea'))) {
                 $retValue = $value;
                 break;
             }
         case 'StateProvince':
         case 'Country':
             switch ($htmlType) {
                 case 'Multi-Select Country':
                     $value = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
                     $customData = array();
                     foreach ($value as $val) {
                         if ($val) {
                             $customData[] = CRM_Core_PseudoConstant::country($val, FALSE);
                         }
                     }
                     $retValue = implode(', ', $customData);
                     break;
                 case 'Select Country':
                     $retValue = CRM_Core_PseudoConstant::country($value, FALSE);
                     break;
                 case 'Select State/Province':
                     $retValue = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
                     break;
                 case 'Multi-Select State/Province':
                     $value = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
                     $customData = array();
                     foreach ($value as $val) {
                         if ($val) {
                             $customData[] = CRM_Core_PseudoConstant::stateProvince($val, FALSE);
                         }
                     }
                     $retValue = implode(', ', $customData);
                     break;
                 case 'Select':
                 case 'Radio':
                 case 'Autocomplete-Select':
                     $retValue = $fieldValueMap[$customField['option_group_id']][$value];
                     break;
                 case 'CheckBox':
                 case 'AdvMulti-Select':
                 case 'Multi-Select':
                     $value = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
                     $customData = array();
                     foreach ($value as $val) {
                         if ($val) {
                             $customData[] = $fieldValueMap[$customField['option_group_id']][$val];
                         }
                     }
                     $retValue = implode(', ', $customData);
                     break;
                 default:
                     $retValue = $value;
             }
             break;
         default:
             $retValue = $value;
//.........这里部分代码省略.........
开发者ID:vincent1892,项目名称:contact_report,代码行数:101,代码来源:Form.php

示例4: formatCustomValues

  /**
   * We are overriding this function to apply crm-editable where appropriate
   * It would be more efficient if we knew the entity being extended (which the parent function
   * does know) but we want to avoid extending any functions we don't have to
   *
   * @param $value
   * @param $customField
   * @param $fieldValueMap
   * @param array $row
   *
   * @return float|string|void
   */
  function formatCustomValues($value, $customField, $fieldValueMap, $row = array()) {
    if (!empty($this->_customGroupExtends) && count($this->_customGroupExtends) == 1) {
      //lets only extend apply editability where only one entity extended
      // we can easily extend to contact combos
      list($entity) = $this->_customGroupExtends;
      $entity_table = strtolower('civicrm_' . $entity);
      $idKeyArray = array($this->_aliases[$entity_table] . '.id');
      if (empty($this->_groupByArray) || $this->_groupByArray == $idKeyArray) {
        $entity_field = $entity_table . '_id';
        $entityID = $row[$entity_field];
      }
    }
    if (CRM_Utils_System::isNull($value) && !in_array($customField['data_type'], array(
        'String',
        'Int'
      ))
    ) {
      // we will return unless it is potentially an editable field
      return;
    }

    $htmlType = $customField['html_type'];

    switch ($customField['data_type']) {
      case 'Boolean':
        if ($value == '1') {
          $retValue = ts('Yes');
        }
        else {
          $retValue = ts('No');
        }
        break;

      case 'Link':
        $retValue = CRM_Utils_System::formatWikiURL($value);
        break;

      case 'File':
        $retValue = $value;
        break;

      case 'Memo':
        $retValue = $value;
        break;

      case 'Float':
        if ($htmlType == 'Text') {
          $retValue = (float) $value;
          break;
        }
      case 'Money':
        if ($htmlType == 'Text') {
          $retValue = CRM_Utils_Money::format($value, NULL, '%a');
          break;
        }
      case 'String':
      case 'Int':
        if (in_array($htmlType, array(
          'Text',
          'TextArea',
          'Select',
          'Radio'
        ))
        ) {
          $retValue = $value;
          $extra = '';
          if (($htmlType == 'Select' || $htmlType == 'Radio') && !empty($entity)) {
            $options = civicrm_api($entity, 'getoptions', array(
              'version' => 3,
              'field' => 'custom_' . $customField['id']
            ));
            $options = $options['values'];
            $options['selected'] = $value;
            $extra = "data-type='select' data-options='" . json_encode($options) . "'";
            $value = $options[$value];
          }
          if (!empty($entity_field)) {
            //$
            $retValue = "<div id={$entity}-{$entityID} class='crm-entity'>
          <span class='crm-editable crmf-custom_{$customField['id']} crm-editable' data-action='create' $extra >" . $value . "</span></div>";
          }
          break;
        }
      case 'StateProvince':
      case 'Country':

        switch ($htmlType) {
          case 'Multi-Select Country':
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:ExtendedReport.php

示例5: formatCustomValues

 /**
  * Format custom value according to data, view mode
  *
  * @param array $values associated array of custom values
  * @param array $field associated array
  * @param boolean $dncOptionPerLine true if optionPerLine should not be consider
  *
  */
 static function formatCustomValues(&$values, &$field, $dncOptionPerLine = FALSE)
 {
     $value = $values['data'];
     //changed isset CRM-4601
     if (CRM_Utils_System::isNull($value)) {
         return;
     }
     $htmlType = CRM_Utils_Array::value('html_type', $field);
     $dataType = CRM_Utils_Array::value('data_type', $field);
     $option_group_id = CRM_Utils_Array::value('option_group_id', $field);
     $timeFormat = CRM_Utils_Array::value('time_format', $field);
     $optionPerLine = CRM_Utils_Array::value('options_per_line', $field);
     $freezeString = "";
     $freezeStringChecked = "";
     switch ($dataType) {
         case 'Date':
             $customTimeFormat = '';
             $customFormat = NULL;
             switch ($timeFormat) {
                 case 1:
                     $customTimeFormat = '%l:%M %P';
                     break;
                 case 2:
                     $customTimeFormat = '%H:%M';
                     break;
                 default:
                     // if time is not selected remove time from value
                     $value = substr($value, 0, 10);
             }
             $supportableFormats = array('mm/dd' => "%B %E%f {$customTimeFormat}", 'dd-mm' => "%E%f %B {$customTimeFormat}", 'yy' => "%Y {$customTimeFormat}", 'M yy' => "%b %Y {$customTimeFormat}", 'yy-mm' => "%Y-%m {$customTimeFormat}");
             if ($format = CRM_Utils_Array::value('date_format', $field)) {
                 if (array_key_exists($format, $supportableFormats)) {
                     $customFormat = $supportableFormats["{$format}"];
                 }
             }
             $retValue = CRM_Utils_Date::customFormat($value, $customFormat);
             break;
         case 'Boolean':
             if ($value == '1') {
                 $retValue = $freezeStringChecked . ts('Yes') . "\n";
             } else {
                 $retValue = $freezeStringChecked . ts('No') . "\n";
             }
             break;
         case 'Link':
             if ($value) {
                 $retValue = CRM_Utils_System::formatWikiURL($value);
             }
             break;
         case 'File':
             $retValue = $values;
             break;
         case 'ContactReference':
             if (CRM_Utils_Array::value('data', $values)) {
                 $retValue = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $values['data'], 'display_name');
             }
             break;
         case 'Memo':
             $retValue = $value;
             break;
         case 'Float':
             if ($htmlType == 'Text') {
                 $retValue = (double) $value;
                 break;
             }
         case 'Money':
             if ($htmlType == 'Text') {
                 $retValue = CRM_Utils_Money::format($value, NULL, '%a');
                 break;
             }
         case 'String':
         case 'Int':
             if (in_array($htmlType, array('Text', 'TextArea'))) {
                 $retValue = $value;
                 break;
             }
             // note that if its not text / textarea, the code falls thru and executes
             // the below case also
         // note that if its not text / textarea, the code falls thru and executes
         // the below case also
         case 'StateProvince':
         case 'Country':
             $options = array();
             $coDAO = NULL;
             //added check for Multi-Select in the below if-statement
             $customData[] = $value;
             //form custom data for multiple-valued custom data
             switch ($htmlType) {
                 case 'Multi-Select Country':
                 case 'Select Country':
                     $customData = $value;
                     if (!is_array($value)) {
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:CustomGroup.php


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