本文整理汇总了PHP中html::table方法的典型用法代码示例。如果您正苦于以下问题:PHP html::table方法的具体用法?PHP html::table怎么用?PHP html::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render
*
* @param object $object
* @return string
*/
public static function render($object)
{
$input = $object->options['input'];
$filter = $object->filter;
$full_text_search = $filter['full_text_search'] ?? null;
unset($filter['full_text_search']);
// generating form
$table = ['header' => ['name' => i18n(null, 'Column'), 'value' => i18n(null, 'Value'), 'sep' => ' ', 'value2' => ' '], 'options' => []];
// fields
foreach ($filter as $k => $v) {
if (!empty($v['range'])) {
$table['options'][$k] = ['name' => ['value' => i18n(null, $v['name']) . ':', 'width' => '25%', 'class' => 'list_filter_name'], 'value' => ['value' => self::render_column($v, $k, false, $input), 'width' => '30%'], 'sep' => ['value' => '—', 'width' => '1%', 'class' => 'list_filter_value'], 'value2' => ['value' => self::render_column($v, $k, true, $input), 'width' => '30%']];
} else {
$table['options'][$k] = ['name' => ['value' => i18n(null, $v['name']) . ':', 'width' => '25%', 'class' => 'list_filter_name'], 'value' => ['value' => self::render_column($v, $k, false, $input), 'width' => '30%']];
}
}
// full text search last
if (!empty($full_text_search)) {
$names = [];
foreach ($full_text_search as $v) {
$names[] = i18n(null, $filter[$v]['name']);
}
$table['options']['full_text_search'] = ['name' => ['value' => i18n(null, 'Text Search') . ':', 'class' => 'list_filter_name'], 'value' => ['value' => html::input(['name' => 'filter[full_text_search]', 'class' => 'list_filter_full_text_search', 'size' => 15, 'value' => $input['filter']['full_text_search'] ?? null])], 'value2' => ['value' => implode(', ', $names), 'class' => 'list_filter_value']];
}
$body = html::table($table);
$footer = html::button2(['name' => 'submit_filter', 'value' => i18n(null, 'Submit'), 'type' => 'primary', 'onclick' => "numbers.modal.hide('list_{$object->list_link}_filter'); \$('#list_{$object->list_link}_form').attr('target', '_self'); \$('#list_{$object->list_link}_form').attr('no_ajax', ''); return true;"]);
return html::modal(['id' => "list_{$object->list_link}_filter", 'class' => 'large', 'title' => i18n(null, 'Filter'), 'body' => $body, 'footer' => $footer]);
}
示例2: render
/**
* Render
*
* @param object $object
* @return string
*/
public static function render($object)
{
$input = $object->options['input'];
// generating form
$table = ['header' => ['column' => i18n(null, 'Column'), 'value' => i18n(null, 'Value')], 'options' => [], 'skip_header' => 1];
$model = new object_content_exports();
$table['options'][0]['column'] = ['value' => i18n(null, 'Format') . ':', 'width' => '1%', 'nowrap' => true, 'class' => 'list_filter_name'];
$table['options'][0]['value']['value'] = html::select(['id' => 'export_format', 'name' => 'export[format]', 'options' => $model->options(['i18n' => true]), 'value' => $input['export']['format'] ?? null]);
$body = html::table($table);
$footer = html::button2(['name' => 'submit_export', 'value' => i18n(null, 'Submit'), 'type' => 'primary', 'onclick' => "if (\$('#export_format').val() == 'html2') { \$('#list_{$object->list_link}_form').attr('target', '_blank'); } else { \$('#list_{$object->list_link}_form').attr('target', '_self'); } \$('#list_{$object->list_link}_form').attr('no_ajax', 1); numbers.modal.hide('list_{$object->list_link}_export'); return true;"]);
return html::modal(['id' => "list_{$object->list_link}_export", 'class' => '', 'title' => i18n(null, 'Export/Print'), 'body' => $body, 'footer' => $footer]);
}
示例3: buildTable
private function buildTable($data)
{
$id = uniqid('table');
$tvpag = <<<EOT
function table_setpage(tableid,page) {
alert('Set page ' + page);
}
EOT;
App::document()->addInlineScript($tvpag, 'text/javascript', 'tableview-pagination');
$hc = empty($this->options['header-columns']) ? 0 : $this->options['header-columns'];
$hr = empty($this->options['header-rows']) ? 0 : $this->options['header-rows'];
$rows = [];
$ri = 0;
$ipp = $this->options['items-per-page'];
foreach ($data as $row) {
$ri++;
$ci = 0;
$cols = [];
foreach ($row as $col) {
$ci++;
if ($ci <= $hc || $ri <= $hr) {
$cols[] = html::th($col);
} else {
$cols[] = html::td($col);
}
}
$rows[] = html::tr(join($cols));
if ($ipp && $ri > $ipp) {
break;
}
}
$table = html::table(join($rows), ['class' => $this->options['table-class'], 'style' => 'width:100%;']);
if ($ipp) {
$page = 0;
$numpages = floor((count($data) - 1) / $ipp) + 1;
$pagelinks = html::a(' « First ', ['href' => 'javascript:return false;']);
$pagelinks .= html::a(' ‹ Prev ', ['href' => 'javascript:return false;']);
for ($n = 1; $n <= $numpages; $n++) {
$pagelinks .= html::a(' {page} ', ['href' => 'javascript:return false;'], ['page' => $n]);
}
$pagelinks .= html::a(' Next › ', ['href' => 'javascript:return false;']);
$pagelinks .= html::a(' Last » ', ['href' => 'javascript:return false;']);
$table .= html::div('Page {page} of {pages} ({items} items) {links}', ['class' => $this->options['footer-class']], ['page' => $page + 1, 'pages' => $numpages, 'items' => count($data), 'links' => $pagelinks]);
}
return html::div($table, ['style' => 'width:99%']);
}
示例4: render
/**
* Render
*
* @param object $object
* @return string
*/
public static function render($object)
{
$input = $object->options['input'];
if (empty($input['sort'])) {
$i = 0;
foreach ($object->orderby as $k => $v) {
$input['sort'][$i]['column'] = $k;
$input['sort'][$i]['order'] = $v;
$i++;
}
}
// generating form
$table = ['header' => ['row_number' => ' ', 'column' => i18n(null, 'Column'), 'order' => i18n(null, 'Order')], 'options' => []];
$order_model = new object_data_model_order();
$columns = [];
// we need to skip certain columns
foreach ($object->columns as $k => $v) {
if (!in_array($k, ['row_number', 'offset_number', 'action'])) {
$v['name'] = i18n(null, $v['name']);
$columns[$k] = $v;
}
}
// full text search goes last
if (!empty($object->filter['full_text_search'])) {
$columns['full_text_search'] = ['name' => i18n(null, 'Text Search')];
}
// render 5 rows
for ($i = 0; $i < 5; $i++) {
if (empty($input['sort'][$i]['column'])) {
$input['sort'][$i]['order'] = SORT_ASC;
}
$column = html::select(['id' => 'sort_' . $i . '_column', 'name' => 'sort[' . $i . '][column]', 'options' => $columns, 'value' => $input['sort'][$i]['column'] ?? null]);
$order = html::select(['id' => 'sort_' . $i . '_order', 'name' => 'sort[' . $i . '][order]', 'no_choose' => true, 'options' => $order_model->options(['i18n' => true]), 'value' => $input['sort'][$i]['order'] ?? null]);
$table['options'][$i] = ['row_number' => ['value' => format::id($i + 1) . '.', 'width' => '1%', 'align' => 'right'], 'column' => ['value' => $column, 'width' => '25%', 'class' => 'list_sort_name'], 'order' => ['value' => $order, 'width' => '30%']];
}
$body = html::table($table);
$footer = html::button2(['name' => 'submit_sort', 'value' => i18n(null, 'Submit'), 'type' => 'primary', 'onclick' => "numbers.modal.hide('list_{$object->list_link}_sort'); \$('#list_{$object->list_link}_form').attr('target', '_self'); \$('#list_{$object->list_link}_form').attr('no_ajax', ''); return true;"]);
return html::modal(['id' => "list_{$object->list_link}_sort", 'class' => 'large', 'title' => i18n(null, 'Sort'), 'body' => $body, 'footer' => $footer]);
}
示例5: render
/**
* Render debug toolbar
*
* @return string
*/
public static function render()
{
$loaded_classes = application::get(['application', 'loaded_classes']);
self::$data['session'] = [];
if (!empty($_SESSION)) {
self::$data['session'] = [$_SESSION];
}
$application = application::get();
$result = '<div class="container" dir="ltr">';
$result .= '<table cellpadding="2" cellspacing="2" width="100%">';
$result .= '<tr>';
$result .= '<td>';
$result .= '<table width="100%">';
$result .= '<tr>';
$result .= '<td nowrap> ' . html::a(['value' => 'Hide All', 'href' => 'javascript:void(0);', 'onclick' => "\$('.debuging_toolbar_class').hide();"]) . ' </td>';
foreach (self::$data as $k => $v) {
if ($k == 'errors') {
$count = count(error_base::$errors);
} else {
if ($k == 'classes') {
$count = count($loaded_classes);
} else {
if ($k == 'application') {
$count = count($application);
} else {
if ($k == 'phpinfo') {
$count = 1;
} else {
$count = count($v);
}
}
}
}
$result .= '<td nowrap> ' . html::a(['value' => ucwords($k) . ' (' . $count . ')', 'id' => "debuging_toolbar_{$k}_a", 'href' => 'javascript:void(0);', 'onclick' => "\$('#debuging_toolbar_{$k}').toggle();"]) . ' </td>';
}
$result .= '<td width="50%" align="right">' . html::a(['href' => '/numbers/frontend/system/controller/dev', 'value' => 'Dev. Portal']) . '</td>';
$result .= '</tr>';
$result .= '</table>';
$result .= '</td>';
$result .= '</tr>';
// errors
$result .= '<tr id="debuging_toolbar_errors" class="debuging_toolbar_class" style="display: none;">';
$result .= '<td>';
$result .= '<h3>Errors (' . count(error_base::$errors) . ')</h3>';
$result .= '<table border="1" cellpadding="2" cellspacing="2" width="100%">';
foreach (error_base::$errors as $k => $v) {
$result .= '<tr>';
$result .= '<td><b>' . error_base::$error_codes[$v['errno']] . ' (' . $v['errno'] . ') - ' . implode('<br/>', $v['error']) . '</b></td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td>File: ' . $v['file'] . ', Line: ' . $v['line'] . '</td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td><pre>' . $v['code'] . '</pre></td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td><pre>' . implode("\n", $v['backtrace']) . '</pre></td>';
$result .= '</tr>';
}
$result .= '</table>';
$result .= '</td>';
$result .= '</tr>';
// suppressed
$result .= '<tr id="debuging_toolbar_suppressed" class="debuging_toolbar_class" style="display: none;">';
$result .= '<td>';
$result .= '<h3>Suppressed (' . count(self::$data['suppressed']) . ')</h3>';
$result .= '<table border="1" cellpadding="2" cellspacing="2" width="100%">';
foreach (self::$data['suppressed'] as $k => $v) {
$result .= '<tr>';
$result .= '<td><b>' . error_base::$error_codes[$v['errno']] . ' (' . $v['errno'] . ') - ' . implode('<br/>', $v['error']) . '</b></td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td>File: ' . $v['file'] . ', Line: ' . $v['line'] . '</td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td><pre>' . $v['code'] . '</pre></td>';
$result .= '</tr>';
}
$result .= '</table>';
$result .= '</td>';
$result .= '</tr>';
// javascript
$result .= '<tr id="debuging_toolbar_js" class="debuging_toolbar_class" style="display: none;">';
$result .= '<td>';
$result .= '<h3>Javascript Errors (' . count(self::$data['js']) . ')</h3>';
$result .= '<table border="1" cellpadding="2" cellspacing="2" width="100%">';
foreach (self::$data['js'] as $k => $v) {
$result .= '<tr>';
$result .= '<td><b>' . implode('<br/>', $v['error']) . '</b></td>';
$result .= '</tr>';
$result .= '<tr>';
$result .= '<td>File: ' . $v['file'] . ', Line: ' . $v['line'] . '</td>';
$result .= '</tr>';
}
$result .= '</table>';
//.........这里部分代码省略.........
示例6: grid
/**
* @see html::grid()
*/
public static function grid($options = [])
{
$rows = isset($options['options']) ? $options['options'] : [];
unset($options['options']);
$data = ['header' => [], 'options' => [], 'skip_header' => true];
foreach ($rows as $k => $v) {
$index = 0;
foreach ($v as $k2 => $v2) {
foreach ($v2 as $k3 => $v3) {
$cell = ['header' => [0], 'options' => [[$v3['label'] ?? ''], [$v3['value'] ?? ''], [$v3['description'] ?? '']], 'skip_header' => true];
if (!empty($v3['separator'])) {
$data['options'][$k][$index] = ['value' => $v3['value'], 'colspan' => 24];
} else {
$data['options'][$k][$index] = html::table($cell);
}
$data['header'][$index] = $index;
$index++;
}
}
}
return html::table($data);
}
示例7: compose
//.........这里部分代码省略.........
$identities[$key] = $singleIdentity->realName . ' <' . $singleIdentity->emailAddress . '>';
if (!empty($singleIdentity->default)) {
#$defaultIdentity = $singleIdentity->id;
$defaultIdentity = $key;
$sessionData['signatureID'] = $singleIdentity->signature;
}
}
$selectFrom = html::select('identity', $defaultIdentity, $identities, true, "style='width:100%;' onchange='changeIdentity(this);'");
$this->t->set_var('select_from', $selectFrom);
// navbar(, kind of)
$this->t->set_var('img_clear_left', $GLOBALS['phpgw']->common->image('felamimail', 'clear_left'));
$this->t->set_var('img_fileopen', $GLOBALS['phpgw']->common->image('phpgwapi', 'fileopen'));
$this->t->set_var('img_mail_send', $GLOBALS['phpgw']->common->image('felamimail', 'mail_send'));
$this->t->set_var('img_attach_file', $GLOBALS['phpgw']->common->image('felamimail', 'attach'));
$this->t->set_var('ajax-loader', $GLOBALS['phpgw']->common->image('felamimail', 'ajax-loader'));
$this->t->set_var('img_fileexport', $GLOBALS['phpgw']->common->image('felamimail', 'fileexport'));
// prepare print url/button
$this->t->set_var('img_print_it', $GLOBALS['phpgw']->common->image('felamimail', 'fileprint'));
$this->t->set_var('lang_print_it', lang('print it'));
$this->t->set_var('print_it', $printURL);
// from, to, cc, replyto
$destinationRows = 0;
foreach (array('to', 'cc', 'bcc', 'replyto', 'folder') as $destination) {
foreach ((array) $sessionData[$destination] as $key => $value) {
$selectDestination = html::select('destination[]', $destination, $this->destinations, false, "style='width: 100%;' onchange='fm_compose_changeInputType(this)'");
$this->t->set_var('select_destination', $selectDestination);
$this->t->set_var('address', @htmlentities($value, ENT_QUOTES, $this->displayCharset));
$this->t->parse('destinationRows', 'destination_row', True);
$destinationRows++;
}
}
while ($destinationRows < 3) {
// and always add one empty row
$selectDestination = html::select('destination[]', 'to', $this->destinations, false, "style='width: 100%;' onchange='fm_compose_changeInputType(this)'");
$this->t->set_var('select_destination', $selectDestination);
$this->t->set_var('address', '');
$this->t->parse('destinationRows', 'destination_row', True);
$destinationRows++;
}
// and always add one empty row
$selectDestination = html::select('destination[]', 'to', $this->destinations, false, "style='width: 100%;' onchange='fm_compose_changeInputType(this)'");
$this->t->set_var('select_destination', $selectDestination);
$this->t->set_var('address', '');
$this->t->parse('destinationRows', 'destination_row', True);
$this->t->set_var("subject", @htmlentities($sessionData['subject'], ENT_QUOTES, $this->displayCharset));
$this->t->set_var('addressbookImage', $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website', 'users'));
// $this->t->set_var('infologImage',html::image('felamimail','to_infolog',lang('Save as infolog'),'width="17px" height="17px" valign="middle"' ));
// $this->t->set_var('lang_save_as_infolog',lang('Save as infolog'));
$this->t->set_var('lang_no_recipient', lang('No recipient address given!'));
$this->t->set_var('lang_no_subject', lang('No subject given!'));
$this->t->pparse("out", "header");
// body
if ($sessionData['mimeType'] == 'html') {
$style = "border:0px; width:100%; height:400px;";
$this->t->set_var('tinymce', html::fckEditorQuick('body', 'simple', $sessionData['body']));
$this->t->set_var('mimeType', 'html');
$ishtml = 1;
} else {
$style = "border:0px; width:100%; height:400px;";
$this->t->set_var('tinymce', html::fckEditorQuick('body', 'ascii', $sessionData['body']));
$this->t->set_var('mimeType', 'text');
$ishtml = 0;
}
require_once PHPGW_INCLUDE_ROOT . '/felamimail/inc/class.felamimail_bosignatures.inc.php';
$boSignatures = new felamimail_bosignatures();
$signatures = $boSignatures->getListOfSignatures();
if (empty($sessionData['signatureID'])) {
if ($signatureData = $boSignatures->getDefaultSignature()) {
if (is_array($signatureData)) {
$sessionData['signatureID'] = $signatureData['signatureid'];
} else {
$sessionData['signatureID'] = $signatureData;
}
}
}
$selectSignatures = array('-2' => lang('no signature'));
foreach ($signatures as $signature) {
$selectSignatures[$signature['fm_signatureid']] = $signature['fm_description'];
}
$selectBox = html::select('signatureID', $presetSig ? $presetSig : $sessionData['signatureID'], $selectSignatures, true, "style='width: 70%;' onchange='fm_compose_changeInputType(this)'");
$this->t->set_var("select_signature", $selectBox);
$this->t->set_var("lang_editormode", lang("Editor type"));
$this->t->set_var("toggle_editormode", lang("Editor type") . ": <span><input name=\"_is_html\" value=\"" . $ishtml . "\" type=\"hidden\" /><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" " . ($ishtml ? "checked=\"checked\"" : "") . " id=\"_html\" value=\"html\" type=\"radio\"><label for=\"_html\">HTML</label><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" " . ($ishtml ? "" : "checked=\"checked\"") . " id=\"_plain\" value=\"plain\" type=\"radio\"><label for=\"_plain\">Plain text</label></span>");
$this->t->pparse("out", "body_input");
// attachments
if (is_array($sessionData['attachments']) && count($sessionData['attachments']) > 0) {
$imgClearLeft = $GLOBALS['phpgw']->common->image('felamimail', 'clear_left');
foreach ((array) $sessionData['attachments'] as $id => $attachment) {
$tempArray = array('1' => $attachment['name'], '2' => $attachment['type'], '.2' => "style='text-align:center;'", '3' => $attachment['size'], '4' => "<img src='{$imgClearLeft}' onclick=\"fm_compose_deleteAttachmentRow(this,'{$_composeID}','{$id}')\">");
$tableRows[] = $tempArray;
}
if (count($tableRows) > 0) {
$table = html::table($tableRows, "style='width:100%'");
}
$this->t->set_var('attachment_rows', $table);
} else {
$this->t->set_var('attachment_rows', '');
}
$this->t->pparse("out", "attachment");
}
示例8: render
//.........这里部分代码省略.........
$temp2 = [];
foreach ($v['d'] as $k2 => $v2) {
if (is_array($v2)) {
$value = $v2['v'] ?? null;
} else {
$value = $v2;
}
// replaces
$value = str_replace(' ', ' ', $value);
$temp2[] = strip_tags($value);
}
$temp[$sheet][] = $temp2;
}
// get output buffering
helper_ob::clean_all();
// content
switch ($type) {
case 'xlsx':
echo io::array_to_excel($temp, io::$formats[$type]['excel_code'], null);
break;
default:
// csv or text
header('Content-Type: ' . numbers_frontend_exports_csv_base::$formats[$type]['content_type']);
header('Content-Disposition: attachment; filename="' . $sheet . '.' . $type . '"');
header('Cache-Control: max-age=0');
echo numbers_frontend_exports_csv_base::array_to_csv($temp, numbers_frontend_exports_csv_base::$formats[$type]['delimiter'], numbers_frontend_exports_csv_base::$formats[$type]['enclosure']);
}
exit;
break;
case 'html':
case 'html2':
default:
// rendering data
$table = ['options' => []];
$counter = 1;
foreach ($this->data as $k => $v) {
$flag_colspan = 0;
$row = [];
if (!empty($v['d'])) {
foreach ($v['d'] as $k2 => $v2) {
if ($flag_colspan > 0) {
$flag_colspan--;
continue;
}
$colspan = '';
if ($v2['c'] ?? null) {
$colspan = $v2['c'];
$flag_colspan = $v2['c'] - 1;
}
$align = 'left';
$title = '';
$style = '';
if (is_array($v2)) {
$value = $v2['v'] ?? null;
if (!empty($v2['h'])) {
$v2['h']['value'] = $value;
$value = html::a($v2['h']);
}
if (!empty($v2['a'])) {
$align = $v2['a'];
}
if (!empty($v2['l'])) {
$title = $v2['l'];
}
// bold lines
if ($v2['b'] ?? null) {
示例9: loader_box
<?php
echo loader_box('cms/nav');
loader_import('saf.HTML');
echo template_simple(CMS_JS_ALERT_MESSAGE, $GLOBALS['cgi']);
if (false && @is_dir(site_docroot() . '/inc/app/sitetracker')) {
echo html::table(html::tr(html::td(html::h1(intl_get('Inbox')) . loader_box('cms/messages/inbox') . html::hr() . html::h1(intl_get('Bookmarks')) . loader_box('cms/bookmarks'), array('valign' => 'top', 'width' => '66%', 'style' => 'padding-right: 10px')) . html::td(loader_box('sitetracker/stats/summary'), array('valign' => 'top', 'width' => '33%', 'style' => 'padding-left: 10px'))), array('border' => 0, 'cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%'));
} else {
echo html::table(html::tr(html::td(html::h1(intl_get('Inbox')) . loader_box('cms/messages/inbox') . html::h1(intl_get('Drafts')) . loader_box('cms/autosave/drafts'), array('valign' => 'top', 'width' => '66%', 'style' => 'padding-right: 10px')) . html::td(html::h1(intl_get('Bookmarks')) . loader_box('cms/bookmarks'), array('valign' => 'top', 'width' => '33%', 'style' => 'padding-left: 10px'))), array('border' => 0, 'cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%'));
}
示例10: render_container_type_details_rows
/**
* Details - render table
*
* @param array $rows
* @param array $values
* @param array $options
*/
public function render_container_type_details_rows($rows, $values, $options = [])
{
$result = '';
// empty_warning_message
if (empty($options['details_new_rows']) && empty($values) && isset($options['details_empty_warning_message'])) {
if (empty($options['details_empty_warning_message'])) {
return html::message(['type' => 'warning', 'options' => [object_content_messages::no_rows_found]]);
} else {
return html::message(['type' => 'warning', 'options' => [$options['details_empty_warning_message']]]);
}
}
// building table
$table = ['header' => ['row_number' => '', 'row_data' => '', 'row_delete' => ''], 'options' => [], 'skip_header' => true];
if (!empty($options['details_11'])) {
$table['class'] = 'table grid_table_details_11';
$table['header'] = ['row_data' => ''];
}
// header rows for table
if ($options['details_rendering_type'] == 'table') {
foreach ($rows as $k => $v) {
array_key_sort($v['elements'], ['order' => SORT_ASC]);
// group by
$groupped = [];
foreach ($v['elements'] as $k2 => $v2) {
$groupped[$v2['options']['label_name'] ?? ''][$k2] = $v2;
}
foreach ($groupped as $k2 => $v2) {
$first = current($v2);
$first_key = key($v2);
foreach ($v2 as $k3 => $v3) {
// hidden row
if ($k === $this::hidden && !application::get('flag.numbers.frontend.html.form.show_field_settings')) {
$v3['options']['row_class'] = ($v3['options']['row_class'] ?? '') . ' grid_row_hidden';
}
$data['options'][$k][$k2][$k3] = ['label' => $this->render_element_name($first), 'options' => $v3['options'], 'row_class' => $v3['options']['row_class'] ?? null];
}
}
}
// add a row to a table
$table['options']['__header'] = ['row_number' => ['value' => ' ', 'width' => '1%'], 'row_data' => ['value' => html::grid($data), 'width' => !empty($options['details_11']) ? '100%' : '98%'], 'row_delete' => ['value' => ' ', 'width' => '1%']];
}
// we must sort
array_key_sort($rows, ['order' => SORT_ASC]);
// generating rows
$row_number = 1;
// 1 to 1
if (!empty($options['details_11'])) {
$max_rows = 1;
$processing_values = 1;
} else {
$max_rows = count($values) + ($options['details_new_rows'] ?? 0);
$processing_values = !empty($values);
}
do {
// we exit if there's no rows and if we have no values
if ($row_number > $max_rows) {
break;
}
// render
$data = ['options' => []];
// grab next element from an array
if ($processing_values) {
if (!empty($options['details_11'])) {
$k0 = null;
$v0 = $values;
} else {
$k0 = key($values);
$v0 = current($values);
}
} else {
$k0 = $row_number;
$v0 = [];
}
$i0 = $row_number;
// we need to preset default values
if (!empty($options['details_parent_key'])) {
$fields = $this->sort_fields_for_processing($this->detail_fields[$options['details_parent_key']]['subdetails'][$options['details_key']]['elements'], $this->detail_fields[$options['details_parent_key']]['subdetails'][$options['details_key']]['options']);
} else {
$fields = $this->sort_fields_for_processing($this->detail_fields[$options['details_key']]['elements'], $this->detail_fields[$options['details_key']]['options']);
}
// todo: handle changed field
foreach ($fields as $k19 => $v19) {
if (array_key_exists('default', $v19['options']) && !isset($v0[$k19])) {
$temp = $this->process_default_value($k19, $v19['options']['default'], $v0[$k19] ?? null, $v0, true);
}
}
// looping though rows
foreach ($rows as $k => $v) {
// row_id
if (empty($options['details_parent_key'])) {
$row_id = "form_{$this->form_link}_details_{$options['details_key']}_{$row_number}_row";
} else {
$row_id = "form_{$this->form_link}_subdetails_{$options['details_parent_key']}_{$options['__parent_row_number']}_{$options['details_key']}_{$row_number}_row";
//.........这里部分代码省略.........
示例11: reloadAttachments
function reloadAttachments($_composeID)
{
$bocompose =& CreateObject('felamimail.bocompose', $_composeID);
$tableRows = array();
$table = '';
$imgClearLeft = $GLOBALS['phpgw']->common->image('felamimail', 'clear_left');
foreach ((array) $bocompose->sessionData['attachments'] as $id => $attachment) {
switch (strtoupper($attachment['type'])) {
case 'MESSAGE/RFC822':
$linkData = array('menuaction' => 'felamimail.uidisplay.display', 'uid' => $attachment['uid'], 'part' => $attachment['partID']);
$windowName = 'displayMessage_';
$att_link = "egw_openWindowCentered('" . $GLOBALS['phpgw']->link('/index.php', $linkData) . "','{$windowName}',700,egw_getWindowOuterHeight()); return false;";
break;
case 'IMAGE/JPEG':
case 'IMAGE/PNG':
case 'IMAGE/GIF':
default:
$linkData = array('menuaction' => 'felamimail.uicompose.getAttachment', 'attID' => $id, '_composeID' => $_composeID);
$windowName = 'displayAttachment_';
$att_link = "egw_openWindowCentered('" . $GLOBALS['phpgw']->link('/index.php', $linkData) . "','{$windowName}',800,600);";
break;
}
$tempArray = array('1' => '<a href="#" onclick="' . $att_link . '">' . $attachment['name'] . '</a>', '2' => $attachment['type'], '.2' => "style='text-align:center;'", '3' => $attachment['size'], '4' => "<img src='{$imgClearLeft}' onclick=\"fm_compose_deleteAttachmentRow(this,'{$_composeID}','{$id}')\">");
$tableRows[] = $tempArray;
}
if (count($tableRows) > 0) {
$table = html::table($tableRows, "style='width:100%'");
}
$response =& new xajaxResponse();
$response->addAssign('divAttachments', 'innerHTML', $table);
return $response->getXML();
}
示例12: render
/**
* Render widget
*
* @return mixed
*/
public function render()
{
$result = '';
// action bar
$result .= '<div style="text-align: right;">';
$result .= html::a(array('value' => html::icon(['type' => 'comment']) . ' ' . i18n(null, 'New'), 'href' => 'javascript:void(0);', 'onclick' => "numbers.frontend_form.trigger_submit('#form_numbers_frontend_html_widgets_comments_model_form_comment_form', false, true); numbers.modal.show('widgets_comments_{$this->widget_link}_comment');"));
$result .= '</div>';
$result .= '<hr class="simple" />';
// form
$pk = http_build_query2($this->options['pk']);
$js = <<<TTT
\t\t\tvar mask_id = 'widgets_comments_{$this->widget_link}_mask';
\t\t\t\$.ajax({
\t\t\t\turl: numbers.controller_full,
\t\t\t\tmethod: 'post',
\t\t\t\tdata: '__ajax=1&__ajax_form_id=widgets_comments_{$this->widget_link}_list&{$pk}',
\t\t\t\tdataType: 'json',
\t\t\t\tsuccess: function (data) {
\t\t\t\t\tif (data.success) {
\t\t\t\t\t\t\$('#widgets_comments_{$this->widget_link}_wrapper').html(data.html);
\t\t\t\t\t\teval(data.js);
\t\t\t\t\t\t// remove mask after 100 miliseconds to let js to take affect
\t\t\t\t\t\tsetTimeout(function() {
\t\t\t\t\t\t\t\$('#' + mask_id).unmask();
\t\t\t\t\t\t\t// we need to trigger resize to redraw a screen
\t\t\t\t\t\t\t\$(window).trigger('resize');
\t\t\t\t\t\t}, 100);
\t\t\t\t\t}
\t\t\t\t}
\t\t\t});
TTT;
$form = new numbers_frontend_html_widgets_comments_model_form_comment(['input' => $this->options['input'], 'no_actions' => true, 'bypass_hidden_values' => $this->options['pk'], 'other' => ['model' => $this->options['model'], 'pk' => $this->options['pk'], 'map' => $this->options['map']], 'on_success_js' => "numbers.modal.hide('widgets_comments_{$this->widget_link}_comment');" . $js]);
$body = $form->render();
$footer = html::button2(['name' => 'submit_comment', 'value' => i18n(null, 'Submit'), 'type' => 'primary', 'onclick' => "numbers.frontend_form.trigger_submit('#form_numbers_frontend_html_widgets_comments_model_form_comment_form', true); return false;"]);
$result .= html::modal(['id' => "widgets_comments_{$this->widget_link}_comment", 'class' => 'large', 'title' => i18n(null, 'Add Comment'), 'body' => $body, 'footer' => $footer]);
// list of comments in descending order
$where = [];
foreach ($this->options['map'] as $k => $v) {
$where[$v] = $this->options['pk'][$k];
}
$datasource = new numbers_frontend_html_widgets_comments_model_datasource_comments();
$data = $datasource->get(['model' => $this->options['model'], 'where' => $where]);
if (!empty($data)) {
$table = ['header' => ['id' => ['value' => '#', 'width' => '1%'], 'inserted' => ['value' => i18n(null, 'Date & Time'), 'width' => '1%', 'nowrap' => true], 'important' => ['value' => i18n(null, 'Important'), 'width' => '1%'], 'em_entity_name' => ['value' => i18n(null, 'Entity'), 'width' => '10%'], 'comment_value' => i18n(null, 'Comment')], 'options' => []];
$row_number = 1;
foreach ($data as $k => $v) {
// we need to hide old comments
$row_style = '';
if ($row_number > 10) {
$row_style = 'display: none;';
}
$table['options'][$v['id']] = ['id' => ['value' => $row_number . '.', 'row_style' => $row_style, 'row_class' => "widgets_comments_{$this->widget_link}_list_hiden " . ($v['important'] ? 'success' : null)], 'inserted' => format::datetime($v['inserted']), 'important' => ['value' => $v['important'] ? i18n(null, 'Yes') : ''], 'em_entity_name' => ['value' => $v['em_entity_name'], 'width' => '10%', 'nowrap' => true], 'comment_value' => nl2br($v['comment_value'])];
$row_number++;
}
$result_list = html::table($table);
// link to show all rows
$total_comments = count($data);
if ($total_comments > 10) {
$result_list .= '<div style="text-align: right;">' . html::a(['href' => 'javascript:void(0);', 'value' => i18n(null, '[count] comment(s) are hidden. Show all comments.', ['replace' => ['[count]' => $total_comments - 10]]), 'onclick' => "\$('.widgets_comments_{$this->widget_link}_list_hiden').show(); \$(this).hide();"]) . '</div>';
}
} else {
$result_list = html::message(['type' => 'warning', 'options' => [i18n(null, object_content_messages::no_rows_found)]]);
}
// if we are making an ajax call
if (!empty($this->options['input']['__ajax']) && ($this->options['input']['__ajax_form_id'] ?? '') == "widgets_comments_{$this->widget_link}_list") {
layout::render_as(['success' => true, 'error' => [], 'html' => $result_list, 'js' => ''], 'application/json');
}
// load mask
numbers_frontend_media_libraries_loadmask_base::add();
// put list into result
$result .= "<div id=\"widgets_comments_{$this->widget_link}_mask\"><div id=\"widgets_comments_{$this->widget_link}_wrapper\">" . $result_list . '</div></div>';
// wrap everything into segment
if (isset($this->options['segment'])) {
$temp = is_array($this->options['segment']) ? $this->options['segment'] : [];
$temp['value'] = $result;
$result = html::segment($temp);
}
// anchor
$result = html::a(['name' => "widgets_comments_{$this->widget_link}_anchor"]) . $result;
return $result;
}
示例13: createAccountDataTable
function createAccountDataTable($_identities)
{
$linkData = array('menuaction' => 'felamimail.uipreferences.editAccountData');
$urlEditAccountData = $GLOBALS['phpgw']->link('/index.php', $linkData);
if (is_array($_identities) && !empty($_identities)) {
foreach ($_identities as $identity) {
$description = $identity['id'] . ":" . $identity['realName'] . " " . $identity['organization'] . " <" . $identity['emailAddress'] . ">";
$description = $identity['default'] == true ? $description . ' (' . lang('default') . ')' : $description;
$tableRows[] = array('1' => $identity['id'] != -1 ? html::checkbox('accountID', false, $identity['id']) : '', '.1' => 'style="width:30px"', '2' => '<a href="' . $urlEditAccountData . "&accountID=" . $identity['id'] . '">' . @htmlspecialchars($description, ENT_QUOTES, $this->charset) . '</a>');
}
return html::table($tableRows, 'style="width:100%;"');
}
return '';
}
示例14: render_data_default
/**
* Data default renderer
*
* @return string
*/
private final function render_data_default()
{
$result = '';
// if we have no rows we display a messsage
if ($this->num_rows == 0) {
return html::message(['type' => 'warning', 'options' => [i18n(null, object_content_messages::no_rows_found)]]);
}
$counter = 1;
$table = ['header' => [], 'options' => []];
// action flags
$actions = [];
if (object_controller::can('record_view')) {
$actions['view'] = true;
}
// generate columns
foreach ($this->columns as $k => $v) {
// if we can not view we skip action column
if (empty($actions) && $k == 'action') {
continue;
}
$table['header'][$k] = ['value' => i18n(null, $v['name']), 'nowrap' => true, 'width' => $v['width'] ?? null];
}
// generate rows
foreach ($this->rows as $k => $v) {
// process all columns first
$row = [];
foreach ($this->columns as $k2 => $v2) {
// if we can not view we skip action column
if (empty($actions) && $k2 == 'action') {
continue;
}
$value = [];
// create cell properties
foreach (['width', 'align'] as $v3) {
if (isset($v2[$v3])) {
$value[$v3] = $v2[$v3];
}
}
// process rows
if ($k2 == 'action') {
$value['value'] = [];
if (!empty($actions['view'])) {
$mvc = application::get('mvc');
$pk = extract_keys($this->model_object->pk, $v);
$url = $mvc['controller'] . '/_edit?' . http_build_query2($pk);
$value['value'][] = html::a(['value' => i18n(null, 'View'), 'href' => $url]);
}
$value['value'] = implode(' ', $value['value']);
} else {
if ($k2 == 'row_number') {
$value['value'] = format::id($counter) . '.';
} else {
if ($k2 == 'offset_number') {
$value['value'] = format::id($this->offset + $counter) . '.';
} else {
if (!empty($v2['options_model'])) {
if (strpos($v2['options_model'], '::') === false) {
$v2['options_model'] .= '::options';
}
$params = $v2['options_params'] ?? [];
if (!empty($v2['options_depends'])) {
foreach ($v2['options_depends'] as $k0 => $v0) {
$params[$k0] = $v[$v0];
}
}
$crypt_object = new crypt();
$hash = $crypt_object->hash($v2['options_model'] . serialize($params));
if (!isset($this->cached_options[$hash])) {
$method = factory::method($v2['options_model'], null, true);
$this->cached_options[$hash] = call_user_func_array($method, [['where' => $params]]);
}
if (isset($this->cached_options[$hash][$v[$k2]])) {
$value['value'] = $this->cached_options[$hash][$v[$k2]]['name'];
} else {
$value['value'] = null;
}
} else {
if (!empty($v2['options']) && !is_array($v[$k2])) {
if (isset($v2['options'][$v[$k2]])) {
$value['value'] = $v2['options'][$v[$k2]]['name'];
} else {
$value['value'] = null;
}
} else {
if (isset($v[$k2])) {
$value['value'] = $v[$k2];
} else {
$value['value'] = null;
}
}
}
}
}
}
// put value into row
//.........这里部分代码省略.........
示例15: simple
public static function simple($attributes, $headers, $rows)
{
return html::table($attributes, self::thead($headers) . self::tbody($rows));
}