Example #1
0
 public static function GetFieldInputValuePrintable($parameterDocumentType, $fieldType, $fieldValue)
 {
     list($moduleId, $entity, $documentType) = CBPHelper::ParseDocumentId($parameterDocumentType);
     if (strlen($moduleId) > 0) {
         CModule::IncludeModule($moduleId);
     }
     if (is_array($fieldType)) {
         $arFieldType = array("Type" => null, "Multiple" => false, "Required" => false, "Options" => null);
         foreach ($fieldType as $key => $val) {
             switch (strtoupper($key)) {
                 case "TYPE":
                 case "0":
                     $arFieldType["Type"] = strval($val);
                     break;
                 case "MULTIPLE":
                 case "1":
                     $arFieldType["Multiple"] = !$val || is_int($val) && $val == 0 || strtoupper($val) == "N" ? false : true;
                     break;
                 case "REQUIRED":
                 case "2":
                     $arFieldType["Required"] = !$val || is_int($val) && $val == 0 || strtoupper($val) == "N" ? false : true;
                     break;
                 case "OPTIONS":
                 case "3":
                     if (is_array($val)) {
                         $arFieldType["Options"] = $val;
                     }
                     break;
             }
         }
     } else {
         $arFieldType = array("Type" => strval($fieldType), "Multiple" => false, "Required" => false, "Options" => null);
     }
     if ((string) $arFieldType["Type"] == "") {
         return "";
     }
     if (class_exists($entity)) {
         if (method_exists($entity, "GetFieldInputValuePrintable")) {
             return call_user_func_array(array($entity, "GetFieldInputValuePrintable"), array($documentType, $arFieldType, $fieldValue));
         }
         if (method_exists($entity, "GetFieldValuePrintable")) {
             return call_user_func_array(array($entity, "GetFieldValuePrintable"), array(null, "", $arFieldType["Type"], $fieldValue, $arFieldType));
         }
     }
     return CBPHelper::GetFieldInputValuePrintable($parameterDocumentType, $arFieldType, $fieldValue);
 }
Example #2
0
 public function GetFieldInputValuePrintable($parameterDocumentType, $fieldType, $fieldValue)
 {
     list($moduleId, $entity, $documentType) = CBPHelper::ParseDocumentId($parameterDocumentType);
     if (strlen($moduleId) > 0) {
         CModule::IncludeModule($moduleId);
     }
     $arFieldType = FieldType::normalizeProperty($fieldType);
     if ((string) $arFieldType["Type"] == "") {
         return "";
     }
     $fieldTypeObject = $this->getFieldTypeObject($parameterDocumentType, $arFieldType);
     if ($fieldTypeObject) {
         return $fieldTypeObject->formatValue($fieldValue, 'printable');
     }
     if (class_exists($entity)) {
         if (method_exists($entity, "GetFieldInputValuePrintable")) {
             return call_user_func_array(array($entity, "GetFieldInputValuePrintable"), array($documentType, $arFieldType, $fieldValue));
         }
         if (method_exists($entity, "GetFieldValuePrintable")) {
             return call_user_func_array(array($entity, "GetFieldValuePrintable"), array(null, "", $arFieldType["Type"], $fieldValue, $arFieldType));
         }
     }
     return CBPHelper::GetFieldInputValuePrintable($parameterDocumentType, $arFieldType, $fieldValue);
 }