本文整理汇总了PHP中Page::add_block方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::add_block方法的具体用法?PHP Page::add_block怎么用?PHP Page::add_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::add_block方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_rotate_error
/**
* Display the error.
*
* @param Page $page
* @param string $title
* @param string $message
*/
public function display_rotate_error(Page $page, $title, $message)
{
$page->set_title("Rotate Image");
$page->set_heading("Rotate Image");
$page->add_block(new NavBlock());
$page->add_block(new Block($title, $message));
}
示例2: display_image
public function display_image(Page $page, Image $image)
{
global $config;
$ilink = $image->get_image_link();
$html = "<img id='main_image' src='{$ilink}'>";
if ($config->get_bool("image_show_meta")) {
# FIXME: only read from jpegs?
$exif = @exif_read_data($image->get_image_filename(), 0, true);
if ($exif) {
$head = "";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
if ($key == "IFD0") {
$head .= html_escape("{$name}: {$val}") . "<br>\n";
}
}
}
if ($head) {
$page->add_block(new Block("EXIF Info", $head, "left"));
}
}
}
$zoom_default = $config->get_bool("image_zoom", false) ? "scale(img);" : "";
$zoom = "<script type=\"text/javascript\">\n\t\t\t\t\timg = document.getElementById(\"main_image\");\n\t\t\t\t\t\n\t\t\t\t\tif(img) {\n\t\t\t\t\t\timg.onclick = function() {scale(img);};\n\t\t\t\t\t\n\t\t\t\t\t\tmsg_div = document.createElement(\"div\");\n\t\t\t\t\t\tmsg_div.id = \"msg_div\";\n\t\t\t\t\t\tmsg_div.appendChild(document.createTextNode(\"Note: Image has been scaled to fit the screen; click to enlarge\"));\n\t\t\t\t\t\tmsg_div.style.display=\"none\";\n\t\t\t\t\t\timg.parentNode.insertBefore(msg_div, img);\n\t\t\t\t\t\n\t\t\t\t\t\torig_width = {$image->width};\n\t\t\t\t\t\n\t\t\t\t\t\t{$zoom_default}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction scale(img) {\n\t\t\t\t\t\tif(orig_width >= img.parentNode.clientWidth * 0.9) {\n\t\t\t\t\t\t\tif(img.style.width != \"90%\") {\n\t\t\t\t\t\t\t\timg.style.width = \"90%\";\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"block\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\timg.style.width = orig_width + 'px';\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"none\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t</script>";
$page->add_block(new Block("Image", $html . $zoom, "main", 0));
}
示例3: display_page
public function display_page(Page $page, $images)
{
global $config;
if (count($this->search_terms) == 0) {
$query = null;
$page_title = $config->get_string('title');
} else {
$search_string = implode(' ', $this->search_terms);
$query = url_escape($search_string);
$page_title = html_escape($search_string);
if (count($images) > 0) {
$page->set_subheading("Page {$this->page_number} / {$this->total_pages}");
}
}
if ($this->page_number > 1 || count($this->search_terms) > 0) {
// $page_title .= " / $page_number";
}
$nav = $this->build_navigation($this->page_number, $this->total_pages, $this->search_terms);
$page->set_title($page_title);
$page->set_heading($page_title);
$page->add_block(new Block("Navigation", $nav, "left", 0));
if (count($images) > 0) {
if ($query) {
$page->add_block(new Block("Images", $this->build_table($images, "search={$query}"), "main", 10));
$this->display_paginator($page, "post/list/{$query}", null, $this->page_number, $this->total_pages);
} else {
$page->add_block(new Block("Images", $this->build_table($images, null), "main", 10));
$this->display_paginator($page, "post/list", null, $this->page_number, $this->total_pages);
}
} else {
$page->add_block(new Block("No Images Found", "No images were found to match the search criteria"));
}
}
示例4: display_page_editor
public function display_page_editor(Page $page, WikiPage $wiki_page)
{
$page->set_title(html_escape($wiki_page->title));
$page->set_heading(html_escape($wiki_page->title));
$page->add_block(new NavBlock());
$page->add_block(new Block("Editor", $this->create_edit_html($wiki_page)));
}
示例5: display_global_page
/**
* @param Page $page
* @param array $history
* @param int $page_number
*/
public function display_global_page(Page $page, $history, $page_number)
{
$start_string = "\n\t\t\t<div style='text-align: left'>\n\t\t\t\t" . make_form(make_link("tag_history/revert")) . "\n\t\t\t\t\t<ul style='list-style-type:none;'>\n\t\t";
$end_string = "\n\t\t\t\t\t</ul>\n\t\t\t\t\t<input type='submit' value='Revert To'>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t";
global $user;
$history_list = "";
foreach ($history as $fields) {
$current_id = $fields['id'];
$image_id = $fields['image_id'];
$current_tags = html_escape($fields['tags']);
$name = $fields['name'];
$h_ip = $user->can("view_ip") ? " " . show_ip($fields['user_ip'], "Tagging Image #{$image_id} as '{$current_tags}'") : "";
$setter = "<a href='" . make_link("user/" . url_escape($name)) . "'>" . html_escape($name) . "</a>{$h_ip}";
$history_list .= '
<li>
<input type="radio" name="revert" value="' . $current_id . '">
<a href="' . make_link('post/view/' . $image_id) . '">' . $image_id . '</a>:
' . $current_tags . ' (Set by ' . $setter . ')
</li>
';
}
$history_html = $start_string . $history_list . $end_string;
$page->set_title("Global Tag History");
$page->set_heading("Global Tag History");
$page->add_block(new Block("Tag History", $history_html, "main", 10));
$h_prev = $page_number <= 1 ? "Prev" : '<a href="' . make_link('tag_history/all/' . ($page_number - 1)) . '">Prev</a>';
$h_index = "<a href='" . make_link() . "'>Index</a>";
$h_next = '<a href="' . make_link('tag_history/all/' . ($page_number + 1)) . '">Next</a>';
$nav = $h_prev . ' | ' . $h_index . ' | ' . $h_next;
$page->add_block(new Block("Navigation", $nav, "left"));
}
示例6: display_image
public function display_image(Page $page, Image $image)
{
global $config;
$u_ilink = $image->get_image_link();
if ($config->get_bool("image_show_meta") && function_exists("exif_read_data")) {
# FIXME: only read from jpegs?
$exif = @exif_read_data($image->get_image_filename(), 0, true);
if ($exif) {
$head = "";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
if ($key == "IFD0") {
// Cheap fix for array'd values in EXIF-data
if (is_array($val)) {
$val = implode(',', $val);
}
$head .= html_escape("{$name}: {$val}") . "<br>\n";
}
}
}
if ($head) {
$page->add_block(new Block("EXIF Info", $head, "left"));
}
}
}
$html = "<img alt='main image' class='shm-main-image' id='main_image' src='{$u_ilink}' " . "data-width='{$image->width}' data-height='{$image->height}'>";
$page->add_block(new Block("Image", $html, "main", 10));
}
示例7: display_info_page
public function display_info_page(Page $page, $info)
{
$page->set_title("System Info");
$page->set_heading("System Info");
$page->add_block(new NavBlock());
$page->add_block(new Block("Information:", $this->build_data_form($info)));
}
示例8: display_aliases
public function display_aliases(Page $page, $aliases, $is_admin, $pageNumber, $totalPages)
{
if ($is_admin) {
$action = "<th width='10%'>Action</th>";
$add = "\n\t\t\t\t<tr>\n\t\t\t\t\t<form action='" . make_link("alias/add") . "' method='POST'>\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
} else {
$action = "";
$add = "";
}
$h_aliases = "";
$n = 0;
foreach ($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
$oe = $n++ % 2 == 0 ? "even" : "odd";
$h_aliases .= "<tr class='{$oe}'><td>{$h_old}</td><td>{$h_new}</td>";
if ($is_admin) {
$h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<form action='" . make_link("alias/remove") . "' method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
}
$h_aliases .= "</tr>";
}
$html = "\n\t\t\t<script>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#aliases\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t<table id='aliases' class='zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
$bulk_html = "\n\t\t\t<form enctype='multipart/form-data' action='" . make_link("alias/import") . "' method='POST'>\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
if ($is_admin) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
}
示例9: display_advanced
public function display_advanced(Page $page, $options)
{
global $user;
$rows = "";
$n = 0;
ksort($options);
foreach ($options as $name => $value) {
$h_value = html_escape($value);
$len = strlen($h_value);
$oe = $n++ % 2 == 0 ? "even" : "odd";
$box = "";
if (strpos($value, "\n") > 0) {
$box .= "<textarea cols='50' rows='4' name='_config_{$name}'>{$h_value}</textarea>";
} else {
$box .= "<input type='text' name='_config_{$name}' value='{$h_value}'>";
}
$box .= "<input type='hidden' name='_type_{$name}' value='string'>";
$rows .= "<tr class='{$oe}'><td>{$name}</td><td>{$box}</td></tr>";
}
$table = "\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#settings\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t" . make_form(make_link("setup/save")) . "\n\t\t\t\t<table id='settings' class='zebra'>\n\t\t\t\t\t<thead><tr><th width='25%'>Name</th><th>Value</th></tr></thead>\n\t\t\t\t\t<tbody>{$rows}</tbody>\n\t\t\t\t\t<tfoot><tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr></tfoot>\n\t\t\t\t</table>\n\t\t\t</form>\n\t\t\t";
$page->set_title("Shimmie Setup");
$page->set_heading("Shimmie Setup");
$page->add_block(new Block("Navigation", $this->build_navigation(), "left", 0));
$page->add_block(new Block("Setup", $table));
}
示例10: display_results
public function display_results(Page $page, Image $image)
{
$page->set_title("Thumbnail Regenerated");
$page->set_heading("Thumbnail Regenerated");
$page->add_header("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
$page->add_block(new NavBlock());
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
}
示例11: display_upload_results
public function display_upload_results(Page $page)
{
$page->set_title("Adding folder");
$page->set_heading("Adding folder");
$page->add_block(new NavBlock());
foreach ($this->messages as $block) {
$page->add_block($block);
}
}
示例12: build_tagger
public function build_tagger(Page $page, $event)
{
// Initialization code
$base_href = get_base_href();
// TODO: AJAX test and fallback.
$page->add_html_header("<script src='{$base_href}/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null, "<script type='text/javascript'>\n\t\t\t\t\$( document ).ready(function() {\n\t\t\t\t\tTagger.initialize(" . $event->get_image()->id . ");\n\t\t\t\t});\n\t\t\t</script>", "main", 1000));
// Tagger block
$page->add_block(new Block(null, $this->html($event->get_image()), "main"));
}
示例13: build_tagger
public function build_tagger(Page $page, $event)
{
global $config;
// Initialization code
$base_href = $config->get_string('base_href');
// TODO: AJAX test and fallback.
$page->add_header("<script src='{$base_href}/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null, "<script type='text/javascript'>Tagger.initialize(" . $event->get_image()->id . ");</script>", "main", 1000));
// Tagger block
$page->add_block(new Block(null, $this->html($event->get_image()), "main"));
}
示例14: display_upload_results
public function display_upload_results(Page $page)
{
$page->set_title("Adding folder");
$page->set_heading("Adding folder");
$page->add_block(new NavBlock());
$html = "";
foreach ($this->messages as $block) {
$html .= "<br/>" . html_escape($html);
}
$page->add_block(new Block("Results", $block));
}
示例15: display_resize_page
public function display_resize_page(Page $page, $image_id)
{
global $config;
$default_width = $config->get_int('resize_default_width');
$default_height = $config->get_int('resize_default_height');
$image = Image::by_id($image_id);
$thumbnail = $this->build_thumb_html($image, null);
$html = "<div style='clear:both;'></div>\n\t\t\t\t<p>Resize Image ID " . $image_id . "<br>" . $thumbnail . "</p>\n\t\t\t\t<p>Please note: You will have to refresh the image page, or empty your browser cache.</p>\n\t\t\t\t<p>Enter the new size for the image, or leave blank to scale the image automatically.</p><br>" . make_form(make_link('resize/' . $image_id), 'POST', $multipart = True, 'form_resize') . "\n\t\t\t\t<input type='hidden' name='image_id' value='{$image_id}'>\n\t\t\t\t<table id='large_upload_form'>\n\t\t\t\t\t<tr><td>New Width</td><td colspan='3'><input id='resize_width' name='resize_width' type='text' value='" . $default_width . "'></td></tr>\n\t\t\t\t\t<tr><td>New Height</td><td colspan='3'><input id='resize_height' name='resize_height' type='text' value='" . $default_height . "'></td></tr>\n\t\t\t\t\t<tr><td colspan='4'><input id='resizebutton' type='submit' value='Resize'></td></tr>\n\t\t\t\t</table>\n\t\t\t</form>\n\t\t";
$page->set_title("Resize Image");
$page->set_heading("Resize Image");
$page->add_block(new NavBlock());
$page->add_block(new Block("Resize Image", $html, "main", 20));
}