* Are we in print mode? if so we need to modify the display
* functionality to do a minimal display :)
*
- * @var bool
+ * @var int|string
+ * Should match a CRM_Core_Smarty::PRINT_* constant,
+ * or equal 0 if not in print mode
*/
public $_print = 0;
*/
public function getButtonName() {
$data = &$this->container();
- return $data['_qf_button_name'] ?? NULL;
+ return $data['_qf_button_name'] ?? '';
}
/**
}
/**
- * @param null $fileName
+ * Output HTTP headers for Word document
+ * (note .doc, not the newer .docx format)
+ *
+ * @deprecated
+ *
+ * @param string|null $fileName
+ * @return void
*/
public function setWord($fileName = NULL) {
+ CRM_Core_Error::deprecatedFunctionWarning('no alternative');
+
//Mark as a CSV file.
CRM_Utils_System::setHttpHeader('Content-Type', 'application/vnd.ms-word');
}
/**
- * @param null $fileName
+ * Output HTTP headers for Excel document
+ * (note .xls, not the newer .xlsx format)
+ *
+ * @deprecated
+ *
+ * @param string|null $fileName
+ * @return void
*/
public function setExcel($fileName = NULL) {
+ CRM_Core_Error::deprecatedFunctionWarning('no alternative');
+
//Mark as an excel file.
CRM_Utils_System::setHttpHeader('Content-Type', 'application/vnd.ms-excel');
/**
* Setter for print.
*
- * @param bool $print
+ * Historically the $print argument has also accepted a string (xls or doc),
+ * but this usage is now deprecated.
+ *
+ * @param int|string $print
+ * Should match a CRM_Core_Smarty::PRINT_* constant,
+ * or equal 0 if not in print mode
+ *
+ * @return void
*/
public function setPrint($print) {
- if ($print == "xls") {
+ if ($print === "xls") {
$this->setExcel();
}
- elseif ($print == "doc") {
+ elseif ($print === "doc") {
$this->setWord();
}
$this->_print = $print;
/**
* Getter for print.
*
- * @return bool
- * return the print value
+ * @return int|string
+ * Value matching a CRM_Core_Smarty::PRINT_* constant,
+ * or 0 if not in print mode
*/
public function getPrint() {
return $this->_print;
if ($this->_print == CRM_Core_Smarty::PRINT_PAGE) {
return 'CRM/common/print.tpl';
}
- elseif ($this->_print == 'xls' || $this->_print == 'doc') {
+ elseif ($this->_print === 'xls' || $this->_print === 'doc') {
return 'CRM/Contact/Form/Task/Excel.tpl';
}
else {