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

This commit is contained in:
Mark Nelson 2015-03-25 15:48:38 -07:00
parent 20d38830ae
commit 810920b15d
3 changed files with 17 additions and 2 deletions

View file

@ -804,6 +804,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;

View file

@ -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'))
);
}
}

View file

@ -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'))
);
}
}