// [category.description=id] $context['text'] .= '[title]' . i18n::s('Category') . ' [escape][category.description=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][category.description=featured][/escape]</td>' . '<td>[category.description=featured]</td></tr>' . Skin::table_suffix(); // [user=id] $context['text'] .= '[title]' . i18n::s('User shortcut') . ' [escape][user=<id>] [user=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Have a look at %s'), '[user='******']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Have a look at %s'), '[user='******']') . '</td></tr>' . Skin::table_suffix(); // [server=id] $context['text'] .= '[title]' . i18n::s('Server shortcut') . ' [escape][server=<id>] [server=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [server=2, this server]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [server=2, this server]') . '</td></tr>' . Skin::table_suffix(); // [file=id] $context['text'] .= '[title]' . i18n::s('File shortcut') . ' [escape][file=<id>] [file=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Have a look at %s'), '[file=' . $file_id . ']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Have a look at %s'), '[file=' . $file_id . ']') . '</td></tr>' . Skin::table_suffix(); // [download=id] $context['text'] .= '[title]' . i18n::s('Download shortcut') . ' [escape][download=<id>] [download=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Click to %s'), '[download=' . $file_id . ', ' . i18n::s('download the file') . ']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Click to %s'), '[download=' . $file_id . ', ' . i18n::s('download the file') . ']') . '</td></tr>' . Skin::table_suffix(); // [clicks=id] $context['text'] .= '[title]' . i18n::s('Member clicks') . ' [escape][clicks=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][clicks=' . $file_id . '][/escape]</td>' . '<td>[clicks=' . $file_id . ']</td></tr>' . Skin::table_suffix(); // [action=id] $context['text'] .= '[title]' . i18n::s('Action shortcut') . ' [escape][action=<id>] [action=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [action=2, this action]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [action=2, this action]') . '</td></tr>' . Skin::table_suffix(); // [comment=id] $context['text'] .= '[title]' . i18n::s('Comment shortcut') . ' [escape][comment=<id>] [comment=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [comment=2, this comment]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [comment=2, this comment]') . '</td></tr>' . Skin::table_suffix(); // [script]index.php[/script] $context['text'] .= '[title]' . i18n::s('Script shortcut') . ' [escape][script]<path/script.php>[/script][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('You can access the documentation for the script [script]shared/codes.php[/script]') . '[/escape]</td>' . '<td>' . i18n::s('You can access the documentation for the script [script]shared/codes.php[/script]') . '</td></tr>' . Skin::table_suffix(); // [search=yacs] $context['text'] .= '[title]' . i18n::s('Search') . ' [escape][search] [search=<words>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('All you want to know on [search=yacs]') . '[/escape]</td>' . '<td>' . i18n::s('All you want to know on [search=yacs]') . '</td></tr>' . Skin::table_suffix(); // [wikipedia=keyword, label] $context['text'] .= '[title]' . i18n::s('Wikipedia') . ' [escape][wikipedia=keyword] [wikipedia=keyword, label][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('All you want to know on [wikipedia=Web_2, the web 2.0]') . '[/escape]</td>' . '<td>' . i18n::s('All you want to know on [wikipedia=Web_2, the web 2.0]') . '</td></tr>' . Skin::table_suffix(); // [proxy]url[/proxy] $context['text'] .= '[title]' . i18n::s('Proxy') . ' [escape][proxy]web address[/proxy][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][proxy]http://www.google.com/[/proxy][/escape]</td>' . '<td>[proxy]http://www.google.com/[/proxy]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
/** * render a table * * @param string the table content * @param string the variant, if any * @return string the rendered text **/ public static function render_static_table($content, $variant = '') { global $context; // we are providing inline tables if ($variant) { $variant = 'inline ' . $variant; } else { $variant = 'inline'; } // do we have headers to proceed? $in_body = !preg_match('/\\[body\\]/i', $content); // start at first line, except if headers have to be printed first if ($in_body) { $count = 1; } else { $count = 2; } // split lines $rows = explode("\n", $content); if (!is_array($rows)) { return ''; } // one row per line - cells are separated by |, \t, or 2 spaces $text =& Skin::table_prefix($variant); foreach ($rows as $row) { // skip blank lines if (!$row) { continue; } // header row if (!$in_body) { if (preg_match('/\\[body\\]/i', $row)) { $in_body = true; } else { $text .= Skin::table_row(preg_split("/([\\|\t]| " . " )/", $row), 'header'); } // body row } else { $text .= Skin::table_row(preg_split("/([\\|\t]| " . " )/", $row), $count++); } } // return the complete table $text .= Skin::table_suffix(); return $text; }
// the title of the page $context['page_title'] = i18n::s('Codes to format lists'); // the date of last modification if (Surfer::is_associate()) { $context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>'; } // page header $context['text'] .= '<p>' . i18n::s('On this page we are introducing some formatting codes and live examples of utilization.') . '</p>'; // add a toc $context['text'] .= "\n" . '[toc]' . "\n"; // [*] $context['text'] .= '[title]' . i18n::s('List item') . ' [escape][*][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A simple list:') . "\n\n" . '[*]' . i18n::s('First item') . "\n\n" . '[*]' . i18n::s('Second item (after one empty line)') . "\n" . '[*]' . i18n::s('Third item (next the previous one)') . '[/escape]</td>' . '<td>' . i18n::s('A simple list:') . "\n\n" . '[*]' . i18n::s('First item') . "\n\n" . '[*]' . i18n::s('Second item (after one empty line)') . "\n" . '[*]' . i18n::s('Third item (next the previous one)') . '</td></tr>' . Skin::table_suffix(); // [list]...[/list] $context['text'] .= '[title]' . i18n::s('Bulleted list') . ' [escape][list]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with bulleted items:') . "\n" . '[list]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with bulleted items:') . "\n" . '[list]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // [list=1]...[/list] $context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=1]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with numbered items:') . "\n" . '[list=1]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with numbered items:') . "\n" . '[list=1]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // [list=a]...[/list] $context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=a]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with alphabetically numbered items:') . "\n" . '[list=a]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with alphabetically numbered items:') . "\n" . '[list=a]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // [list=A]...[/list] $context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=A]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Another list with alphabetically numbered items:') . "\n" . '[list=A]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('Another list with alphabetically numbered items:') . "\n" . '[list=A]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // [list=i]...[/list] $context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=i]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with roman numbers:') . "\n" . '[list=i]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with roman numbers:') . "\n" . '[list=i]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // [list=I]...[/list] $context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=I]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Another list with roman numbers:') . "\n" . '[list=I]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('Another list with roman numbers:') . "\n" . '[list=I]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
/** * list articles as topics in a forum * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // start a table $text .= Skin::table_prefix('jive'); // headers $text .= Skin::table_row(array(i18n::s('Topic'), i18n::s('Content')), 'header'); // build a list of articles $odd = FALSE; include_once $context['path_to_root'] . 'comments/comments.php'; include_once $context['path_to_root'] . 'links/links.php'; while ($item = SQL::fetch($result)) { // get the related overlay, if any $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // use the title to label the link if (is_object($overlay)) { $title = Codes::beautify_title($overlay->get_text('title', $item)); } else { $title = Codes::beautify_title($item['title']); } // one row per article $text .= '<tr class="' . ($odd ? 'odd' : 'even') . '"><td>'; $odd = !$odd; // signal articles to be published if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $text .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $text .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $text .= RESTRICTED_FLAG; } // use the title as a link to the page $text .= Skin::build_link($url, '<strong>' . $title . '</strong>', 'basic'); // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) { $text .= ' ' . LOCKED_FLAG; } // flag articles updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $text .= ' ' . EXPIRED_FLAG; } elseif ($item['create_date'] >= $context['fresh']) { $text .= ' ' . NEW_FLAG; } elseif ($item['edit_date'] >= $context['fresh']) { $text .= ' ' . UPDATED_FLAG; } // add details, if any $details = array(); // poster name if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') { if ($item['create_name']) { $details[] = sprintf(i18n::s('posted by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date'])); } } // last update $details[] = sprintf(i18n::s('Updated %s'), Skin::build_date($item['edit_date'])); // add details to the title if (count($details)) { $text .= '<p class="details" style="margin: 3px 0">' . join(', ', $details) . '</p>'; } // display all tags if ($item['tags']) { $text .= '<p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>'; } // next cell for the content $text .= '</td><td width="70%">'; // the content to be displayed $content = ''; // rating if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) { $content .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic'); } // the introductory text if (is_object($overlay)) { $content .= Codes::beautify_introduction($overlay->get_text('introduction', $item)); } else { $content .= Codes::beautify_introduction($item['introduction']); } // insert overlay data, if any if (is_object($overlay)) { $content .= $overlay->get_text('list', $item); } // the description $content .= Skin::build_block($item['description'], 'description', '', $item['options']); // attachment details $details = array(); // info on related files if ($count = Files::count_for_anchor('article:' . $item['id'])) { Skin::define_img('FILES_LIST_IMG', 'files/list.gif'); $details[] = Skin::build_link($url . '#_attachments', FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count), 'span'); } // info on related links if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('LINKS_LIST_IMG', 'links/list.gif'); $details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count); } // count replies if ($count = Comments::count_for_anchor('article:' . $item['id'])) { $details[] = Skin::build_link($url . '#_discussion', sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span'); } // the command to reply if (Comments::allow_creation($item, $anchor)) { Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif'); $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'span'); } // describe attachments $content .= Skin::finalize_list($details, 'menu_bar'); // end the row $text .= $content . '</td></tr>'; } // end of processing SQL::free($result); // return the table $text .= Skin::table_suffix(); return $text; }
$cells = array(i18n::s('Downloads'), 'left=' . Skin::build_number($item['hits'], i18n::s('downloads'))); $context['text'] .= Skin::table_row($cells, $lines++); } // the first poster if ($item['create_name']) { $cells = array(i18n::s('Posted by'), $item['create_name']); $context['text'] .= Skin::table_row($cells, $lines++); } // the last poster if ($item['edit_name'] != $item['create_name']) { $cells = array(i18n::s('Updated by'), $item['edit_name']); $context['text'] .= Skin::table_row($cells, $lines++); } // date of last action $cells = array(i18n::s('Last action'), Skin::build_date($item['edit_date'])); $context['text'] .= Skin::table_row($cells, $lines++); // associates may change the active flag: Yes/public, Restricted/logged, No/associates if (Surfer::is_associate()) { if ($item['active'] == 'N' && Surfer::is_associate()) { $context['text'] .= Skin::table_row(array(i18n::s('Access'), 'left=' . i18n::s('Private - Access is restricted to selected persons')), $lines++); } elseif ($item['active'] == 'R' && Surfer::is_member()) { $context['text'] .= Skin::table_row(array(i18n::s('Access'), 'left=' . i18n::s('Community -Access is granted to any identified surfer')), $lines++); } } // end of the table $context['text'] .= Skin::table_suffix(); // count items related to this file $context['text'] .= Anchors::stat_related_to('file:' . $item['id'], i18n::s('Following items are attached to this record and will be deleted as well.')); } // render the skin render_skin();
/** * list articles * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // the script used to check all pages at once Page::insert_script('function cascade_selection_to_all_article_rows(handle) {' . "\n" . ' $("div#articles_panel input[type=\'checkbox\'].row_selector").each(' . "\n" . ' function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . ' );' . "\n" . '}' . "\n"); // table prefix $text .= Skin::table_prefix('yc-grid'); // table headers $main = '<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />'; $cells = array($main, i18n::s('Page'), i18n::s('Rank')); $text .= Skin::table_row($cells, 'header'); // process all items in the list include_once $context['path_to_root'] . 'comments/comments.php'; include_once $context['path_to_root'] . 'links/links.php'; $count = 0; while ($item = SQL::fetch($result)) { $cells = array(); // get the related overlay, if any $overlay = Overlay::load($item, 'article:' . $item['id']); // get the main anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // column to select the row $cells[] = '<input type="checkbox" name="selected_articles[]" id="article_selector_' . $count . '" class="row_selector" value="' . $item['id'] . '" />'; // use the title to label the link if (is_object($overlay)) { $title = Codes::beautify_title($overlay->get_text('title', $item)); } else { $title = Codes::beautify_title($item['title']); } // initialize variables $prefix = $suffix = $icon = ''; // flag sticky pages if ($item['rank'] < 10000) { $prefix .= STICKY_FLAG; } // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y') { $suffix .= ' ' . LOCKED_FLAG; } // flag articles that are dead, or created or updated very recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $prefix .= EXPIRED_FLAG; } elseif ($item['create_date'] >= $context['fresh']) { $suffix .= ' ' . NEW_FLAG; } elseif ($item['edit_date'] >= $context['fresh']) { $suffix .= ' ' . UPDATED_FLAG; } // signal articles to be published if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $prefix .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $prefix .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $prefix .= RESTRICTED_FLAG; } // the introductory text if (is_object($overlay)) { $introduction = $overlay->get_text('introduction', $item); } else { $introduction = $item['introduction']; } if ($introduction) { $suffix .= BR . Codes::beautify_introduction($introduction); } // insert overlay data, if any if (is_object($overlay)) { $suffix .= $overlay->get_text('list', $item); } // append details to the suffix $suffix .= BR . '<span class="details">'; // details $details = array(); // the author if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') { if ($item['create_name'] != $item['edit_name']) { $details[] = sprintf(i18n::s('by %s, %s'), $item['create_name'], $item['edit_name']); } else { $details[] = sprintf(i18n::s('by %s'), $item['create_name']); } } // the last action $details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']); // the number of hits if (Surfer::is_logged() && $item['hits'] > 1) { $details[] = Skin::build_number($item['hits'], i18n::s('hits')); } // info on related files $stats = Files::stat_for_anchor('article:' . $item['id']); if ($stats['count']) { $details[] = sprintf(i18n::ns('%d file', '%d files', $stats['count']), $stats['count']); } // info on related links $stats = Links::stat_for_anchor('article:' . $item['id']); if ($stats['count']) { $details[] = sprintf(i18n::ns('%d link', '%d links', $stats['count']), $stats['count']); } // info on related comments $stats = Comments::stat_for_anchor('article:' . $item['id']); if ($stats['count']) { $details[] = sprintf(i18n::ns('%d comment', '%d comments', $stats['count']), $stats['count']); } // rating if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) { $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic'); } // combine in-line details if (count($details)) { $suffix .= ucfirst(trim(implode(', ', $details))); } // list up to three categories by title, if any $anchors = array(); if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) { foreach ($members as $id => $attributes) { // add background color to distinguish this category against others if (isset($attributes['background_color']) && $attributes['background_color']) { $attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>'; } $anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic'); } } if (count($anchors)) { $suffix .= BR . sprintf(i18n::s('In %s'), implode(' / ', $anchors)); } // end of details $suffix .= '</span>'; // strip empty details $suffix = str_replace(BR . '<span class="details"></span>', '', $suffix); $suffix = str_replace('<span class="details"></span>', '', $suffix); // the icon to put in the left column if ($item['thumbnail_url']) { $icon = $item['thumbnail_url']; } // commands $commands = array(Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('edit'), 'basic'), Skin::build_link(Articles::get_url($item['id'], 'delete'), i18n::s('delete'), 'basic')); // link to this page $cells[] = $prefix . Skin::build_link($url, $title, 'article') . ' - ' . Skin::finalize_list($commands, 'menu') . $suffix; // ranking $cells[] = '<input type="text" size="5" name="article_rank_' . $item['id'] . '" value="' . $item['rank'] . '" onfocus="$(\'#article_selector_' . $count . '\').attr(\'checked\', \'checked\');" onchange="$(\'#act_on_articles\').prop(\'selectedIndex\', 9);" />'; // append the row $text .= Skin::table_row($cells, $count++); } // select all rows $cells = array('<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />', i18n::s('Select all/none'), ''); $text .= Skin::table_row($cells, $count++); // table suffix $text .= Skin::table_suffix(); // end of processing SQL::free($result); return $text; }
// [sections=self] $context['text'] .= '[title]' . i18n::s('Assigned sections') . ' [escape][sections=self] [sections=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][sections.folded=self][/escape]</td>' . '<td>[sections.folded=self]</td></tr>' . Skin::table_suffix(); // [categories] $context['text'] .= '[title]' . i18n::s('Categories') . ' [escape][categories] [categories=category:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][categories][/escape]</td>' . '<td>[categories]</td></tr>' . Skin::table_suffix(); // [categories=self] $context['text'] .= '[title]' . i18n::s('Assigned categories') . ' [escape][categories=self] [categories=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][categories=self][/escape]</td>' . '<td>[categories=self]</td></tr>' . Skin::table_suffix(); // [published] $context['text'] .= '[title]' . i18n::s('Recent pages') . ' [escape][published] [published=section:<id>] [published=category:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][published.decorated][/escape]</td>' . '<td>[published.decorated]</td></tr>' . Skin::table_suffix(); // [published=self] $context['text'] .= '[title]' . i18n::s('Personal pages') . ' [escape][published=self] [published=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][published=self, 20][/escape]</td>' . '<td>[published=self, 20]</td></tr>' . Skin::table_suffix(); // [updated] $context['text'] .= '[title]' . i18n::s('Recent updates') . ' [escape][updated] [updated=section:<id>] [updated=category:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][updated.timeline][/escape]</td>' . '<td>[updated.timeline]</td></tr>' . Skin::table_suffix(); // [updated=self] $context['text'] .= '[title]' . i18n::s('Personal updates') . ' [escape][updated=self] [updated=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][updated=self, 12][/escape]</td>' . '<td>[updated=self, 12]</td></tr>' . Skin::table_suffix(); // [read] $context['text'] .= '[title]' . i18n::s('Hall of fame') . ' [escape][read] [read=section:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][read][/escape]</td>' . '<td>[read]</td></tr>' . Skin::table_suffix(); // [read=self] $context['text'] .= '[title]' . i18n::s('Personal hits') . ' [escape][read=self] [read=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][read=self][/escape]</td>' . '<td>[read=self]</td></tr>' . Skin::table_suffix(); // [voted] $context['text'] .= '[title]' . i18n::s('Hall of fame') . ' [escape][voted] [voted=section:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][voted][/escape]</td>' . '<td>[voted]</td></tr>' . Skin::table_suffix(); // [voted=self] $context['text'] .= '[title]' . i18n::s('Personal hits') . ' [escape][voted=self] [voted=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][voted=self][/escape]</td>' . '<td>[voted=self]</td></tr>' . Skin::table_suffix(); // [users=present] $context['text'] .= '[title]' . i18n::s('Present users') . ' [escape][users=present][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][users=present][/escape]</td>' . '<td>[users=present]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
/** * build a complete table * * @param array headers * @param array rows of cells * @param string a variant, if any, as decribed for table_prefix() * @return a string to be sent to the browser */ public static function &table($headers, &$rows, $variant = 'yc-grid') { $text =& Skin::table_prefix($variant); if (isset($headers) && is_array($headers)) { $text .= Skin::table_row($headers, 'sortable'); } $row_count = 1; if (is_array($rows)) { foreach ($rows as $cells) { $text .= Skin::table_row($cells, $row_count++); } } $text .= Skin::table_suffix(); return $text; }
// check $value = i18n::s('Configuration files cannot be changed'); $check = i18n::s('WARNING'); } else { $value = i18n::s('May change configuration files'); $check = i18n::s('OK'); } // check $checks[] = array(i18n::s('Permissions'), $value, $check); // report on prerequisite checks $context['text'] .= '<h2>' . i18n::s('Pre-installation checks') . '</h2>'; // check results $context['text'] .= '<table border="1">'; $row_count = 1; foreach ($checks as $cells) { $context['text'] .= Skin::table_row($cells, $row_count++); } $context['text'] .= '</table>'; // link to the readme file $context['text'] .= '<p>' . sprintf(i18n::s('Check the provided %s file to ensure prerequisites are fulfilled.'), '<a href="' . i18n::s('readme.txt') . '">' . i18n::s('readme.txt') . '</a>') . "</p>\n"; // link to the configuration page if (!count($context['error'])) { // report on checks $context['text'] .= '<h2>' . i18n::s('Ready to start the installation') . '</h2>'; // splash screen $context['text'] .= i18n::s("<p>At the moment no configuration file has been found. You will now have to pass through several steps in order to achieve the setup of your server:</p>\n<ul>\n<li>Configure parameters related to the database.</li>\n<li>Load extension hooks.</li>\n<li>Create tables in the database.</li>\n<li>Add one user profile and populate the database.</li>\n<li>Configure the theme of your server.</li>\n</ul>\nIn normal conditions this will take only some minutes. If you have any problems, please consult <a href=\"http://www.yacs.fr/\">www.yacs.fr</a> for additional support.<p>Thank you for having selected the YACS solution.</p>") . "\n"; // add a button to start the installation process $context['text'] .= '<form method="get" action="control/configure.php" id="main_form">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Start the installation process'), NULL, NULL, 'confirmed') . '</p>' . "\n" . '</form>' . "\n"; // a place holder for cookies activation $context['text'] .= '<p id="ask_for_cookies" style="display: none; color: red; text-decoration: blink;"></p>'; // the script used to check that cookies are activated
$cells = array(); $cells[] = '[escape]:! & :!2[/escape]'; $cells[] = i18n::s('warning'); $cells[] = 'left= :! & :!2'; $context['text'] .= Skin::table_row($cells, $lines++); // :*: $cells = array(); $cells[] = '[escape]:*:[/escape]'; $cells[] = i18n::s('star'); $cells[] = ':*:'; $context['text'] .= Skin::table_row($cells, $lines++); // :mac $cells = array(); $cells[] = '[escape]:mac: :tux: :win:[/escape]'; $cells[] = i18n::s('operating systems'); $cells[] = ':mac: :tux: :win:'; $context['text'] .= Skin::table_row($cells, $lines++); // Get out $cells = array(); $cells[] = '[escape]:out:[/escape]'; $cells[] = i18n::s('Ok, i leave'); $cells[] = ':out:'; $context['text'] .= Skin::table_row($cells, $lines++); // end of the table $context['text'] .= Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // referrals, if any $context['components']['referrals'] =& Skin::build_referrals('smileys/index.php'); // render the skin render_skin();
/** * count related items * * This function draws a nice table to show how many items are related to * the anchor that has the focus. * * @param string the target reference * @param string the label to use, if any * @return string some XHTML snippet to send to the browser */ public static function stat_related_to($anchor, $label = NULL) { global $context; // describe related content $related = ''; $lines = 2; // stats for related categories, but only within categories if (strpos($anchor, 'category:') === 0) { if (($stats = Categories::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Categories'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } } // stats for related sections, but only within sections if (strpos($anchor, 'section:') === 0) { if (($stats = Sections::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Sections'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } } // stats for related articles, but only within sections if (strpos($anchor, 'section:') === 0) { if (($stats = Articles::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Pages'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } } // stats for related images include_once $context['path_to_root'] . 'images/images.php'; if (($stats = Images::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Images'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related locations include_once $context['path_to_root'] . 'locations/locations.php'; if (($stats = Locations::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Locations'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related tables include_once $context['path_to_root'] . 'tables/tables.php'; if (($stats = Tables::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Tables'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related files if (($stats = Files::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Files'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related dates include_once $context['path_to_root'] . 'dates/dates.php'; if (($stats = Dates::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Dates'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related comments include_once $context['path_to_root'] . 'comments/comments.php'; if (($stats = Comments::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Comments'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related links include_once $context['path_to_root'] . 'links/links.php'; if (($stats = Links::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Links'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // stats for related versions include_once $context['path_to_root'] . 'versions/versions.php'; if (($stats = Versions::stat_for_anchor($anchor)) && $stats['count']) { $cells = array(); $cells[] = i18n::s('Versions'); $cells[] = 'center=' . $stats['count']; $cells[] = 'center=' . Skin::build_date($stats['oldest_date']); $cells[] = 'center=' . Skin::build_date($stats['newest_date']); $related .= Skin::table_row($cells, $lines++); } // ensure we have a label if (!$label) { $label = i18n::s('Following items are attached to this record and will be impacted as well.'); } // stats for related items in a neat table if ($related) { // make a nice table $related = '<p>' . $label . "</p>\n" . Skin::table_prefix('') . Skin::table_row(array(i18n::s('Table'), i18n::s('Records'), i18n::s('Creation date'), i18n::s('Last edition')), 'header') . $related . Skin::table_suffix(); // put it in a box $related = Skin::build_box(i18n::s('Related items'), $related); } // job done return $related; }
// the title of the page $context['page_title'] = i18n::s('Codes to format tables'); // the date of last modification if (Surfer::is_associate()) { $context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>'; } // page header $context['text'] .= '<p>' . i18n::s('On this page we are showing how to build simple tables. Use the char |, or tab, or two successive spaces, to separate column elements.') . '</p>'; // add a toc $context['text'] .= "\n" . '[toc]' . "\n"; // [table]...[/table] $context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table]...[/table][/escape][/title]' . '<p>' . i18n::s('In this example cells are separated by tabulation characters or by 2 spaces.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table]' . "\n" . i18n::s('Rabbit') . "\t" . i18n::s('Turtle') . "\n" . i18n::s('Stories') . ' ' . i18n::s('Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table]' . "\n" . i18n::s('Rabbit') . "\t" . i18n::s('Turtle') . "\n" . i18n::s('Stories') . ' ' . i18n::s('Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // [table=grid]...[/table] $context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table=grid]...[/table][/escape][/title]' . '<p>' . i18n::s('In this example cells are separated by the | character.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // [table=tiny]...[/table] $context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table=tiny]...[/table][/escape][/title]' . '<p>Actually any style can be applied to the generated table.</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=tiny]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=tiny]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // [table]...[body]...[/table] $context['text'] .= '[title]' . i18n::s('Separate headers from the body') . ' [escape][table]...[body]...[/table][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . i18n::s('First Name|Last Name') . "\n" . '[body]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . i18n::s('First Name|Last Name') . "\n" . '[body]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // cells alignment $context['text'] .= '[title]' . i18n::s('Explicit cells alignment') . '[/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . 'left=' . i18n::s('Full Name') . '| center=' . i18n::s('Birth Year') . '| right=' . i18n::s('Net income') . "\n" . '[body]' . "\n" . 'right=' . i18n::s('Speedy Rabbit') . '|center=1888|$11,230' . "\n" . 'center=' . i18n::s('Jean de la Fontaine') . '|center=1675|$234,567' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . 'left=' . i18n::s('Full Name') . '| center=' . i18n::s('Birth Year') . '| right=' . i18n::s('Net income') . "\n" . '[body]' . "\n" . 'right=' . i18n::s('Speedy Rabbit') . '|center=1888|$11,230' . "\n" . 'center=' . i18n::s('Jean de la Fontaine') . '|center=1675|$234,567' . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // [table]...[csv]...[/csv]...[/table] $context['text'] .= '[title]' . i18n::s('Comma-separated values') . ' [escape][table][csv]...[/csv][/table][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . '[csv]' . "\n" . i18n::s('Net income for the year,$2.310') . "\n" . i18n::s('Net income for last year,$2.100') . "\n" . i18n::s('Net income increase,10%') . "\n" . '[/csv]' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . '[csv]' . "\n" . i18n::s('Net income for the year,$2.310') . "\n" . i18n::s('Net income for last year,$2.100') . "\n" . i18n::s('Net income increase,10%') . "\n" . '[/csv]' . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // [table]...[csv=;]...[/csv]...[/table] $context['text'] .= '[title]' . i18n::s('Comma-separated values') . ' [escape][table][csv=;]...[/csv][/table][/escape][/title]' . '<p>' . i18n::s('Using a different separator between cells.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . '[csv=;]' . "\n" . i18n::s('Net income for the year;$2.310') . "\n" . i18n::s('Net income for last year;$2.100') . "\n" . i18n::s('Net income increase;10%') . "\n" . '[/csv]' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . '[csv=;]' . "\n" . i18n::s('Net income for the year;$2.310') . "\n" . i18n::s('Net income for last year;$2.100') . "\n" . i18n::s('Net income increase;10%') . "\n" . '[/csv]' . "\n" . '[/table]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
$cells[] = i18n::s('Your address'); $cells[] = 'left=' . Surfer::get_email_address(); $information .= Skin::table_row($cells, $lines++); } // the capability field - associate, member, or subscriber $cells = array(); $cells[] = i18n::s('Your status'); if (Surfer::is_associate()) { $cells[] = 'left=' . i18n::s('As an associate of this community, you may contribute freely to any part of this server.'); } elseif (Surfer::is_member()) { $cells[] = 'left=' . i18n::s('As a member of this community, you may access freely most pages of this server.'); } else { $cells[] = 'left=' . i18n::s('As a subscriber of this community, you may freely access most pages of this server.'); } if (isset($cells[1])) { $information .= Skin::table_row($cells, $lines++); } // end of the table $information .= Skin::table_suffix(); // display in a separate panel $panels[] = array('information', i18n::s('You'), 'information_panel', $information); // // assemble all tabs // $context['text'] .= Skin::build_tabs($panels); // follow-up commands $follow_up = i18n::s('Where do you want to go now?'); $menu = array(); if (isset($_REQUEST['login_forward'])) { $menu[] = Skin::build_link($_REQUEST['login_forward'], i18n::s('Move forward'), 'button'); } elseif (isset($_SERVER['HTTP_REFERER']) && !preg_match('/users\\/login\\.php/', $_SERVER['HTTP_REFERER'])) {
// the date of last modification if (Surfer::is_associate()) { $context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>'; } // page header $context['text'] .= '<p>' . i18n::s('On this page we are introducing codes related to widgets and badges.') . '</p>'; // add a toc $context['text'] .= "\n" . '[toc]' . "\n"; // [newsfeed] $context['text'] .= '[title]' . i18n::s('Newsfeed') . ' [escape][newsfeed=<url>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][newsfeed=http://www.yacs.fr/feeds/rss.php][/escape]</td>' . '<td>[newsfeed=http://www.yacs.fr/feeds/rss.php]</td></tr>' . Skin::table_suffix(); // [newsfeed.embed] $context['text'] .= '[title]' . i18n::s('Newsfeed') . ' [escape][newsfeed.embed=<url>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][newsfeed.embed=http://www.yacs.fr/feeds/rss.php][/escape]</td>' . '<td>[newsfeed.embed=http://www.yacs.fr/feeds/rss.php]</td></tr>' . Skin::table_suffix(); // [twitter] $context['text'] .= '[title]' . i18n::s('Twitter profile') . ' [escape][twitter=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][twitter=bernard357][/escape]</td>' . '<td>[twitter=bernard357]</td></tr>' . Skin::table_suffix(); // [tsearch] $context['text'] .= '[title]' . i18n::s('Twitter search') . ' [escape][tsearch=<keyword>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][tsearch=#yacs][/escape]</td>' . '<td>[tsearch=#yacs]</td></tr>' . Skin::table_suffix(); // [iframe] $context['text'] .= '[title]' . i18n::s('External page') . ' [escape][iframe=<width>, <height>]<url>[/iframe][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][iframe=500, 320]http://www.cisco.com/[/iframe][/escape]</td>' . '<td>[iframe=500, 320]http://www.cisco.com/[/iframe]</td></tr>' . Skin::table_suffix(); // [cloud] $context['text'] .= '[title]' . i18n::s('Cloud of tags') . ' [escape][cloud] [cloud=<40>][/escape][/title]' . '<p>' . i18n::s('Use the parameter to adjust the number of tags listed.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][cloud][/escape]</td>' . '<td>[cloud]</td></tr>' . Skin::table_suffix(); // [calendar] $context['text'] .= '[title]' . i18n::s('Events') . ' [escape][calendar][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][calendar][/escape]</td>' . '<td>[calendar]</td></tr>' . Skin::table_suffix(); // [location=latitude, longitude, label] $context['text'] .= '[title]' . i18n::s('Direct location') . ' [escape][location=latitude, longitude, label][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][location=48.871264, 2.307558, Paris][/escape]</td>' . '<td>[location=48.871264, 2.307558, Paris]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
/** * list sections as topics in a forum * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // empty list if (!SQL::count($result)) { $output = array(); return $output; } // output as a string $text = ''; // build a list of sections $family = ''; $first = TRUE; while ($item = SQL::fetch($result)) { // change the family if ($item['family'] != $family) { $family = $item['family']; // close last table only if a section has been already listed if (!$first) { $text .= Skin::table_suffix(); } // show the family $text .= '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('yabb') . Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header'); } elseif ($first) { $text .= Skin::table_prefix('yabb'); $text .= Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header'); } // done with this case $first = FALSE; // reset everything $prefix = $label = $suffix = $icon = ''; // signal restricted and private sections if ($item['active'] == 'N') { $prefix .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $prefix .= RESTRICTED_FLAG; } // indicate the id in the hovering popup $hover = i18n::s('View the section'); if (Surfer::is_member()) { $hover .= ' [section=' . $item['id'] . ']'; } // the url to view this item $url = Sections::get_permalink($item); // use the title as a link to the page $title =& Skin::build_link($url, Codes::beautify_title($item['title']), 'basic', $hover); // also use a clickable thumbnail, if any if ($item['thumbnail_url']) { $prefix = Skin::build_link($url, '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field($hover) . '" class="left_image" />', 'basic', $hover) . $prefix; } // flag sections updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $suffix = EXPIRED_FLAG . ' '; } elseif ($item['create_date'] >= $context['fresh']) { $suffix = NEW_FLAG . ' '; } elseif ($item['edit_date'] >= $context['fresh']) { $suffix = UPDATED_FLAG . ' '; } // board introduction if ($item['introduction']) { $suffix .= '<br style="clear: none;" />' . Codes::beautify_introduction($item['introduction']); } // more details $details = ''; $more = array(); // board moderators if ($moderators = Sections::list_editors_by_name($item, 0, 7, 'comma5')) { $more[] = sprintf(i18n::ns('Moderator: %s', 'Moderators: %s', count($moderators)), $moderators); } // children boards if ($children =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, COMPACT_LIST_SIZE, 'comma')) { $more[] = sprintf(i18n::ns('Child board: %s', 'Child boards: %s', count($children)), Skin::build_list($children, 'comma')); } // as a compact list if (count($more)) { $details .= '<ul class="compact">'; foreach ($more as $list_item) { $details .= '<li>' . $list_item . '</li>' . "\n"; } $details .= '</ul>' . "\n"; } // all details if ($details) { $details = BR . '<span class="details">' . $details . "</span>\n"; } // count posts here, and in children sections $anchors = Sections::get_branch_at_anchor('section:' . $item['id']); if (!($count = Articles::count_for_anchor($anchors))) { $count = 0; } // get last post $last_post = '--'; $article =& Articles::get_newest_for_anchor($anchors, TRUE); if ($article['id']) { // flag articles updated recently if ($article['expiry_date'] > NULL_DATE && $article['expiry_date'] <= $context['now']) { $flag = EXPIRED_FLAG . ' '; } elseif ($article['create_date'] >= $context['fresh']) { $flag = NEW_FLAG . ' '; } elseif ($article['edit_date'] >= $context['fresh']) { $flag = UPDATED_FLAG . ' '; } else { $flag = ''; } // title $last_post = Skin::build_link(Articles::get_permalink($article), Codes::beautify_title($article['title']), 'article'); // last editor if ($article['edit_date']) { // find a name, if any if ($article['edit_name']) { // label the action if (isset($article['edit_action'])) { $action = Anchors::get_action_label($article['edit_action']); } else { $action = i18n::s('edited'); } // name of last editor $user = sprintf(i18n::s('%s by %s'), $action, Users::get_link($article['edit_name'], $article['edit_address'], $article['edit_id'])); } $last_post .= $flag . BR . '<span class="tiny">' . $user . ' ' . Skin::build_date($article['edit_date']) . '</span>'; } } // this is another row of the output $text .= Skin::table_row(array($prefix . $title . $suffix . $details, 'center=' . $count, $last_post)); } // end of processing SQL::free($result); $text .= Skin::table_suffix(); return $text; }
{ "type": "line", "values": [ 2, 2, 2, 2, 2, 2, 2 ], "dot-style": { "type": "star", "colour": "#8000FF", "dot-size": 4 }, "width": 1, "colour": "#8000FF", "tip": "Purple #val#", "text": "Mr Purple", "font-size": 10, "loop": true } ], "title": { "text": "Radar Chart" }, "radar_axis": { "max": 5, "colour": "#DAD5E0", "grid-colour": "#DAD5E0", "labels": { "labels": [ "Zero", "", "", "Middle", "", "High" ], "colour": "#9F819F" }, "spoke-labels": { "labels": [ "Strength", "Smarts", "Sweet Tooth", "Armour", "Max Hit Points", "foo", "bar" ], "colour": "#9F819F" } }, "tooltip": { "mouse": 1 }, "bg_colour": "#ffffff" }'; // [chart]...[/chart] $context['text'] .= '[title]' . i18n::s('Static chart') . ' [escape][chart]...[/chart][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][chart=320, 256]' . "\n" . $chart_data . "\n" . '[/chart][/escape]</td>' . '<td>[chart=320, 256]' . "\n" . $chart_data . "\n" . '[/chart]</td></tr>' . Skin::table_suffix(); // [execute=tools/echo.php] $context['text'] .= '[title]' . i18n::s('Execute a local script') . ' [escape][execute=tools/echo.php][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][execute=tools/echo.php][/escape]</td>' . '<td>[execute=tools/echo.php]</td></tr>' . Skin::table_suffix(); // [redirect=tools/echo.php] $context['text'] .= '[title]' . i18n::s('Redirect to a local address') . ' [escape][redirect=tools/echo.php][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example')), 'header') . '<tr><td class="sample">[escape][redirect=tools/echo.php][/escape]</td></tr>' . Skin::table_suffix(); // [parameter=page_details] $context['text'] .= '[title]' . i18n::s('Display some parameter') . ' [escape][parameter=site_name][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][parameter=site_name][/escape]</td>' . '<td>[parameter=site_name]</td></tr>' . Skin::table_suffix(); // [escape]...[/escape] $context['text'] .= '[title]' . i18n::s('Prevent code interpretation') . ' [escape][escape]...[/escape][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][escape]hello world[new][/escape][/escape]</td>' . '<td>[escape]hello world[new][/escape]</td></tr>' . Skin::table_suffix(); // [anonymous]...[/anonymous] $context['text'] .= '[title]' . i18n::s('Displayed only to anonymous surfers') . ' [escape][anonymous]...[/anonymous][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][anonymous]' . i18n::s('Displayed only to anonymous surfers') . '[/anonymous][/escape]</td>' . '<td>[anonymous]' . i18n::s('Displayed only to anonymous surfers') . '[/anonymous]</td></tr>' . Skin::table_suffix(); // [authenticated]...[/authenticated] $context['text'] .= '[title]' . i18n::s('Displayed only to authenticated surfers') . ' [escape][authenticated]...[/authenticated][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][authenticated]' . i18n::s('Displayed only to authenticated surfers') . '[/authenticated][/escape]</td>' . '<td>[authenticated]' . i18n::s('Displayed only to authenticated surfers') . '[/authenticated]</td></tr>' . Skin::table_suffix(); // [associate]...[/associate] $context['text'] .= '[title]' . i18n::s('Displayed only to associates') . ' [escape][associate]...[/associate][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][associate]' . i18n::s('Displayed only to associates') . '[/associate][/escape]</td>' . '<td>[associate]' . i18n::s('Displayed only to associates') . '[/associate]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
// ++...++ $context['text'] .= '[title]' . i18n::s('Wiki insertion') . ' [escape]++...++[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text ++has been inserted++.') . '[/escape]</td>' . '<td>' . i18n::s('This text ++has been inserted++.') . '</td></tr>' . Skin::table_suffix(); // [inserted]...[/inserted] $context['text'] .= '[title]' . i18n::s('Inserted') . ' [escape][inserted]...[/inserted][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text [inserted]has been inserted[/inserted].') . '[/escape]</td>' . '<td>' . i18n::s('This text [inserted]has been inserted[/inserted].') . '</td></tr>' . Skin::table_suffix(); // --...-- $context['text'] .= '[title]' . i18n::s('Wiki deletion') . ' [escape]--...--[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text --has been deleted--.') . '[/escape]</td>' . '<td>' . i18n::s('This text --has been deleted--.') . '</td></tr>' . Skin::table_suffix(); // [deleted]...[/deleted] $context['text'] .= '[title]' . i18n::s('Deleted') . ' [escape][deleted]...[/deleted][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text [deleted]has been deleted[/deleted].') . '[/escape]</td>' . '<td>' . i18n::s('This text [deleted]has been deleted[/deleted].') . '</td></tr>' . Skin::table_suffix(); // [flag]...[/flag] $context['text'] .= '[title]' . i18n::s('Flag') . ' [escape][flag]...[/flag][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('[flag]important![/flag] Don\'t forget to give something to your cat today.') . '[/escape]</td>' . '<td>' . i18n::s('[flag]important![/flag] Don\'t forget to give something to your cat today.') . '</td></tr>' . Skin::table_suffix(); // [lang=xy]...[/lang] $context['text'] .= '[title]' . i18n::s('Language') . ' [escape][lang=xy]...[/lang][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][lang=en]This is in English[/lang][lang=fr]Ceci est en français[/lang][/escape]</td>' . '<td>[lang=en]This is in English[/lang][lang=fr]Ceci est en français[/lang]</td></tr>' . Skin::table_suffix(); // [style=serif]...[/style] $context['text'] .= '[title]' . i18n::s('Serif') . ' [escape][style=serif]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=serif]' . i18n::s('This text is in Serif.') . '[/style][/escape]</td>' . '<td>[style=serif]' . i18n::s('This text is in Serif.') . '[/style]</td></tr>' . Skin::table_suffix(); // [style=sans-serif]...[/style] $context['text'] .= '[title]' . i18n::s('Sans-Serif') . ' [escape][style=sans-serif]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=sans-serif]' . i18n::s('This text is in Sans-Serif.') . '[/style][/escape]</td>' . '<td>[style=sans-serif]' . i18n::s('This text is in Sans-Serif.') . '[/style]</td></tr>' . Skin::table_suffix(); // [style=cursive]...[/style] $context['text'] .= '[title]' . i18n::s('Cursive') . ' [escape][style=cursive]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=cursive]' . i18n::s('This text is in Cursive.') . '[/style][/escape]</td>' . '<td>[style=cursive]' . i18n::s('This text is in Cursive.') . '[/style]</td></tr>' . Skin::table_suffix(); // [style=fantasy]...[/style] $context['text'] .= '[title]' . i18n::s('Fantasy') . ' [escape][style=fantasy]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=fantasy]' . i18n::s('This text is in Fantasy.') . '[/style][/escape]</td>' . '<td>[style=fantasy]' . i18n::s('This text is in Fantasy.') . '[/style]</td></tr>' . Skin::table_suffix(); // [style=comic]...[/style] $context['text'] .= '[title]' . i18n::s('Comic') . ' [escape][style=comic]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=comic]' . i18n::s('This text is in Comic.') . '[/style][/escape]</td>' . '<td>[style=comic]' . i18n::s('This text is in Comic.') . '[/style]</td></tr>' . Skin::table_suffix(); // [style]...[/style] $context['text'] .= '[title]' . i18n::s('Use any style') . ' [escape][style=<style name>]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=my_style]' . i18n::s('But where will this rabbit be in some minutes? I don\'t know, but it depends also on the turtle speed...') . '[/style][/escape]</td>' . '<td>[style=my_style]' . i18n::s('But where will this rabbit be in some minutes? I don\'t know, but it depends also on the turtle speed...') . '[/style]</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();
$cells = array(); $cells[] = Skin::build_link('http://www.apache.org/', 'Apache'); $cells[] = apache_get_version(); $box .= Skin::table_row($cells, $lines++); } // time shift $cells = array(); $cells[] = i18n::s('Server time zone'); $cells[] = sprintf('UTC %s%s %s', $context['gmt_offset'] > 0 ? '+' : '', $context['gmt_offset'], i18n::ns('hour', 'hours', abs($context['gmt_offset']))); $box .= Skin::table_row($cells, $lines++); // memory usage if (is_callable('memory_get_usage')) { $cells = array(); $cells[] = i18n::s('Memory'); $cells[] = memory_get_usage(); $box .= Skin::table_row($cells, $lines++); } // end of the table $box .= Skin::table_suffix(); // make a nice box out of it $text .= Skin::build_box(i18n::s('System overview'), $box); } // available commands for system management $commands = array(); $commands[] = sprintf(i18n::s('%s - basic view of the system'), '<a href="test.php">' . i18n::s('Test') . '</a>'); // more information to associates if (Surfer::is_associate()) { $commands[] = sprintf(i18n::s('%s - phpinfo() and more'), '<a href="info.php">' . i18n::s('Run-time information') . '</a>'); $commands[] = sprintf(i18n::s('%s - operation summary'), '<a href="../agents/">' . i18n::s('Background processing') . '</a>'); } // commands for associates -- complex command
/** * build one table * * Accept following variants: * - csv - to provide a downloadable csv page * - json - to provide all values in one column * - inline - to render tables within articles * - simple - the legacy fixed table * - sortable - click on column to sort the row * * @param the id of the table to build * @param string the variant to provide - default is 'simple' * @return a displayable string */ public static function build($id, $variant = 'simple') { global $context; // split parameters $attributes = preg_split("/\\s*,\\s*/", $id, 3); $id = $attributes[0]; // get the table object if (!($table = Tables::get($id))) { return NULL; } // do the SELECT statement if (!($rows = SQL::query($table['query']))) { Logger::error(sprintf(i18n::s('Error in table query %s'), $id) . BR . htmlspecialchars($table['query']) . BR . SQL::error()); return NULL; } // build the resulting string $text = ''; switch ($variant) { // produce a table readable into MS-Excel case 'csv': // comma separated values $separator = ","; // one row for the title if ($table['title']) { $label = preg_replace('/\\s/', ' ', $table['title']); // encode to ASCII $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); $text .= '"' . $label . '"'; $text .= "\n"; } // one row for header fields $index = 0; while ($field = SQL::fetch_field($rows)) { if ($index++) { $text .= $separator; } $label = trim(preg_replace('/\\s/', ' ', ucfirst($field->name))); // encode $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); $text .= '"' . $label . '"'; } $text .= "\n"; // process every table row $row_index = 0; while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // glue cells if ($index++) { $text .= $separator; } // remove HTML tags $value = strip_tags(str_replace('</', ' </', str_replace(BR, ' / ', $value))); // clean spaces $label = trim(preg_replace('/\\s+/', ' ', $value)); // encode $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // make a link if this is a reference if ($index == 1 && $table['with_zoom'] == 'Y') { $label = $context['url_to_home'] . $context['url_to_root'] . $label; } // quote data $text .= '"' . $label . '"'; } // new line $text .= "\n"; } return $text; // a JSON set of values // a JSON set of values case 'json': // get header labels $labels = array(); while ($field = SQL::fetch_field($rows)) { $labels[] = trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); } // all items $data = array(); $data['items'] = array(); while ($row = SQL::fetch_row($rows)) { // all rows $datum = array(); $label = FALSE; $index = 0; $link = NULL; foreach ($row as $name => $value) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { $link = $context['url_to_home'] . $context['url_to_root'] . ltrim($value, '/'); continue; } // adjust types to not fool the json encoder if (preg_match('/^(\\+|-){0,1}[0-9]+$/', $value)) { $value = intval($value); } elseif (preg_match('/^(\\+|-){0,1}[0-9\\.,]+$/', $value)) { $value = floatval($value); } elseif (preg_match('/^(true|false)$/i', $value)) { $value = intval($value); } // ensure we have some label for SIMILE Exhibit if (!$label) { $label = $value; } // combine first and second columns if ($index == 2 && $link) { $value = Skin::build_link($link, $value, 'basic'); } // save this value $datum[$labels[$name]] = utf8::to_ascii($value, PRINTABLE_SAFE_ALPHABET); } if ($label && !in_array('label', $labels)) { $datum['label'] = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); } // add a tip, if any $data['items'][] = $datum; } include_once $context['path_to_root'] . 'included/json.php'; $text .= json_encode2($data); return $text; // list of facets for SIMILE Exhibit // list of facets for SIMILE Exhibit case 'json-facets': // columns are actual facets $facets = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // first column has a link if ($index == 2 && $table['with_zoom'] == 'Y') { continue; } // column is a facet $label = '.' . trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); $title = trim(str_replace(',', '', ucfirst($field->name))); $facets[] = '<div ex:role="facet" ex:expression="' . $label . '" ex:facetLabel="' . $title . '"></div>'; // only last columns can be faceted if (count($facets) > 7) { array_shift($facets); } } // reverse facet order $facets = array_reverse($facets); // job done $text = join("\n", $facets); return $text; // list of columns for SIMILE Exhibit // list of columns for SIMILE Exhibit case 'json-labels': // get header labels $labels = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // column id $labels[] = '.' . trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); // limit the number of columns put on screen if (count($labels) >= 7) { break; } } // job done $text = join(', ', $labels); return $text; // titles of columns for SIMILE Exhibit // titles of columns for SIMILE Exhibit case 'json-titles': // get header labels $labels = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // column header $labels[] = trim(str_replace(',', '', ucfirst($field->name))); } $text = join(', ', $labels); return $text; // produce an HTML table // produce an HTML table default: case 'inline': case 'sortable': // a table with a grid $text .= Skin::table_prefix('grid'); // the title, with a menu to download the table into Excel if ($variant == 'inline') { $item_bar = array(); $item_bar += array(Tables::get_url($id) => $table['title']); $item_bar += array(Tables::get_url($id, 'fetch_as_csv') => 'CSV (Excel)'); if (Surfer::is_associate()) { $item_bar += array(Tables::get_url($id, 'edit') => i18n::s('edit')); } if (count($item_bar)) { $text .= '<caption>' . Skin::build_list($item_bar, 'menu') . "</caption>\n"; } } // column headers are clickable links $cells = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { if ($index++ != 0 || $table['with_zoom'] != 'Y') { $cells[] = ucfirst($field->name); } } $text .= "\t\t" . Skin::table_row($cells, 'sortable'); // the table body $count = 0; $row_index = 0; while ($row = SQL::fetch_row($rows)) { $cells = array(); $link = ''; for ($index = 0; $index < count($row); $index++) { if ($index == 0 && $table['with_zoom'] == 'Y') { $link = $row[$index]; } elseif ($link) { $cells[] = Skin::build_link($link, $row[$index]); $link = ''; } else { $cells[] = $row[$index]; } } $text .= "\t\t" . Skin::table_row($cells, $count++); } $text .= Skin::table_suffix(); return $text; // adapted to open chart flash // adapted to open chart flash case 'chart': // get title for y series $y_title = $y2_title = $y3_title = NULL; $y_index = $y2_index = $y3_index = 0; $index = 0; while ($field = SQL::fetch_field($rows)) { // time will be used for x labels if ($index == 0 && $table['with_zoom'] == 'T') { } elseif ($index == 0 && $table['with_zoom'] == 'Y') { } elseif (!$y_title) { $y_title = '"' . ucfirst($field->name) . '"'; $y_index = $index; } elseif (!$y2_title) { $y2_title = '"' . ucfirst($field->name) . '"'; $y2_index = $index; } elseif (!$y3_title) { $y3_title = '"' . ucfirst($field->name) . '"'; $y3_index = $index; break; } $index++; } // process every table row $x_labels = array(); $y_values = array(); $y2_values = array(); $y3_values = array(); $y_min = $y_max = NULL; $count = 1; while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // quote data if (preg_match('/-*[^0-9\\,\\.]/', $label)) { $label = '"' . $label . '"'; } // x labels if ($index == 0) { if ($table['with_zoom'] == 'T') { array_unshift($x_labels, $label); } else { $x_labels[] = $count++; } // y value } elseif ($index == $y_index) { if ($table['with_zoom'] == 'T') { array_unshift($y_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // y2 value } elseif ($index == $y2_index) { if ($table['with_zoom'] == 'T') { array_unshift($y2_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // y3 value } elseif ($index == $y3_index) { if ($table['with_zoom'] == 'T') { array_unshift($y3_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // we won't process the rest break; } // next column $index++; } } // y minimum if ($y_min > 0) { $y_min = 0; } // y maximum $y_max = strval($y_max); if (strlen($y_max) == 1) { $y_max = 10; } elseif (strlen($y_max) == 2) { $y_max = (intval(substr($y_max, 0, 1)) + 1) * 10; } elseif (strlen($y_max) == 3) { $y_max = (intval(substr($y_max, 0, 2)) + 1) * 10; } else { $y_max = strval(intval(substr($y_max, 0, 2)) + 1) . substr('0000000000000000000000000000000000000000000000000000', 0, strlen($y_max) - 2); } // data series $elements = array(); if (count($y_values)) { $elements[] = '{ "type":"bar_glass", "colour":"#BF3B69", "values": [ ' . join(',', $y_values) . ' ], "text": ' . $y_title . ', "font-size": 12 }'; } if (count($y2_values)) { $elements[] = '{ "type": "line", "width": 1, "colour": "#5E4725", "values": [ ' . join(',', $y2_values) . ' ], "text": ' . $y2_title . ', "font-size": 12 }'; } if (count($y3_values)) { $elements[] = '{ "type":"bar_glass", "colour":"#5E0722", "values": [ ' . join(',', $y3_values) . ' ], "text": ' . $y3_title . ', "font-size": 12 }'; } // the full setup $text = '{ "elements": [ ' . join(',', $elements) . ' ], "x_axis": { "offset": false, "steps": 1, "labels": { "steps": 3, "rotate": 310, "labels": [ ' . join(',', $x_labels) . ' ] } }, "y_axis": { "min": ' . $y_min . ', "max": ' . $y_max . ' } }'; return $text; // first number // first number case 'column': // comma separated values $separator = ","; // process every table row while ($row = SQL::fetch($rows)) { // not always the first column $index = 0; foreach ($row as $name => $value) { $index++; // skip dates and links if ($index == 1 && $table['with_zoom'] != 'N') { continue; } // glue cells if ($text) { $text .= $separator; } // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // quote data if (preg_match('/[^a-zA-Z0-9\\,\\.\\-_]/', $label)) { $text .= '"' . $label . '"'; } else { $text .= $label; } // only first column break; } } return $text; // produce a raw table // produce a raw table case 'raw': // comma separated values $separator = ","; // process every table row while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // glue cells if ($index++) { $text .= $separator; } // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // make a link if this is a reference if ($index == 0 && $table['with_zoom'] == 'Y') { $label = $context['url_to_home'] . $context['url_to_root'] . $label; } // quote data if (preg_match('/[^a-zA-Z0-9\\-_]/', $label)) { $text .= '"' . $label . '"'; } else { $text .= $label; } } // new line $text .= "\n"; } return $text; // a simple table // a simple table case 'simple': $text .= Skin::table_prefix('table'); // columns headers $index = 0; while ($field = SQL::fetch_field($rows)) { $cells[] = ucfirst($field->name); } $text .= Skin::table_row($cells, 'header'); // other rows while ($row = SQL::fetch_row($rows)) { $text .= Skin::table_row($row, $count++); } $text .= Skin::table_suffix(); return $text; // xml table // xml table case 'xml': $text = ''; while ($row = SQL::fetch($rows)) { $text .= ' <item>' . "\n"; foreach ($row as $name => $value) { $type = preg_replace('/[^a-z0-9]+/i', '_', $name); if (preg_match('/^[^a-z]/i', $type)) { $type = '_' . $type; } $text .= ' <' . $type . '>' . preg_replace('/&(?!(amp|#\\d+);)/i', '&', utf8::transcode(str_replace(array('left=', 'right='), '', $value))) . '</' . $type . '>' . "\n"; } $text .= ' </item>' . "\n\n"; } return '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<items>' . "\n" . $text . '</items>' . "\n"; } }
// ===...=== $context['text'] .= '[title]' . i18n::s('Header level 2') . ' [escape]===...===[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl]' . '[escape]===' . i18n::s('Rabbit and Turtle') . '===[/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . "\n" . '===' . i18n::s('Rabbit and Turtle') . '===' . "\n" . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // [header2]...[/header2] $context['text'] .= '[title]' . i18n::s('Header level 2') . ' [escape][header2]...[/header2][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl][nl]' . '[escape][header2]' . i18n::s('Rabbit and Turtle') . '[/header2][/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[nl]' . '[header2]' . i18n::s('Rabbit and Turtle') . '[/header2]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // ====...==== $context['text'] .= '[title]' . i18n::s('Header level 3') . ' [escape]====...====[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl]' . '[escape]====' . i18n::s('Rabbit and Turtle') . '====[/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . "\n" . '====' . i18n::s('Rabbit and Turtle') . '====' . "\n" . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // [header3]...[/header3] $context['text'] .= '[title]' . i18n::s('Header level 3') . ' [escape][header3]...[/header3][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl][nl]' . '[escape][header3]' . i18n::s('Rabbit and Turtle') . '[/header3][/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[nl]' . '[header3]' . i18n::s('Rabbit and Turtle') . '[/header3]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // =====...===== $context['text'] .= '[title]' . i18n::s('Header level 4') . ' [escape]=====...=====[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl]' . '[escape]=====' . i18n::s('Rabbit and Turtle') . '=====[/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . "\n" . '=====' . i18n::s('Rabbit and Turtle') . '=====' . "\n" . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // [header4]...[/header4] $context['text'] .= '[title]' . i18n::s('Header level 4') . ' [escape][header4]...[/header4][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl][nl]' . '[escape][header4]' . i18n::s('Rabbit and Turtle') . '[/header4][/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[nl]' . '[header4]' . i18n::s('Rabbit and Turtle') . '[/header4]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // ======...====== $context['text'] .= '[title]' . i18n::s('Header level 5') . ' [escape]======...======[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl]' . '[escape]======' . i18n::s('Rabbit and Turtle') . '======[/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . "\n" . '======' . i18n::s('Rabbit and Turtle') . '======' . "\n" . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // [header5]...[/header5] $context['text'] .= '[title]' . i18n::s('Header level 5') . ' [escape][header5]...[/header5][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape][nl][nl]' . '[escape][header5]' . i18n::s('Rabbit and Turtle') . '[/header5][/escape][nl]' . '[escape]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '[nl]' . '[header5]' . i18n::s('Rabbit and Turtle') . '[/header5]' . i18n::s('But where will this rabbit be in some minutes?[nl]I don\'t know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // [toq] $context['text'] .= '[title]' . i18n::s('Table of Questions') . ' [escape][toq][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][toq][/escape]</td>' . '<td>[toq]</td></tr>' . Skin::table_suffix(); // [question]...[/question] $context['text'] .= '[title]' . i18n::s('Question-title') . ' [escape][question]...[/question][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][question]' . i18n::s('But where will this rabbit be in some minutes?') . '[/question][/escape]</td>' . '<td>[question]' . i18n::s('But where will this rabbit be in some minutes?') . '[/question]</td></tr>' . Skin::table_suffix(); // [question] $context['text'] .= '[title]' . i18n::s('Question') . ' [escape][question][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][question]' . i18n::s('But where is this rabbit right now?') . '[/escape]</td>' . '<td>[question]' . i18n::s('But where is this rabbit right now?') . '</td></tr>' . Skin::table_suffix(); // [answer] $context['text'] .= '[title]' . i18n::s('Answer') . ' [escape][answer][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][answer]' . i18n::s('I do not know, but it depends also on the turtle speed...') . '[/escape]</td>' . '<td>[answer]' . i18n::s('I do not know, but it depends also on the turtle speed...') . '</td></tr>' . Skin::table_suffix(); // transform the text $context['text'] = Codes::beautify($context['text']); // general help on this page $help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>'; $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); // render the skin render_skin();