<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
*/
require_once 'tcpdf/tcpdf.php';
+
+/**
+ * Class CRM_Utils_PDF_Label
+ */
class CRM_Utils_PDF_Label extends TCPDF {
// make these properties public due to
/**
* Constructor
*
- * @param $format Either the name of a Label Format in the Option Value table
+ * @param $format
+ * Either the name of a Label Format in the Option Value table.
* or an array of Label Format values.
* @param string|\Unit $unit Unit of measure for the PDF document
*
- * @access public
*/
- function __construct($format, $unit = 'mm') {
+ public function __construct($format, $unit = 'mm') {
if (is_array($format)) {
// Custom format
$tFormat = $format;
$this->setPrintFooter(FALSE);
}
- function SetGenerator($objectinstance, $methodname = 'generateLabel') {
+ /**
+ * @param $objectinstance
+ * @param string $methodname
+ */
+ public function SetGenerator($objectinstance, $methodname = 'generateLabel') {
$this->generatorMethod = $methodname;
$this->generatorObject = $objectinstance;
}
- function getFormatValue($name, $convert = FALSE) {
+ /**
+ * @param string $name
+ * @param bool $convert
+ *
+ * @return float|int|mixed
+ */
+ public function getFormatValue($name, $convert = FALSE) {
if (isset($this->format[$name])) {
$value = $this->format[$name];
$metric = $this->format['metric'];
}
/*
- * Function to initialize label format settings
+ * initialize label format settings
*/
- function LabelSetFormat(&$format, $unit) {
+ /**
+ * @param $format
+ * @param $unit
+ */
+ public function LabelSetFormat(&$format, $unit) {
$this->defaults = CRM_Core_BAO_LabelFormat::getDefaultValues();
$this->format = &$format;
$this->formatName = $this->getFormatValue('name');
}
/*
- * function to Generate the pdf of one label (can be modified using SetGenerator)
+ * Generate the pdf of one label (can be modified using SetGenerator)
+ */
+ /**
+ * @param $text
*/
- function generateLabel($text) {
+ public function generateLabel($text) {
$args = array(
'w' => $this->width,
'h' => 0,
}
/*
- * function to Print a label
+ * Print a label
*/
- function AddPdfLabel($texte) {
+ /**
+ * @param $texte
+ */
+ public function AddPdfLabel($texte) {
if ($this->countX == $this->xNumber) {
// Page full, we start a new one
$this->AddPage();
}
}
- function getFontNames() {
+ public function getFontNames() {
// Define labels for TCPDF core fonts
$fontLabel = array(
'courier' => ts('Courier'),
'dejavusans' => ts('Deja Vu Sans (UTF-8)'),
);
-
// Check to see if we have any additional fonts to add. You can specify more fonts in
// civicrm.settings.php via: $config['CiviCRM Preferences']['additional_fonts']
// CRM-13307
return $list;
}
}
-