示例#1
0
<?php

/**
 * The Product Page!
 * 
 * RFI & SANH 2007-03-02
 */
require_once PROJECT_ROOT . '/haddock/database/classes/' . 'Database_MySQLUserFactory.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_P.inc.php';
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$comments_table = $database->get_table('hpi_shop_comments');
if (isset($_GET['add_comment'])) {
    if ($_POST['name'] != '' && $_POST['email'] != '' && $_POST['comment'] != '') {
        $ip = $_SERVER['REMOTE_ADDR'];
        $last_added_id = $comments_table->add_comment($_POST['name'], $ip, $_POST['email'], $_POST['url'], $_POST['homepage_title'], $_POST['comment'], $_POST['product_id']);
        $form_notification = new HTMLTags_P('Thank you for your comment.<br />Comments can take up to 24 hours to appear in the shop.');
        echo $form_notification->get_as_string();
    } else {
        $form_notification = new HTMLTags_P('Please complete name, email and comment');
        echo $form_notification->get_as_string();
    }
}
<?php

/**
 * The p the link to the page for all the products.
 * 
 * @copyright Clear Line Web Design, 2007-07-26
 */
$all_products_link = new HTMLTags_A('See All Products');
$all_products_location = new HTMLTags_URL();
$all_products_location->set_file('/');
$all_products_location->set_get_variable('section', 'plug-ins');
$all_products_location->set_get_variable('module', 'shop');
$all_products_location->set_get_variable('page', 'products');
$all_products_location->set_get_variable('type', 'html');
$all_products_link->set_href($all_products_location);
$all_products_link_p = new HTMLTags_P();
$all_products_link_p->append_tag_to_content($all_products_link);
echo $all_products_link_p->get_as_string();
<?php

/**
 * Link to the log out script of a page in the admin section.
 *
 * @copyright Clear Line Web Design, 2007-08-22
 */
$log_out_p = new HTMLTags_P();
$log_out_p->set_attribute_str('id', 'log_out');
$alm = Admin_LoginManager::get_instance();
$log_out_p->append_tag_to_content($alm->get_log_out_a());
echo $log_out_p->get_as_string();
<?php

/**
 * Link to the log out script of a page in the admin section.
 *
 * @copyright Clear Line Web Design, 2007-08-23
 */
$logged_in_as_p = new HTMLTags_P();
$logged_in_as_p->set_attribute_str('id', 'logged_in_as');
$alm = Admin_LoginManager::get_instance();
$logged_in_as_p->append_str_to_content('<em>User:</em> ' . $alm->get_name());
$logged_in_as_p->append_str_to_content('&nbsp;');
$logged_in_as_p->append_str_to_content('<em>Type:</em> ' . $alm->get_type());
echo $logged_in_as_p->get_as_string();
<?php

/**
 * The welcome message given to all clients.
 * 
 * @copyright Clear Line Web Design, 2007-07-26
 */
$welcome_message_txt = <<<TXT
Welcome to our shop!
TXT;
$welcome_message_p = new HTMLTags_P($welcome_message_txt);
$welcome_message_p->set_attribute_str('id', 'welcome_message');
echo $welcome_message_p->get_as_string();
<?php

/**
 * The text that is given to the customer if they are logged in that
 * tells them how to log out.
 *
 * @copyright Clear Line Web Design, 2007-08-21
 */
$text = <<<TXT
You are already logged in.
Perhaps you'd like to log out and log in again as someone else...
If so, please click below.
TXT;
$p = new HTMLTags_P($text);
echo $p->get_as_string();
<?php

/**
 * The Salutation that is offered to a customer if they are logged in.
 *
 * @copyright Clear Line Web Design, 2007-07-26
 */
$if_logged_in_message_txt = <<<TXT
Hello&nbsp;
TXT;
$customer = $log_in_manager->get_customer();
$if_logged_in_message_txt .= $customer->get_full_name();
$if_logged_in_message_p = new HTMLTags_P($if_logged_in_message_txt);
echo $if_logged_in_message_p->get_as_string();