function prefs_list($args) { if ($args['section'] == 'mailbox') { $RCMAIL = rcmail::get_instance(); $field_id = 'rcmfd_html5_notifier'; $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id)); $select_duration->add($this->gettext('off'), '0'); $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30'); foreach ($times as $time) { $select_duration->add($time . ' ' . $this->gettext('seconds'), $time); } $select_duration->add($this->gettext('durable'), '-1'); $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id)); $select_smbox->add($this->gettext('no_mailbox'), '0'); $select_smbox->add($this->gettext('short_mailbox'), '1'); $select_smbox->add($this->gettext('full_mailbox'), '2'); $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . ''); $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . ''); $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' '; $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser')); $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, Q($this->gettext('shownotifies'))), 'content' => $content); $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1)); $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false)); $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, Q($this->gettext('onlynew'))), 'content' => $content); $field_id .= '_excluded'; $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id)); $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . '')); $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });"); } return $args; }
function template_object_identityform($args) { if ($this->rcmail_inst->config->get('identity_limit') === true) { $emails = new html_select(array('name' => '_email', 'id' => 'rcmfd_email', 'class' => 'ff_email')); try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $alias = $this->soap->mail_alias_get($session_id, array('destination' => $mail_user[0]['email'], 'type' => 'alias', 'active' => 'y')); $this->soap->logout($session_id); $emails->add($mail_user[0]['email'], $mail_user[0]['email']); for ($i = 0; $i < count($alias); $i++) { $emails->add($alias[$i]['source'], $alias[$i]['source']); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } if (version_compare(RCMAIL_VERSION, '0.7.0') <= 0) { preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $args['content'], $test); $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $emails->show($test[1]), $args['content']); } else { preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $args['content'], $test); $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $emails->show($test[1]), $args['content']); } } return $args; }
function show_settings($args) { if ($args['section'] == 'mailbox') { $this->add_texts('localization/'); $field_id = 'rcmfd_previewpane_layout'; $select = new html_select(array('name' => '_previewpane_layout', 'id' => $field_id)); $select->add(rcmail::Q($this->gettext('threecol.none')), 'none'); $select->add(rcmail::Q($this->gettext('threecol.below')), 'below'); $select->add(rcmail::Q($this->gettext('threecol.right')), 'right'); // add new option at the top of the list $val = rcube::get_instance()->config->get('preview_pane') ? rcube::get_instance()->config->get('previewpane_layout', 'below') : 'none'; $args['blocks']['main']['options']['preview_pane']['content'] = $select->show($val); } return $args; }
function display_search_field($content = '') { global $CFG, $DB, $OUTPUT; $usedoptions = array(); $sql = "SELECT DISTINCT content\n FROM {data_content}\n WHERE fieldid=: AND content IS NOT NULL"; if ($used = $DB->get_records_sql($sql, array($this->field->id))) { foreach ($used as $data) { $value = $data->content; if ($value === '') { continue; } $usedoptions[$value] = $value; } } $options = array(); foreach (explode("\n", $this->field->param1) as $option) { $option = trim($option); if (!isset($usedoptions[$option])) { continue; } $options[$option] = $option; } if (!$options) { // oh, nothing to search for return ''; } return $OUTPUT->select(html_select::make($options, 'f_' . $this->field->id, $content, ' ')); }
function mh_get_form_row($header = 'from', $input = '', $color = '#ffffff', $delete = false) { // header select box $header_select = new html_select(array('name' => '_mh_header[]', 'class' => 'rcmfd_mh_header')); $header_select->add(Q($this->gettext('subject')), 'subject'); $header_select->add(Q($this->gettext('from')), 'from'); $header_select->add(Q($this->gettext('to')), 'to'); $header_select->add(Q($this->gettext('cc')), 'cc'); // input field $input = new html_inputfield(array('name' => '_mh_input[]', 'class' => 'rcmfd_mh_input', 'type' => 'text', 'autocomplete' => 'off', 'value' => $input)); // color box $color = html::tag('input', array('id' => uniqid(), 'name' => '_mh_color[]', 'type' => 'color', 'text' => 'hidden', 'class' => 'mh_color_input', 'value' => $color, 'data-hex' => 'true')); // delete button $button = html::tag('input', array('class' => 'button mh_delete mh_button', 'type' => 'button', 'value' => $this->gettext('mh_delete'), 'title' => $this->gettext('mh_delete_description'))); // add button $add_button = html::tag('input', array('class' => 'button mh_add mh_button', 'type' => 'button', 'value' => $this->gettext('mh_add'), 'title' => $this->gettext('mh_add_description'))); $content = $header_select->show($header) . html::span('mh_matches', Q($this->gettext('mh_matches'))) . $input->show() . html::span('mh_color', Q($this->gettext('mh_color'))) . $color . $button . $add_button; if (rcmail::get_instance()->config->get('request_saver_compress_html', false)) { $content = request_saver::html_compress($content); } return $content; }
function display_search_field($value = '') { global $CFG, $DB, $OUTPUT; $lats = $DB->get_records_sql_menu('SELECT id, content FROM {data_content} WHERE fieldid=? GROUP BY content ORDER BY content', array($this->field->id)); $longs = $DB->get_records_sql_menu('SELECT id, content1 FROM {data_content} WHERE fieldid=? GROUP BY content ORDER BY content', array($this->field->id)); $options = array(); if (!empty($lats) && !empty($longs)) { $options[''] = ''; // Make first index blank. foreach ($lats as $key => $temp) { $options[$temp . ',' . $longs[$key]] = $temp . ',' . $longs[$key]; } } return $OUTPUT->select(html_select::make($options, 'f_' . $this->field->id, $value)); }
function display_search_field($value = '') { global $CFG, $DB, $OUTPUT; $temp = $DB->get_records_sql_menu('SELECT id, content FROM {data_content} WHERE fieldid=? GROUP BY content ORDER BY content', array($this->field->id)); $options = array(); if (!empty($temp)) { $options[''] = ''; //Make first index blank. foreach ($temp as $key) { $options[$key] = $key; //Build following indicies from the sql. } } return $OUTPUT->select(html_select::make($options, 'f_' . $this->field->id, $value)); }
function display_add_field($recordid = 0) { global $DB, $OUTPUT; if ($recordid) { $content = (int) $DB->get_field('data_content', 'content', array('fieldid' => $this->field->id, 'recordid' => $recordid)); } else { $content = time(); } $str = '<div title="' . s($this->field->description) . '">'; $dayselector = html_select::make_time_selector('days', 'field_' . $this->field->id . '_day', $content); $monthselector = html_select::make_time_selector('months', 'field_' . $this->field->id . '_month', $content); $yearselector = html_select::make_time_selector('years', 'field_' . $this->field->id . '_year', $content); $str .= $OUTPUT->select($dayselector) . $OUTPUT->select($monthselector) . $OUTPUT->select($yearselector); $str .= '</div>'; return $str; }
function prefs_table($args) { global $CURR_SECTION; if ($args['section'] == 'folders') { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); // load folders list when needed if ($CURR_SECTION) { $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30, 'exceptions' => array('INBOX'))); } else { $select = new html_select(); } $args['blocks']['main']['options']['archive_mbox'] = array('title' => $this->gettext('archivefolder'), 'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox"))); } return $args; }
function report_stats_mode_menu($course, $mode, $time, $url) { global $CFG, $OUTPUT; /* $reportoptions = stats_get_report_options($course->id, $mode); $timeoptions = report_stats_timeoptions($mode); if (empty($timeoptions)) { print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id); } */ $options = array(); $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral'); $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed'); if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) { $options[STATS_MODE_RANKED] = get_string('reports'); } $popupurl = $url . "?course={$course->id}&time={$time}"; $select = html_select::make_popup_form($popupurl, 'mode', $options, 'switchmode', $mode); $select->nothinglabel = false; return $OUTPUT->select($select); }
/** * GUI object 'charsetselector' * * @param array Named parameters for the select tag * @return string HTML code for the gui object */ public function charset_selector($attrib) { // pass the following attributes to the form class $field_attrib = array('name' => '_charset'); foreach ($attrib as $attr => $value) { if (in_array($attr, array('id', 'name', 'class', 'style', 'size', 'tabindex'))) { $field_attrib[$attr] = $value; } } $charsets = array('UTF-8' => 'UTF-8 (' . $this->app->gettext('unicode') . ')', 'US-ASCII' => 'ASCII (' . $this->app->gettext('english') . ')', 'ISO-8859-1' => 'ISO-8859-1 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-2' => 'ISO-8859-2 (' . $this->app->gettext('easterneuropean') . ')', 'ISO-8859-4' => 'ISO-8859-4 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-5' => 'ISO-8859-5 (' . $this->app->gettext('cyrillic') . ')', 'ISO-8859-6' => 'ISO-8859-6 (' . $this->app->gettext('arabic') . ')', 'ISO-8859-7' => 'ISO-8859-7 (' . $this->app->gettext('greek') . ')', 'ISO-8859-8' => 'ISO-8859-8 (' . $this->app->gettext('hebrew') . ')', 'ISO-8859-9' => 'ISO-8859-9 (' . $this->app->gettext('turkish') . ')', 'ISO-8859-10' => 'ISO-8859-10 (' . $this->app->gettext('nordic') . ')', 'ISO-8859-11' => 'ISO-8859-11 (' . $this->app->gettext('thai') . ')', 'ISO-8859-13' => 'ISO-8859-13 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-14' => 'ISO-8859-14 (' . $this->app->gettext('celtic') . ')', 'ISO-8859-15' => 'ISO-8859-15 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-16' => 'ISO-8859-16 (' . $this->app->gettext('southeasterneuropean') . ')', 'WINDOWS-1250' => 'Windows-1250 (' . $this->app->gettext('easterneuropean') . ')', 'WINDOWS-1251' => 'Windows-1251 (' . $this->app->gettext('cyrillic') . ')', 'WINDOWS-1252' => 'Windows-1252 (' . $this->app->gettext('westerneuropean') . ')', 'WINDOWS-1253' => 'Windows-1253 (' . $this->app->gettext('greek') . ')', 'WINDOWS-1254' => 'Windows-1254 (' . $this->app->gettext('turkish') . ')', 'WINDOWS-1255' => 'Windows-1255 (' . $this->app->gettext('hebrew') . ')', 'WINDOWS-1256' => 'Windows-1256 (' . $this->app->gettext('arabic') . ')', 'WINDOWS-1257' => 'Windows-1257 (' . $this->app->gettext('baltic') . ')', 'WINDOWS-1258' => 'Windows-1258 (' . $this->app->gettext('vietnamese') . ')', 'ISO-2022-JP' => 'ISO-2022-JP (' . $this->app->gettext('japanese') . ')', 'ISO-2022-KR' => 'ISO-2022-KR (' . $this->app->gettext('korean') . ')', 'ISO-2022-CN' => 'ISO-2022-CN (' . $this->app->gettext('chinese') . ')', 'EUC-JP' => 'EUC-JP (' . $this->app->gettext('japanese') . ')', 'EUC-KR' => 'EUC-KR (' . $this->app->gettext('korean') . ')', 'EUC-CN' => 'EUC-CN (' . $this->app->gettext('chinese') . ')', 'BIG5' => 'BIG5 (' . $this->app->gettext('chinese') . ')', 'GB2312' => 'GB2312 (' . $this->app->gettext('chinese') . ')'); if (!empty($_POST['_charset'])) { $set = $_POST['_charset']; } else { if (!empty($attrib['selected'])) { $set = $attrib['selected']; } else { $set = $this->get_charset(); } } $set = strtoupper($set); if (!isset($charsets[$set])) { $charsets[$set] = $set; } $select = new html_select($field_attrib); $select->add(array_values($charsets), array_keys($charsets)); return $select->show($set); }
/** * Drop-down menus for recurrence rules like "each last sunday of" */ private function rrule_selectors($part, $noselect = null) { // rule selectors $select_prefix = new html_select(array('name' => 'bydayprefix', 'id' => "edit-recurrence-{$part}-prefix")); if ($noselect) { $select_prefix->add($noselect, ''); } $select_prefix->add(array($this->gettext('first'), $this->gettext('second'), $this->gettext('third'), $this->gettext('fourth'), $this->gettext('last')), array(1, 2, 3, 4, -1)); $select_wday = new html_select(array('name' => 'byday', 'id' => "edit-recurrence-{$part}-byday")); if ($noselect) { $select_wday->add($noselect, ''); } $daymap = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); $first = $this->rc->config->get('calendar_first_day', 1); for ($j = $first; $j <= $first + 6; $j++) { $d = $j % 7; $select_wday->add($this->gettext($daymap[$d]), strtoupper(substr($daymap[$d], 0, 2))); } return $select_prefix->show() . ' ' . $select_wday->show(); }
function action_div($fid, $id, $div = true) { $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id]; $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']); $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : ''; $out .= '<table><tr><td class="rowactions">'; // action select $select_action = new html_select(array('name' => "_action_type[{$id}]", 'id' => 'action_type' . $id, 'onchange' => 'action_type_select(' . $id . ')')); if (in_array('fileinto', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagemoveto')), 'fileinto'); } if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagecopyto')), 'fileinto_copy'); } $select_action->add(rcube::Q($this->plugin->gettext('messageredirect')), 'redirect'); if (in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagesendcopy')), 'redirect_copy'); } if (in_array('reject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'reject'); } else { if (in_array('ereject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'ereject'); } } if (in_array('vacation', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagereply')), 'vacation'); } $select_action->add(rcube::Q($this->plugin->gettext('messagedelete')), 'discard'); if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setflags')), 'setflag'); $select_action->add(rcube::Q($this->plugin->gettext('addflags')), 'addflag'); $select_action->add(rcube::Q($this->plugin->gettext('removeflags')), 'removeflag'); } if (in_array('variables', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setvariable')), 'set'); } if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('notify')), 'notify'); } $select_action->add(rcube::Q($this->plugin->gettext('messagekeep')), 'keep'); $select_action->add(rcube::Q($this->plugin->gettext('rulestop')), 'stop'); $select_type = $action['type']; if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) { $select_type .= '_copy'; } $out .= $select_action->show($select_type); $out .= '</td>'; // actions target inputs $out .= '<td class="rowtargets">'; // force domain selection in redirect email input $domains = (array) $this->rc->config->get('managesieve_domains'); if (!empty($domains)) { sort($domains); $domain_select = new html_select(array('name' => "_action_target_domain[{$id}]", 'id' => 'action_target_domain' . $id)); $domain_select->add(array_combine($domains, $domains)); if ($action['type'] == 'redirect') { $parts = explode('@', $action['target']); if (!empty($parts)) { $action['domain'] = array_pop($parts); $action['target'] = implode('@', $parts); } } } // redirect target $out .= '<span id="redirect_target' . $id . '" style="white-space:nowrap;' . ' display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '">' . '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '"' . ' value="' . ($action['type'] == 'redirect' ? rcube::Q($action['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . $this->error_class($id, 'action', 'target', 'action_target') . ' />' . (!empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : '') . '</span>'; // (e)reject target $out .= '<textarea name="_action_target_area[' . $id . ']" id="action_target_area' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'targetarea', 'action_target_area') . 'style="display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') . '">' . (in_array($action['type'], array('reject', 'ereject')) ? rcube::Q($action['target'], 'strict', false) : '') . "</textarea>\n"; // vacation $vsec = in_array('vacation-seconds', $this->exts); $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('vacationreason')) . '</span><br />' . '<textarea name="_action_reason[' . $id . ']" id="action_reason' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'reason', 'action_reason') . '>' . Q($action['reason'], 'strict', false) . "</textarea>\n"; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' . $this->list_input($id, 'action_addresses', $action['addresses'], true, $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30); $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' . '<input type="text" name="_action_interval[' . $id . ']" id="action_interval' . $id . '" ' . 'value="' . rcube::Q(isset($action['seconds']) ? $action['seconds'] : $action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'interval', 'action_interval') . ' />'; if ($vsec) { $out .= ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="days"' . (!isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('days') . '</label>' . ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="seconds"' . (isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('seconds') . '</label>'; } $out .= '</div>'; // flags $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft'); $flags_target = (array) $action['target']; $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>'; foreach ($flags as $fidx => $flag) { $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . rcube::Q($this->plugin->gettext('flag' . $fidx)) . '<br>'; } $out .= '</div>'; // set variable $set_modifiers = array('lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length'); $out .= '<div id="action_set' . $id . '" style="display:' . ($action['type'] == 'set' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('setvarname')) . '</span><br />' . '<input type="text" name="_action_varname[' . $id . ']" id="action_varname' . $id . '" ' . 'value="' . rcube::Q($action['name']) . '" size="35" ' . $this->error_class($id, 'action', 'name', 'action_varname') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarvalue')) . '</span><br />' . '<input type="text" name="_action_varvalue[' . $id . ']" id="action_varvalue' . $id . '" ' . 'value="' . rcube::Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarmodifiers')) . '</span><br />'; foreach ($set_modifiers as $s_m) { $s_m_id = 'action_varmods' . $id . $s_m; $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', $id, $s_m, $s_m_id, array_key_exists($s_m, (array) $action) && $action[$s_m] ? ' checked="checked"' : '', rcube::Q($this->plugin->gettext('var' . $s_m))); } $out .= '</div>'; // notify $notify_methods = (array) $this->rc->config->get('managesieve_notify_methods'); $importance_options = $this->notify_importance_options; if (empty($notify_methods)) { $notify_methods = $this->notify_methods; } list($method, $target) = explode(':', $action['method'], 2); $method = strtolower($method); if ($method && !in_array($method, $notify_methods)) { $notify_methods[] = $method; } $select_method = new html_select(array('name' => "_action_notifymethod[{$id}]", 'id' => "_action_notifymethod{$id}", 'class' => $this->error_class($id, 'action', 'method', 'action_notifymethod'))); foreach ($notify_methods as $m_n) { $select_method->add(rcube::Q($this->rc->text_exists('managesieve.notifymethod' . $m_n) ? $this->plugin->gettext('managesieve.notifymethod' . $m_n) : $m_n), $m_n); } $select_importance = new html_select(array('name' => "_action_notifyimportance[{$id}]", 'id' => "_action_notifyimportance{$id}", 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance'))); foreach ($importance_options as $io_v => $io_n) { $select_importance->add(rcube::Q($this->plugin->gettext($io_n)), $io_v); } // @TODO: nice UI for mailto: (other methods too) URI parameters $out .= '<div id="action_notify' . $id . '" style="display:' . ($action['type'] == 'notify' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('notifytarget')) . '</span><br />' . $select_method->show($method) . '<input type="text" name="_action_notifytarget[' . $id . ']" id="action_notifytarget' . $id . '" ' . 'value="' . rcube::Q($target) . '" size="25" ' . $this->error_class($id, 'action', 'target', 'action_notifytarget') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifymessage')) . '</span><br />' . '<textarea name="_action_notifymessage[' . $id . ']" id="action_notifymessage' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') . '>' . rcube::Q($action['message'], 'strict', false) . "</textarea>\n"; if (in_array('enotify', $this->exts)) { $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyfrom')) . '</span><br />' . '<input type="text" name="_action_notifyfrom[' . $id . ']" id="action_notifyfrom' . $id . '" ' . 'value="' . rcube::Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') . ' />'; } $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyimportance')) . '</span><br />'; $out .= $select_importance->show($action['importance'] ? (int) $action['importance'] : 2); $out .= '<div id="action_notifyoption_div' . $id . '">' . '<span class="label">' . rcube::Q($this->plugin->gettext('notifyoptions')) . '</span><br />' . $this->list_input($id, 'action_notifyoption', (array) $action['options'], true, $this->error_class($id, 'action', 'options', 'action_notifyoption'), 30) . '</div>'; $out .= '</div>'; // mailbox select if ($action['type'] == 'fileinto') { $mailbox = $this->mod_mailbox($action['target'], 'out'); } else { $mailbox = ''; } $select = $this->rc->folder_selector(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (empty($action['type']) || $action['type'] == 'fileinto' ? 'inline' : 'none'))); $out .= $select->show($mailbox); $out .= '</td>'; // add/del buttons $out .= '<td class="rowbuttons">'; $out .= '<a href="#" id="actionadd' . $id . '" title="' . rcube::Q($this->plugin->gettext('add')) . '" onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>'; $out .= '<a href="#" id="actiondel' . $id . '" title="' . rcube::Q($this->plugin->gettext('del')) . '" onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>'; $out .= '</td>'; $out .= '</tr></table>'; $out .= $div ? "</div>\n" : ''; return $out; }
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; }
/** * Handler for calendar/itip-status requests */ function event_itip_status() { $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true); // find local copy of the referenced event $this->load_driver(); $existing = $this->driver->get_event($data, calendar_driver::FILTER_WRITEABLE | calendar_driver::FILTER_PERSONAL); $itip = $this->load_itip(); $response = $itip->get_itip_status($data, $existing); // get a list of writeable calendars to save new events to if (!$existing && !$data['nosave'] && $response['action'] == 'rsvp' || $response['action'] == 'import') { $calendars = $this->driver->list_calendars(calendar_driver::FILTER_PERSONAL); $calendar_select = new html_select(array('name' => 'calendar', 'id' => 'itip-saveto', 'is_escaped' => true)); $calendar_select->add('--', ''); $numcals = 0; foreach ($calendars as $calendar) { if ($calendar['editable']) { $calendar_select->add($calendar['name'], $calendar['id']); $numcals++; } } if ($numcals <= 1) { $calendar_select = null; } } if ($calendar_select) { $default_calendar = $this->get_default_calendar($data['sensitivity']); $response['select'] = html::span('folder-select', $this->gettext('saveincalendar') . ' ' . $calendar_select->show($default_calendar['id'])); } else { if ($data['nosave']) { $response['select'] = html::tag('input', array('type' => 'hidden', 'name' => 'calendar', 'id' => 'itip-saveto', 'value' => '')); } } // render small agenda view for the respective day if ($data['method'] == 'REQUEST' && !empty($data['date']) && $response['action'] == 'rsvp') { $event_start = rcube_utils::anytodatetime($data['date']); $day_start = new Datetime(gmdate('Y-m-d 00:00', $data['date']), $this->lib->timezone); $day_end = new Datetime(gmdate('Y-m-d 23:59', $data['date']), $this->lib->timezone); // get events on that day from the user's personal calendars $calendars = $this->driver->list_calendars(calendar_driver::FILTER_PERSONAL); $events = $this->driver->load_events($day_start->format('U'), $day_end->format('U'), null, array_keys($calendars)); usort($events, function ($a, $b) { return $a['start'] > $b['start'] ? 1 : -1; }); $before = $after = array(); foreach ($events as $event) { // TODO: skip events with free_busy == 'free' ? if ($event['uid'] == $data['uid'] || $event['end'] < $day_start || $event['start'] > $day_end) { continue; } else { if ($event['start'] < $event_start) { $before[] = $this->mail_agenda_event_row($event); } else { $after[] = $this->mail_agenda_event_row($event); } } } $response['append'] = array('selector' => '.calendar-agenda-preview', 'replacements' => array('%before%' => !empty($before) ? join("\n", array_slice($before, -3)) : html::div('event-row no-event', $this->gettext('noearlierevents')), '%after%' => !empty($after) ? join("\n", array_slice($after, 0, 3)) : html::div('event-row no-event', $this->gettext('nolaterevents')))); } $this->rc->output->command('plugin.update_itip_object_status', $response); }
function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) { global $CFG, $DB, $OUTPUT; $reports = hotpot_get_report_names('overview,simplestat,fullstat'); print '<form method="post" action="' . "{$CFG->wwwroot}/mod/hotpot/report.php?hp={$hotpot->id}" . '">'; print '<table cellpadding="2" align="center">'; $menus = array(); $menus['mode'] = array(); foreach ($reports as $name) { if ($name == 'overview' || $name == 'simplestat' || $name == 'fullstat') { $module = "quiz"; // standard reports } else { if ($name == 'click' && empty($hotpot->clickreporting)) { $module = ""; // clickreporting is disabled } else { $module = "hotpot"; // custom reports } } if ($module) { $menus['mode'][$name] = get_string("report{$name}", $module); } } $menus['reportusers'] = array('allusers' => get_string('allusers', 'hotpot'), 'allparticipants' => get_string('allparticipants')); // groups if ($groups = groups_get_all_groups($course->id)) { foreach ($groups as $gid => $group) { $menus['reportusers']["group{$gid}"] = get_string('group') . ': ' . format_string($group->name); } } // get users who have ever atetmpted this HotPot $users = $DB->get_records_sql("\n SELECT \n u.id, u.firstname, u.lastname\n FROM \n {user} u,\n {hotpot_attempts} ha\n WHERE\n u.id = ha.userid AND ha.hotpot=?\n ORDER BY\n u.lastname\n ", array($hotpot->id)); if (!empty($users)) { // get context $cm = get_coursemodule_from_instance('hotpot', $hotpot->id); $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id); $teachers = hotpot_get_users_by_capability($modulecontext, 'mod/hotpot:viewreport'); $students = hotpot_get_users_by_capability($modulecontext, 'mod/hotpot:attempt'); // current students if (!empty($students)) { $firsttime = true; foreach ($users as $user) { if (array_key_exists($user->id, $teachers)) { continue; // skip teachers } if (array_key_exists($user->id, $students)) { if ($firsttime) { $firsttime = false; // so we only do this once $menus['reportusers']['existingstudents'] = get_string('existingstudents'); $menus['reportusers'][] = '------'; } $menus['reportusers']["{$user->id}"] = fullname($user); unset($users[$user->id]); } } unset($students); } // others (former students, teachers, admins, course creators) $firsttime = true; foreach ($users as $user) { if ($firsttime) { $firsttime = false; // so we only do this once $menus['reportusers'][] = '======'; } $menus['reportusers']["{$user->id}"] = fullname($user); } } $menus['reportattempts'] = array('all' => get_string('attemptsall', 'hotpot'), 'best' => get_string('attemptsbest', 'hotpot'), 'first' => get_string('attemptsfirst', 'hotpot'), 'last' => get_string('attemptslast', 'hotpot')); print '<tr><td>'; echo $OUTPUT->help_icon(moodle_help_icon::make('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot')); print '</td><th align="right" scope="col">' . get_string('reportcontent', 'hotpot') . ':</th><td colspan="7">'; foreach ($menus as $name => $options) { $value = $formdata[$name]; print $OUTPUT->select(html_select::make($options, $name, $value, false)); } print '<input type="submit" value="' . get_string('reportbutton', 'hotpot') . '" /></td></tr>'; $menus = array(); $menus['reportformat'] = array(); $menus['reportformat']['htm'] = get_string('reportformathtml', 'hotpot'); if (file_exists("{$CFG->libdir}/excel") || file_exists("{$CFG->libdir}/excellib.class.php")) { $menus['reportformat']['xls'] = get_string('reportformatexcel', 'hotpot'); } $menus['reportformat']['txt'] = get_string('reportformattext', 'hotpot'); if (trim($CFG->hotpot_excelencodings)) { $menus['reportencoding'] = array(get_string('none') => ''); $encodings = explode(',', $CFG->hotpot_excelencodings); foreach ($encodings as $encoding) { $encoding = trim($encoding); if ($encoding) { $menus['reportencoding'][$encoding] = $encoding; } } } $menus['reportwrapdata'] = array('1' => get_string('yes'), '0' => get_string('no')); $menus['reportshowlegend'] = array('1' => get_string('yes'), '0' => get_string('no')); print '<tr><td>'; echo $OUTPUT->help_icon(moodle_help_icon::make('reportformat', get_string('reportformat', 'hotpot'), 'hotpot')); print '</td>'; foreach ($menus as $name => $options) { $value = $formdata[$name]; print '<th align="right" scope="col">' . get_string($name, 'hotpot') . ':</th><td>' . $OUTPUT->select(html_select::make($options, $name, $value, false)) . '</td>'; } print '</tr>'; print '</table>'; print '<hr size="1" noshade="noshade" />'; print '</form>' . "\n"; }
function scorm_get_toc($user, $scorm, $liststyle, $currentorg = '', $scoid = '', $mode = 'normal', $attempt = '', $play = false) { global $CFG, $DB, $PAGE, $OUTPUT; $strexpand = get_string('expcoll', 'scorm'); $modestr = ''; if ($mode == 'browse') { $modestr = '&mode=' . $mode; } $result = new stdClass(); $result->toc = "<ul id='s0' class='{$liststyle}'>\n"; $tocmenus = array(); $result->prerequisites = true; $incomplete = false; // // Get the current organization infos // if (!empty($currentorg)) { if (($organizationtitle = $DB->get_field('scorm_scoes', 'title', array('scorm' => $scorm->id, 'identifier' => $currentorg))) != '') { $result->toc .= "\t<li>{$organizationtitle}</li>\n"; $tocmenus[] = $organizationtitle; } } // // If not specified retrieve the last attempt number // if (empty($attempt)) { $attempt = scorm_get_last_attempt($scorm->id, $user->id); } $result->attemptleft = $scorm->maxattempt - $attempt; if ($scoes = scorm_get_scoes($scorm->id, $currentorg)) { // // Retrieve user tracking data for each learning object // $usertracks = array(); foreach ($scoes as $sco) { if (!empty($sco->launch)) { if ($usertrack = scorm_get_tracks($sco->id, $user->id, $attempt)) { if ($usertrack->status == '') { $usertrack->status = 'notattempted'; } $usertracks[$sco->identifier] = $usertrack; } } } $level = 0; $sublist = 1; $previd = 0; $nextid = 0; $findnext = false; $parents[$level] = '/'; foreach ($scoes as $pos => $sco) { $isvisible = false; $sco->title = $sco->title; if (!isset($sco->isvisible) || isset($sco->isvisible) && $sco->isvisible == 'true') { $isvisible = true; } if ($parents[$level] != $sco->parent) { if ($newlevel = array_search($sco->parent, $parents)) { for ($i = 0; $i < $level - $newlevel; $i++) { $result->toc .= "\t\t</ul></li>\n"; } $level = $newlevel; } else { $i = $level; $closelist = ''; while ($i > 0 && $parents[$level] != $sco->parent) { $closelist .= "\t\t</ul></li>\n"; $i--; } if ($i == 0 && $sco->parent != $currentorg) { $style = ''; if (isset($_COOKIE['hide:SCORMitem' . $sco->id])) { $style = ' style="display: none;"'; } $result->toc .= "\t\t<li><ul id='s{$sublist}' class='{$liststyle}'{$style}>\n"; $level++; } else { $result->toc .= $closelist; $level = $i; } $parents[$level] = $sco->parent; } } if (isset($scoes[$pos + 1])) { $nextsco = $scoes[$pos + 1]; } else { $nextsco = false; } $nextisvisible = false; if (!isset($nextsco->isvisible) || isset($nextsco->isvisible) && $nextsco->isvisible == 'true') { $nextisvisible = true; } if ($nextisvisible && $nextsco !== false && $sco->parent != $nextsco->parent && ($level == 0 || $level > 0 && $nextsco->parent == $sco->identifier)) { $sublist++; $icon = 'minus'; if (isset($_COOKIE['hide:SCORMitem' . $nextsco->id])) { $icon = 'plus'; } $result->toc .= "\t\t" . '<li><a href="javascript:expandCollide(\'img' . $sublist . '\',\'s' . $sublist . '\',' . $nextsco->id . ');">' . '<img id="img' . $sublist . '" src="' . $OUTPUT->mod_icon_url('pix/' . $icon, 'scorm') . '" alt="' . $strexpand . '" title="' . $strexpand . '"/></a>'; } else { if ($isvisible) { $result->toc .= "\t\t" . '<li><img src="' . $OUTPUT->mod_icon_url('pix/spacer', 'scorm') . '" alt="" />'; } } if (empty($sco->title)) { $sco->title = $sco->identifier; } if (!empty($sco->launch)) { if ($isvisible) { $startbold = ''; $endbold = ''; $score = ''; if (empty($scoid) && $mode != 'normal') { $scoid = $sco->id; } if (isset($usertracks[$sco->identifier])) { $usertrack = $usertracks[$sco->identifier]; $strstatus = get_string($usertrack->status, 'scorm'); if ($sco->scormtype == 'sco') { $statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/' . $usertrack->status, 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" />'; } else { $statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/assetc', 'scorm') . '" alt="' . get_string('assetlaunched', 'scorm') . '" title="' . get_string('assetlaunched', 'scorm') . '" />'; } if ($usertrack->status == 'notattempted' || $usertrack->status == 'incomplete' || $usertrack->status == 'browsed') { $incomplete = true; if ($play && empty($scoid)) { $scoid = $sco->id; } } if ($usertrack->score_raw != '') { $score = '(' . get_string('score', 'scorm') . ': ' . $usertrack->score_raw . ')'; } $strsuspended = get_string('suspended', 'scorm'); if (isset($usertrack->{'cmi.core.exit'}) && $usertrack->{'cmi.core.exit'} == 'suspend') { if ($usertrack->status != 'completed') { $statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/suspend', 'scorm') . '" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />'; } } } else { if ($play && empty($scoid)) { $scoid = $sco->id; } if ($sco->scormtype == 'sco') { $statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />'; $incomplete = true; } else { $statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/asset', 'scorm') . '" alt="' . get_string('asset', 'scorm') . '" title="' . get_string('asset', 'scorm') . '" />'; } } if ($sco->id == $scoid) { $startbold = '<b>'; $endbold = '</b>'; $findnext = true; $shownext = isset($sco->next) ? $sco->next : 0; $showprev = isset($sco->prev) ? $sco->prev : 0; } if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) { if (!empty($sco->launch)) { $previd = $sco->id; } } require_once 'sequencinglib.php'; if (scorm_seq_evaluate($sco->id, $usertracks)) { if ($sco->id == $scoid) { $result->prerequisites = true; } $url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid=' . $sco->id; $result->toc .= $statusicon . ' ' . $startbold . '<a href="' . $url . '">' . format_string($sco->title) . '</a>' . $score . $endbold . "</li>\n"; $tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title); } else { if ($sco->id == $scoid) { $result->prerequisites = false; } $result->toc .= ' ' . format_string($sco->title) . "</li>\n"; } } } else { $result->toc .= ' ' . format_string($sco->title) . "</li>\n"; } if ($nextsco !== false && $nextid == 0 && $findnext) { if (!empty($nextsco->launch)) { $nextid = $nextsco->id; } } } for ($i = 0; $i < $level; $i++) { $result->toc .= "\t\t</ul></li>\n"; } if ($play) { $sco = $DB->get_record('scorm_scoes', array('id' => $scoid)); $sco->previd = $previd; $sco->nextid = $nextid; $result->sco = $sco; $result->incomplete = $incomplete; } else { $result->incomplete = $incomplete; } } $result->toc .= "\t</ul>\n"; if ($scorm->hidetoc == 0) { $PAGE->requires->data_for_js('scormdata', array('plusicon' => $OUTPUT->mod_icon_url('pix/plus', 'scorm'), 'minusicon' => $OUTPUT->mod_icon_url('pix/minus', 'scorm'))); $PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js'); } $url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '¤torg=' . $currentorg . $modestr; $select = html_select::make_popup_form($url, 'scoid', $tocmenus, "tocmenu", $sco->id); $select->nothinglabel = false; $result->tocmenu = $OUTPUT->select($select); return $result; }
/** * Return folders list as html_select object * * @param array $p Named parameters * * @return html_select HTML drop-down object */ public function folder_selector($p = array()) { $p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true); $a_mailboxes = array(); $storage = $this->get_storage(); if (empty($p['folder_name'])) { $p['folder_name'] = '*'; } if ($p['unsubscribed']) { $list = $storage->list_folders('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']); } else { $list = $storage->list_folders_subscribed('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']); } $delimiter = $storage->get_hierarchy_delimiter(); foreach ($list as $folder) { if (empty($p['exceptions']) || !in_array($folder, $p['exceptions'])) { $this->build_folder_tree($a_mailboxes, $folder, $delimiter); } } $select = new html_select($p); if ($p['noselection']) { $select->add(html::quote($p['noselection']), ''); } $this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p); return $select; }
/** * Create an edit field for inclusion on a form * * @param string col field name * @param string value field value * @param array attrib HTML element attributes for field * @param string type HTML element type (default 'text') * * @return string HTML field definition */ public static function get_edit_field($col, $value, $attrib, $type = 'text') { static $colcounts = array(); $fname = '_' . $col; $attrib['name'] = $fname . ($attrib['array'] ? '[]' : ''); $attrib['class'] = trim($attrib['class'] . ' ff_' . $col); if ($type == 'checkbox') { $attrib['value'] = '1'; $input = new html_checkbox($attrib); } else { if ($type == 'textarea') { $attrib['cols'] = $attrib['size']; $input = new html_textarea($attrib); } else { if ($type == 'select') { $input = new html_select($attrib); $input->add('---', ''); $input->add(array_values($attrib['options']), array_keys($attrib['options'])); } else { if ($attrib['type'] == 'password') { $input = new html_passwordfield($attrib); } else { if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') { $attrib['type'] = 'text'; } $input = new html_inputfield($attrib); } } } } // use value from post if (isset($_POST[$fname])) { $postvalue = self::get_input_value($fname, self::INPUT_POST, true); $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue; } $out = $input->show($value); return $out; }
admin_externalpage_setup('reportquestioninstances'); admin_externalpage_print_header(); // Log. add_to_log(SITEID, "admin", "report questioninstances", "report/questioninstances/index.php?qtype={$requestedqtype}", $requestedqtype); // Prepare the list of capabilites to choose from $qtypechoices = array(); foreach ($QTYPES as $qtype) { $qtypechoices[$qtype->name()] = $qtype->local_name(); } // Print the settings form. echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter centerpara'); echo '<form method="get" action="." id="settingsform"><div>'; echo $OUTPUT->heading(get_string('reportsettings', 'report_questioninstances')); echo '<p id="intro">', get_string('intro', 'report_questioninstances'), '</p>'; echo '<p><label for="menuqtype"> ' . get_string('questiontype', 'admin') . '</label> '; $select = html_select::make($qtypechoices, 'qtype', $requestedqtype, get_string('all')); $select->nothingvalue = '_all_'; echo $OUTPUT->select($select); echo '</p>'; echo '<p><input type="submit" id="settingssubmit" value="' . get_string('getreport', 'report_questioninstances') . '" /></p>'; echo '</div></form>'; echo $OUTPUT->box_end(); // If we have a qtype to report on, generate the report. if ($requestedqtype) { // Work out the bits needed for the SQL WHERE clauses. if ($requestedqtype == 'missingtype') { $othertypes = array_keys($QTYPES); $key = array_search('missingtype', $othertypes); unset($othertypes[$key]); list($sqlqtypetest, $params) = $DB->get_in_or_equal($othertypes, SQL_PARAMS_QM, '', false); $sqlqtypetest = 'WHERE qtype ' . $sqlqtypetest;
function output_quiz_info_table($course, $cm, $quiz, $quizstats, $usingattemptsstring, $currentgroup, $groupstudents, $useallattempts, $download, $reporturl, $everything) { global $DB, $OUTPUT; // Print information on the number of existing attempts $quizinformationtablehtml = $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 2, 'main'); $quizinformationtable = new html_table(); $quizinformationtable->align = array('center', 'center'); $quizinformationtable->width = '60%'; $quizinformationtable->class = 'generaltable titlesleft'; $quizinformationtable->data = array(); $quizinformationtable->data[] = array(get_string('quizname', 'quiz_statistics'), $quiz->name); $quizinformationtable->data[] = array(get_string('coursename', 'quiz_statistics'), $course->fullname); if ($cm->idnumber) { $quizinformationtable->data[] = array(get_string('idnumbermod'), $cm->idnumber); } if ($quiz->timeopen) { $quizinformationtable->data[] = array(get_string('quizopen', 'quiz'), userdate($quiz->timeopen)); } if ($quiz->timeclose) { $quizinformationtable->data[] = array(get_string('quizclose', 'quiz'), userdate($quiz->timeclose)); } if ($quiz->timeopen && $quiz->timeclose) { $quizinformationtable->data[] = array(get_string('duration', 'quiz_statistics'), format_time($quiz->timeclose - $quiz->timeopen)); } $format = array('firstattemptscount' => '', 'allattemptscount' => '', 'firstattemptsavg' => 'sumgrades_as_percentage', 'allattemptsavg' => 'sumgrades_as_percentage', 'median' => 'sumgrades_as_percentage', 'standarddeviation' => 'sumgrades_as_percentage', 'skewness' => '', 'kurtosis' => '', 'cic' => 'number_format', 'errorratio' => 'number_format', 'standarderror' => 'sumgrades_as_percentage'); foreach ($quizstats as $property => $value) { if (!isset($format[$property])) { continue; } if (!is_null($value)) { switch ($format[$property]) { case 'sumgrades_as_percentage': $formattedvalue = quiz_report_scale_sumgrades_as_percentage($value, $quiz); break; case 'number_format': $formattedvalue = quiz_format_grade($quiz, $value) . '%'; break; default: $formattedvalue = $value; } $quizinformationtable->data[] = array(get_string($property, 'quiz_statistics', $usingattemptsstring), $formattedvalue); } } if (!$this->table->is_downloading()) { if (isset($quizstats->timemodified)) { list($fromqa, $whereqa, $qaparams) = quiz_report_attempts_sql($quiz->id, $currentgroup, $groupstudents, $useallattempts); $sql = 'SELECT COUNT(1) ' . 'FROM ' . $fromqa . ' ' . 'WHERE ' . $whereqa . ' AND qa.timefinish > :time'; $a = new object(); $a->lastcalculated = format_time(time() - $quizstats->timemodified); if (!($a->count = $DB->count_records_sql($sql, array('time' => $quizstats->timemodified) + $qaparams))) { $a->count = 0; } $quizinformationtablehtml .= $OUTPUT->box_start('boxaligncenter generalbox boxwidthnormal mdl-align'); $quizinformationtablehtml .= get_string('lastcalculated', 'quiz_statistics', $a); $quizinformationtablehtml .= $OUTPUT->button(html_form::make_button($reporturl->out(true), $reporturl->params() + array('recalculate' => 1), get_string('recalculatenow', 'quiz_statistics'))); $quizinformationtablehtml .= $OUTPUT->box_end(); } $downloadoptions = $this->table->get_download_menu(); $quizinformationtablehtml .= '<form action="' . $this->table->baseurl . '" method="post">'; $quizinformationtablehtml .= '<div class="mdl-align">'; $quizinformationtablehtml .= '<input type="hidden" name="everything" value="1"/>'; $quizinformationtablehtml .= '<input type="submit" value="' . get_string('downloadeverything', 'quiz_statistics') . '"/>'; $select = html_select::make($downloadoptions, 'download', $this->table->defaultdownloadformat, false); $select->nothingvalue = ''; $quizinformationtablehtml .= $OUTPUT->select($select); $quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table'))); $quizinformationtablehtml .= '</div></form>'; } $quizinformationtablehtml .= $OUTPUT->table($quizinformationtable); if (!$this->table->is_downloading()) { echo $quizinformationtablehtml; } elseif ($everything) { $exportclass =& $this->table->export_class_instance(); if ($download == 'xhtml') { echo $quizinformationtablehtml; } else { $exportclass->start_table(get_string('quizinformation', 'quiz_statistics')); $headers = array(); $row = array(); foreach ($quizinformationtable->data as $data) { $headers[] = $data[0]; $row[] = $data[1]; } $exportclass->output_headers($headers); $exportclass->add_data($row); $exportclass->finish_table(); } } }
function gen_form() { $policy_name = array(); $policy_id = array(); try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email'])); $policy = $this->soap->mail_policy_get($session_id, array(1 => 1)); $policy_sel = $this->soap->mail_policy_get($session_id, array("id" => $spam_user[0]['policy_id'])); $this->soap->logout($session_id); for ($i = 0; $i < count($policy); $i++) { $policy_name[] = $policy[$i]['policy_name']; $policy_id[] = $policy[$i]['id']; } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $mail_user[0]['move_junk']; if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } $this->rcmail_inst->output->set_env('framed', true); $out .= '<fieldset><legend>' . $this->gettext('junk') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_spampolicy_name = new html_select(array('name' => '_spampolicy_name', 'id' => 'spampolicy_name')); $input_spampolicy_name->add($policy_name, $policy_id); $table->add('title', rep_specialchars_output($this->gettext('policy_name'))); $table->add('', $input_spampolicy_name->show($policy_sel[0]['policy_name'])); $input_spammove = new html_checkbox(array('name' => '_spammove', 'id' => 'spammove', 'value' => '1')); $table->add('title', rep_specialchars_output($this->gettext('spammove'))); $table->add('', $input_spammove->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; $state_names = note_get_state_names(); // the first time list hack if (empty($users)) { foreach ($_POST as $k => $v) { if (preg_match('/^user(\\d+)$/', $k, $m)) { $users[] = $m[1]; } } } $strpublishstate = get_string('publishstate', 'notes'); $userlist = array(); foreach ($users as $k => $v) { if (!($user = $DB->get_record('user', array('id' => $v)))) { continue; } echo '<input type="hidden" name="userid[' . $k . ']" value="' . $v . '" />'; $userlist[] = fullname($user, true); } echo '<p>'; echo get_string('users') . ': ' . implode(', ', $userlist) . '.'; echo '</p>'; echo '<p>' . get_string('content', 'notes'); echo $OUTPUT->help_icon(moodle_help_icon::make('writing', get_string('helpwriting'))); echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>'; echo '<p>' . $strpublishstate; echo $OUTPUT->help_icon(moodle_help_icon::make('status', $strpublishstate, 'notes')); echo $OUTPUT->select(html_select::make($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, false)); echo '</p>'; echo '<input type="submit" value="' . get_string('savechanges') . '" /></div></form>'; echo $OUTPUT->footer();
/** * Display all the submissions ready for grading * * @global object * @global object * @global object * @global object * @param string $message * @return bool|void */ function display_submissions($message = '') { global $CFG, $DB, $USER, $DB, $OUTPUT; require_once $CFG->libdir . '/gradelib.php'; /* first we check to see if the form has just been submitted * to request user_preference updates */ if (isset($_POST['updatepref'])) { $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = $perpage <= 0 ? 10 : $perpage; set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); $quickgrade = get_user_preferences('assignment_quickgrade', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { $uses_outcomes = true; } else { $uses_outcomes = false; } $page = optional_param('page', 0, PARAM_INT); $strsaveallfeedback = get_string('saveallfeedback', 'assignment'); /// Some shortcuts to make the code read better $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->cm->id, $this->assignment->id, $this->cm->id); $navigation = build_navigation($this->strsubmissions, $this->cm); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); $course_context = get_context_instance(CONTEXT_COURSE, $course->id); if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) { echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>'; } if (!empty($message)) { echo $message; // display messages here if any } $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// Check to see if groups are being used in this assignment /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id); /// Get all ppl that are allowed to submit assignments if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) { $users = array_keys($users); } // if groupmembersonly used, remove users who are not in any group if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) { if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { $users = array_intersect($users, array_keys($groupingusers)); } } $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade'); if ($uses_outcomes) { $tablecolumns[] = 'outcome'; // no sorting based on outcomes column } $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', get_string('status'), get_string('finalgrade', 'grades')); if ($uses_outcomes) { $tableheaders[] = get_string('outcome', 'grades'); } require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('grade', 'grade'); $table->column_class('submissioncomment', 'comment'); $table->column_class('timemodified', 'timemodified'); $table->column_class('timemarked', 'timemarked'); $table->column_class('status', 'status'); $table->column_class('finalgrade', 'finalgrade'); if ($uses_outcomes) { $table->column_class('outcome', 'outcome'); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '100%'); //$table->set_attribute('align', 'center'); $table->no_sorting('finalgrade'); $table->no_sorting('outcome'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); if (empty($users)) { echo $OUTPUT->heading(get_string('nosubmitusers', 'assignment')); return true; } /// Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY ' . $sort; } $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.submissioncomment, s.timemodified, s.timemarked, COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status '; $sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $grademenu = make_grades_menu($this->assignment->grade); if (($ausers = $DB->get_records_sql($select . $sql . $sort, null, $table->get_page_start(), $table->get_page_size())) !== false) { $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); foreach ($ausers as $auser) { $final_grade = $grading_info->items[0]->grades[$auser->id]; $grademax = $grading_info->items[0]->grademax; $final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2); $locked_overridden = 'locked'; if ($final_grade->overridden) { $locked_overridden = 'overridden'; } /// Calculate user status $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified; $picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id)); if (empty($auser->submissionid)) { $auser->grade = -1; //no submission yet } if (!empty($auser->submissionid)) { ///Prints student answer and student modified date ///attach file or print link to student answer, depending on the type of the assignment. ///Refer to print_student_answer in inherited classes. if ($auser->timemodified > 0) { $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>'; } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; } ///Print grade, dropdown or text if ($auser->timemarked > 0) { $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } else { $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } ///Print Comment if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>'; } } } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->formatted_grade . '</div>'; } else { if ($quickgrade) { // allow editing $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde')); $select->nothingvalue = '-1'; $select->tabindex = $tabindex++; $menu = $OUTPUT->select($select); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">-</div>'; } } if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '"> </div>'; } } } if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1 $auser->status = 0; } else { $auser->status = 1; } $buttontext = $auser->status == 1 ? $strupdate : $strgrade; ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++; $link = html_link::make($popup_url, $buttontext); $link->add_action(new popup_action('click', $link->url, 'grade' . $auser->id, array('height' => 600, 'width' => 700))); $link->title = $buttontext; $button = $OUTPUT->link($link); $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>'; $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>'; $outcomes = ''; if ($uses_outcomes) { foreach ($grading_info->outcomes as $n => $outcome) { $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>'; $options = make_grades_menu(-$outcome->scaleid); if ($outcome->grades[$auser->id]->locked or !$quickgrade) { $options[0] = get_string('nooutcome', 'grades'); $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>'; } else { $outcomes .= ' '; $select = html_select::make($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades')); $select->nothingvalue = '0'; $select->tabindex = $tabindex++; $select->id = 'outcome_' . $n . '_' . $auser->id; $outcomes .= $OUTPUT->select($select); } $outcomes .= '</div>'; } } $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $course->id . '">' . fullname($auser) . '</a>'; $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade); if ($uses_outcomes) { $row[] = $outcomes; } $table->add_data($row); } } /// Print quickgrade form around the table if ($quickgrade) { echo '<form action="submissions.php" id="fastg" method="post">'; echo '<div>'; echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />'; echo '<input type="hidden" name="mode" value="fastgrade" />'; echo '<input type="hidden" name="page" value="' . $page . '" />'; echo '</div>'; } $table->print_html(); /// Print the whole table if ($quickgrade) { $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : ''; echo '<div class="fgcontrols">'; echo '<div class="emailnotification">'; echo '<label for="mailinfo">' . get_string('enableemailnotification', 'assignment') . '</label>'; echo '<input type="hidden" name="mailinfo" value="0" />'; echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" ' . $lastmailinfo . ' />'; echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')) . '</p></div>'; echo '</div>'; echo '<div class="fastgbutton"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>'; echo '</div>'; echo '</form>'; } /// End of fast grading form /// Mini form for setting user preference echo '<div class="qgprefs">'; echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post"><div>'; echo '<input type="hidden" name="updatepref" value="1" />'; echo '<table id="optiontable">'; echo '<tr><td>'; echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>'; echo '</td>'; echo '<td>'; echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />'; echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize', 'assignment'), 'assignment')); echo '</td></tr>'; echo '<tr><td>'; echo '<label for="quickgrade">' . get_string('quickgrade', 'assignment') . '</label>'; echo '</td>'; echo '<td>'; $checked = $quickgrade ? 'checked="checked"' : ''; echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" ' . $checked . ' />'; echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')) . '</p></div>'; echo '</td></tr>'; echo '<tr><td colspan="2">'; echo '<input type="submit" value="' . get_string('savepreferences') . '" />'; echo '</td></tr></table>'; echo '</div></form></div>'; ///End of mini form echo $OUTPUT->footer(); }
/** * Return folders list as html_select object * * @param array $p Named parameters * * @return html_select HTML drop-down object */ public function folder_selector($p = array()) { $realnames = $this->config->get('show_real_foldernames'); $p += array('maxlength' => 100, 'realnames' => $realnames, 'is_escaped' => true); $a_mailboxes = array(); $storage = $this->get_storage(); if (empty($p['folder_name'])) { $p['folder_name'] = '*'; } if ($p['unsubscribed']) { $list = $storage->list_folders('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']); } else { $list = $storage->list_folders_subscribed('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']); } $delimiter = $storage->get_hierarchy_delimiter(); if (!empty($p['exceptions'])) { $list = array_diff($list, (array) $p['exceptions']); } if (!empty($p['additional'])) { foreach ($p['additional'] as $add_folder) { $add_items = explode($delimiter, $add_folder); $folder = ''; while (count($add_items)) { $folder .= array_shift($add_items); // @TODO: sorting if (!in_array($folder, $list)) { $list[] = $folder; } $folder .= $delimiter; } } } foreach ($list as $folder) { $this->build_folder_tree($a_mailboxes, $folder, $delimiter); } $select = new html_select($p); if ($p['noselection']) { $select->add(html::quote($p['noselection']), ''); } $this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p); return $select; }
public function prefs_list($args) { if ($args['section'] != 'thunderbird_labels') { return $args; } $this->load_config(); $dont_override = (array) $this->rc->config->get('dont_override', array()); $args['blocks']['tb_label'] = array(); $args['blocks']['tb_label']['name'] = $this->gettext('tb_label_options'); $key = 'tb_label_enable'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1)); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_option'), 'content' => $content); } $key = 'tb_label_enable_shortcuts'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1)); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_shortcuts_option'), 'content' => $content); } $key = 'tb_label_style'; if (!in_array($key, $dont_override)) { $select = new html_select(array('name' => $key, 'id' => $key)); $select->add(array($this->gettext('thunderbird'), $this->gettext('bullets')), array('thunderbird', 'bullets')); $content = $select->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_style_option'), 'content' => $content); } $key = 'tb_label_custom_labels'; if (!in_array($key, $dont_override) && $this->rc->config->get('tb_label_modify_labels')) { $old = $this->rc->config->get($key); for ($i = 1; $i <= 5; $i++) { $input = new html_inputfield(array('name' => $key . $i, 'id' => $key . $i, 'type' => 'text', 'autocomplete' => 'off', 'value' => $old[$i])); $args['blocks']['tb_label']['options'][$key . $i] = array('title' => $this->gettext('tb_label_label') . " " . $i, 'content' => $input->show()); } } return $args; }
/** * Template object for key generation form */ function tpl_key_create_form($attrib) { $attrib += array('id' => 'rcmKeyCreateForm'); $table = new html_table(array('cols' => 2)); // get user's identities $identities = $this->rc->user->list_identities(null, true); // Identity $select = new html_select(array('name' => 'identity', 'id' => 'key-ident')); foreach ((array) $identities as $idx => $ident) { $name = empty($ident['name']) ? '<' . $ident['email'] . '>' : $ident['ident']; $select->add($name, $idx); } $table->add('title', html::label('key-name', rcube::Q($this->enigma->gettext('newkeyident')))); $table->add(null, $select->show(0)); // Key size $select = new html_select(array('name' => 'size', 'id' => 'key-size')); $select->add($this->enigma->gettext('key2048'), '2048'); $select->add($this->enigma->gettext('key4096'), '4096'); $table->add('title', html::label('key-size', rcube::Q($this->enigma->gettext('newkeysize')))); $table->add(null, $select->show()); // Password and confirm password $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass')))); $table->add(null, rcube_output::get_edit_field('password', '', array('id' => 'key-pass', 'size' => $attrib['size'], 'required' => true), 'password')); $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm')))); $table->add(null, rcube_output::get_edit_field('password-confirm', '', array('id' => 'key-pass-confirm', 'size' => $attrib['size'], 'required' => true), 'password')); $this->rc->output->add_gui_object('keyform', $attrib['id']); $this->rc->output->add_label('enigma.keygenerating', 'enigma.formerror', 'enigma.passwordsdiffer', 'enigma.keygenerateerror', 'enigma.nonameident', 'enigma.keygennosupport'); return $this->rc->output->form_tag(array(), $table->show($attrib)); }
function settings_table($args) { if ($args['section'] == 'mailbox') { $a_list_cols = rcmail::get_instance()->config->get('list_cols'); $args['blocks']['roworder']['name'] = Q($this->gettext('roworder', 'msglistcols')); for ($i = 0; $i < 9; $i++) { $field_id = 'rcmfd_list_col' . $i; $select_col = new html_select(array('name' => '_list_cols[]', 'id' => $field_id)); $select_col->add(rcube_label('skip', 'msglistcols'), ''); $select_col->add(rcube_label('subject'), 'subject'); $select_col->add(rcube_label('from'), 'from'); $select_col->add(rcube_label('to'), 'to'); $select_col->add(rcube_label('cc'), 'cc'); $select_col->add(rcube_label('replyto'), 'replyto'); $select_col->add(rcube_label('date'), 'date'); $select_col->add(rcube_label('size'), 'size'); $select_col->add(rcube_label('flagged', 'msglistcols'), 'flag'); $select_col->add(rcube_label('attachment', 'msglistcols'), 'attachment'); $args['blocks']['roworder']['options']['listcol_' . $i]['title'] = Q($this->gettext('list_col_' . $i, 'msglistcols')); if (!empty($a_list_cols[$i])) { $selected = $a_list_cols[$i]; } else { $selected = ""; } $args['blocks']['roworder']['options']['listcol_' . $i]['content'] = $select_col->show($selected); unset($select_col); } } return $args; }
/** * Create a HTML dropdown to select a previous version of Roundcube */ function versions_select($attrib = array()) { $select = new html_select($attrib); $select->add(array('0.1-stable', '0.1.1', '0.2-alpha', '0.2-beta', '0.2-stable', '0.3-stable', '0.3.1', '0.4-beta', '0.4.2', '0.5-beta', '0.5', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.6-beta', '0.6', '0.7-beta', '0.7', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.8-beta', '0.8-rc', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.9-beta', '0.9-rc', '0.9-rc2')); return $select; }
<dt class="propname">mdn_requests <span class="userconf">*</span></dt> <dd> <?php $mdn_opts = array(0 => 'ask the user', 1 => 'send automatically', 3 => 'send receipt to user contacts, otherwise ask the user', 4 => 'send receipt to user contacts, otherwise ignore', 2 => 'ignore'); $select_mdnreq = new html_select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq")); $select_mdnreq->add(array_values($mdn_opts), array_keys($mdn_opts)); echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests'))); ?> <div>Behavior if a received message requests a message delivery notification (read receipt)</div> </dd> <dt class="propname">mime_param_folding <span class="userconf">*</span></dt> <dd> <?php $select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => "cfgmimeparamfolding")); $select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0'); $select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1'); $select_param_folding->add('Full RFC 2047 (deprecated)', '2'); echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding'))); ?> <div>How to encode attachment long/non-ascii names</div> </dd> </dl> <p class="hint"><span class="userconf">*</span> These settings are defaults for the user preferences</p> </fieldset> <fieldset>