本文整理汇总了PHP中html_table::add_row方法的典型用法代码示例。如果您正苦于以下问题:PHP html_table::add_row方法的具体用法?PHP html_table::add_row怎么用?PHP html_table::add_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_table
的用法示例。
在下文中一共展示了html_table::add_row方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: table_output
/**
* Create a HTML table based on the given data
*
* @param array Named table attributes
* @param mixed Table row data. Either a two-dimensional array or a valid SQL result set
* @param array List of cols to show
* @param string Name of the identifier col
*
* @return string HTML table code
*/
public function table_output($attrib, $table_data, $a_show_cols, $id_col)
{
$table = new html_table($attrib);
// add table header
if (!$attrib['noheader']) {
foreach ($a_show_cols as $col) {
$table->add_header($col, $this->Q($this->gettext($col)));
}
}
if (!is_array($table_data)) {
$db = $this->get_dbh();
while ($table_data && ($sql_arr = $db->fetch_assoc($table_data))) {
$table->add_row(array('id' => 'rcmrow' . rcube_utils::html_identifier($sql_arr[$id_col])));
// format each col
foreach ($a_show_cols as $col) {
$table->add($col, $this->Q($sql_arr[$col]));
}
}
} else {
foreach ($table_data as $row_data) {
$class = !empty($row_data['class']) ? $row_data['class'] : null;
if (!empty($attrib['rowclass'])) {
$class = trim($class . ' ' . $attrib['rowclass']);
}
$rowid = 'rcmrow' . rcube_utils::html_identifier($row_data[$id_col]);
$table->add_row(array('id' => $rowid, 'class' => $class));
// format each col
foreach ($a_show_cols as $col) {
$val = is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col];
$table->add($col, empty($attrib['ishtml']) ? $this->Q($val) : $val);
}
}
}
return $table->show($attrib);
}
示例2: sprintf
//.........这里部分代码省略.........
// Autoresponder
$out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n";
$out .= '<div class="fieldset-content">';
$out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
$field_id = 'on_vacation';
$input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1));
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), '');
$field_id = 'vacation';
$input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea'));
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>');
$out .= '</table>';
$out .= '</div></fieldset>' . "\n\n";
// =====================================================================================================
// Forward
$out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n";
$out .= '<div class="fieldset-content">';
$out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
$field_id = 'on_forward';
$input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1));
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0));
$field_id = 'forward';
$input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward));
$field_id = 'unseen';
$input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1));
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0));
$out .= '</table>';
$out .= '</div></fieldset>' . "\n\n";
// =====================================================================================================
// Header blocks (based on code from Philip Weir's sauserprefs plugin
// http://roundcube.net/plugins/sauserprefs)
$out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n";
$out .= '<div class="fieldset-content">';
$out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>';
$table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3));
$field_id = 'rcmfd_headerblockrule';
$input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id));
$input_headerblockrule->add($this->gettext('headerfrom'), 'From');
$input_headerblockrule->add($this->gettext('headerto'), 'To');
$input_headerblockrule->add($this->gettext('headersubject'), 'Subject');
$input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer');
$field_id = 'rcmfd_headerblockvalue';
$input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;'));
$field_id = 'rcmbtn_add_address';
$button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;'));
$table->add(null, $input_headerblockrule->show());
$table->add(null, $input_headerblockvalue->show());
$table->add(array('align' => 'right'), $button_addaddress);
$delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall'));
$table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all);
$table->add_row();
$address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
$address_table->add_header(array('width' => '120px'), $this->gettext('field'));
$address_table->add_header(null, $this->gettext('value'));
$address_table->add_header(array('width' => '40px'), ' ');
$this->_address_row($address_table, null, null, $attrib);
// Get the header rules from DB. Should probably be put in a function.
$this->_load_config();
$this->_db_connect('r');
$sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t FROM blocklists\r\n\t\t WHERE user_id = '{$user_id}'\r\n\t\t AND domain_id = '{$domain_id}'\r\n\t\t ORDER BY block_id;");
if ($sql_result && $this->db->num_rows($sql_result) > 0) {
$norules = 'display: none;';
}
$address_table->set_row_attribs(array('style' => $norules));
$address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules')));
$address_table->add_row();
$this->api->output->set_env('address_rule_count', $this->db->num_rows());
while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
$field = $sql_arr['blockhdr'];
$value = $sql_arr['blockval'];
$this->_address_row($address_table, $field, $value, $attrib);
}
$table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show()));
$table->add_row();
if ($table->size()) {
$out .= $table->show();
}
$out .= '</div></fieldset>' . "\n\n";
// =====================================================================================================
// Parameters
$out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n";
$out .= '<div class="fieldset-content">';
$out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
$field_id = 'maxmsgsize';
$input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4));
if ($default_maxmsgsize == 0) {
$default_maxmsgsize = $this->gettext('unlimited');
} else {
$default_maxmsgsize = $default_maxmsgsize . ' kb';
}
$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>');
$out .= '</table>';
$out .= '</div></fieldset>' . "\n\n";
// =====================================================================================================
$out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
$rcmail->output->add_gui_object('veximform', 'veximaccountadminform');
$out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out);
$out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom));
return $out;
}
示例3: list_rights
/**
* Creates ACL rights table
*
* @param array $attrib Template object attributes
*
* @return string HTML Content
*/
private function list_rights($attrib = array())
{
// Get ACL for the folder
$acl = $this->rc->storage->get_acl($this->mbox);
if (!is_array($acl)) {
$acl = array();
}
// Keep special entries (anyone/anonymous) on top of the list
if (!empty($this->specials) && !empty($acl)) {
foreach ($this->specials as $key) {
if (isset($acl[$key])) {
$acl_special[$key] = $acl[$key];
unset($acl[$key]);
}
}
}
// Sort the list by username
uksort($acl, 'strnatcasecmp');
if (!empty($acl_special)) {
$acl = array_merge($acl_special, $acl);
}
// Get supported rights and build column names
$supported = $this->rights_supported();
// depending on server capability either use 'te' or 'd' for deleting msgs
$deleteright = implode(array_intersect(str_split('ted'), $supported));
// Use advanced or simple (grouped) rights
$advanced = $this->rc->config->get('acl_advanced_mode');
if ($advanced) {
$items = array();
foreach ($supported as $sup) {
$items[$sup] = $sup;
}
} else {
$items = array('read' => 'lrs', 'write' => 'wi', 'delete' => $deleteright, 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode($supported)));
}
// Create the table
$attrib['noheader'] = true;
$table = new html_table($attrib);
// Create table header
$table->add_header('user', $this->gettext('identifier'));
foreach (array_keys($items) as $key) {
$label = $this->gettext('shortacl' . $key);
$table->add_header(array('class' => 'acl' . $key, 'title' => $label), $label);
}
$js_table = array();
foreach ($acl as $user => $rights) {
if ($this->rc->storage->conn->user == $user) {
continue;
}
// filter out virtual rights (c or d) the server may return
$userrights = array_intersect($rights, $supported);
$userid = rcube_utils::html_identifier($user);
if (!empty($this->specials) && in_array($user, $this->specials)) {
$user = $this->gettext($user);
}
$table->add_row(array('id' => 'rcmrow' . $userid));
$table->add('user', rcube::Q($user));
foreach ($items as $key => $right) {
$in = $this->acl_compare($userrights, $right);
switch ($in) {
case 2:
$class = 'enabled';
break;
case 1:
$class = 'partial';
break;
default:
$class = 'disabled';
break;
}
$table->add('acl' . $key . ' ' . $class, '');
}
$js_table[$userid] = implode($userrights);
}
$this->rc->output->set_env('acl', $js_table);
$this->rc->output->set_env('acl_advanced', $advanced);
$out = $table->show();
return $out;
}
示例4: vacation_sieve_form
public function vacation_sieve_form()
{
try {
$table = new html_table(array('cols' => 2, 'class' => 'propform'));
$format = $this->app->config->get('date_format');
# Options
$table->add(array('colspan' => 2, 'class' => 'section-first'), Q($this->gettext('options')));
$table->add_row();
$field_id = 'vacation_enable';
$input_vacationenable = new html_checkbox(array('name' => '_vacation_enable', 'id' => $field_id, 'value' => 1));
$table->add('title', html::label($field_id, Q($this->gettext('vacationenable'))));
$table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() ? 1 : 0));
$field_id = 'vacation_start';
$input_vacationstart = new html_inputfield(array('name' => '_vacation_start', 'id' => $field_id, 'size' => 10));
$table->add('title', html::label($field_id, Q($this->gettext('period'))));
$vacStart = $this->obj->get_vacation_start();
$hour_text = array();
$hour_value = array();
$wholeDay = Q($this->gettext('wholeday'));
$hour_value[$wholeDay] = '';
$hour_text[$wholeDay] = $wholeDay;
$minHour = $this->config['working_hours'][0];
$maxHour = $this->config['working_hours'][1];
foreach (range($minHour, $maxHour) as $tmp_hour) {
$hour_text[$tmp_hour] = sprintf("%02d:00", $tmp_hour);
$hour_value[$tmp_hour] = $tmp_hour;
}
unset($tmp_hour);
$field_id = 'vacation_starttime';
$input_vacationstarttime = new html_select(array('name' => '_vacation_starttime'));
$input_vacationstarttime->add($hour_text, $hour_value);
$field_id = 'vacation_endtime';
$input_vacationendtime = new html_select(array('name' => '_vacation_endtime'));
$input_vacationendtime->add($hour_text, $hour_value);
$field_id = 'vacation_end';
$input_vacationend = new html_inputfield(array('name' => '_vacation_end', 'id' => $field_id, 'size' => 10));
$vacEnd = $this->obj->get_vacation_end();
$periodFields = $this->gettext('vacationfrom') . ' ' . $input_vacationstart->show(date($format, $vacStart)) . ' ' . $input_vacationstarttime->show($hour_text[$this->obj->get_vacation_starttime()]) . ' ' . $this->gettext('vacationto') . ' ' . $input_vacationend->show(date($format, $vacEnd)) . ' ' . $input_vacationendtime->show($hour_text[$this->obj->get_vacation_endtime()]);
$table->add(null, $periodFields);
$table->add_row();
$field_id = 'every';
$input_every = new html_inputfield(array('name' => '_every', 'id' => $field_id, 'size' => 5));
$table->add('title', html::label($field_id, Q($this->gettext('frequency'))));
$table->add(null, $this->gettext('answer_no_more_than_every') . ' ' . $input_every->show($this->obj->get_every()) . ' ' . $this->gettext('vacationdays'));
$table->add_row();
$identities = $this->get_identities();
$default_identity = key($identities);
$field_id = 'addressed_to';
$input_addressed_to = new html_select(array('name' => '_addressed_to[]', 'id' => $field_id, 'multiple' => true));
$input_addressed_to->add($identities);
$addressedTo = $this->obj->get_addressed_to();
$table->add('title', html::label($field_id, Q($this->gettext('addressed_to'))));
$table->add(null, $input_addressed_to->show($addressedTo ? $addressedTo : $default_identity));
# Subject field
$table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('subject')));
$table->add_row();
$field_id = 'vacation_subject';
$input_vacationsubject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => 40));
$table->add('title', html::label($field_id, Q($this->gettext('vacationsubject'))));
$table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject()));
$table->add_row();
$field_id = '_append_subject';
$input_appendsubject = new html_checkbox(array('name' => '_append_subject', 'id' => $field_id, 'value' => 1));
$table->add('title', html::label($field_id, Q($this->gettext('append_subject'))));
$table->add(null, $input_appendsubject->show($this->obj->get_append_subject() ? 1 : 0));
# Message
$table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('vacationmessage')));
$table->add_row();
$field_id = 'send_from';
$input_sendfrom = new html_select(array('name' => '_send_from', 'id' => $field_id));
$input_sendfrom->add($identities);
$sendFrom = $this->obj->get_send_from();
$table->add('title', html::label($field_id, Q($this->gettext('send_from'))));
$table->add(null, $input_sendfrom->show($sendFrom ? $sendFrom : $default_identity));
# Add the HTML Row
$table->add_row();
$field_id = 'vacation_message';
if ($this->config['msg_format'] == 'html') {
$this->app->output->add_label('converting', 'editorwarning');
rcube_html_editor('identity');
$text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40, 'class' => 'mce_editor'));
} else {
$text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40));
}
#
$table->add('top title', html::label($field_id, Q($this->gettext('vacationmessage'))));
$table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message()));
# Get the HTML
$tableHtml = $table->show();
$submitLine = html::p(null, $this->app->output->button(array('command' => 'plugin.vacation_sieve-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
# First line
$boxTitle = html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation'));
$out = html::div(array('class' => 'box'), $boxTitle . html::div(array('class' => "boxcontent"), $tableHtml . $submitLine));
$this->app->output->add_gui_object('vacationsieveform', 'vacation_sieve_form');
return $this->app->output->form_tag(array('id' => 'vacation_sieve_form', 'name' => 'vacation_sieve_form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation_sieve-save'), $out);
} catch (Exception $exc) {
$this->log_error('Fail to build form: ' . $exc->getMessage());
}
}
示例5: _action_row
//.........这里部分代码省略.........
if ($this->show_vacfrom && in_array('variables', $ext)) {
$select_id->add(Q($this->gettext('autodetect')), "auto");
} elseif (!$this->show_vacfrom) {
$select_id->add(Q($this->gettext('autodetect')), "");
}
foreach ($user_identities as $sql_arr) {
$select_id->add($sql_arr['email'], $sql_arr['email']);
$ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id'];
if ($this->force_vacto) {
$curaddress = $sql_arr['email'];
$vacto .= (!empty($vacto) ? ',' : '') . $sql_arr['email'];
} else {
$curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : "";
}
$input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox'));
$to_addresses .= $input_address->show($curaddress) . " " . html::label($ffield_id, Q($sql_arr['email'])) . "<br />";
}
}
if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) {
$vacs_table->set_row_attribs(array('class' => $vacadvclass_from, 'style' => $vacadvstyle_from));
$vacs_table->add(null, html::label($field_id, Q($this->gettext('from'))));
$vacs_table->add(null, $select_id->show($vacfrom));
$sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' '));
$vacs_table->add(null, $sig_button);
$field_id = 'rcmfd_sievevacto_' . $rowid;
$input_vacto = new html_hiddenfield(array('id' => $field_id, 'name' => '_vacto[]', 'value' => $vacto));
$vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $vacadvstyle));
$vacs_table->add(array('style' => 'vertical-align: top;'), Q($this->gettext('sieveto')));
$vacs_table->add(null, $to_addresses . $input_vacto->show());
$help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
$vacs_table->add(array('style' => 'vertical-align: top;'), $help_button);
$vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;'));
$vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vactoexp'));
$vacs_table->add_row();
} else {
$field_id = 'rcmfd_sievevacfrom_' . $rowid;
$input_vacfrom = new html_inputfield(array('id' => $field_id, 'name' => '_vacfrom[]'));
$vacs_table->set_row_attribs(array('class' => $vacadvclass_from, 'style' => $vacadvstyle_from));
$vacs_table->add(null, html::label($field_id, Q($this->gettext('from'))));
$vacs_table->add(null, $input_vacfrom->show($vacfrom));
$sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' '));
$vacs_table->add(null, $sig_button);
$field_id = 'rcmfd_sievevacto_' . $rowid;
$input_vacto = new html_inputfield(array('id' => $field_id, 'name' => '_vacto[]', 'class' => 'short'));
$vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $vacadvstyle));
$vacs_table->add(null, html::label($field_id, Q($this->gettext('sieveto'))));
$vacs_table->add(null, $input_vacto->show($vacto));
$help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
$vacs_table->add(null, $help_button);
$vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;'));
$vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv'));
$vacs_table->add_row();
}
$field_id = 'rcmfd_sievevacdays_' . $rowid;
$input_day = new html_inputfield(array('id' => $field_id, 'name' => '_day[]', 'class' => 'short'));
$vacs_table->add(null, html::label($field_id, Q($this->gettext('days'))));
$vacs_table->add(null, $input_day->show($days));
$help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
$vacs_table->add(null, $help_button);
$vacs_table->set_row_attribs(array('style' => 'display: none;'));
$vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vacdaysexp'));
$vacs_table->add_row();
$field_id = 'rcmfd_sievevachandle_' . $rowid;
$input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short'));
$vacs_table->set_row_attribs(array('class' => $vacadvclass_handle, 'style' => $vacadvstyle_handle));
$vacs_table->add(null, html::label($field_id, Q($this->gettext('sievevachandle'))));
示例6: _prefs_block
private function _prefs_block($part, $attrib)
{
$rcmail = rcmail::get_instance();
$no_override = array_flip($rcmail->config->get('sauserprefs_dont_override'));
$locale_info = localeconv();
switch ($part) {
// General tests
case 'general':
$out = '';
$data = '';
if (!isset($no_override['required_hits'])) {
$field_id = 'rcmfd_spamthres';
$input_spamthres = new html_select(array('name' => '_spamthres', 'id' => $field_id));
$input_spamthres->add($this->gettext('defaultscore'), '');
$decPlaces = 0;
if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
$decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
}
$score_found = false;
for ($i = 1; $i <= 10; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
$input_spamthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
if (!$score_found && $this->user_prefs['required_hits'] && (double) $this->user_prefs['required_hits'] == (double) $i) {
$score_found = true;
}
}
if (!$score_found && $this->user_prefs['required_hits']) {
$input_spamthres->add(str_replace('%s', $this->user_prefs['required_hits'], $this->gettext('otherscore')), (double) $this->user_prefs['required_hits']);
}
$table = new html_table(array('class' => 'generalprefstable', 'cols' => 2));
$table->add('title', html::label($field_id, Q($this->gettext('spamthres'))));
$table->add(null, $input_spamthres->show(number_format($this->user_prefs['required_hits'], $decPlaces, '.', '')));
$data = $table->show() . Q($this->gettext('spamthresexp')) . '<br /><br />';
}
if (!isset($no_override['rewrite_header Subject'])) {
$table = new html_table(array('class' => 'generalprefstable', 'cols' => 2));
$field_id = 'rcmfd_spamsubject';
$input_spamsubject = new html_inputfield(array('name' => '_spamsubject', 'id' => $field_id, 'value' => $this->user_prefs['rewrite_header Subject'], 'style' => 'width:200px;'));
$table->add('title', html::label($field_id, Q($this->gettext('spamsubject'))));
$table->add(null, $input_spamsubject->show());
$table->add(null, " ");
$table->add(null, Q($this->gettext('spamsubjectblank')));
$data .= $table->show();
}
if (!empty($data)) {
$out .= html::tag('fieldset', null, html::tag('legend', null, Q($this->gettext('mainoptions'))) . $data);
}
if (!isset($no_override['ok_languages']) || !isset($no_override['ok_locales'])) {
$data = html::p(null, Q($this->gettext('spamlangexp')));
$table = new html_table(array('class' => 'langprefstable', 'cols' => 2));
$select_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_all_langs', 'type' => 'link', 'label' => 'all'));
$select_none = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_no_langs', 'type' => 'link', 'label' => 'none'));
$select_invert = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_invert_langs', 'type' => 'link', 'label' => 'invert'));
$table->add(array('colspan' => 2, 'id' => 'listcontrols'), $this->gettext('select') . ": " . $select_all . " " . $select_invert . " " . $select_none);
$table->add_row();
$lang_table = new html_table(array('id' => 'spam-langs-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
$lang_table->add_header(array('colspan' => 2), $this->gettext('language'));
if (!isset($no_override['ok_locales'])) {
if ($this->user_prefs['ok_locales'] == "all") {
$ok_locales = $this->sa_locales;
} else {
$ok_locales = explode(" ", $this->user_prefs['ok_locales']);
}
} else {
$ok_locales = array();
}
if (!isset($no_override['ok_languages'])) {
if ($this->user_prefs['ok_languages'] == "all") {
$ok_languages = array_keys($rcmail->config->get('sauserprefs_languages'));
} else {
$ok_languages = explode(" ", $this->user_prefs['ok_languages']);
}
} else {
$tmp_array = $rcmail->config->get('sauserprefs_languages');
$rcmail->config->set('sauserprefs_languages', array_intersect_key($tmp_array, array_flip($this->sa_locales)));
$ok_languages = array();
}
$i = 0;
$locales_langs = array_merge($ok_locales, $ok_languages);
foreach ($rcmail->config->get('sauserprefs_languages') as $lang_code => $name) {
if (in_array($lang_code, $locales_langs)) {
$button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'enabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.enabled', 'content' => ' '));
} else {
$button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'disabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.disabled', 'content' => ' '));
}
$input_spamlang = new html_checkbox(array('style' => 'display: none;', 'name' => '_spamlang[]', 'value' => $lang_code));
$lang_table->add('lang', $name);
$lang_table->add('tick', $button . $input_spamlang->show(in_array($lang_code, $locales_langs) ? $lang_code : ''));
$i++;
}
$table->add(array('colspan' => 2), html::div(array('id' => 'spam-langs-cont'), $lang_table->show()));
$table->add_row();
$out .= html::tag('fieldset', null, html::tag('legend', null, Q($this->gettext('langoptions'))) . $data . $table->show());
}
break;
// Header settings
// Header settings
case 'headers':
$data = html::p(null, Q($this->gettext('headersexp')));
if (!isset($no_override['fold_headers'])) {
$help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
//.........这里部分代码省略.........
示例7: array
/**
* Label list to folder list menu and set flags in imap conn
*
* @access public
*/
function folder_list_label($args)
{
$args['content'] .= html::div(array('id' => 'labels-title', 'class' => 'boxtitle label_header_menu'), $this->gettext('label_title') . html::tag('span', array('class' => 'drop_arrow'), ''));
$prefs = $this->rc->config->get('message_label', array());
if (!strlen($attrib['id'])) {
$attrib['id'] = 'labellist';
}
$display_label = $this->rc->config->get('message_label_display');
if ($display_label == 'false') {
$style = 'display: none;';
}
if (count($prefs) > 0) {
$table = new html_table($attrib);
foreach ($prefs as $p) {
$table->add_row(array('id' => 'rcmrow' . $p['id'], 'class' => 'labels_row'));
$table->add(array('class' => 'labels_color'), html::tag('span', array('class' => 'lmessage', 'style' => 'background-color:' . $p['color']), ''));
$table->add(array('class' => 'labels_name'), $p['text']);
}
$args['content'] .= html::div(array('class' => 'lmenu', 'id' => 'drop_labels', 'style' => $style), $table->show($attrib));
} else {
$args['content'] .= html::div('lmenu', html::a(array('href' => '#', 'onclick' => 'return rcmail.command(\'plugin.label_redirect\',\'true\',true)'), $this->gettext('label_create')));
}
$flags = array();
foreach ($prefs as $prefs_val) {
$flags += array(strtoupper($prefs_val['id']) => '$labels_' . $prefs_val['id']);
}
$this->rc->imap->conn->flags = array_merge($this->rc->imap->conn->flags, $flags);
//write_log('debug', preg_replace('/\r\n$/', '', print_r($this->rc->imap->conn->flags,true)));
// add id to message label table if not specified
$this->rc->output->add_gui_object('labellist', $attrib['id']);
return $args;
}
示例8: Q
function filters_form()
{
$this->rc->imap_connect();
$table = new html_table(array('cols' => 4));
$table->add('title', Q($this->gettext('whatfilter') . ":"));
$select = new html_select(array('name' => '_whatfilter', 'id' => 'whatfilter'));
$select->add($this->gettext('from'), 'from');
$select->add($this->gettext('to'), 'to');
$select->add($this->gettext('cc'), 'cc');
$select->add($this->gettext('subject'), 'subject');
$table->add('', $select->show($this->gettext('from')));
$table->add_row();
$table->add('title', Q($this->gettext('searchstring') . ":"));
$inputfield = new html_inputfield(array('name' => '_searchstring', 'id' => 'searchstring'));
$table->add('', $inputfield->show(""));
$table->add('title', Q($this->gettext('casesensitive') . ":"));
$checkbox = new html_checkbox(array('name' => '_casesensitive', 'id' => 'casesensitive', 'value' => '1'));
$casesensitive = $this->rc->config->get('caseInsensitiveSearch', true);
$table->add('', $checkbox->show($casesensitive ? 1 : 0));
$table->add_row();
$table->add('title', Q($this->gettext('moveto') . ":"));
$select = rcmail_mailbox_select(array('name' => '_folders', 'id' => 'folders'));
$table->add('title', $select->show());
$table->add_row();
# new option: all, read and unread messages
$table->add('title', Q($this->gettext('messagecount') . ":"));
$select = new html_select(array('name' => '_messages', 'id' => 'messages'));
$select->add($this->gettext('all'), 'all');
$select->add($this->gettext('unread'), 'unread');
$select->add($this->gettext('markread'), 'markread');
$table->add('', $select->show($this->gettext('all')));
// get mailbox list
$a_folders = $this->rc->imap->list_mailboxes('', '*');
$delimiter = $this->rc->imap->get_hierarchy_delimiter();
$a_mailboxes = array();
foreach ($a_folders as $folder) {
rcmail_build_folder_tree($a_mailboxes, $folder, $delimiter);
}
// load saved filters
$user = $this->rc->user;
$arr_prefs = $user->get_prefs();
$i = 1;
$flag = false;
$table2 = new html_table(array('cols' => 2));
//To prevent PHP Warning when no filter already set
if (!empty($arr_prefs['filters'])) {
foreach ($arr_prefs['filters'] as $key => $saved_filter) {
$flag = true;
$folder_id = $saved_filter['destfolder'];
$folder_name = "";
if (strtoupper($folder_id) == 'INBOX') {
$folder_name = rcube_label('inbox');
} else {
foreach ($a_mailboxes as $folder => $vet) {
if ($vet['id'] == $folder_id) {
$folder_name = $vet['name'];
break;
}
}
}
$messages = $saved_filter['messages'];
$msg = $i . " - " . $this->gettext('msg_if_field') . " <b>" . $this->gettext($saved_filter['whatfilter']) . "</b> " . $this->gettext('msg_contains') . " <b>" . $saved_filter['searchstring'] . "</b> " . ($saved_filter['casesensitive'] == '1' ? $this->gettext('msg_and_is') . " <b>" . $this->gettext('casesensitive') . "</b> " : "") . $this->gettext('msg_move_msg_in') . " <b>" . $folder_name . "</b> " . "(" . $this->gettext('messagecount') . ": " . $this->gettext($saved_filter['messages']) . ")";
$table2->add('title', $msg);
$dlink = "<a href='./?_task=settings&_action=plugin.filters-delete&filterid=" . $key . "'>" . $this->gettext('delete') . "</a>";
$table2->add('title', $dlink);
$i++;
}
}
if (!$flag) {
$table2->add('title', Q($this->gettext('msg_no_stored_filters')));
}
$out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('filters')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.filters-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
$out .= html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('storedfilters')) . html::div(array('class' => 'uibox listbox scroller', 'style' => 'margin-top:205px;'), html::div(array('class' => 'boxcontent'), $table2->show()));
$this->rc->output->add_gui_object('filtersform', 'filters-form');
return $this->rc->output->form_tag(array('id' => 'filters-form', 'name' => 'filters-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.filters-save'), $out);
}