/** * @see plugintype_interface::get_settings_url() */ public function get_settings_url() { $globalstates = self::get_global_states(); $legacyname = $globalstates[$this->name]->legacyname; if (filter_has_global_settings($legacyname)) { return new moodle_url('/admin/settings.php', array('section' => 'filtersetting' . str_replace('/', '', $legacyname))); } else { return null; } }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $select = html_select::make_popup_form(action_url($filter, 'setstate'), 'newstate', $activechoices, 'active' . basename($filter), $filterinfo->active); $select->nothinglabel = false; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Re-order $updown = ''; $spacer = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" class="iconsmall" alt="" /> '; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up')); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down')); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $select = html_select::make_popup_form(action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, 'applyto' . basename($filter), $applytostrings); $select->nothinglabel = false; $select->disabled = $filterinfo->active == TEXTFILTER_DISABLED; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete if (substr($filter, 0, 4) != 'mod/') { $row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; } else { $row[] = ''; } return $row; }
/** * Construct table record. * * @param \core\plugininfo\filter $plugininfo * @param stdClass $state * @param bool $isfirstrow * @param bool $islastactive * @param bool $applytostrings * @return array data */ function get_table_row(\core\plugininfo\filter $plugininfo, $state, $isfirstrow, $islastactive, $applytostrings) { global $OUTPUT; $row = array(); $filter = $state->filter; $active = $plugininfo->is_installed_and_upgraded(); static $activechoices; static $applytochoices; if (!isset($activechoices)) { $activechoices = array(TEXTFILTER_DISABLED => get_string('disabled', 'core_filters'), TEXTFILTER_OFF => get_string('offbutavailable', 'core_filters'), TEXTFILTER_ON => get_string('on', 'core_filters')); $applytochoices = array(0 => get_string('content', 'core_filters'), 1 => get_string('contentandheadings', 'core_filters')); } // Filter name. $displayname = $plugininfo->displayname; if (!$plugininfo->rootdir) { $displayname = '<span class="error">' . $displayname . ' - ' . get_string('status_missing', 'core_plugin') . '</span>'; } else { if (!$active) { $displayname = '<span class="error">' . $displayname . ' - ' . get_string('error') . '</span>'; } } $row[] = $displayname; // Disable/off/on. $select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $state->active, null, 'active' . $filter); $select->set_label(get_string('isactive', 'filters'), array('class' => 'accesshide')); $row[] = $OUTPUT->render($select); // Re-order. $updown = ''; $spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" />'; if ($state->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up'), '', array('class' => 'iconsmall'))); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= $OUTPUT->action_icon(filters_action_url($filter, 'down'), new pix_icon('t/down', get_string('down'), '', array('class' => 'iconsmall'))); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . $filter); $select->set_label(get_string('applyto', 'filters'), array('class' => 'accesshide')); $select->disabled = $state->active == TEXTFILTER_DISABLED; $row[] = $OUTPUT->render($select); // Settings link, if required. if ($active and filter_has_global_settings($filter)) { $row[] = html_writer::link(new moodle_url('/admin/settings.php', array('section' => 'filtersetting' . $filter)), get_string('settings')); } else { $row[] = ''; } // Uninstall. $row[] = html_writer::link(filters_action_url($filter, 'delete'), get_string('uninstallplugin', 'core_admin')); return $row; }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; //TODO: this is sloppy coding style!! $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $filterinfo->active, null, 'active' . $filter); $select->set_label(get_string('isactive', 'filters'), array('class' => 'accesshide')); $row[] = $OUTPUT->render($select); // Re-order $updown = ''; $spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" />'; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up'), '', array('class' => 'iconsmall'))); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= $OUTPUT->action_icon(filters_action_url($filter, 'down'), new pix_icon('t/down', get_string('down'), '', array('class' => 'iconsmall'))); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . $filter); $select->set_label(get_string('applyto', 'filters'), array('class' => 'accesshide')); $select->disabled = $filterinfo->active == TEXTFILTER_DISABLED; $row[] = $OUTPUT->render($select); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . $filter . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete $row[] = '<a href="' . filters_action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; return $row; }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $activechoices, $applytochoices, $filternames; $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $row[] = popup_form(action_url($filter, 'setstate') . '&newstate=', $activechoices, 'active' . basename($filter), $filterinfo->active, '', '', '', true, 'self', '', NULL, get_string('save', 'admin')); // Re-order $updown = ''; $spacer = '<img src="' . $CFG->pixpath . '/spacer.gif" class="iconsmall" alt="" /> '; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up')); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down')); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $row[] = popup_form(action_url($filter, 'setapplyto') . '&stringstoo=', $applytochoices, 'applyto' . basename($filter), $applytostrings, '', '', '', true, 'self', '', NULL, get_string('save', 'admin'), $filterinfo->active == TEXTFILTER_DISABLED); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete if (substr($filter, 0, 4) != 'mod/') { $row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; } else { $row[] = ''; } return $row; }