#12468 Fixed instructions

This commit is contained in:
Daniel Maya 2023-11-29 10:27:55 +01:00
parent 22969eff6e
commit 892048554e
2 changed files with 4 additions and 17 deletions

View File

@ -5775,7 +5775,7 @@ function events_get_field_value_by_event_id(
} }
function events_get_instructions($event) function events_get_instructions($event, $max_text_length=300)
{ {
if (is_array($event) === false) { if (is_array($event) === false) {
return ''; return '';
@ -5823,17 +5823,17 @@ function events_get_instructions($event)
return ''; return '';
} }
$max_text_length = 300;
$over_text = io_safe_output($value); $over_text = io_safe_output($value);
if (strlen($over_text) > ($max_text_length + 3)) { if (strlen($over_text) > ($max_text_length + 3)) {
$over_text = substr($over_text, 0, $max_text_length).'...'; $over_text = substr($over_text, 0, $max_text_length).'...';
} else {
return $value;
} }
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"'; $output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
$output .= ' class="event_instruction">'; $output .= ' class="event_instruction">';
$output .= $value; $output .= $value;
$output .= '</div>'; $output .= '</div>';
$output .= '<center>';
$output .= '<span id="value_event_'.$event['id_evento'].'" class="nowrap">'; $output .= '<span id="value_event_'.$event['id_evento'].'" class="nowrap">';
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>'; $output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">'; $output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
@ -5842,7 +5842,6 @@ function events_get_instructions($event)
true, true,
['title' => $over_text] ['title' => $over_text]
).'</a></span>'; ).'</a></span>';
$output .= '</center>';
return $output; return $output;
} }

View File

@ -644,19 +644,7 @@ if (is_ajax() === true) {
$tmp->data = ui_print_truncate_text($tmp->data, 10); $tmp->data = ui_print_truncate_text($tmp->data, 10);
} }
$tmp->instructions = events_get_instructions($item); $tmp->instructions = events_get_instructions($item, 15);
if (strlen($tmp->instructions) >= 20) {
$tmp->instructions = ui_print_truncate_text(
$tmp->instructions,
20,
false,
true,
false,
'&hellip;',
true,
true,
);
}
$tmp->user_comment = ui_print_comments( $tmp->user_comment = ui_print_comments(
event_get_last_comment( event_get_last_comment(