mirror of
https://github.com/Karaka-Management/oms-QA.git
synced 2026-01-28 15:28:42 +00:00
Merge branch 'develop' of https://github.com/Karaka-Management/oms-QA into develop
This commit is contained in:
commit
deebb55fd6
|
|
@ -154,7 +154,7 @@ final class Application
|
|||
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')
|
||||
&& $response->header->l11n->language !== $this->app->sessionManager->get('language')
|
||||
) {
|
||||
$response->header->l11n
|
||||
->loadFromLanguage(
|
||||
|
|
@ -165,7 +165,7 @@ final class Application
|
|||
$this->app->setResponseLanguage($request, $response, $this->config);
|
||||
}
|
||||
|
||||
if (!\in_array($response->getLanguage(), $this->config['language'])) {
|
||||
if (!\in_array($response->header->l11n->language, $this->config['language'])) {
|
||||
$response->header->l11n->setLanguage($this->app->l11nServer->getLanguage());
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ final class Application
|
|||
$head = new Head();
|
||||
|
||||
$pageView->setData('unitId', $this->app->unitId);
|
||||
$pageView->setData('head', $head);
|
||||
$pageView->data['head'] = $head;
|
||||
$response->set('Content', $pageView);
|
||||
|
||||
/* App only allows GET */
|
||||
|
|
@ -190,14 +190,14 @@ final class Application
|
|||
return;
|
||||
}
|
||||
|
||||
UriFactory::setQuery('/lang', $response->getLanguage());
|
||||
UriFactory::setQuery('/lang', $response->header->l11n->language);
|
||||
|
||||
$this->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/lang/' . $response->getLanguage() . '.lang.php'
|
||||
$response->header->l11n->language,
|
||||
__DIR__ . '/lang/' . $response->header->l11n->language . '.lang.php'
|
||||
);
|
||||
|
||||
$response->header->set('content-language', $response->getLanguage(), true);
|
||||
$response->header->set('content-language', $response->header->l11n->language, true);
|
||||
|
||||
/* Create html head */
|
||||
$this->initResponseHead($head, $request, $response);
|
||||
|
|
@ -255,8 +255,8 @@ final class Application
|
|||
$response->header->status = RequestStatusCode::R_406;
|
||||
$pageView->setTemplate('/Web/{APPNAME}/Error/406');
|
||||
$this->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
$response->header->l11n->language,
|
||||
__DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -275,8 +275,8 @@ final class Application
|
|||
$response->header->status = RequestStatusCode::R_503;
|
||||
$pageView->setTemplate('/Web/{APPNAME}/Error/503');
|
||||
$this->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
$response->header->l11n->language,
|
||||
__DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -334,8 +334,8 @@ final class Application
|
|||
$response->header->status = RequestStatusCode::R_403;
|
||||
$pageView->setTemplate('/Web/{APPNAME}/Error/403');
|
||||
$this->loadLanguageFromPath(
|
||||
$response->getLanguage(),
|
||||
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php'
|
||||
$response->header->l11n->language,
|
||||
__DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ declare(strict_types=1);
|
|||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var phpOMS\Model\Html\Head $head */
|
||||
$head = $this->getData('head');
|
||||
$head = $this->head;
|
||||
|
||||
/** @var array $dispatch */
|
||||
$dispatch = $this->getData('dispatch') ?? [];
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?= $this->printHtml($this->response->getLanguage()); ?>">
|
||||
<html lang="<?= $this->printHtml($this->response->header->l11n->language); ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ use phpOMS\Uri\UriFactory;
|
|||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\QA\Models\QAApp[] $apps
|
||||
*/
|
||||
$apps = $this->getData('apps') ?? [];
|
||||
$apps = $this->data['apps'] ?? [];
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ final class ApiController extends Controller
|
|||
public function apiQAQuestionCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateQAQuestionCreate($request))) {
|
||||
$response->set('qa_question_create', new FormValidation($val));
|
||||
$response->data['qa_question_create'] = new FormValidation($val);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
|
|
@ -172,7 +172,7 @@ final class ApiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($uploadedFiles = $request->getFiles())) {
|
||||
if (!empty($uploadedFiles = $request->files)) {
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
[],
|
||||
[],
|
||||
|
|
@ -238,7 +238,7 @@ final class ApiController extends Controller
|
|||
public function apiQAAnswerCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateQAAnswerCreate($request))) {
|
||||
$response->set('qa_answer_create', new FormValidation($val));
|
||||
$response->data['qa_answer_create'] = new FormValidation($val);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
|
|
@ -270,7 +270,7 @@ final class ApiController extends Controller
|
|||
$answer->setStatus((int) $request->getData('status'));
|
||||
$answer->createdBy = new Profile(new NullAccount($request->header->account));
|
||||
|
||||
if (!empty($uploadedFiles = $request->getFiles())) {
|
||||
if (!empty($uploadedFiles = $request->files)) {
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
[],
|
||||
[],
|
||||
|
|
@ -393,7 +393,7 @@ final class ApiController extends Controller
|
|||
public function apiQAAppCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateQAAppCreate($request))) {
|
||||
$response->set('qa_app_create', new FormValidation($val));
|
||||
$response->data['qa_app_create'] = new FormValidation($val);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
|
|
@ -458,7 +458,7 @@ final class ApiController extends Controller
|
|||
public function apiChangeQAQuestionVote(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateQuestionVote($request))) {
|
||||
$response->set('qa_question_vote', new FormValidation($val));
|
||||
$response->data['qa_question_vote'] = new FormValidation($val);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
|
|
@ -533,7 +533,7 @@ final class ApiController extends Controller
|
|||
public function apiChangeQAAnswerVote(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAnswerVote($request))) {
|
||||
$response->set('qa_answer_vote', new FormValidation($val));
|
||||
$response->data['qa_answer_vote'] = new FormValidation($val);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ final class BackendController extends Controller
|
|||
*/
|
||||
public function setUpBackend(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
$head = $response->get('Content')->getData('head');
|
||||
$head = $response->get('Content')->head;
|
||||
$head->addAsset(AssetType::CSS, '/Modules/QA/Theme/Backend/styles.css?v=1.0.0');
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-dashboard');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion[] $list */
|
||||
$list = QAQuestionMapper::getAll()
|
||||
|
|
@ -80,15 +80,15 @@ final class BackendController extends Controller
|
|||
->with('answers/votes')
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->where('tags/title/language', $response->getLanguage())
|
||||
->where('language', $response->getLanguage())
|
||||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->where('language', $response->header->l11n->language)
|
||||
->limit(50)->execute();
|
||||
|
||||
$view->setData('questions', $list);
|
||||
$view->data['questions'] = $list;
|
||||
|
||||
/** @var \Modules\QA\Models\QAApp[] $apps */
|
||||
$apps = QAAppMapper::getAll()->execute();
|
||||
$view->setData('apps', $apps);
|
||||
$view->data['apps'] = $apps;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-question');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion $question */
|
||||
$question = QAQuestionMapper::get()
|
||||
|
|
@ -124,13 +124,13 @@ final class BackendController extends Controller
|
|||
->with('tags/title')
|
||||
->with('media')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('tags/title/language', $response->getLanguage())
|
||||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->addData('question', $question);
|
||||
$view->data['question'] = $question;
|
||||
|
||||
$scores = QAHelperMapper::getAccountScore($question->getAccounts());
|
||||
$view->addData('scores', $scores);
|
||||
$view->data['scores'] = $scores;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -151,11 +151,11 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-question-create');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion $question */
|
||||
$question = QAQuestionMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$view->addData('question', $question);
|
||||
$view->data['question'] = $question;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -174,17 +174,17 @@ final class BackendController extends Controller
|
|||
public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response);
|
||||
|
||||
$id = $request->getDataString('id') ?? '';
|
||||
|
||||
/** @var \Model\Setting[] $settings */
|
||||
$settings = SettingMapper::getAll()->where('module', $id)->execute();
|
||||
$view->setData('settings', $settings);
|
||||
$view->data['settings'] = $settings;
|
||||
|
||||
/** @var \Modules\QA\Models\QAApp[] $apps */
|
||||
$apps = QAAppMapper::getAll()->execute();
|
||||
$view->setData('apps', $apps);
|
||||
$view->data['apps'] = $apps;
|
||||
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');
|
||||
|
||||
|
|
@ -206,9 +206,9 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-app');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response);
|
||||
|
||||
$view->addData('app', QAAppMapper::get()->where('id', (int) $request->getData('app'))->execute());
|
||||
$view->data['app'] = QAAppMapper::get()->where('id', (int) $request->getData('app'))->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ declare(strict_types=1);
|
|||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \Modules\QA\Modles\QAQuestion[] $questions */
|
||||
$questions = $this->getData('questions');
|
||||
$questions = $this->data['questions'];
|
||||
|
||||
/** @var \Modules\QA\Modles\QAApp[] $apps */
|
||||
$apps = $this->getData('apps');
|
||||
$apps = $this->data['apps'];
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 box">
|
||||
|
|
|
|||
|
|
@ -15,15 +15,15 @@ declare(strict_types=1);
|
|||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion $question */
|
||||
$question = $this->getData('question');
|
||||
$question = $this->data['question'];
|
||||
|
||||
/** @var \Modules\QA\Models\QAAnswer[] $answers */
|
||||
$answers = $question->getAnswersByScore();
|
||||
|
||||
/** @var array $scores */
|
||||
$scores = $this->getData('scores');
|
||||
$scores = $this->data['scores'];
|
||||
|
||||
echo $this->getData('nav')->render();
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
|
||||
<div class="row qa">
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$tag = $this->getData('tag');
|
||||
$tag = $this->data['tag'];
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->getData('nav')->render();
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$tags = $this->getData('tags');
|
||||
$tags = $this->data['tags'];
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->getData('nav')->render();
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user