diff --git a/Admin/Install/Application/QA/Application.php b/Admin/Install/Application/QA/Application.php
index b54b56d..6982bf6 100755
--- a/Admin/Install/Application/QA/Application.php
+++ b/Admin/Install/Application/QA/Application.php
@@ -151,7 +151,7 @@ final class Application
$account = $this->loadAccount($request);
- if (!($account instanceof NullAccount)) {
+ if ($account->id > 0) {
$response->header->l11n = $account->l11n;
} elseif ($this->app->sessionManager->get('language') !== null
&& $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language')
@@ -161,6 +161,8 @@ final class Application
$this->app->sessionManager->get('language'),
$this->app->sessionManager->get('country') ?? '*'
);
+ } else {
+ $this->app->setResponseLanguage($request, $response, $this->config);
}
if (!\in_array($response->getLanguage(), $this->config['language'])) {
diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php
index e6143ac..7e53c25 100755
--- a/Admin/Settings/Theme/Backend/settings.tpl.php
+++ b/Admin/Settings/Theme/Backend/settings.tpl.php
@@ -59,7 +59,7 @@ echo $this->getData('nav')->render(); ?>
foreach ($apps as $key => $app) : ++$count;
$url = UriFactory::build('{/base}/admin/module/settings?id=QA&app=' . $app->id); ?>
- | = $app->getId(); ?>
+ | = $app->id; ?>
| = $this->printHtml($app->name); ?>
diff --git a/Controller/ApiController.php b/Controller/ApiController.php
index 480fc46..fd43954 100755
--- a/Controller/ApiController.php
+++ b/Controller/ApiController.php
@@ -344,11 +344,11 @@ final class ApiController extends Controller
/** @var \Modules\QA\Models\QAAnswer $oldAccepted */
$oldAccepted = QAAnswerMapper::get()
- ->where('question', $old->question->getId())
+ ->where('question', $old->question->id)
->where('isAccepted', true)
->execute();
- if ($old->getId() !== $oldAccepted->getId()) {
+ if ($old->id !== $oldAccepted->id) {
$oldUnaccepted = clone $oldAccepted;
$oldUnaccepted->isAccepted = !$oldUnaccepted->isAccepted;
@@ -474,7 +474,7 @@ final class ApiController extends Controller
->where('createdBy', $request->header->account)
->execute();
- if ($questionVote === false || $questionVote instanceof NullQAQuestionVote || $questionVote === null) {
+ if ($questionVote->id === 0) {
/** @var \Modules\QA\Models\QAQuestion $question */
$question = QAQuestionMapper::get()->where('id', (int) $request->getData('id'))->execute();
@@ -482,7 +482,7 @@ final class ApiController extends Controller
$new->score = (int) $request->getData('type');
$new->question = (int) $request->getData('id');
$new->createdBy = new NullAccount($request->header->account);
- $new->createdFor = $question->createdBy->getId();
+ $new->createdFor = $question->createdBy->id;
$this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
@@ -549,7 +549,7 @@ final class ApiController extends Controller
->where('createdBy', $request->header->account)
->execute();
- if ($answerVote === false || $answerVote instanceof NullQAAnswerVote || $answerVote === null) {
+ if ($answerVote->id === 0) {
/** @var \Modules\QA\Models\QAAnswer $answer */
$answer = QAAnswerMapper::get()->where('id', (int) $request->getData('id'))->execute();
@@ -557,7 +557,7 @@ final class ApiController extends Controller
$new->score = (int) $request->getData('type');
$new->answer = (int) $request->getData('id');
$new->createdBy = new NullAccount($request->header->account);
- $new->createdFor = $answer->createdBy->getId();
+ $new->createdFor = $answer->createdBy->id;
$this->createModel($request->header->account, $new, QAAnswerVoteMapper::class, 'qa_answer_vote', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
diff --git a/Models/QAAnswer.php b/Models/QAAnswer.php
index 81df700..ae28a33 100755
--- a/Models/QAAnswer.php
+++ b/Models/QAAnswer.php
@@ -34,7 +34,7 @@ class QAAnswer implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Status.
@@ -42,7 +42,7 @@ class QAAnswer implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- private int $status = QAAnswerStatus::ACTIVE;
+ public int $status = QAAnswerStatus::ACTIVE;
/**
* Answer.
@@ -187,7 +187,7 @@ class QAAnswer implements \JsonSerializable
public function getAccountVoteScore(int $account) : int
{
foreach ($this->votes as $vote) {
- if ($vote->createdBy->getId() === $account) {
+ if ($vote->createdBy->id === $account) {
return $vote->score;
}
}
diff --git a/Models/QAAnswerVote.php b/Models/QAAnswerVote.php
index b24d90e..8b00583 100755
--- a/Models/QAAnswerVote.php
+++ b/Models/QAAnswerVote.php
@@ -33,7 +33,7 @@ class QAAnswerVote
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Account.
diff --git a/Models/QAApp.php b/Models/QAApp.php
index 99e8f25..6f6eda0 100755
--- a/Models/QAApp.php
+++ b/Models/QAApp.php
@@ -30,7 +30,7 @@ class QAApp implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Application name.
diff --git a/Models/QAQuestion.php b/Models/QAQuestion.php
index 5f5ec17..10de8e4 100755
--- a/Models/QAQuestion.php
+++ b/Models/QAQuestion.php
@@ -37,7 +37,7 @@ class QAQuestion implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Title.
@@ -53,7 +53,7 @@ class QAQuestion implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- private int $status = QAQuestionStatus::ACTIVE;
+ public int $status = QAQuestionStatus::ACTIVE;
/**
* Question.
@@ -77,7 +77,7 @@ class QAQuestion implements \JsonSerializable
* @var string
* @since 1.0.0
*/
- private string $language = ISO639x1Enum::_EN;
+ public string $language = ISO639x1Enum::_EN;
/**
* Created by.
@@ -166,10 +166,10 @@ class QAQuestion implements \JsonSerializable
public function getAccounts() : array
{
$accounts = [];
- $accounts[] = $this->createdBy->account->getId();
+ $accounts[] = $this->createdBy->account->id;
foreach ($this->answers as $answer) {
- $accounts[] = $answer->createdBy->account->getId();
+ $accounts[] = $answer->createdBy->account->id;
}
return \array_unique($accounts);
@@ -378,7 +378,7 @@ class QAQuestion implements \JsonSerializable
public function getAccountVoteScore(int $account) : int
{
foreach ($this->votes as $vote) {
- if ($vote->createdBy->getId() === $account) {
+ if ($vote->createdBy->id === $account) {
return $vote->score;
}
}
diff --git a/Models/QAQuestionVote.php b/Models/QAQuestionVote.php
index 398d693..6f47244 100755
--- a/Models/QAQuestionVote.php
+++ b/Models/QAQuestionVote.php
@@ -33,7 +33,7 @@ class QAQuestionVote
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Account.
diff --git a/Theme/Backend/qa-dashboard.tpl.php b/Theme/Backend/qa-dashboard.tpl.php
index 6cd5900..3505cf7 100755
--- a/Theme/Backend/qa-dashboard.tpl.php
+++ b/Theme/Backend/qa-dashboard.tpl.php
@@ -28,7 +28,7 @@ echo $this->getData('nav')->render(); ?>
@@ -51,7 +51,7 @@ echo $this->getData('nav')->render(); ?>
@@ -62,9 +62,9 @@ echo $this->getData('nav')->render(); ?>
-
+
= $this->printHtml($question->createdBy->account->name2); ?> = $this->printHtml($question->createdBy->account->name1); ?>
- createdBy->image !== null && !($question->createdBy->image instanceof NullMedia)) : ?>
+ createdBy->image->id > 0) : ?>
diff --git a/Theme/Backend/qa-question.tpl.php b/Theme/Backend/qa-question.tpl.php
index 625f448..f891a65 100755
--- a/Theme/Backend/qa-question.tpl.php
+++ b/Theme/Backend/qa-question.tpl.php
@@ -37,7 +37,7 @@ echo $this->getData('nav')->render();
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
- {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/question/vote?id=' . $question->getId());?>&type=1", "method": "PUT", "request_type": "json"}
+ {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/question/vote?id=' . $question->id);?>&type=1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@@ -49,7 +49,7 @@ echo $this->getData('nav')->render();
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
- {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/question/vote?id=' . $question->getId());?>&type=-1", "method": "PUT", "request_type": "json"}
+ {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/question/vote?id=' . $question->id);?>&type=-1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@@ -75,16 +75,16 @@ echo $this->getData('nav')->render();
getMedia(); foreach ($files as $file) : ?>
- = $file->name; ?>
+ = $file->name; ?>
-
+
= $this->printHtml($question->createdBy->account->name2); ?> = $this->printHtml($question->createdBy->account->name1); ?>
- Score: = $scores[$question->createdBy->account->getId()] ?? 0; ?>
+ Score: = $scores[$question->createdBy->account->id] ?? 0; ?>
- createdBy->image !== null && !($question->createdBy->image instanceof NullMedia)) : ?>
+ createdBy->image->id > 0) : ?>
@@ -101,11 +101,11 @@ echo $this->getData('nav')->render();
- getId());?>&type=1", "method": "PUT", "request_type": "json"}
+ {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->id);?>&type=1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@@ -113,11 +113,11 @@ echo $this->getData('nav')->render();
= $answer->getVoteScore(); ?>
Score
- getId());?>&type=-1", "method": "PUT", "request_type": "json"}
+ {"key": 2, "type": "message.request", "uri": "= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->id);?>&type=-1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@@ -125,11 +125,11 @@ echo $this->getData('nav')->render();
|