|
71 | 71 | $eta = floor($duration / $progress + $crawlstart); |
72 | 72 |
|
73 | 73 | $robot = $DB->get_record('user', ['username' => $config->botusername]); |
74 | | -if (!$robot) { |
75 | | - $robot = new stdClass(); |
76 | | - $robot->id = get_string('botusermissing', 'tool_crawler'); |
77 | | - $robot->username = get_string('botusermissing', 'tool_crawler'); |
| 74 | +$botrowdata = array(get_string('botuser', 'tool_crawler')); |
| 75 | + |
| 76 | +// Do not display links to bot user if it doesn't exist |
| 77 | +if ($robot) { |
| 78 | + $botrowdata[] = implode(' | ', array( |
| 79 | + $robot->username, |
| 80 | + $boterror ? $boterror : get_string('good', 'tool_crawler'), |
| 81 | + html_writer::link( |
| 82 | + new moodle_url( |
| 83 | + '/user/editadvanced.php', |
| 84 | + ['id' => $robot->id, 'courseid' => 1] |
| 85 | + ), |
| 86 | + get_string('useraccount', 'tool_crawler') |
| 87 | + ), |
| 88 | + html_writer::link( |
| 89 | + new moodle_url( |
| 90 | + '/admin/roles/usersroles.php', |
| 91 | + ['userid' => $robot->id, 'courseid' => 1] |
| 92 | + ), |
| 93 | + get_string('roles') |
| 94 | + ), |
| 95 | + )); |
| 96 | +} else { |
| 97 | + $botrowdata[] = $boterror; |
78 | 98 | } |
79 | 99 |
|
80 | 100 | $table = new html_table(); |
81 | 101 | $table->head = [get_string('robotstatus', 'tool_crawler')]; |
82 | 102 | $table->headspan = [2, 1]; |
83 | 103 | $table->attributes['class'] = 'generaltable table table-hover w-auto'; |
84 | 104 | $table->data = [ |
85 | | - [ |
86 | | - get_string('botuser', 'tool_crawler'), |
87 | | - $robot->username |
88 | | - . ' | ' . ($boterror ? $boterror : get_string('good', 'tool_crawler')) |
89 | | - . ' | ' . html_writer::link(new moodle_url( |
90 | | - '/user/editadvanced.php', |
91 | | - ['id' => $robot->id, 'courseid' => 1] |
92 | | - ), get_string('useraccount', 'tool_crawler')) |
93 | | - . ' | ' . html_writer::link(new moodle_url( |
94 | | - '/admin/roles/usersroles.php', |
95 | | - ['userid' => $robot->id, 'courseid' => 1] |
96 | | - ), get_string('roles')), |
97 | | - ], |
| 105 | + $botrowdata, |
98 | 106 | [ |
99 | 107 | get_string('progress', 'tool_crawler'), |
100 | 108 |
|
|
0 commit comments