本文整理汇总了PHP中CRM_Utils_PDF_Utils::convertMetric方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_PDF_Utils::convertMetric方法的具体用法?PHP CRM_Utils_PDF_Utils::convertMetric怎么用?PHP CRM_Utils_PDF_Utils::convertMetric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_PDF_Utils
的用法示例。
在下文中一共展示了CRM_Utils_PDF_Utils::convertMetric方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LabelSetFormat
/**
* initialize label format settings.
*
* @param $format
* @param $unit
*/
public function LabelSetFormat(&$format, $unit)
{
$this->defaults = CRM_Core_BAO_LabelFormat::getDefaultValues();
$this->format =& $format;
$this->formatName = $this->getFormatValue('name');
$this->paperSize = $this->getFormatValue('paper-size');
$this->orientation = $this->getFormatValue('orientation');
$this->fontName = $this->getFormatValue('font-name');
$this->charSize = $this->getFormatValue('font-size');
$this->fontStyle = $this->getFormatValue('font-style');
$this->xNumber = $this->getFormatValue('NX');
$this->yNumber = $this->getFormatValue('NY');
$this->metricDoc = $unit;
$this->marginLeft = $this->getFormatValue('lMargin', TRUE);
$this->marginTop = $this->getFormatValue('tMargin', TRUE);
$this->xSpace = $this->getFormatValue('SpaceX', TRUE);
$this->ySpace = $this->getFormatValue('SpaceY', TRUE);
$this->width = $this->getFormatValue('width', TRUE);
$this->height = $this->getFormatValue('height', TRUE);
$this->paddingLeft = $this->getFormatValue('lPadding', TRUE);
$this->paddingTop = $this->getFormatValue('tPadding', TRUE);
$paperSize = CRM_Core_BAO_PaperSize::getByName($this->paperSize);
$w = CRM_Utils_PDF_Utils::convertMetric($paperSize['width'], $paperSize['metric'], $this->metricDoc);
$h = CRM_Utils_PDF_Utils::convertMetric($paperSize['height'], $paperSize['metric'], $this->metricDoc);
$this->paper_dimensions = array($w, $h);
}
示例2: retrieve
/**
* Retrieve DB object based on input parameters.
*
* It also stores all the retrieved values in the default array.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $values
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Core_DAO_OptionValue
*/
public static function retrieve(&$params, &$values)
{
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
$optionValue->option_group_id = self::_getGid();
if ($optionValue->find(TRUE)) {
// Extract fields that have been serialized in the 'value' column of the Option Value table.
$values = json_decode($optionValue->value, TRUE);
// Add any new fields that don't yet exist in the saved values.
foreach (self::$optionValueFields as $name => $field) {
if (!isset($values[$name])) {
$values[$name] = $field['default'];
if (isset($field['metric']) && $field['metric']) {
$values[$name] = CRM_Utils_PDF_Utils::convertMetric($field['default'], self::$optionValueFields['metric']['default'], $values['metric'], 3);
}
}
}
// Add fields from the OptionValue base class
CRM_Core_DAO::storeValues($optionValue, $values);
return $optionValue;
}
return NULL;
}
示例3: toTwip
/**
* @param $value
* @param $metric
* @return int
*/
public static function toTwip($value, $metric)
{
$point = CRM_Utils_PDF_Utils::convertMetric($value, $metric, 'pt');
return \PhpOffice\PhpWord\Shared\Converter::pointToTwip($point);
}