本文整理汇总了PHP中CRM_Core_SelectValues::documentApplicationType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::documentApplicationType方法的具体用法?PHP CRM_Core_SelectValues::documentApplicationType怎么用?PHP CRM_Core_SelectValues::documentApplicationType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_SelectValues
的用法示例。
在下文中一共展示了CRM_Core_SelectValues::documentApplicationType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->_contactIds = array($this->individualCreate(array('first_name' => 'Antonia', 'last_name' => 'D`souza')), $this->individualCreate(array('first_name' => 'Anthony', 'last_name' => 'Collins')));
$this->_docTypes = CRM_Core_SelectValues::documentApplicationType();
}
示例2: formRule
/**
* Global form rule.
*
* @param array $params
* The input form values.
* @param array $files
* The uploaded files if any.
* @param array $self
*
* @return array
* array of errors
*/
public static function formRule($params, $files, $self)
{
$errors = array();
// If user uploads non-document file other than odt/docx
if (!empty($files['file_id']['tmp_name']) && array_search($files['file_id']['type'], CRM_Core_SelectValues::documentApplicationType()) == NULL) {
$error['file_id'] = ts('Invalid document file format');
} elseif (empty($files['file_id']['tmp_name']) && !empty($params['file_type']) && !$self->_is_document) {
//On edit page of docx/odt message template if user changes file type but forgot to upload document
$errors['file_id'] = ts('Please upload document');
}
return $errors;
}
示例3: docReader
/**
* @param array $path docx/odt file path
* @param string $type File type
*
* @return array
* Return extracted content of document in HTML and document type
*/
public static function docReader($path, $type)
{
$type = array_search($type, CRM_Core_SelectValues::documentApplicationType());
$fileType = $type == 'docx' ? 'Word2007' : 'ODText';
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path, $fileType);
$phpWordHTML = new \PhpOffice\PhpWord\Writer\HTML($phpWord);
// return the html content for tokenreplacment and eventually used for document download
return array($phpWordHTML->getWriterPart('Body')->write(), $type);
}
示例4: formRule
/**
* Form rule.
*
* @param array $fields
* The input form values.
* @param array $files
* @param array $self
* Additional values form 'this'.
*
* @return bool
* TRUE if no errors, else array of errors.
*/
public static function formRule($fields, $files, $self)
{
$errors = array();
$template = CRM_Core_Smarty::singleton();
// If user uploads non-document file other than odt/docx
if (empty($fields['template']) && !empty($files['document_file']['tmp_name']) && array_search($files['document_file']['type'], CRM_Core_SelectValues::documentApplicationType()) == NULL) {
$errors['document_file'] = ts('Invalid document file format');
}
//Added for CRM-1393
if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) {
$errors['saveTemplateName'] = ts("Enter name to save message template");
}
if (!is_numeric($fields['margin_left'])) {
$errors['margin_left'] = 'Margin must be numeric';
}
if (!is_numeric($fields['margin_right'])) {
$errors['margin_right'] = 'Margin must be numeric';
}
if (!is_numeric($fields['margin_top'])) {
$errors['margin_top'] = 'Margin must be numeric';
}
if (!is_numeric($fields['margin_bottom'])) {
$errors['margin_bottom'] = 'Margin must be numeric';
}
return empty($errors) ? TRUE : $errors;
}