8000 Task index · zino-coder/mvc-sample@ac352bc · GitHub
[go: up one dir, main page]

Skip to content

Commit ac352bc

Browse files
committed
Task index
1 parent 4836107 commit ac352bc

File tree

2,167 files changed

+420182
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,167 files changed

+420182
-14
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.vscode/launch.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Listen for Xdebug",
9+
"type": "php",
10+
"request": &q 97AE uot;launch",
11+
"port": 9003
12+
},
13+
{
14+
"name": "Launch currently open script",
15+
"type": "php",
16+
"request": "launch",
17+
"program": "${file}",
18+
"cwd": "${fileDirname}",
19+
"port": 0,
20+
"runtimeArgs": [
21+
"-dxdebug.start_with_request=yes"
22+
],
23+
"env": {
24+
"XDEBUG_MODE": "debug,develop",
25+
"XDEBUG_CONFIG": "client_port=${port}"
26+
}
27+
},
28+
{
29+
"name": "Launch Built-in web server",
30+
"type": "php",
31+
"request": "launch",
32+
"runtimeArgs": [
33+
"-dxdebug.mode=debug",
34+
"-dxdebug.start_with_request=yes",
35+
"-S",
36+
"localhost:0"
37+
],
38+
"program": "",
39+
"cwd": "${workspaceRoot}",
40+
"port": 9003,
41+
"serverReadyAction": {
42+
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
43+
"uriFormat": "http://localhost:%s",
44+
"action": "openExternally"
45+
}
46+
}
47+
]
48+
}

Controllers/TaskController.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ class TaskController extends Controller
99
function __construct() {
1010
$this->model = new Task();
1111
}
12-
public function index() {
13-
$tasks = 12;
14-
15-
$this->render('index', ['tasks' => $tasks, 'title' => 'Hello casc bajns']);
16-
}
1712

18-
public function create($a, $b, $c) {
19-
echo "$a, $b, $c";
13+
public function index() {
14+
$tasks = $this->model->getAllTask();
15+
16+
$this->render('index', ['tasks' => $tasks]);
2017
}
2118
}

Database/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Connection
44
{
55
private $conn;
66

7-
public function getBdd() {
7+
protected function getBdd() {
88
if (!$this->conn) {
99
$this->conn = new PDO('mysql:host=localhost;dbname=mvc', 'root', '12345678');
1010
$this->conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);

Models/Task.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,22 @@
22

33
class Task extends Connection
44
{
5-
5+
public function getAllTask() {
6+
$sql = '
7+
SELECT tasks.*,
8+
CASE
9+
WHEN ts.id = 1 THEN CONCAT(\'<span class="btn btn-outline-primary disabled">\', ts.name, \'</span>\')
10+
WHEN ts.id = 2 THEN CONCAT(\'<span class="btn btn-outline-primary disabled">\', ts.name, \'</span>\')
11+
WHEN ts.id = 3 THEN CONCAT(\'<span class="btn btn-outline-success disabled">\', ts.name, \'</span>\')
12+
WHEN ts.id = 4 THEN CONCAT(\'<span class="btn btn-outline-success disabled">\', ts.name, \'</span>\')
13+
WHEN ts.id = 5 THEN CONCAT(\'<span class="btn btn-outline-danger disabled">\', ts.name, \'</span>\')
14+
END
15+
AS statusName
16+
FROM tasks
17+
INNER JOIN task_status ts ON tasks.status = ts.id
18+
';
19+
$query = $this->getBdd()->query($sql);
20+
21+
return $query->fetchAll();
22+
}
623
}

public/.DS_Store

6 KB
Binary file not shown.

public/assets/.DS_Store

6 KB
Binary file not shown.

public/assets/lib/.DS_Store

6 KB
Binary file not shown.

public/assets/lib/bootstrap/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)
0