getOnePrdData($type); if (empty($data) === false) { $sql = sprintf( 'SELECT %s FROM %s', reset($data['items']['value']).', '.reset($data['items']['show']), $data['items']['table'] ); $result = html_print_label_input_block( $data['label'], io_safe_output( html_print_select_from_sql( $sql, 'select_value', '', '', '', 0, true, false, true, false, false, false, GENERIC_SIZE_TEXT, 'w90p', ), ), [ 'div_style' => 'display: flex; flex-direction: column; width: 50%', 'div_id' => 'resource_type', ], ); } echo $result; return; } if ($exportPrd === true) { $type = (string) get_parameter('type', ''); $value = (int) get_parameter('value', 0); $name = (string) get_parameter('name', ''); $filename = (string) get_parameter('filename', ''); try { $data = $prd->exportPrd($type, $value, $name); } catch (\Exception $e) { $data = ''; } $return = []; if (empty($data) === false) { $filename_download = date('YmdHis').'-'.$type.'-'.$name.'.prd'; $file = $config['attachment_store'].'/'.$filename; $file_pointer = fopen($file, 'a'); if ($file_pointer !== false) { $write = fwrite($file_pointer, $data); if ($write === false) { $return['error'] = -2; unlink($config['attachment_store'].'/'.$filename); } else { $return['name'] = $filename; $return['name_download'] = $filename_download; } fclose($file_pointer); } else { $return['error'] = -1; } } echo json_encode($return); return; } if ($deleteFile === true) { $filename = (string) get_parameter('filename', ''); unlink($config['attachment_store'].'/'.$filename); } }