diff --git a/classes/table/interaction_attention_table.php b/classes/table/interaction_attention_table.php index 306fd381d0dfd186111cc880e55337baf1dbb571..ded5263de7e32c9b2c6108464ec9a30730fd2d6a 100644 --- a/classes/table/interaction_attention_table.php +++ b/classes/table/interaction_attention_table.php @@ -38,7 +38,8 @@ class interaction_attention_table extends interaction_table { global $PAGE; $fields = "p.id as processid, c.id as courseid, c.fullname as coursefullname, c.shortname as courseshortname, " . - "cc.name as category , s.id as stepinstanceid, s.instancename as stepinstancename, s.subpluginname as subpluginname"; + "c.startdate, cc.name as category , s.id as stepinstanceid, s.instancename as stepinstancename, ". + "s.subpluginname as subpluginname"; $from = '{tool_lifecycle_process} p join ' . '{course} c on p.courseid = c.id join ' . '{tool_lifecycle_step} s ' . @@ -51,7 +52,7 @@ class interaction_attention_table extends interaction_table { $where = 'p.courseid IN (' . $ids . ')'; } - $this->column_nosort = array('category', 'status', 'tools'); + $this->column_nosort = array('status', 'tools'); $this->set_sql($fields, $from, $where, []); $this->define_baseurl($PAGE->url); $this->init(); @@ -61,10 +62,10 @@ class interaction_attention_table extends interaction_table { * Initialises the columns of the table. */ public function init() { - $this->define_columns(['courseid', 'coursefullname', 'category', 'status', 'tools', 'date']); + $this->define_columns(['coursefullname', 'startdate', 'category', 'status', 'tools', 'date']); $this->define_headers([ - get_string('course'), get_string('coursename', 'tool_lifecycle'), + get_string('startdate'), get_string('category'), get_string('status', 'tool_lifecycle'), get_string('tools', 'tool_lifecycle'), diff --git a/classes/table/interaction_remaining_table.php b/classes/table/interaction_remaining_table.php index 24059e591fa611ac16676989702b3d7adce860d6..63569acf96de4a50f83e06c0b53e1ef616865469 100644 --- a/classes/table/interaction_remaining_table.php +++ b/classes/table/interaction_remaining_table.php @@ -45,7 +45,8 @@ class interaction_remaining_table extends interaction_table { // We need to do this, so that courses without any action have a smaller timestamp than courses with an recorded action. // Otherwise, it would mess up the sorting. $fields = "c.id as courseid, p.id AS processid, c.fullname AS coursefullname, c.shortname AS courseshortname, " . - "cc.name AS category, COALESCE(l.time, 0) AS lastmodified, l.userid, l.action, s.subpluginname, " . + "c.startdate, cc.name AS category, COALESCE(l.time, 0) AS lastmodified, l.userid, " . + "l.action, s.subpluginname, " . get_all_user_name_fields(true, 'u'); $from = '{course} c ' . 'LEFT JOIN (' . @@ -70,10 +71,9 @@ class interaction_remaining_table extends interaction_table { $where = 'c.id IN ('. $ids . ')'; } - $order = ' ORDER BY lastmodified DESC'; - - $this->sortable(false); - $this->set_sql($fields, $from, $where . $order, []); + $this->column_nosort = array('status', 'tools'); + $this->sortable(true, 'lastmodified', 'DESC'); + $this->set_sql($fields, $from, $where, []); $this->set_count_sql("SELECT COUNT(1) FROM {course} c WHERE $where"); $this->define_baseurl($PAGE->url); $this->init(); @@ -83,10 +83,10 @@ class interaction_remaining_table extends interaction_table { * Initialises the columns of the table. */ public function init() { - $this->define_columns(['courseid', 'coursefullname', 'category', 'status', 'lastmodified', 'tools']); + $this->define_columns(['coursefullname', 'startdate', 'category', 'status', 'lastmodified', 'tools']); $this->define_headers([ - get_string('course'), get_string('coursename', 'tool_lifecycle'), + get_string('startdate'), get_string('category'), get_string('status', 'tool_lifecycle'), get_string('lastaction', 'tool_lifecycle'), diff --git a/classes/table/interaction_table.php b/classes/table/interaction_table.php index a1239e5132b998b4bebb9a5fe104b617736f4915..ba207ea1e7fcce4be5a91b92145d728a8173cf37 100644 --- a/classes/table/interaction_table.php +++ b/classes/table/interaction_table.php @@ -46,22 +46,28 @@ abstract class interaction_table extends \table_sql { public abstract function init(); /** - * Render courseid column. + * Render coursefullname column. * @param $row * @return string course link */ - public function col_courseid($row) { - return \html_writer::link(course_get_url($row->courseid), $row->courseid); + public function col_coursefullname($row) { + $courselink = \html_writer::link(course_get_url($row->courseid), $row->coursefullname); + return $courselink . '<br><span class="secondary-info">' . $row->courseshortname . '</span>'; } /** - * Render coursefullname column. + * Render startdate column. * @param $row - * @return string course link + * @return string human readable date + * @throws \coding_exception */ - public function col_coursefullname($row) { - $courselink = \html_writer::link(course_get_url($row->courseid), $row->coursefullname); - return $courselink . '<br><span class="secondary-info">' . $row->courseshortname . '</span>'; + public function col_startdate($row) { + if ($row->startdate) { + $dateformat = get_string('strftimedate', 'langconfig'); + return userdate($row->startdate, $dateformat); + } else { + return "-"; + } } /**