1
0

Add link to photo thumbnails for ordering prints.

This commit is contained in:
rWatcher 2012-06-02 23:46:32 -04:00
parent d90eb9b884
commit 5f5d8b986f
4 changed files with 34 additions and 5 deletions

View File

@ -27,4 +27,16 @@ class fotomotorw_event_Core {
->label(t("Fotomoto"))
->url(url::site("admin/fotomotorw")));
}
static function context_menu($menu, $theme, $item) {
// Add a "Buy Prints" option to the photo's thumbnail menu.
if ($item->type == "photo") {
$menu->get("options_menu")
->append(Menu::factory("link")
->id("fotomotorw")
->label(t("Buy Prints"))
->url("javascript:showFotomotoDialog(100, '" . url::abs_site("fotomotorw/resize/" . md5($item->created) . "/{$item->id}") . "');")
->css_class("g-print-fotomotorw-link ui-icon-print"));
}
}
}

View File

@ -18,20 +18,21 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class fotomotorw_theme_Core {
class fotomotorw_theme_Core {
static function head($theme) {
// Load fotomoto's js file on photo pages.
if($theme->page_subtype == "photo") {
// Load fotomoto's js file on photo and album pages.
if(($theme->page_subtype == "photo") || ($theme->page_subtype == "album")) {
return html::script('http://widget.fotomoto.com/stores/script/' . module::get_var("fotomotorw", "fotomoto_site_key") . '.js?api=true');
}
}
static function resize_bottom($theme) {
// Generate an array of links to display below photos.
// Create a new block to use to display Fotomoto buy links below the photo.
$block = new Block;
$block->css_id = "g-fotomoto";
$block->anchor = "fotomoto";
// Generate an array of links to display below photos.
$link_array = array();
$counter = 0;
if (module::get_var("fotomotorw", "fotomoto_buy_prints")) {
@ -63,9 +64,19 @@ class fotomotorw_theme_Core {
$counter++;
}
$view = new View("fotomotorw_block.html");
$view = new View("fotomotorw_photo_block.html");
$view->details = $link_array;
$block->content = $view;
return $block;
}
static function album_bottom($theme) {
// Add some javascript to the bottom of album pages.
$block = new Block;
$block->css_id = "g-fotomoto";
$block->anchor = "fotomoto";
$view = new View("fotomotorw_album_block.html");
$block->content = $view;
return $block;
}
}

View File

@ -0,0 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
function showFotomotoDialog(window_type, resize_url) {
FOTOMOTO.API.showWindow(window_type, resize_url);
}
</script>