diff --git a/controllers/TracksController.php b/controllers/TracksController.php index a464e10..a1939d0 100644 --- a/controllers/TracksController.php +++ b/controllers/TracksController.php @@ -60,7 +60,30 @@ class TracksController extends Controller App::error404(); } - App::redirect('/tracks/files'); + App::redirect('/tracks/importgpx/id/'.$tmp->id); + } + + function actionGetFile() + { + $id = intval(App::getParam('id')); + + if (!$id) { + App::error404(); + } + + $trackFile = TrackFiles::model()->getByPK($id); + + if ($trackFile->isEmpty() || $trackFile->owner != App::$user->id) { + App::error404(); + } + + $temp = pathinfo($trackFile->filename); + $extension = strtolower($temp['extension']); + + self::renderPartial('file.php', array( + 'filePath' => App::getBasedir(). 'tracks/track' . $id . '.' . $extension, + 'fileName' => $trackFile->filename, + )); } function actionImportgpx() diff --git a/views/file.php b/views/file.php new file mode 100644 index 0000000..6a6aad2 --- /dev/null +++ b/views/file.php @@ -0,0 +1,20 @@ + -
- - - -
- -

Ваши файлы с треками

id . ' — ' . $file->name . ' [' . $file->tracksCount.' . ' . $file->tptCount.' . ' . $file->wptCount . ']
'; + print $file->id . ' — ' . $file->name . ' [' . $file->tracksCount.' . ' . $file->tptCount.' . ' . $file->wptCount . ']
'; } } else { print 'Пока ничего не загружено'; diff --git a/views/tracks/index.php b/views/tracks/index.php index 432080b..380ad2c 100644 --- a/views/tracks/index.php +++ b/views/tracks/index.php @@ -1,5 +1,21 @@ -

Ваши треки

-загрузка треков + + + + + +
+

Ваши треки

+
+
+
+ + + +   + +
+
+