-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from tharindu-dm/developement
Developement
- Loading branch information
Showing
29 changed files
with
566 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
class BookListController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
//echo "this is the List Controller\n"; | ||
$list = new BookList; | ||
|
||
$this->view("BookList"); //calling the view function in /includes/Controller.php to view the Listpage | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
class BookList | ||
{ | ||
use Model; // Use the Model trait | ||
|
||
protected $table = 'BookList'; //when using the Model trait, this table name ise used | ||
|
||
public function getBookList($userID) | ||
{ | ||
|
||
return $this->where(['user' => $userID]); | ||
|
||
} | ||
public function getBookListCount($userID) | ||
{ | ||
$query = "SELECT | ||
COUNT(CASE WHEN [status] = 'reading' THEN 1 END) AS reading, | ||
COUNT(CASE WHEN [status] = 'planned' THEN 1 END) AS planned, | ||
COUNT(CASE WHEN [status] = 'dropped' THEN 1 END) AS dropped, | ||
COUNT(CASE WHEN [status] = 'hold' THEN 1 END) AS hold, | ||
COUNT(CASE WHEN [status] = 'completed' THEN 1 END) AS completed | ||
FROM [dbo].[BookList] | ||
WHERE [user] = $userID;"; | ||
return $this->query($query); | ||
} | ||
public function addToList($userID, $bookID, $AddStatus) | ||
{ //$chapter to be added to the list : edit the query to add the chapter to the list | ||
return $this->insert(['user' => $userID, 'book' => $bookID, 'status' => $AddStatus]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.