From 0dc2ce90ec3334b9af82736b85233db94debc0cf Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Fri, 27 May 2016 20:19:38 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=B0=20=D1=81=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D1=83=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=B0=D0=BF?= =?UTF-8?q?=D0=BB=D0=BE=D0=B0=D0=B4=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= =?UTF-8?q?;=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D1=81=D0=BA=D0=B0=D1=87=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=B8=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/TracksController.php | 25 ++++++++++++++++++++++++- views/file.php | 20 ++++++++++++++++++++ views/tracks/files.php | 10 +--------- views/tracks/index.php | 20 ++++++++++++++++++-- 4 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 views/file.php 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 @@ -

Ваши треки

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

Ваши треки

+
+
+
+ + + +   + +
+
+