Skip to content
Snippets Groups Projects
Commit 3824d220 authored by André Noack's avatar André Noack
Browse files

Resolve #3646 "Fragebögen: Standardsortierung nach Titel ist nicht hilfreich"

Closes #3646

Merge request studip/studip!2529
parent b8c9b120
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ class QuestionnaireController extends AuthenticatedController ...@@ -34,7 +34,7 @@ class QuestionnaireController extends AuthenticatedController
if (!$GLOBALS['perm']->have_perm('autor')) { if (!$GLOBALS['perm']->have_perm('autor')) {
throw new AccessDeniedException('Only for logged in users.'); throw new AccessDeniedException('Only for logged in users.');
} }
$this->questionnaires = Questionnaire::findBySQL("user_id = ? ORDER BY title ASC", [$GLOBALS['user']->id]); $this->questionnaires = Questionnaire::findBySQL("user_id = ? ORDER BY chdate DESC", [$GLOBALS['user']->id]);
foreach ($this->questionnaires as $questionnaire) { foreach ($this->questionnaires as $questionnaire) {
if (!$questionnaire['visible'] && $questionnaire->isRunning()) { if (!$questionnaire['visible'] && $questionnaire->isRunning()) {
$questionnaire->start(); $questionnaire->start();
...@@ -55,7 +55,7 @@ class QuestionnaireController extends AuthenticatedController ...@@ -55,7 +55,7 @@ class QuestionnaireController extends AuthenticatedController
Navigation::activateItem("/course/admin/questionnaires"); Navigation::activateItem("/course/admin/questionnaires");
$this->statusgruppen = Statusgruppen::findByRange_id($this->range_id); $this->statusgruppen = Statusgruppen::findByRange_id($this->range_id);
$this->questionnaires = Questionnaire::findBySQL( $this->questionnaires = Questionnaire::findBySQL(
"INNER JOIN questionnaire_assignments USING (questionnaire_id) WHERE (questionnaire_assignments.range_id = ? AND questionnaire_assignments.range_type = ?) OR (questionnaire_assignments.range_id IN (?) AND questionnaire_assignments.range_type = 'statusgruppe') ORDER BY questionnaires.title ASC", "INNER JOIN questionnaire_assignments USING (questionnaire_id) WHERE (questionnaire_assignments.range_id = ? AND questionnaire_assignments.range_type = ?) OR (questionnaire_assignments.range_id IN (?) AND questionnaire_assignments.range_type = 'statusgruppe') ORDER BY questionnaires.chdate DESC",
[$this->range_id, $this->range_type, array_map(function ($g) { return $g->getId(); }, $this->statusgruppen)] [$this->range_id, $this->range_type, array_map(function ($g) { return $g->getId(); }, $this->statusgruppen)]
); );
foreach ($this->questionnaires as $questionnaire) { foreach ($this->questionnaires as $questionnaire) {
......
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
<td> <td>
<?= htmlReady($countedAnswers ?: '0') ?> <?= htmlReady($countedAnswers ?: '0') ?>
</td> </td>
<td data-text="<?= (int) $questionnaire['chdate'] ?>">
<?= date('d.m.Y H:i', $questionnaire['chdate']) ?>
</td>
<td class="actions"> <td class="actions">
<? if ($questionnaire->isRunning() && $countedAnswers) : ?> <? if ($questionnaire->isRunning() && $countedAnswers) : ?>
<?= Icon::create('edit', Icon::ROLE_INACTIVE)->asImg(['title' => _('Der Fragebogen wurde gestartet und kann nicht mehr bearbeitet werden.')]) ?> <?= Icon::create('edit', Icon::ROLE_INACTIVE)->asImg(['title' => _('Der Fragebogen wurde gestartet und kann nicht mehr bearbeitet werden.')]) ?>
......
<form action="<?= $controller->link_for("questionnaire/bulkdelete", compact('range_type', 'range_id')) ?>" <form action="<?= $controller->link_for("questionnaire/bulkdelete", compact('range_type', 'range_id')) ?>"
method="post"> method="post">
<?= CSRFProtection::tokenTag() ?> <?= CSRFProtection::tokenTag() ?>
<table class="default sortable-table" data-sortlist="[[1, 0]]" id="questionnaire_overview"> <table class="default sortable-table" data-sortlist="[[6, 1]]" id="questionnaire_overview">
<thead> <thead>
<tr> <tr>
<th width="20"><input type="checkbox" data-proxyfor="#questionnaire_overview > tbody input[type=checkbox]"></th> <th width="20"><input type="checkbox" data-proxyfor="#questionnaire_overview > tbody input[type=checkbox]"></th>
<th data-sort="text"><?= _('Fragebogen') ?></th> <th data-sort="text"><?= _('Fragebogen') ?></th>
<th data-sort="digit"><?= _('Startet') ?></th> <th data-sort="digit"><?= _('Start') ?></th>
<th data-sort="digit"><?= _('Endet') ?></th> <th data-sort="digit"><?= _('Ende') ?></th>
<th data-sort="text"><?= _('Eingebunden') ?></th> <th data-sort="text"><?= _('Eingebunden') ?></th>
<th data-sort="digit"><?= _('Teilnehmende') ?></th> <th data-sort="digit"><?= _('Teilnehmende') ?></th>
<th data-sort="digit"><?= _('Datum') ?></th>
<th class="actions"><?= _('Aktionen') ?></th> <th class="actions"><?= _('Aktionen') ?></th>
</tr> </tr>
</thead> </thead>
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
<? endforeach ?> <? endforeach ?>
<? else : ?> <? else : ?>
<tr class="noquestionnaires"> <tr class="noquestionnaires">
<td colspan="7" style="text-align: center"> <td colspan="8" style="text-align: center">
<?= _('Sie haben noch keine Fragebögen erstellt.') ?> <?= _('Sie haben noch keine Fragebögen erstellt.') ?>
</td> </td>
</tr> </tr>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="7"> <td colspan="8">
<?= \Studip\Button::create(_("Löschen"), "bulkdelete", ['data-confirm' => _("Wirklich löschen?")]) ?> <?= \Studip\Button::create(_("Löschen"), "bulkdelete", ['data-confirm' => _("Wirklich löschen?")]) ?>
</td> </td>
</tr> </tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment