@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Tracker_Favourites_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | tf.chapter, tf.updated_at', FALSE) |
15 | 15 | ->from('tracker_favourites AS tf') |
16 | 16 | ->join('tracker_chapters AS tc', 'tf.chapter_id = tc.id', 'left') |
17 | - ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
18 | - ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
17 | + ->join('tracker_titles AS tt', 'tc.title_id = tt.id', 'left') |
|
18 | + ->join('tracker_sites AS ts', 'tt.site_id = ts.id', 'left') |
|
19 | 19 | ->where('tc.user_id', $this->User->id) //CHECK: Is this inefficient? Would it be better to have a user_id column in tracker_favourites? |
20 | 20 | ->order_by('tf.id DESC') |
21 | 21 | ->limit($rowsPerPage, ($rowsPerPage * ($page - 1))) |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Tracker_Favourites_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -71,32 +71,32 @@ |
||
71 | 71 | |
72 | 72 | ////We need the series to be tracked |
73 | 73 | $idCQuery = $this->db->select('id') |
74 | - ->where('user_id', $userID) |
|
75 | - ->where('title_id', $titleID) |
|
76 | - ->get('tracker_chapters'); |
|
74 | + ->where('user_id', $userID) |
|
75 | + ->where('title_id', $titleID) |
|
76 | + ->get('tracker_chapters'); |
|
77 | 77 | if(!($idCQuery->num_rows() > 0)) { |
78 | 78 | //NOTE: This pretty much repeats a lot of what we already did above. Is there a better way to do this? |
79 | 79 | $this->Tracker->list->update($userID, $site, $title, $chapter, FALSE); |
80 | 80 | |
81 | 81 | $idCQuery = $this->db->select('id') |
82 | - ->where('user_id', $userID) |
|
83 | - ->where('title_id', $titleID) |
|
84 | - ->get('tracker_chapters'); |
|
82 | + ->where('user_id', $userID) |
|
83 | + ->where('title_id', $titleID) |
|
84 | + ->get('tracker_chapters'); |
|
85 | 85 | } |
86 | 86 | if($idCQuery->num_rows() > 0) { |
87 | 87 | $idCQueryRow = $idCQuery->row(); |
88 | 88 | |
89 | 89 | //Check if it is already favourited |
90 | 90 | $idFQuery = $this->db->select('id') |
91 | - ->where('chapter_id', $idCQueryRow->id) |
|
92 | - ->where('chapter', $chapter) |
|
93 | - ->get('tracker_favourites'); |
|
91 | + ->where('chapter_id', $idCQueryRow->id) |
|
92 | + ->where('chapter', $chapter) |
|
93 | + ->get('tracker_favourites'); |
|
94 | 94 | if($idFQuery->num_rows() > 0) { |
95 | 95 | //Chapter is already favourited, so remove it from DB |
96 | 96 | $idFQueryRow = $idFQuery->row(); |
97 | 97 | |
98 | 98 | $isSuccess = (bool) $this->db->where('id', $idFQueryRow->id) |
99 | - ->delete('tracker_favourites'); |
|
99 | + ->delete('tracker_favourites'); |
|
100 | 100 | |
101 | 101 | if($isSuccess) { |
102 | 102 | $success = array( |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | public function setByID(int $userID, int $chapterID, string $category) : bool { |
9 | 9 | $success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL]) |
10 | - ->where('user_id', $userID) |
|
11 | - ->where('id', $chapterID) |
|
12 | - ->update('tracker_chapters'); |
|
10 | + ->where('user_id', $userID) |
|
11 | + ->where('id', $chapterID) |
|
12 | + ->update('tracker_chapters'); |
|
13 | 13 | |
14 | 14 | return (bool) $success; |
15 | 15 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | public function getUsed(int $userID) : array { |
42 | 42 | $query = $this->db->distinct() |
43 | - ->select('category') |
|
44 | - ->from('tracker_chapters') |
|
45 | - ->where('tracker_chapters.active', 'Y') |
|
46 | - ->where('user_id', $userID) |
|
47 | - ->get(); |
|
43 | + ->select('category') |
|
44 | + ->from('tracker_chapters') |
|
45 | + ->where('tracker_chapters.active', 'Y') |
|
46 | + ->where('user_id', $userID) |
|
47 | + ->get(); |
|
48 | 48 | |
49 | 49 | return array_column($query->result_array(), 'category'); |
50 | 50 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Tracker_Category_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class Tracker_Category_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
3 | 3 | |
4 | 4 | echo "\nERROR: ", |
5 | 5 | $heading, |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
3 | 3 | ?><!DOCTYPE html> |
4 | 4 | <html lang="en"> |
5 | 5 | <head> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
3 | 3 | ?><!DOCTYPE html> |
4 | 4 | <html lang="en"> |
5 | 5 | <head> |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | <div class="row"> |
21 | 21 | <div class="col-xs-12 col-md-12"> |
22 | - <?=form_submit($form_submit);?> |
|
22 | + <?=form_submit($form_submit); ?> |
|
23 | 23 | </div> |
24 | 24 | </div> |
25 | 25 | </form> |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | <div class="row"> |
21 | 21 | <div class="col-xs-12 col-md-12"> |
22 | - <?=form_submit($form_submit);?> |
|
22 | + <?=form_submit($form_submit); ?> |
|
23 | 23 | </div> |
24 | 24 | </div> |
25 | 25 | </form> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | $active_group = 'default'; |
4 | 4 | $query_builder = TRUE; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
3 | 3 | |
4 | 4 | /* |
5 | 5 | | ------------------------------------------------------------------------- |