本文整理汇总了PHP中format_admin_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP format_admin_setting函数的具体用法?PHP format_admin_setting怎么用?PHP format_admin_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_admin_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_html
/**
* Return an XHTML string for the setting
* @return string Returns an XHTML string
*/
public function output_html($data, $query = '')
{
$healthcheckurl = new \moodle_url('/local/o365/acp.php', ['mode' => 'healthcheck']);
$settinghtml = '<input type="hidden" id="' . $this->get_id() . '" name="' . $this->get_full_name() . '" value="0" />';
$settinghtml .= \html_writer::link($healthcheckurl, get_string('settings_healthcheck_linktext', 'local_o365'));
return format_admin_setting($this, $this->visiblename, $settinghtml, $this->description);
}
示例2: output_html
public function output_html($data, $query = '')
{
if (!isset($data['value'])) {
$data['value'] = $this->normalise_data($data);
}
$return = '<div id="adminquizreviewoptions" class="clearfix">' . "\n";
foreach (admin_setting_quiz_reviewoptions::$times as $timemask => $timestring) {
$return .= '<div class="group"><div class="fitemtitle">' . get_string($timestring, 'quiz') . "</div>\n";
$nameprefix = $this->get_full_name() . '[' . $timemask . ']';
$idprefix = $this->get_id() . '_' . $timemask . '_';
foreach (admin_setting_quiz_reviewoptions::$things as $thingmask => $thingstring) {
$id = $idprefix . $thingmask;
$state = '';
if ($data['value'] & $timemask & $thingmask) {
$state = 'checked="checked" ';
}
$return .= '<span><input type="checkbox" name="' . $nameprefix . '[' . $thingmask . ']" value="1" id="' . $id . '" ' . $state . '/> <label for="' . $id . '">' . get_string($thingstring, 'quiz') . "</label></span>\n";
}
$return .= "</div>\n";
}
$return .= "</div>\n";
$adv = !empty($data['adv']);
$return .= '<input type="checkbox" class="form-checkbox" id="' . $this->get_id() . '_adv" name="' . $this->get_full_name() . '[adv]" value="1" ' . ($adv ? 'checked="checked"' : '') . ' />' . ' <label for="' . $this->get_id() . '_adv">' . get_string('advanced') . '</label> ';
return format_admin_setting($this, $this->visiblename, $return, $this->description, true, '', get_string('everythingon', 'quiz'), $query);
}
示例3: output_html
public function output_html($data, $query = '')
{
global $DB;
$defaultinfo = get_string('checkboxno', 'admin');
if ((string) $data === (string) year_tables::ENABLED_ON) {
$html = \html_writer::div(get_string('yearsenabled_on', 'local_ousearch'), 'local_ousearch_yearsenabled defaultsnext');
} else {
if ((string) $data === (string) year_tables::ENABLED_TRANSFERRING) {
// Show transferring progress. This database query only occurs
// during the transferring phase.
$transferring = get_config('local_ousearch', year_tables::CONFIG_TRANSFERRING_COURSE);
if (!$transferring) {
$pc = '0';
} else {
$progress = $DB->get_record_sql('SELECT (SELECT COUNT(1) FROM {course} WHERE id < ?) AS done,
(SELECT COUNT(1) FROM {course}) AS total', array($transferring, $transferring));
$pc = round(100.0 * $progress->done / $progress->total, 1);
}
$html = \html_writer::div(get_string('yearsenabled_transferring', 'local_ousearch', $pc), 'local_ousearch_yearsenabled defaultsnext');
} else {
// This is similar to standard checkbox except I didn't support it
// being shown as checked.
$html = \html_writer::div(\html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $this->get_full_name(), 'value' => $this->no)) . \html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => $this->get_full_name(), 'value' => $this->yes)), 'form-checkbox defaultsnext');
}
}
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', $defaultinfo, $query);
}
示例4: output_html
/**
* Returns an HTML string for the redirect uri display.
*
* @return string Returns an HTML string.
*/
public function output_html($data, $query = '')
{
global $CFG;
$wwwroot = !empty($CFG->loginhttps) ? str_replace('http://', 'https://', $CFG->wwwroot) : $CFG->wwwroot;
$html = \html_writer::tag('h5', $wwwroot . '/auth/oidc/');
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query);
}
示例5: output_html
public function output_html($data, $query = '')
{
if ($this->load_choices()) {
return parent::output_html($data, $query);
}
$visiblename = get_string('services_displaylabel', 'block_mhaairs');
$description = get_string('service_down_msg', 'block_mhaairs');
return format_admin_setting($this, $visiblename, '', $description, false, '', '');
}
示例6: output_html
/**
* Return an XHTML string for the setting
* @return string Returns an XHTML string
*/
public function output_html($data, $query = '')
{
global $CFG;
$a = new \stdClass();
$a->callbackurl = \local_msaccount\client::callback_url()->out(false);
$settinghtml = get_string('settingredirect', 'local_msaccount', $a);
$settinghtml .= '<input type="hidden" id="' . $this->get_id() . '" name="' . $this->get_full_name() . '" value="0" />';
return format_admin_setting($this, $this->visiblename, $settinghtml, $this->description);
}
示例7: output_html
/**
* Returns XHTML field(s) as required by choices
*
* Relies on data being an array should data ever be another valid vartype with
* acceptable value this may cause a warning/error
* if (!is_array($data)) would fix the problem
*
* @todo Add vartype handling to ensure $data is an array
*
* @param array $data An array of checked values
* @param string $query
* @return string XHTML field
*/
public function output_html($data, $query = '')
{
if (!$this->load_choices() or empty($this->choices)) {
return '';
}
$default = $this->get_defaultsetting();
if (is_null($default)) {
$default = array();
}
if (is_null($data)) {
$data = array();
}
$options = array();
$defaults = array();
foreach ($this->choices as $key => $description) {
if (!empty($data[$key])) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
if (!empty($default[$key])) {
$defaults[] = $description;
}
// $options[] = '<input type="checkbox" id="'.$this->get_id().'_'.$key.'" name="'.$this->get_full_name().'['.$key.']" value="1" '.$checked.' />'
// .'<label for="'.$this->get_id().'_'.$key.'">'.highlightfast($query, $description).'</label>';
$options[] = '<input type="checkbox" id="' . $this->get_id() . '_' . $key . '" name="' . $this->get_full_name() . '[' . $key . ']" value="1" ' . $checked . ' />' . '<label for="' . $this->get_id() . '_' . $key . '">' . $this->icons[$key] . highlightfast($query, $description) . '</label>';
}
if (is_null($default)) {
$defaultinfo = NULL;
} elseif (!empty($defaults)) {
$defaultinfo = implode(', ', $defaults);
} else {
$defaultinfo = get_string('none');
}
$return = '<div class="form-multicheckbox">';
$return .= '<input type="hidden" name="' . $this->get_full_name() . '[xxxxx]" value="1" />';
// something must be submitted even if nothing selected
if ($options) {
$return .= '<ul>';
foreach ($options as $option) {
$return .= '<li>' . $option . '</li>';
}
$return .= '</ul>';
}
$return .= '</div>';
return format_admin_setting($this, $this->visiblename, $return, $this->description, false, '', $defaultinfo, $query);
}
示例8: output_html
/**
* Returns XHTML select field and wrapping div(s)
*
* @see output_select_html()
*
* @param string $data the option to show as selected
* @param string $query
* @return string XHTML field and wrapping div
*/
public function output_html($data, $query = '')
{
$html = '';
$baseid = $this->get_id();
$inputname = $this->get_full_name();
foreach ($this->flowtypes as $flowtype) {
$html .= \html_writer::start_div();
$flowtypeid = $baseid . '_' . $flowtype;
$radioattrs = ['type' => 'radio', 'name' => $inputname, 'id' => $flowtypeid, 'value' => $flowtype];
if ($data === $flowtype || empty($data) && $flowtype === $this->get_defaultsetting()) {
$radioattrs['checked'] = 'checked';
}
$typename = get_string('cfg_loginflow_' . $flowtype, 'auth_oidc');
$typedesc = get_string('cfg_loginflow_' . $flowtype . '_desc', 'auth_oidc');
$html .= \html_writer::empty_tag('input', $radioattrs);
$html .= \html_writer::label($typename, $flowtypeid, false);
$html .= '<br />';
$html .= \html_writer::span($typedesc);
$html .= '<br /><br />';
$html .= \html_writer::end_div();
}
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query);
}
示例9: output_html
/**
* Return an XHTML string for the setting.
*
* @return string Returns an XHTML string
*/
public function output_html($data, $query = '')
{
global $DB, $OUTPUT;
$html = \html_writer::start_tag('div');
$style = 'button.addmapping, .fieldlist select, .fieldlist button {vertical-align:middle;margin:0;}';
$style .= '.fieldlist {margin-bottom:0.5rem;}';
$html .= \html_writer::tag('style', $style);
$hiddenattrs = ['type' => 'hidden', 'name' => $this->get_full_name() . '[save]', 'value' => 'save'];
$html .= \html_writer::empty_tag('input', $hiddenattrs);
$fieldlist = new \html_table();
$fieldlist->attributes['class'] = 'fieldlist';
$fieldlist->head = [get_string('settings_fieldmap_header_remote', 'local_o365'), '', get_string('settings_fieldmap_header_local', 'local_o365'), get_string('settings_fieldmap_header_behavior', 'local_o365')];
$fieldlist->data = [];
if ($data === false) {
$data = $this->get_defaultsetting();
}
if (empty($data) || !is_array($data)) {
$data = [];
}
foreach ($data as $fieldmap) {
$fieldmap = explode('/', $fieldmap);
if (count($fieldmap) !== 3) {
continue;
}
list($remotefield, $localfield, $behavior) = $fieldmap;
if (!isset($this->remotefields[$remotefield])) {
continue;
}
if (!isset($this->localfields[$localfield])) {
continue;
}
if (!isset($this->syncbehavopts[$behavior])) {
continue;
}
$fieldlist->data[] = [\html_writer::select($this->remotefields, $this->get_full_name() . '[remotefield][]', $remotefield, false), \html_writer::tag('span', '→'), \html_writer::select($this->localfields, $this->get_full_name() . '[localfield][]', $localfield, false), \html_writer::select($this->syncbehavopts, $this->get_full_name() . '[behavior][]', $behavior, false), \html_writer::tag('button', 'X', ['class' => 'removerow'])];
}
$html .= \html_writer::table($fieldlist);
$html .= \html_writer::tag('button', get_string('settings_fieldmap_addmapping', 'local_o365'), ['class' => 'addmapping']);
// Add row template.
$maptpl = \html_writer::start_tag('tr');
$maptpl .= \html_writer::tag('td', \html_writer::select($this->remotefields, $this->get_full_name() . '[remotefield][]', ''));
$maptpl .= \html_writer::tag('td', \html_writer::tag('span', '→'));
$maptpl .= \html_writer::tag('td', \html_writer::select($this->localfields, $this->get_full_name() . '[localfield][]', ''));
$maptpl .= \html_writer::tag('td', \html_writer::select($this->syncbehavopts, $this->get_full_name() . '[behavior][]', '', false));
$maptpl .= \html_writer::tag('td', \html_writer::tag('button', 'X', ['class' => 'removerow']));
$maptpl .= \html_writer::end_tag('tr');
$html .= \html_writer::tag('textarea', htmlentities($maptpl), ['class' => 'maptpl', 'style' => 'display:none;']);
// Using a <script> tag here instead of $PAGE->requires->js() because using $PAGE object loads file too late.
$scripturl = new \moodle_url('/local/o365/classes/adminsetting/fieldmap.js');
$html .= \html_writer::script('', $scripturl->out());
$html .= \html_writer::script('$(function() { $("#admin-' . $this->name . '").fieldmap({}); });');
$html .= \html_writer::end_tag('div');
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query);
}
示例10: output_html
/**
* Returns an XHTML string for the editor
*
* @param string $data
* @param string $query
* @return string XHTML string for the editor
*/
public function output_html($data, $query='') {
global $USER;
$default = $this->get_defaultsetting();
$defaultinfo = $default;
if (!is_null($default) and $default !== '') {
$defaultinfo = "\n".$default;
}
$ctx = context_user::instance($USER->id);
$editor = editors_get_preferred_editor(FORMAT_HTML);
$options = $this->get_options();
$draftitemid = file_get_unused_draft_itemid();
$component = is_null($this->plugin) ? 'core' : $this->plugin;
$data = file_prepare_draft_area($draftitemid, $options['context']->id,
$component, $this->get_full_name().'_draftitemid',
$draftitemid, $options, $data);
$fpoptions = array();
$args = new stdClass();
// Need these three to filter repositories list.
$args->accepted_types = array('web_image');
$args->return_types = $options['return_types'];
$args->context = $ctx;
$args->env = 'filepicker';
// Advimage plugin.
$imageoptions = initialise_filepicker($args);
$imageoptions->context = $ctx;
$imageoptions->client_id = uniqid();
$imageoptions->maxbytes = $options['maxbytes'];
$imageoptions->areamaxbytes = $options['areamaxbytes'];
$imageoptions->env = 'editor';
$imageoptions->itemid = $draftitemid;
// Moodlemedia plugin.
$args->accepted_types = array('video', 'audio');
$mediaoptions = initialise_filepicker($args);
$mediaoptions->context = $ctx;
$mediaoptions->client_id = uniqid();
$mediaoptions->maxbytes = $options['maxbytes'];
$mediaoptions->areamaxbytes = $options['areamaxbytes'];
$mediaoptions->env = 'editor';
$mediaoptions->itemid = $draftitemid;
// Advlink plugin.
$args->accepted_types = '*';
$linkoptions = initialise_filepicker($args);
$linkoptions->context = $ctx;
$linkoptions->client_id = uniqid();
$linkoptions->maxbytes = $options['maxbytes'];
$linkoptions->areamaxbytes = $options['areamaxbytes'];
$linkoptions->env = 'editor';
$linkoptions->itemid = $draftitemid;
$fpoptions['image'] = $imageoptions;
$fpoptions['media'] = $mediaoptions;
$fpoptions['link'] = $linkoptions;
$editor->use_editor($this->get_id(), $options, $fpoptions);
return format_admin_setting($this, $this->visiblename,
'<div class="form-textarea">
<textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'.$this->get_full_name()
.'"spellcheck="true">'. s($data) .'
</textarea>
</div>
<input value="'.$draftitemid.'" name="'.$this->get_full_name().'_draftitemid" type="hidden" />',
$this->description, true, '', $defaultinfo, $query);
}
示例11: output_html
/**
* Return XHTML field(s) for regexes
*
* @param array $data Array of options to set in HTML
* @return string XHTML string for the fields and wrapping div(s)
*/
public function output_html($data, $query = '')
{
global $OUTPUT;
$out = html_writer::start_tag('table', array('border' => 1, 'class' => 'generaltable'));
$out .= html_writer::start_tag('thead');
$out .= html_writer::start_tag('tr');
$out .= html_writer::tag('th', get_string('devicedetectregexexpression', 'admin'));
$out .= html_writer::tag('th', get_string('devicedetectregexvalue', 'admin'));
$out .= html_writer::end_tag('tr');
$out .= html_writer::end_tag('thead');
$out .= html_writer::start_tag('tbody');
if (empty($data)) {
$looplimit = 1;
} else {
$looplimit = count($data) / 2 + 1;
}
for ($i = 0; $i < $looplimit; $i++) {
$out .= html_writer::start_tag('tr');
$expressionname = 'expression' . $i;
if (!empty($data[$expressionname])) {
$expression = $data[$expressionname];
} else {
$expression = '';
}
$out .= html_writer::tag('td', html_writer::empty_tag('input', array('type' => 'text', 'class' => 'form-text', 'name' => $this->get_full_name() . '[expression' . $i . ']', 'value' => $expression)), array('class' => 'c' . $i));
$valuename = 'value' . $i;
if (!empty($data[$valuename])) {
$value = $data[$valuename];
} else {
$value = '';
}
$out .= html_writer::tag('td', html_writer::empty_tag('input', array('type' => 'text', 'class' => 'form-text', 'name' => $this->get_full_name() . '[value' . $i . ']', 'value' => $value)), array('class' => 'c' . $i));
$out .= html_writer::end_tag('tr');
}
$out .= html_writer::end_tag('tbody');
$out .= html_writer::end_tag('table');
return format_admin_setting($this, $this->visiblename, $out, $this->description, false, '', null, $query);
}
示例12: output_html
/**
* Return an XHTML string for the setting.
*
* @return string Returns an XHTML string.
*/
public function output_html($data, $query = '')
{
global $OUTPUT;
$settinghtml = '';
$oidcconfig = get_config('auth_oidc');
$clientcredspresent = !empty($oidcconfig->clientid) && !empty($oidcconfig->clientsecret) ? true : false;
$endpointspresent = !empty($oidcconfig->authendpoint) && !empty($oidcconfig->tokenendpoint) ? true : false;
// Input + detect button.
$inputattrs = ['type' => 'text', 'class' => 'maininput', 'size' => 30, 'id' => $this->get_id(), 'name' => $this->get_full_name(), 'value' => s($data)];
$input = \html_writer::empty_tag('input', $inputattrs);
if ($clientcredspresent === true && $endpointspresent === true) {
$buttonattrs = ['class' => 'detect'];
$strdetect = get_string('settings_serviceresourceabstract_detect', 'local_o365');
$detectbutton = \html_writer::tag('button', $strdetect, $buttonattrs);
$settinghtml .= \html_writer::div($input . $detectbutton);
if (!empty($data)) {
$icon = $OUTPUT->pix_icon('t/check', 'valid', 'moodle');
$strvalid = get_string('settings_serviceresourceabstract_valid', 'local_o365', $this->visiblename);
$statusmessage = \html_writer::tag('span', $strvalid, ['class' => 'statusmessage']);
$settinghtml .= \html_writer::div($icon . $statusmessage, 'alert-success local_o365_statusmessage');
} else {
$icon = $OUTPUT->pix_icon('i/warning', 'valid', 'moodle');
$strnocreds = get_string('settings_serviceresourceabstract_empty', 'local_o365');
$statusmessage = \html_writer::tag('span', $strnocreds, ['class' => 'statusmessage']);
$settinghtml .= \html_writer::div($icon . $statusmessage, 'alert-info local_o365_statusmessage');
}
// Using a <script> tag here instead of $PAGE->requires->js() because using $PAGE object loads file too late.
$scripturl = new \moodle_url('/local/o365/classes/adminsetting/serviceresource.js');
$settinghtml .= '<script src="' . $scripturl->out() . '"></script>';
$strvalid = get_string('settings_serviceresourceabstract_valid', 'local_o365', $this->visiblename);
$strinvalid = get_string('settings_serviceresourceabstract_invalid', 'local_o365', $this->visiblename);
$strerror = get_string('settings_serviceresourceabstract_error', 'local_o365', $this->visiblename);
$strdetect = get_string('settings_serviceresourceabstract_detect', 'local_o365', $this->visiblename);
$strdetecting = get_string('settings_serviceresourceabstract_detecting', 'local_o365', $this->visiblename);
$iconvalid = addslashes($OUTPUT->pix_icon('t/check', 'valid', 'moodle'));
$iconinvalid = addslashes($OUTPUT->pix_icon('t/delete', 'invalid', 'moodle'));
$iconloading = addslashes($OUTPUT->pix_icon('i/ajaxloader', 'loading', 'moodle'));
$ajaxurl = new \moodle_url('/local/o365/ajax.php');
$settinghtml .= '<script>
$(function() {
var opts = {
url: "' . $ajaxurl->out() . '",
setting: "' . $this->name . '",
strvalid: "' . $strvalid . '",
strinvalid: "' . $strinvalid . '",
iconvalid: "' . $iconvalid . '",
iconinvalid: "' . $iconinvalid . '",
iconloading: "' . $iconloading . '",
strerror: "' . $strerror . '",
strdetecting: "' . $strdetecting . '",
strdetect: "' . $strdetect . '"
};
$("#admin-' . $this->name . '").serviceresource(opts);
});
</script>';
} else {
$settinghtml .= \html_writer::div($input);
$icon = $OUTPUT->pix_icon('i/warning', 'valid', 'moodle');
$strnocreds = get_string('settings_serviceresourceabstract_nocreds', 'local_o365');
$statusmessage = \html_writer::tag('span', $strnocreds, ['class' => 'statusmessage']);
$settinghtml .= \html_writer::div($icon . $statusmessage, 'alert-info local_o365_statusmessage');
}
return format_admin_setting($this, $this->visiblename, $settinghtml, $this->description);
}
示例13: output_html
/**
* Return an XHTML string for the setting
* @return string Returns an XHTML string
*/
public function output_html($data, $query = '')
{
global $OUTPUT;
$button = \html_writer::tag('button', get_string('settings_detectperms_update', 'local_o365'), ['class' => 'refreshperms']);
$results = \html_writer::tag('div', '', ['class' => 'results']);
$settinghtml = $button . $results;
if (\local_o365\adminsetting\detectoidc::setup_step_complete() === true) {
$existingsetting = $this->config_read($this->name);
if (!empty($existingsetting)) {
$messageattrs = ['class' => 'permmessage'];
$message = \html_writer::tag('span', get_string('settings_detectperms_valid', 'local_o365'), $messageattrs);
} else {
$messageattrs = ['class' => 'permmessage'];
$message = \html_writer::tag('span', get_string('settings_detectperms_invalid', 'local_o365'), $messageattrs);
}
} else {
$icon = $OUTPUT->pix_icon('i/warning', 'prerequisite not complete', 'moodle');
$message = \html_writer::tag('span', get_string('settings_detectperms_nocreds', 'local_o365'));
$settinghtml .= \html_writer::tag('div', $icon . $message, ['class' => 'alert-info local_o365_statusmessage']);
}
// Using a <script> tag here instead of $PAGE->requires->js() because using $PAGE object loads file too late.
$scripturl = new \moodle_url('/local/o365/classes/adminsetting/azuresetup.js');
$settinghtml .= '<script src="' . $scripturl->out() . '"></script>';
$lastresults = get_config('local_o365', 'azuresetupresult');
if (!empty($lastresults)) {
$lastresults = @unserialize($lastresults);
$lastresults = !empty($lastresults) && is_object($lastresults) ? $lastresults : false;
$lastresults = json_encode(['success' => true, 'data' => $lastresults]);
} else {
$lastresults = json_encode(false);
}
$unifiedenabled = \local_o365\rest\unified::is_enabled() === true ? 'true' : 'false';
$ajaxurl = new \moodle_url('/local/o365/ajax.php');
$settinghtml .= '<script>
$(function() {
var opts = {
url: "' . $ajaxurl->out() . '",
lastresults: ' . $lastresults . ',
iconsuccess: "' . addslashes($OUTPUT->pix_icon('t/check', 'success', 'moodle')) . '",
iconinfo: "' . addslashes($OUTPUT->pix_icon('i/warning', 'information', 'moodle')) . '",
iconerror: "' . addslashes($OUTPUT->pix_icon('t/delete', 'error', 'moodle')) . '",
strupdate: "' . addslashes(get_string('settings_azuresetup_update', 'local_o365')) . '",
strchecking: "' . addslashes(get_string('settings_azuresetup_checking', 'local_o365')) . '",
strmissingperms: "' . addslashes(get_string('settings_azuresetup_missingperms', 'local_o365')) . '",
strpermscorrect: "' . addslashes(get_string('settings_azuresetup_permscorrect', 'local_o365')) . '",
strfixperms: "' . addslashes(get_string('settings_detectperms_fixperms', 'local_o365')) . '",
strfixprereq: "' . addslashes(get_string('settings_detectperms_fixprereq', 'local_o365')) . '",
strerrorfix: "' . addslashes(get_string('settings_detectperms_errorfix', 'local_o365')) . '",
strerrorcheck: "' . addslashes(get_string('settings_azuresetup_errorcheck', 'local_o365')) . '",
strnoinfo: "' . addslashes(get_string('settings_azuresetup_noinfo', 'local_o365')) . '",
showunified: ' . $unifiedenabled . ',
strunifiedheader: "' . addslashes(get_string('settings_azuresetup_unifiedheader', 'local_o365')) . '",
strunifieddesc: "' . addslashes(get_string('settings_azuresetup_unifieddesc', 'local_o365')) . '",
strunifiederror: "' . addslashes(get_string('settings_azuresetup_unifiederror', 'local_o365')) . '",
strunifiedpermerror: "' . addslashes(get_string('settings_azuresetup_strunifiedpermerror', 'local_o365')) . '",
strunifiedmissing: "' . addslashes(get_string('settings_azuresetup_unifiedmissing', 'local_o365')) . '",
strunifiedactive: "' . addslashes(get_string('settings_azuresetup_unifiedactive', 'local_o365')) . '",
strlegacyheader: "' . addslashes(get_string('settings_azuresetup_legacyheader', 'local_o365')) . '",
strlegacydesc: "' . addslashes(get_string('settings_azuresetup_legacydesc', 'local_o365')) . '",
strlegacyerror: "' . addslashes(get_string('settings_azuresetup_legacyerror', 'local_o365')) . '",
strtenanterror: "' . addslashes(get_string('settings_azuresetup_strtenanterror', 'local_o365')) . '"
};
$("#admin-' . $this->name . '").azuresetup(opts);
});
</script>';
return format_admin_setting($this, $this->visiblename, $settinghtml, $this->description, true, '', null, $query);
}
示例14: output_html
/**
* Get admin setting HTML.
*
* @param mixed $data Saved data.
* @param string $query
* @return string The setting HTML.
*/
public function output_html($data, $query = '')
{
global $OUTPUT;
$html = '<style>
label.iconselect {
display: inline-block !important;
padding: 0 !important;
margin: 5px;
}
label.iconselect img {
width: 25px;
height: 25px;
padding: 10px;
}
input.iconselect {
display: none;
}
input[type="radio"].iconselect:checked + label.iconselect {
outline: 1px solid #007fec;
}
body.ie input.iconselect {
display: inline-block;
}
body.ie label.iconselect {
margin-left: 0;
margin-right: 20px;
}
body.ie label.iconselect img {
padding: 5px;
}
</style>';
$html .= \html_writer::start_tag('div', ['style' => 'max-width: 390px']);
$selected = !empty($data) ? $data : $this->defaultsetting;
foreach ($this->choices as $icon) {
$id = $icon['component'] . ':' . $icon['pix'];
$iconhtml = $OUTPUT->pix_icon($icon['pix'], $icon['alt'], $icon['component']);
$inputattrs = ['type' => 'radio', 'id' => $id, 'name' => $this->get_full_name(), 'value' => $id, 'class' => 'iconselect'];
if ($id === $selected) {
$inputattrs['checked'] = 'checked';
}
$html .= \html_writer::empty_tag('input', $inputattrs);
$labelattrs = ['class' => 'iconselect'];
$html .= \html_writer::label($iconhtml, $id, true, $labelattrs);
}
$html .= \html_writer::end_tag('div');
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query);
}
示例15: output_html
/**
* Returns XHTML field(s) as required by choices
*
* Relies on data being an array should data ever be another valid vartype with
* acceptable value this may cause a warning/error
* if (!is_array($data)) would fix the problem
*
* @todo Add vartype handling to ensure $data is an array
*
* @param array $data An array of checked values
* @param string $query
* @return string XHTML field
*/
public function output_html($data, $query = '')
{
$return = '<div style="float:left; width:auto; margin-right: 0.5em;">';
$return .= '<div style="height: 2em;">' . get_string('roles', 'role') . '</div>';
foreach ($data as $role) {
$return .= '<div style="height: 2em;">' . s($role['name']) . '</div>';
}
$return .= '</div>';
$return .= '<div style="float:left; width:auto; margin-right: 0.5em;">';
$return .= '<div style="height: 2em;">' . get_string('contexts', 'enrol_ldap') . '</div>';
foreach ($data as $role) {
$contextid = $this->get_id() . '[' . $role['id'] . '][contexts]';
$contextname = $this->get_full_name() . '[' . $role['id'] . '][contexts]';
$return .= '<div style="height: 2em;"><label class="accesshide" for="' . $contextid . '">' . get_string('role_mapping_context', 'enrol_ldap', $role['name']) . '</label>';
$return .= '<input type="text" size="40" id="' . $contextid . '" name="' . $contextname . '" value="' . s($role['contexts']) . '"/></div>';
}
$return .= '</div>';
$return .= '<div style="float:left; width:auto; margin-right: 0.5em;">';
$return .= '<div style="height: 2em;">' . get_string('memberattribute', 'enrol_ldap') . '</div>';
foreach ($data as $role) {
$memberattrid = $this->get_id() . '[' . $role['id'] . '][memberattribute]';
$memberattrname = $this->get_full_name() . '[' . $role['id'] . '][memberattribute]';
$return .= '<div style="height: 2em;"><label class="accesshide" for="' . $memberattrid . '">' . get_string('role_mapping_attribute', 'enrol_ldap', $role['name']) . '</label>';
$return .= '<input type="text" size="15" id="' . $memberattrid . '" name="' . $memberattrname . '" value="' . s($role['memberattribute']) . '"/></div>';
}
$return .= '</div>';
$return .= '<div style="clear:both;"></div>';
return format_admin_setting($this, $this->visiblename, $return, $this->description, true, '', '', $query);
}