diff --git a/admin/tool/lp/classes/output/template_cohorts_table.php b/admin/tool/lp/classes/output/template_cohorts_table.php index d9d468e37c6..feee8d46005 100644 --- a/admin/tool/lp/classes/output/template_cohorts_table.php +++ b/admin/tool/lp/classes/output/template_cohorts_table.php @@ -80,8 +80,11 @@ class template_cohorts_table extends table_sql { * @return string */ protected function col_actions($row) { - // TODO MDL-52266 Add delete action icon. - return ''; + global $OUTPUT; + $action = new \confirm_action(get_string('areyousure')); + $url = new moodle_url($this->baseurl); + $url->params(array('removecohort' => $row->id, 'sesskey' => sesskey())); + return $OUTPUT->action_link($url, '', $action, null, new \pix_icon('t/delete', get_string('stopsyncingcohort', 'tool_lp'))); } /** diff --git a/admin/tool/lp/lang/en/tool_lp.php b/admin/tool/lp/lang/en/tool_lp.php index af774e1e337..7b70dec0a15 100644 --- a/admin/tool/lp/lang/en/tool_lp.php +++ b/admin/tool/lp/lang/en/tool_lp.php @@ -164,6 +164,7 @@ $string['selectuserstocreateplansfor'] = 'Select users to create plans for'; $string['shortname'] = 'Name'; $string['state'] = 'State'; $string['status'] = 'Status'; +$string['stopsyncingcohort'] = 'Stop syncing cohort'; $string['taxonomies'] = 'Taxonomies'; $string['taxonomy_add_behaviour'] = 'Add behaviour'; $string['taxonomy_add_competency'] = 'Add competency'; diff --git a/admin/tool/lp/template_cohorts.php b/admin/tool/lp/template_cohorts.php index adc0373c3e6..17b2866f481 100644 --- a/admin/tool/lp/template_cohorts.php +++ b/admin/tool/lp/template_cohorts.php @@ -41,6 +41,11 @@ $url = new moodle_url('/admin/tool/lp/template_cohorts.php', array( list($title, $subtitle) = \tool_lp\page_helper::setup_for_template($pagecontextid, $url, $template, get_string('cohortssyncedtotemplate', 'tool_lp')); +// Remove cohort. +if (($removecohort = optional_param('removecohort', false, PARAM_INT)) !== false && confirm_sesskey()) { + \tool_lp\api::delete_template_cohort($template, $removecohort); +} + // Capture the form submission. $form = new \tool_lp\form\template_cohorts($url->out(false), array('pagecontextid' => $pagecontextid)); if (($data = $form->get_data()) && !empty($data->cohorts)) {