Ejemplo n.º 1
0
function display_page_content()
{
    $accnt_id = requestIdParam();
    $account = Paypal_Config::FindById($accnt_id);
    ?>

<script type="text/javascript">
	$().ready(function() {
		$("#edit_paypal").validate({
			rules: {
					email: { required: true, email: true }
				},
			messages: {
					email: "Please enter a valid email address"
				}
		});
	});
</script>

<form id="edit_paypal" method="POST">

	<h1>Edit Account "<?php 
    echo $account->account_name;
    ?>
"</h1>
	
	<p class="announce">There is one PayPal account associated with <a href="<?php 
    echo BASEHREF;
    ?>
admin/list_products">products</a> on your site. To change the email associated with products and your PayPal account, edit it here. If you need more than one account &ndash; say, for different types of products &ndash; then let us know, and we can add that functionality.</p>
	<p>&nbsp;</p>
	
	<p><label for="email">Email:</label>
	<?php 
    textField("email", $account->email, "required: true");
    ?>
</p>
	
	<p><label for="email">Success URL:</label>
	<?php 
    textField("success_url", $account->success_url);
    ?>
<br />
	<span class="hint">Optional address to send people to when they successfully complete a checkout</span></p>
	
	<p><label for="email">Cancel URL:</label>
	<?php 
    textField("cancel_url", $account->cancel_url);
    ?>
<br />
	<span class="hint">Optional address to send people to when they decline or cancel a checkout</span></p>
		
	<input type="submit" class="submitbutton" name="submit" value="Save" />
</form>
<?php 
}
Ejemplo n.º 2
0
 function setLink($id, $table)
 {
     $paypal_accnt = Paypal_Config::FindFirst("Paypal_Config", "email='{$this->email}'");
     if (!$paypal_accnt) {
         echo "Too bad\n";
         return false;
     }
     $query = "INSERT INTO paypal_items (item_table, item_id, paypal_id) VALUES ('{$table}', '{$id}', '{$this->id}');";
     mysql_query($query, MyActiveRecord::Connection());
 }
