. * */ declare(strict_types=0); namespace Ampache\Module\Application\Playlist; use Ampache\Repository\Model\ModelFactoryInterface; use Ampache\Module\Application\ApplicationActionInterface; use Ampache\Module\Application\Exception\AccessDeniedException; use Ampache\Module\Authorization\GuiGatekeeperInterface; use Ampache\Module\Util\Ui; use Ampache\Module\Util\UiInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; final class SortTrackAction implements ApplicationActionInterface { public const REQUEST_KEY = 'sort_tracks'; private ModelFactoryInterface $modelFactory; private UiInterface $ui; public function __construct( ModelFactoryInterface $modelFactory, UiInterface $ui ) { $this->modelFactory = $modelFactory; $this->ui = $ui; } public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface { $this->ui->showHeader(); $playlist = $this->modelFactory->createPlaylist((int) $_REQUEST['playlist_id']); if (!$playlist->has_access()) { throw new AccessDeniedException(); } /* Sort the tracks */ $playlist->sort_tracks(); $object_ids = $playlist->get_items(); require_once Ui::find_template('show_playlist.inc.php'); $this->ui->showQueryStats(); $this->ui->showFooter(); return null; } }