@@ 3-42 (lines=40) @@ | ||
1 | <?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | ||
3 | class Favourites extends Auth_Controller { |
|
4 | public function __construct() { |
|
5 | parent::__construct(); |
|
6 | } |
|
7 | ||
8 | public function index(int $page = 1) : void { |
|
9 | if($page === 0) redirect('user/favourites/1'); |
|
10 | ||
11 | $this->header_data['title'] = "Favourites"; |
|
12 | $this->header_data['page'] = "favourites"; |
|
13 | ||
14 | $favouriteData = $this->Tracker->favourites->get($page); |
|
15 | $this->body_data['favouriteData'] = $favouriteData['rows']; |
|
16 | $this->body_data['currentPage'] = $page; |
|
17 | $this->body_data['totalPages'] = $favouriteData['totalPages']; |
|
18 | ||
19 | if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1'); |
|
20 | ||
21 | $this->_render_page('User/Favourites'); |
|
22 | } |
|
23 | ||
24 | public function export(string $type) : void { |
|
25 | $favouriteData = $this->Tracker->favourites->getAll(); |
|
26 | ||
27 | switch($type) { |
|
28 | case 'json': |
|
29 | $this->_render_json($favouriteData, TRUE, 'tracker-history'); |
|
30 | break; |
|
31 | ||
32 | case 'csv': |
|
33 | $this->output->set_content_type('text/csv', 'utf-8'); |
|
34 | $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL', ',', '"', FALSE, TRUE), 'csv',TRUE, 'tracker-favourite'); |
|
35 | break; |
|
36 | ||
37 | default: |
|
38 | //404 |
|
39 | break; |
|
40 | } |
|
41 | } |
|
42 | } |
|
43 |
@@ 3-42 (lines=40) @@ | ||
1 | <?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | ||
3 | class History extends Auth_Controller { |
|
4 | public function __construct() { |
|
5 | parent::__construct(); |
|
6 | } |
|
7 | ||
8 | public function index(int $page = 1) : void { |
|
9 | if($page === 0) redirect('user/history/1'); |
|
10 | ||
11 | $this->header_data['title'] = "History"; |
|
12 | $this->header_data['page'] = "history"; |
|
13 | ||
14 | $historyData = $this->History->userGetHistory($page); |
|
15 | $this->body_data['historyData'] = $historyData['rows']; |
|
16 | $this->body_data['currentPage'] = (int) $page; |
|
17 | $this->body_data['totalPages'] = $historyData['totalPages']; |
|
18 | ||
19 | if($page > $this->body_data['totalPages'] && $page > 1) redirect('user/history/1'); |
|
20 | ||
21 | $this->_render_page('User/History'); |
|
22 | } |
|
23 | ||
24 | public function export(string $type) : void { |
|
25 | $historyData = $this->History->userGetHistoryAll(); |
|
26 | ||
27 | switch($type) { |
|
28 | case 'json': |
|
29 | $this->_render_json($historyData, TRUE, 'tracker-history'); |
|
30 | break; |
|
31 | ||
32 | case 'csv': |
|
33 | $this->output->set_content_type('text/csv', 'utf-8'); |
|
34 | $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($historyData, 'Date/Time,Title,URL,Site,Status', ',', '"', FALSE, TRUE), 'csv',TRUE, 'tracker-history'); |
|
35 | break; |
|
36 | ||
37 | default: |
|
38 | //404 |
|
39 | break; |
|
40 | } |
|
41 | } |
|
42 | } |
|
43 |