Ejemplo n.º 3
0
function display_page_content()
{
    $accounts = Paypal_Config::FindAll();
    ?>

					<h1>List of Paypal accounts</h1>
					<ul id="paypal">
<?php 
    if (count($accounts) > 1) {
        foreach ($accounts as $account) {
            echo "\t\t\t\t\t\t<li><a href=\"" . get_link("/admin/edit_paypal/{$account->id}") . "\">{$account->account_name}</a> {$account->email}</li>\n";
        }
    } else {
        redirect("admin/edit_paypal/{$account->id}");
    }
    ?>
	
					</ul>

<?php 
}
Ejemplo n.º 4
0
function product_display($content_to_display)
{
    // This is the pattern: }}product:sample1}}
    $productPattern = "*}{2}(product:[A-Za-z0-9_ \\-]+)}{2}*";
    $productIds = getFilterIds($content_to_display, $productPattern);
    $products = array();
    foreach ($productIds as $productName) {
        $sploded = explode(":", $productName);
        $products[] = Product::FindByName($sploded[1]);
    }
    foreach ($products as $product) {
        if (is_object($product)) {
            $account = Paypal_Config::GetAccount();
            //print_r($product);
            // TO DO: Move the render function into the model, like videos and testimonials
            $replacement = "\n    \t\t\t\t<div id =\"product_{$product->id}\" class=\"product\">\n    \t\t\t\t\t<h3>{$product->display_name}</h3>\n    \t\t\t\t\t<table cellspacing=\"0\" cellpadding=\"0\">\n    \t\t\t\t\t\t<tbody>\n    \t\t\t\t\t\t\t<tr>\n    \t\t\t\t\t\t\t\t<td valign=\"top\">\n";
            if ($product->thumbnail) {
                $replacement .= "\t\t\t\t\t\t\t\t\t<div id=\"prodGal_" . $product->id . "\">\n    \t\t\t\t\t\t\t\t\t\t<a class=\"product_thumb\" href=\"" . get_link("/images/prodimg/" . $product->id) . "\"><img src=\"" . get_link("/images/prodimg/" . $product->id) . "\" title=\"{$product->display_name}\" /></a>\n    \t\t\t\t\t\t\t\t\t</div>\n    \t\t\t\t\t\t\t\t\t\n    \t\t\t\t\t\t\t\t\t<script type= \"text/javascript\">//<![CDATA[\n    \t\t\t\t\t\t\t\t\t\$(function() { \$('#prodGal_" . $product->id . " a').hcdlightBox(); });\n    \t\t\t\t\t\t\t\t\t//]]></script>\n";
            }
            $replacement .= "\n    \t\t\t\t\t\t\t\t\t<form action=\"https://www.paypal.com/cgi-bin/webscr\" target=\"_blank\" method=\"post\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"business\" value=\"" . $account->email . "\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"undefined_quantity\" value=\"1\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"item_name\" value=\"" . $product->display_name . "\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"item_number\" value=\"" . $product->name . "\">\n";
            if ($product->price > 0) {
                $replacement .= "\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"amount\" value=\"" . $product->price . "\">\n";
            }
            $replacement .= "\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"no_shipping\" value=\"2\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"return\" value=\"" . $account->return . "\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"cancel_return\" value=\"" . $account->cancel_return . "\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"no_note\" value=\"0\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"currency_code\" value=\"USD\">\n    \t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"lc\" value=\"US\">";
            if ($product->price > 0) {
                $replacement .= "\$" . $product->price . " <br />\n\t\t\t\t\t\t\t\t\t\t<font>(plus shipping if applicable)</font><br />";
            }
            if ($product->price == 0 || $product->price == 0.0) {
                $replacement .= "\n    \t\t\t\t\t\t\t\t\t\t<input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">";
            } else {
                $replacement .= "\n    \t\t\t\t\t\t\t\t\t\t<input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/x-click-but23.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">";
            }
            $replacement .= "\n    \t\t\t\t\t\t\t\t\t</form>\n    \t\t\t\t\t\t\t\t</td>\n    \t\t\t\t\t\t\t\t<td valign=\"top\">\n    \t\t\t\t\t\t\t\t\t" . $product->description . "\n    \t\t\t\t\t\t\t\t</td>\n    \t\t\t\t\t\t\t</tr>\n    \t\t\t\t\t\t</tbody>\n    \t\t\t\t\t</table>\n    \t\t\t\t</div>\n    \t\t\t";
            $search = "}}product:" . $product->name . "}}";
            $content_to_display = str_replace($search, $replacement, $content_to_display);
        } else {
            $content_to_display = "<span class=\"database_error\">HCd&gt;CMS Warning: Product not found!</span> " . $content_to_display;
        }
    }
    return $content_to_display;
}
Ejemplo n.º 5
0
function display_page_content()
{
    $product_id = requestIdParam();
    $product = Product::FindById($product_id);
    $account = Paypal_Config::GetAccount();
    ?>
										
	<script type="text/javascript">		
		$().ready(function() {
			$("#edit_product").validate({
				rules: {
						display_name: "required",
						price: "required"
					},
				messages: {
						display_name: "Please enter a name that should be displayed for this product",
						price: "Please enter a price for this product"
					}
			});
		});
	</script>
	
	<div id="edit-header" class="productnav">
		<h1>Edit Product</h1>
	</div>
	
	<form method="POST" id="edit_product" enctype="multipart/form-data">
		<?php 
    hiddenField("accountId", $account->id);
    ?>
		
		<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
		
		<p class="display_name">
		    <label for="display_name">Display Name:</label>
		    <span class="hint">This is the Proper Name of the product.</span><br />
			<?php 
    textField("display_name", $product->display_name, "required: true");
    ?>
		</p>
		
		<p><label for="price">Price:</label><span class="hint">This is the price of the product.</span><br />
		<?php 
    textField("price", $product->price, "required: true");
    ?>
</p>
		
		<p><?php 
    $product->displayThumbnail();
    ?>
<br />
		    <label for="id_image">Select a new image to use:</label><input type="file" name="image" id="id_image" value="" />
		</p>
		
		<p><label for="product_description">Description:</label><br />
		<?php 
    textArea("product_description", $product->description, 98, 30);
    ?>
		</p>
			
		<p><input type="submit" class="submitbutton" name="submit" value="Save Product" /></p>
	
	
    	<div id="edit-footer" class="productnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Product" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
	<?php 
    $thisuser = Users::GetCurrentUser();
    if ($thisuser->has_role()) {
        ?>
		
        		<p>
        		    <label for="delete">Delete this product? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $product->id;
        ?>
"></label>
            		<span class="hint">Check the box and then click &ldquo;Edit&rdquo; above to delete this product from the database</span>
                </p>
	<?php 
    }
    ?>
    			
			</div>
		</div>
		
	</form>
<?php 
}
Ejemplo n.º 6
0
function display_page_content()
{
    $account = Paypal_Config::GetAccount();
    ?>
										
	<script type="text/javascript">
		$().ready(function() {
			$("#add_product").validate({
				rules: {
						display_name: "required",
						price: "required"
					},
				messages: {
						display_name: "Please a name that should be displayed for this product",
						price: "Please enter a price for this product"
					}
			});
		});
	</script>
					
	<div id="edit-header" class="productnav">
		<h1>Add Product</h1>
	</div>
	
	<form method="POST" id="add_product" enctype="multipart/form-data">
		<?php 
    hiddenField("accountId", $account->id);
    ?>
		
		<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
		
		<p class="display_name"><label for="display_name">Display Name:</label><span class="hint">This is the Proper Name of the product.</span><br />
		<?php 
    textField("display_name", "", "required: true");
    ?>
</p>
		
		<p><label for="price">Price:</label><span class="hint">This is the price of the product.</span><br />
		<?php 
    textField("price", "", "required: true");
    ?>
</p>
		
		<p>
		    <label for="id_image">Select an image to use:</label>
		    <input type="file" name="image" id="id_image" value="" />
		</p>
		
		<p><label for="product_description">Description:</label><br />
		<?php 
    textArea("product_description", "", 98, 30);
    ?>
		</p>
			
		<div id="edit-footer" class="productnav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Add Product" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
				</p>
				
			</div>
			<div class="column half last"></div>
		</div>
		
	</form>
<?php 
}