MDL-49680 core_question: added ability to order questions by dates

Backport of MDL-25721.
This commit is contained in:
Mark Nelson
2015-05-18 19:06:09 -07:00
parent 18202cbed7
commit 8ee8195650
3 changed files with 17 additions and 2 deletions
+9
View File
@@ -783,6 +783,15 @@ table.quizreviewsummary td.cell {
font-weight: normal;
font-size: 0.8em;
}
#categoryquestions td.modifiername,
#categoryquestions td.creatorname {
line-height: 1em;
}
#categoryquestions td.modifiername span.date,
#categoryquestions td.creatorname span.date {
font-weight: normal;
font-size: 0.8em;
}
table#categoryquestions {
width: 100%;
overflow: hidden;
@@ -37,7 +37,8 @@ class creator_name_column extends column_base {
if (!empty($question->creatorfirstname) && !empty($question->creatorlastname)) {
$u = new \stdClass();
$u = username_load_fields_from_object($u, $question, 'creator');
echo fullname($u);
$date = userdate($question->timecreated, get_string('strftimedatetime', 'langconfig'));
echo fullname($u) . '<br>' . \html_writer::tag('span', $date, array('class' => 'date'));
}
}
@@ -51,6 +52,7 @@ class creator_name_column extends column_base {
foreach ($allnames as $allname) {
$requiredfields[] = 'uc.' . $allname . ' AS creator' . $allname;
}
$requiredfields[] = 'q.timecreated';
return $requiredfields;
}
@@ -58,6 +60,7 @@ class creator_name_column extends column_base {
return array(
'firstname' => array('field' => 'uc.firstname', 'title' => get_string('firstname')),
'lastname' => array('field' => 'uc.lastname', 'title' => get_string('lastname')),
'timecreated' => array('field' => 'q.timecreated', 'title' => get_string('date'))
);
}
}
@@ -36,7 +36,8 @@ class modifier_name_column extends column_base {
if (!empty($question->modifierfirstname) && !empty($question->modifierlastname)) {
$u = new \stdClass();
$u = username_load_fields_from_object($u, $question, 'modifier');
echo fullname($u);
$date = userdate($question->timemodified, get_string('strftimedatetime', 'langconfig'));
echo fullname($u) . '<br>' . \html_writer::tag('span', $date, array('class' => 'date'));
}
}
@@ -50,6 +51,7 @@ class modifier_name_column extends column_base {
foreach ($allnames as $allname) {
$requiredfields[] = 'um.' . $allname . ' AS modifier' . $allname;
}
$requiredfields[] = 'q.timemodified';
return $requiredfields;
}
@@ -57,6 +59,7 @@ class modifier_name_column extends column_base {
return array(
'firstname' => array('field' => 'um.firstname', 'title' => get_string('firstname')),
'lastname' => array('field' => 'um.lastname', 'title' => get_string('lastname')),
'timemodified' => array('field' => 'q.timemodified', 'title' => get_string('date'))
);
}
}