<?php
// $Id: bracelets.php,v 1.1.1.1 2002/09/15 22:26:15 root Exp $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Jim McDonald
// Purpose of file: Show bracelets items in amazon
// ----------------------------------------------------------------------

/**
 * initialise block
 */
function amazon_braceletsblock_init()
{
    // Security
    pnSecAddSchema( 'Amazon:Braceletsblock:', 'Block title::' );
}

/**
 * get information on block
 */
function amazon_braceletsblock_info()
{
    // Values
    return array( 'text_type' => 'Bracelets',
                  'module' => 'Amazon',
                  'text_type_long' => 'For The Children Bracelets',
                  'allow_multiple' => true,
                  'form_content' => false,
                  'form_refresh' => false,
                  'show_preview' => true );
}

/**
 * display block
 */
function amazon_braceletsblock_display( $blockinfo )
{
    // Security check
    if ( !pnSecAuthAction( 0,
                           'Amazon:Braceletsblock:',
                           "$blockinfo[title]::",
                           ACCESS_READ ) )
    {
        return;
    }

    $output = new pnHTML();
    $output->SetInputMode( _PNH_VERBATIMINPUT );

    $blockHTML = ''
        . '<div align="center">'
//        . '  <div style="padding-bottom:3px;font-size:10px;"><b>Click to see his new room!</b></div>'
//        . '  <a href="/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=5043"><img src="images/tm/rrwinner03.gif" width="160" height="133" border="0"></a>'

. '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="padding:0px;margin:0px">'
. '<input type="image" src="/images/banners/bracelets.jpg" width="160" height="150" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">'
. '<input type="hidden" name="add" value="1">'
. '<input type="hidden" name="cmd" value="_cart">'
. '<input type="hidden" name="business" value="shopping@kidspages.org">'
. '<input type="hidden" name="item_name" value="Kids\' Pages Cares Bracelet">'
. '<input type="hidden" name="amount" value="3.00">'
. '<input type="hidden" name="no_note" value="1">'
. '<input type="hidden" name="currency_code" value="USD">'
. '<input type="hidden" name="lc" value="US">'
. '</form>'
. '<span style="font-size:10px">Mailed to your home.<br />Includes shipping & handling.</span>'

        . '</div>';

    $output->Text( $blockHTML );

    // Populate block info and pass to theme
    $blockinfo['content'] = $output->GetOutput();
    return themesideblock( $blockinfo );
}

/**
 * modify block settings
 */
function amazon_braceletsblock_modify( $blockinfo )
{
    // Create output object
    $output = new pnHTML();

    // Get current content
    $vars = pnBlockVarsFromContent( $blockinfo['content'] );

    // Defaults
    if ( empty( $vars['numitems'] ) )
    {
        $vars['numitems'] = 5;
    }

    // Create row
    $row = array();
    $output->SetOutputMode( _PNH_RETURNOUTPUT );
    $row[] = $output->Text( _NUMITEMS );
    $row[] = $output->FormText( 'numitems',
                                pnVarPrepForDisplay( $vars['numitems'] ),
                                5,
                                5 );
    $output->SetOutputMode( _PNH_KEEPOUTPUT );

    // Add row
    $output->SetInputMode( _PNH_VERBATIMINPUT );
    $output->TableAddRow( $row, 'left' );
    $output->SetInputMode( _PNH_PARSEINPUT );

    // Return output
    return $output->GetOutput();
}

/**
 * update block settings
 */
function amazon_braceletsblock_update( $blockinfo )
{
    $vars['numitems'] = pnVarCleanFromInput( 'numitems' );

    $blockinfo['content'] = pnBlockVarsToContent( $vars );

    return $blockinfo;
}

?>
