@@ -47,7 +47,7 @@ |
||
47 | 47 | "submit" => [ |
48 | 48 | "type" => "submit", |
49 | 49 | "value" => "Create user", |
50 | - "callback" => [$this, "callbackSubmit"] |
|
50 | + "callback" => [ $this, "callbackSubmit" ] |
|
51 | 51 | ], |
52 | 52 | ] |
53 | 53 | ); |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | [ |
27 | 27 | "id" => [ |
28 | 28 | "type" => "text", |
29 | - "validation" => ["not_empty"], |
|
29 | + "validation" => [ "not_empty" ], |
|
30 | 30 | "readonly" => "readonly", |
31 | 31 | "value" => $user->id, |
32 | 32 | ], |
33 | 33 | |
34 | 34 | "username" => [ |
35 | 35 | "type" => "text", |
36 | - "validation" => ["not_empty"], |
|
36 | + "validation" => [ "not_empty" ], |
|
37 | 37 | "value" => $user->username, |
38 | 38 | ], |
39 | 39 | |
40 | 40 | "password" => [ |
41 | 41 | "type" => "password", |
42 | - "validation" => ["not_empty"], |
|
42 | + "validation" => [ "not_empty" ], |
|
43 | 43 | ], |
44 | 44 | |
45 | 45 | "password-again" => [ |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | "email" => [ |
53 | 53 | "type" => "email", |
54 | - "validation" => ["not_empty"], |
|
54 | + "validation" => [ "not_empty" ], |
|
55 | 55 | "value" => $user->email, |
56 | 56 | ], |
57 | 57 | |
58 | 58 | "submit" => [ |
59 | 59 | "type" => "submit", |
60 | 60 | "value" => "Create user", |
61 | - "callback" => [$this, "callbackSubmit"] |
|
61 | + "callback" => [ $this, "callbackSubmit" ] |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | $user->find("id", $this->form->value("id")); |
106 | - $user->username = $username; |
|
106 | + $user->username = $username; |
|
107 | 107 | $user->password = $this->form->value("password"); |
108 | 108 | $user->email = $email; |
109 | 109 | $user->save(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | "submit" => [ |
40 | 40 | "type" => "submit", |
41 | 41 | "value" => "Login", |
42 | - "callback" => [$this, "callbackSubmit"] |
|
42 | + "callback" => [ $this, "callbackSubmit" ] |
|
43 | 43 | ], |
44 | 44 | ] |
45 | 45 | ); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | public function callbackSubmit() |
57 | 57 | { |
58 | 58 | // Get values from the submitted form |
59 | - $username = $this->form->value("username"); |
|
60 | - $password = $this->form->value("password"); |
|
59 | + $username = $this->form->value("username"); |
|
60 | + $password = $this->form->value("password"); |
|
61 | 61 | |
62 | 62 | // Try to login |
63 | 63 | // $db = $this->di->get("dbqb"); |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class Answer extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "Svar"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $questionId; |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class Comment extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "Comment"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $questionId; |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class AnswerComment extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "AnswerComment"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $answerId; |
@@ -27,40 +27,52 @@ |
||
27 | 27 | <h3>Questions you have asked: </h3> |
28 | 28 | <?php if (empty($posts)) : ?> |
29 | 29 | <p>You have not made any posts yet.</p> |
30 | -<?php else : ?> |
|
30 | +<?php else { |
|
31 | + : ?> |
|
31 | 32 | <?php foreach ($posts as $post) : ?> |
32 | 33 | <p> |
33 | 34 | <a href="forum/question/<?= $post->id ?>"><?= $post->title ?></a> |
34 | 35 | </p> |
35 | - <?php endforeach; ?> |
|
36 | + <?php endforeach; |
|
37 | +} |
|
38 | +?> |
|
36 | 39 | <?php endif; ?> |
37 | 40 | <h3>Answers you have posted: </h3> |
38 | 41 | <?php if (empty($answers)) : ?> |
39 | 42 | <p>You have not posted any answers yet.</p> |
40 | -<?php else : ?> |
|
43 | +<?php else { |
|
44 | + : ?> |
|
41 | 45 | <?php foreach ($answers as $answer) : ?> |
42 | 46 | <p> |
43 | 47 | <a href="forum/question/<?= $answer->questionId ?>"><?= $answer->content ?></a> |
44 | 48 | </p> |
45 | - <?php endforeach; ?> |
|
49 | + <?php endforeach; |
|
50 | +} |
|
51 | +?> |
|
46 | 52 | <?php endif; ?> |
47 | 53 | <h3>Comments you have posted: </h3> |
48 | 54 | <?php if (empty($comments)) : ?> |
49 | 55 | <p>You have not posted any comments yet.</p> |
50 | -<?php else : ?> |
|
56 | +<?php else { |
|
57 | + : ?> |
|
51 | 58 | <?php foreach ($comments as $comment) : ?> |
52 | 59 | <p> |
53 | 60 | <a href="forum/question/<?= $answer->questionId ?>"><?= $comment->content ?></a> |
54 | 61 | </p> |
55 | - <?php endforeach; ?> |
|
62 | + <?php endforeach; |
|
63 | +} |
|
64 | +?> |
|
56 | 65 | <?php endif; ?> |
57 | 66 | <h3>Comments on answers you have posted: </h3> |
58 | 67 | <?php if (empty($anscomments)) : ?> |
59 | 68 | <p>You have not made any comments on answers yet.</p> |
60 | -<?php else : ?> |
|
69 | +<?php else { |
|
70 | + : ?> |
|
61 | 71 | <?php foreach ($anscomments as $anscomment) : ?> |
62 | 72 | <p> |
63 | 73 | <a href="forum/question/<?= $answer->questionId ?>"><?= $anscomment->content ?></a> |
64 | 74 | </p> |
65 | - <?php endforeach; ?> |
|
75 | + <?php endforeach; |
|
76 | +} |
|
77 | +?> |
|
66 | 78 | <?php endif; ?> |
@@ -22,33 +22,42 @@ |
||
22 | 22 | <h3>Questions asked: </h3> |
23 | 23 | <?php if (empty($questions)) : ?> |
24 | 24 | <p>This user hasen't posted any questions yet.</p> |
25 | -<?php else : ?> |
|
25 | +<?php else { |
|
26 | + : ?> |
|
26 | 27 | <?php foreach ($questions as $question) : ?> |
27 | 28 | <p> |
28 | 29 | <a href="../../forum/question/<?= $question->id ?>"><?= $question->title ?></a> |
29 | 30 | </p> |
30 | - <?php endforeach; ?> |
|
31 | + <?php endforeach; |
|
32 | +} |
|
33 | +?> |
|
31 | 34 | <?php endif; ?> |
32 | 35 | <h3>Answers posted: </h3> |
33 | 36 | <?php if (empty($answers)) : ?> |
34 | 37 | <p>This user hasn't posted any answers yet.</p> |
35 | -<?php else : ?> |
|
38 | +<?php else { |
|
39 | + : ?> |
|
36 | 40 | <?php foreach ($answers as $answer) : ?> |
37 | 41 | <p> |
38 | 42 | <a href="../../forum/question/<?= $answer->questionId ?>"><?= $answer->content ?></a> |
39 | 43 | </p> |
40 | - <?php endforeach; ?> |
|
44 | + <?php endforeach; |
|
45 | +} |
|
46 | +?> |
|
41 | 47 | <?php endif; ?> |
42 | 48 | <?php if (empty($comments)) : ?> |
43 | 49 | <h3>Comments this user have posted: </h3> |
44 | 50 | <p>This user have not posted any comments yet.</p> |
45 | -<?php else : ?> |
|
51 | +<?php else { |
|
52 | + : ?> |
|
46 | 53 | <h3>Comments you have posted: </h3> |
47 | 54 | <?php foreach ($comments as $comment) : ?> |
48 | 55 | <p> |
49 | 56 | <a href="../../forum/question/<?= $answer->questionId ?>"><?= $comment->content ?></a> |
50 | 57 | </p> |
51 | - <?php endforeach; ?> |
|
58 | + <?php endforeach; |
|
59 | +} |
|
60 | +?> |
|
52 | 61 | <?php endif; ?> |
53 | 62 | <h3>Comments on answers you have posted: </h3> |
54 | 63 | <?php foreach ($anscomments as $anscomment) : ?> |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $items = isset($items) ? $items : null; |
12 | 12 | $session = $this->di->get("session"); |
13 | 13 | $filter = $this->di->get("textfilter"); |
14 | -$tags = []; |
|
14 | +$tags = [ ]; |
|
15 | 15 | var_dump($res); |
16 | 16 | // var_dump($session); |
17 | 17 | ?> |
@@ -20,9 +20,12 @@ |
||
20 | 20 | <p> |
21 | 21 | <a href="forum/create">Create a new post</a> |
22 | 22 | </p> |
23 | -<?php else : ?> |
|
23 | +<?php else { |
|
24 | + : ?> |
|
24 | 25 | <p>You have to be logged in to create a new post</p> |
25 | -<?php endif; ?> |
|
26 | +<?php endif; |
|
27 | +} |
|
28 | +?> |
|
26 | 29 | <?php if (!$items) : ?> |
27 | 30 | <p>There are no posts to show!</p> |
28 | 31 | <?php endif; ?> |