mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-52266 tool_lp: Cohorts can be removed from template synced cohorts
This commit is contained in:
parent
dd1df08248
commit
13ef20f65c
3 changed files with 11 additions and 2 deletions
|
@ -80,8 +80,11 @@ class template_cohorts_table extends table_sql {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function col_actions($row) {
|
protected function col_actions($row) {
|
||||||
// TODO MDL-52266 Add delete action icon.
|
global $OUTPUT;
|
||||||
return '';
|
$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')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -164,6 +164,7 @@ $string['selectuserstocreateplansfor'] = 'Select users to create plans for';
|
||||||
$string['shortname'] = 'Name';
|
$string['shortname'] = 'Name';
|
||||||
$string['state'] = 'State';
|
$string['state'] = 'State';
|
||||||
$string['status'] = 'Status';
|
$string['status'] = 'Status';
|
||||||
|
$string['stopsyncingcohort'] = 'Stop syncing cohort';
|
||||||
$string['taxonomies'] = 'Taxonomies';
|
$string['taxonomies'] = 'Taxonomies';
|
||||||
$string['taxonomy_add_behaviour'] = 'Add behaviour';
|
$string['taxonomy_add_behaviour'] = 'Add behaviour';
|
||||||
$string['taxonomy_add_competency'] = 'Add competency';
|
$string['taxonomy_add_competency'] = 'Add competency';
|
||||||
|
|
|
@ -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,
|
list($title, $subtitle) = \tool_lp\page_helper::setup_for_template($pagecontextid, $url, $template,
|
||||||
get_string('cohortssyncedtotemplate', 'tool_lp'));
|
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.
|
// Capture the form submission.
|
||||||
$form = new \tool_lp\form\template_cohorts($url->out(false), array('pagecontextid' => $pagecontextid));
|
$form = new \tool_lp\form\template_cohorts($url->out(false), array('pagecontextid' => $pagecontextid));
|
||||||
if (($data = $form->get_data()) && !empty($data->cohorts)) {
|
if (($data = $form->get_data()) && !empty($data->cohorts)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue