'; // Normal view button. $output .= '
'; $normalQuery = http_build_query(['dashboardId' => $dashboardId]); $output .= ''; $output .= html_print_image( 'images/normal_screen.png', true, [ 'title' => __('Exit fullscreen'), 'class' => 'invert_filter', ] ); $output .= ''; $output .= '
'; $next_slides_url = ''; $prev_slides_url = ''; if ($cellModeSlides === 0) { $index = 0; $items_num = count($slidesIds); $first_index = 0; $last_index = ($items_num - 1); foreach ($slidesIds as $key => $id) { if ($dashboardId === (int) $id) { $index = $key; break; } } if ($index === $first_index && $index === $last_index) { $next_id = $dashboardId; $prev_id = $dashboardId; } else if ($index === $first_index) { $prev_id = $slidesIds[$last_index]; $next_id = $slidesIds[($index + 1)]; } else if ($index === $last_index) { $prev_id = $slidesIds[($index - 1)]; $next_id = $slidesIds[$first_index]; } else { $prev_id = $slidesIds[($index - 1)]; $next_id = $slidesIds[($index + 1)]; } $next_common_query = [ 'dashboardId' => $next_id, 'slides' => 1, 'slidesIds' => $slidesIds, 'pure' => 1, 'cellModeSlides' => 0, ]; $prev_common_query = [ 'dashboardId' => $prev_id, 'slides' => 1, 'slidesIds' => $slidesIds, 'pure' => 1, 'cellModeSlides' => 0, ]; $cell_slides_query = [ 'dashboardId' => $dashboardId, 'slidesIds' => $slidesIds, 'pure' => 1, 'slides' => 1, 'cellModeSlides' => 1, ]; $name = $dashboard['name']; } else { // Cells slideshow mode. $prev_cell_id = null; $next_cell_id = null; // This mode is like the slides mode, but with cells. $cell_id_found = false; foreach ($cells as $cell) { if ($cell_id_found === true) { $next_cell_id = (int) $cell['id']; break; } else if ($cellId === (int) $cell['id']) { $cell_id_found = true; } else { $prev_cell_id = (int) $cell['id']; } } if (isset($next_cell_id) === true) { $next_id = $next_cell_id; } else { if ((int) $cellId !== (int) $cells[0]['id']) { $next_id = $cells[0]['id']; } else { $next_id = $cells[1]['id']; } } $next_common_query = [ 'dashboardId' => $dashboardId, 'cellId' => $next_id, 'pure' => 1, 'slides' => 1, 'cellModeSlides' => 1, 'slidesIds' => $slidesIds, ]; $prev_id = (isset($prev_cell_id) === true) ? $prev_cell_id : (int) $cells[(count($cells) - 1)]['id']; $prev_common_query = [ 'dashboardId' => $dashboardId, 'cellId' => $prev_id, 'pure' => 1, 'slides' => 1, 'cellModeSlides' => 1, 'slidesIds' => $slidesIds, ]; $cell_slides_query = [ 'dashboardId' => $dashboardId, 'pure' => 1, 'slides' => 1, 'cellModeSlides' => 0, 'slidesIds' => $slidesIds, ]; $cells = array_reduce( $cells, function ($carry, $item) { $carry[$item['id']] = $item; return $carry; } ); $options = json_decode($cells[$cellId]['options'], true); $name = ''; if (isset($options) === true) { $name = $options['title']; } } $next_slides_url = $url.'&'.http_build_query($next_common_query); $prev_slides_url = $url.'&'.http_build_query($prev_common_query); $cell_slides_url = $url.'&'.http_build_query($cell_slides_query); // Auto refresh control. $output .= '
'; $output .= '
'; $output .= '
'; $output .= '
'; $output .= ''.__('Change every').':'; $output .= html_print_select( get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false ); $output .= '
'; $output .= '
'; $output .= '
'; // Prev slides button. $output .= '
'; $output .= ''; $output .= html_print_image( 'images/control_prev.png', true, [ 'title' => __('Previous'), 'class' => 'invert_filter', ] ); $output .= ''; $output .= '
'; // Stop slides button. $stop_slides_url = http_build_query( ['dashboardId' => $dashboardId] ); $output .= '
'; $output .= ''; $output .= html_print_image( 'images/control_stop.png', true, [ 'title' => __('Stop'), 'class' => 'invert_filter', ] ); $output .= ''; $output .= '
'; // Pause slides button. $output .= '
'; $output .= ''; $output .= html_print_image( 'images/control_pause.png', true, [ 'title' => __('Pause'), 'class' => 'invert_filter', ] ); $output .= ''; $output .= '
'; // Next slides button. $output .= '
'; $output .= ''; $output .= html_print_image( 'images/control_next.png', true, [ 'title' => __('Next'), 'class' => 'invert_filter', ] ); $output .= ''; $output .= '
'; // Cell slides button view. $output .= '
'; $output .= ''; if ($cellModeSlides === 0) { $output .= html_print_image( 'images/visual_console.png', true, [ 'title' => __('Boxed mode'), 'class' => 'invert_filter', ] ); $msg_tooltip = __('This mode will show the dashboard with all the widgets in the screen. Click to change to single screen mode.'); } else { $output .= html_print_image( 'images/dashboard.png', true, [ 'title' => __('Single screen'), 'class' => 'invert_filter', ] ); $msg_tooltip = __('This mode will show each widget in a screen, rotating between elements in each dashboard. Click to change to boxed mode.'); } $output .= ''; $output .= ui_print_help_tip( $msg_tooltip, true ); $output .= '
'; // Dashboard name. $output .= '
'; $output .= '
'.$name.'
'; $output .= '
'; $output .= ''; $output .= ' '; echo $output;