public function __construct(Exception $e, $print_name = FALSE, $print_trace = FALSE) { parent::__construct(); $this->set_attribute_str('id', 'exception'); /* * The exception class p. */ if ($print_name) { $this->append_tag_to_content(new HTMLTags_P(get_class($e))); } /* * The exception message p. */ $this->append_tag_to_content(new HTMLTags_P($e->getMessage())); /* * The exception's trace list. */ if ($print_trace) { $trace_list = new HTMLTags_OL(); $trace_list->set_attribute_str('id', 'trace-list'); foreach ($e->getTrace() as $data) { $trace_item = new HTMLTags_LI(); #print_r($location); foreach (array_keys($data) as $key) { $trace_item->append_str_to_content("{$key}:"); #$trace_item->append_tag_to_content(new HTMLTags_BR()); if (is_array($data[$key])) { foreach ($data[$key] as $datum) { $trace_item->append_str_to_content(' '); if (is_numeric($datum) || is_string($datum)) { $trace_item->append_str_to_content('"' . $datum . '"'); } $trace_item->append_tag_to_content(new HTMLTags_BR()); } } else { if (strtolower($key) == 'file') { $formatted_filename = new Formatting_FileName($data[$key]); $formatted_filename_pre = new HTMLTags_Pre($formatted_filename->get_pretty_name()); $trace_item->append_tag_to_content($formatted_filename_pre); $trace_item->append_tag_to_content(new HTMLTags_BR()); } else { $trace_item->append_str_to_content(' '); #echo $data[$key]; #print_r($data[$key]); $trace_item->append_str_to_content('' . $data[$key]); $trace_item->append_tag_to_content(new HTMLTags_BR()); } } } $trace_list->append_tag_to_content($trace_item); } $this->append_tag_to_content($trace_list); } }
public function get_form_li($name, HTMLTags_InputTag $input_tag, $label_text = null, $post_content = '') { #echo "In HTMLTags_SimpleOLForm::add_input_tag(...)\n"; $input_li = new HTMLTags_LI(); if (!isset($label_text)) { $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($name, '_'); $label_text = $l_t_l_o_ws->get_words_as_capitalised_string(); # echo "\$label_text: $label_text\n"; #} else { # echo "\$label_text: $label_text\n"; } #echo "After if\n"; $input_label = new HTMLTags_Label($label_text); $input_label->set_attribute_str('for', $name); #$input_label->set_attribute_str('id', $name); $input_li->append_tag_to_content($input_label); $input_li->append_tag_to_content($input_tag); if (strlen($post_content) > 0) { $input_li->append_str_to_content($post_content); } $input_msg_box = new HTMLTags_Span(); $input_msg_box->set_attribute_str('id', $name . 'msg'); $input_msg_box->set_attribute_str('class', 'rules'); $input_li->append_tag_to_content($input_msg_box); if (count($this->input_lis) == 0) { $this->first_input_name = $name; } return $input_li; }
public function get_principal_tag_form_checkbox_li() { $products_table = $this->get_element(); $database = $products_table->get_database(); $product_tags_table = $database->get_table('hpi_shop_product_tags'); $input_li = new HTMLTags_LI(); $input_label = new HTMLTags_Label('Tags'); $input_label->set_attribute_str('for', 'principal_tag_id'); $input_li->append_tag_to_content($input_label); $principal_tags = $product_tags_table->get_principal_tags(); foreach ($principal_tags as $principal_tag) { $input = new HTMLTags_Input(); $input->set_attribute_str('type', 'checkbox'); $input->set_attribute_str('name', 'tag_' . $principal_tag->get_id()); $input->set_value($principal_tag->get_id()); $input_li->append_tag_to_content($input); $input_li->append_str_to_content($principal_tag->get_tag()); // $input_li->append_tag_to_content(new HTMLTags_BR()); } $input_msg_box = new HTMLTags_Span(); $input_msg_box->set_attribute_str('id', 'principal_tag_id' . 'msg'); $input_msg_box->set_attribute_str('class', 'rules'); $input_li->append_tag_to_content($input_msg_box); return $input_li; }
public function get_content() { #echo "\$this->offset: $this->offset\n"; #echo "\$this->limit: $this->limit\n"; $content = new HTMLTags_TagContent(); /* * Are we at the beginning? */ if ($this->offset > 0) { $first_offset = 0; $previous_offset = $this->offset - $this->limit; $first_page_li = new HTMLTags_LI(); $link_to_first_page = new HTMLTags_A('first'); # How will we set this to 'primero' etc? $first_page_href = clone $this->link_href; $first_page_href->set_get_variable('offset', 0); $first_page_href->set_get_variable('limit', $this->limit); $link_to_first_page->set_href($first_page_href); $first_page_li->append_tag_to_content($link_to_first_page); $content->append_tag($first_page_li); /* * Do previous and first collide? */ if ($first_offset < $previous_offset) { $previous_page_li = new HTMLTags_LI(); $link_to_previous_page = new HTMLTags_A('previous'); $previous_page_href = clone $this->link_href; $previous_page_href->set_get_variable('offset', $previous_offset); $previous_page_href->set_get_variable('limit', $this->limit); $link_to_previous_page->set_href($previous_page_href); $previous_page_li->append_tag_to_content($link_to_previous_page); $content->append_tag($previous_page_li); } } /* * Current * * offset to offset + limit */ $current_page_li = new HTMLTags_LI(); $current_msg = $this->offset + 1; $current_msg .= ' to '; #$row_count = $this->table->count_all_rows(); $current_msg .= $this->offset + $this->limit < $this->row_count ? $this->offset + $this->limit : $this->row_count; $current_page_li->append_str_to_content($current_msg); $content->append_tag($current_page_li); /* * Are there more rows to show? */ #echo "\$row_count: $row_count\n"; if ($this->offset + $this->limit < $this->row_count) { #echo "There are more pages\n"; $next_offset = $this->offset + $this->limit; $last_offset = $this->row_count - ($this->row_count % $this->limit == 0 ? $this->limit : $this->row_count % $this->limit); /* * Do next and final collide? */ if ($next_offset < $last_offset) { $next_page_li = new HTMLTags_LI(); $link_to_next_page = new HTMLTags_A('next'); $next_page_href = clone $this->link_href; $next_page_href->set_get_variable('offset', $next_offset); $next_page_href->set_get_variable('limit', $this->limit); $link_to_next_page->set_href($next_page_href); $next_page_li->append_tag_to_content($link_to_next_page); $content->append_tag($next_page_li); } $last_page_li = new HTMLTags_LI(); $link_to_last_page = new HTMLTags_A('last'); $last_page_href = clone $this->link_href; $last_page_href->set_get_variable('offset', $last_offset); $last_page_href->set_get_variable('limit', $this->limit); $link_to_last_page->set_href($last_page_href); $last_page_li->append_tag_to_content($link_to_last_page); $content->append_tag($last_page_li); } return $content; }
/** * The purpose of this div is to tell the customer which * the stage of the checkout process they have reached. * * A short explanation of the stage is also given. */ public function get_checkout_status_div() { // accounts >> shipping-details >> payment-options $checkout_status = $this->get_checkout_status(); #echo $checkout_status; exit; $checkout_status_div = new HTMLTags_Div(); $checkout_status_div->set_attribute_str('id', 'checkout_status_div'); $checkout_status_ul = new HTMLTags_UL(); switch ($checkout_status) { case 'accounts': $status_step_one_li = new HTMLTags_LI(); $status_step_one_li->append_tag_to_content(new HTMLTags_Em('Log In')); $checkout_status_ul->append_tag_to_content($status_step_one_li); $status_step_two_li = new HTMLTags_LI(); $status_step_two_li->append_str_to_content('Shipping Details'); $checkout_status_ul->append_tag_to_content($status_step_two_li); $status_step_three_li = new HTMLTags_LI(); $status_step_three_li->append_str_to_content('Go to Secure Server'); $checkout_status_ul->append_tag_to_content($status_step_three_li); $p_text = <<<TXT Please complete this form and create an account with us. Alternatively, log in with your existing email address and password. TXT; break; case 'shipping-details': $status_step_one_li = new HTMLTags_LI(); $status_step_one_li->append_str_to_content('Log In'); $checkout_status_ul->append_tag_to_content($status_step_one_li); $status_step_two_li = new HTMLTags_LI(); $status_step_two_li->append_tag_to_content(new HTMLTags_Em('Shipping Details')); $checkout_status_ul->append_tag_to_content($status_step_two_li); $status_step_three_li = new HTMLTags_LI(); $status_step_three_li->append_str_to_content('Go to Secure Server'); $checkout_status_ul->append_tag_to_content($status_step_three_li); $p_text = <<<TXT Please enter or confirm your shipping address, this must be the same as your billing address. TXT; break; case 'payment-options': $status_step_one_li = new HTMLTags_LI(); $status_step_one_li->append_str_to_content('Log In'); $checkout_status_ul->append_tag_to_content($status_step_one_li); $status_step_two_li = new HTMLTags_LI(); $status_step_two_li->append_str_to_content('Shipping Details'); $checkout_status_ul->append_tag_to_content($status_step_two_li); $status_step_three_li = new HTMLTags_LI(); $status_step_three_li->append_tag_to_content(new HTMLTags_Em('Go to Secure Server')); $checkout_status_ul->append_tag_to_content($status_step_three_li); $p_text = <<<TXT Check your shipping details and shopping basket. TXT; $p2_text = <<<TXT When you're happy, click the button below to be transfered to a secure server where you can enter your credit card details to complete the payment. TXT; break; } $checkout_status_div->append_tag_to_content($checkout_status_ul); $checkout_status_div->append_tag_to_content(new HTMLTags_P($p_text)); if (isset($p2_text)) { $checkout_status_div->append_tag_to_content(new HTMLTags_P($p2_text)); } return $checkout_status_div; }
public function get_widget_content() { $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $people_table = $database->get_table('hpi_mailing_list_people'); $widget_div = new HTMLTags_Div(); $rows_html_ul = new HTMLTags_UL(); $rows_html_ul->set_attribute_str('class', 'people'); $query = <<<SQL SELECT * FROM hpi_mailing_list_people WHERE status = 'new' OR status = 'accepted' ORDER BY `added` DESC LIMIT 0, 5 SQL; try { $rows = $people_table->get_rows_for_select($query); } catch (Exception $e) { } if (count($rows) > 0) { $explanation_p = new HTMLTags_P(); $explanation_txt = <<<TXT The last five people to join the list: TXT; $explanation_p->append($explanation_txt); $widget_div->append($explanation_p); foreach ($rows as $row) { $li = new HTMLTags_LI(); $li->append_str_to_content($row->get_name() . ' (' . $row->get_email() . ')'); $rows_html_ul->append_tag_to_content($li); } } else { $no_people_p = new HTMLTags_P(); $no_people_txt = <<<TXT There are no people in the Mailing List. TXT; $no_people_p->append($no_people_txt); $widget_div->append($no_people_p); } $widget_div->append_tag_to_content($rows_html_ul); $widget_div->append(self::get_mailing_list_links_ul()); return $widget_div; }
* @copyright Clear Line Web Design, 2007-05-15 */ $content_div = new HTMLTags_Div(); $content_div->set_attribute_str('id', 'content'); $project_directory_finder = HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance(); $project_directory = $project_directory_finder->get_project_directory_for_this_project(); /* * The core modules. */ $core_module_directories = $project_directory->get_core_module_directories(); $content_div->append_tag_to_content(new HTMLTags_Heading(3, 'Core Modules')); $c_m_ul = new HTMLTags_UL(); foreach ($core_module_directories as $c_m_d) { $c_m_d_li = new HTMLTags_LI(); $c_m_d_li->append_str_to_content($c_m_d->basename()); $c_m_ul->add_li($c_m_d_li); } $content_div->append_tag_to_content($c_m_ul); /* * The plug-in modules. */ $plug_in_module_directories = $project_directory->get_plug_in_module_directories(); $content_div->append_tag_to_content(new HTMLTags_Heading(3, 'Plug-in Modules')); $pi_m_ul = new HTMLTags_UL(); foreach ($plug_in_module_directories as $pi_m_d) { $pi_m_d_li = new HTMLTags_LI(); $pi_m_d_li->append_str_to_content($pi_m_d->basename()); $pi_m_ul->add_li($pi_m_d_li); } $content_div->append_tag_to_content($pi_m_ul); echo $content_div->get_as_string();
public function get_social_network_links_ul() { $product = $this->get_element(); $share_links_ul = new HTMLTags_UL(); $facebook_li = new HTMLTags_LI(); if (isset($_SERVER['HTTPS'])) { $http_or_https = 'https'; } else { $http_or_https = 'http'; } $product_page_url = $this->get_product_page_url(); $product_page_url_string = $http_or_https . '://' . $_SERVER['SERVER_NAME'] . $product_page_url->get_as_string(); $facebook_link = <<<TXT <script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a href="http://www.facebook.com/share.php?u={$product_page_url_string}" onclick="return fbs_click()" target="_blank">Share on Facebook</a> TXT; $facebook_li->append_str_to_content($facebook_link); $share_links_ul->append_tag_to_content($facebook_li); return $share_links_ul; }
<?php /** * A div that is displayed if the customer is already logged into a shop. * * @copyright Clear Line Web Design, 2007-08-21 */ $checkout_process_div = new HTMLTags_Div(); $checkout_process_div->set_attribute_str('id', 'checkout_process_div'); $checkout_process_ul = new HTMLTags_UL(); $process_step_one_li = new HTMLTags_LI(); $process_step_one_li->append_tag_to_content(new HTMLTags_Em('Step 1')); $checkout_process_ul->append_tag_to_content($process_step_one_li); $process_step_two_li = new HTMLTags_LI(); $process_step_two_li->append_str_to_content('Step 2'); $checkout_process_ul->append_tag_to_content($process_step_two_li); $process_step_three_li = new HTMLTags_LI(); $process_step_three_li->append_str_to_content('Step 3'); $checkout_process_ul->append_tag_to_content($process_step_three_li); $checkout_process_div->append_tag_to_content($checkout_process_ul); // Already logged in // You are logged in as Mr. X. $p_text = <<<TXT Step 1 on the Checkout process TXT; $checkout_process_div->append_tag_to_content(new HTMLTags_P($p_text)); echo $checkout_process_div->get_as_string();
public function get_supplier_form_checkbox_li($customer_region_id) { $input_li = new HTMLTags_LI(); $input_label = new HTMLTags_Label('Suppliers'); $input_label->set_attribute_str('for', 'supplier_id'); $input_li->append_tag_to_content($input_label); $customer_region_supplier_links_table = $this->get_element(); $database = $customer_region_supplier_links_table->get_database(); $suppliers_table = $database->get_table('hpi_shop_suppliers'); $suppliers = $suppliers_table->get_all_rows(); foreach ($suppliers as $supplier) { $input = new HTMLTags_Input(); $input->set_attribute_str('type', 'checkbox'); $input->set_attribute_str('name', $supplier->get_id()); $input->set_value($supplier->get_id()); $conditions = array(); $conditions['supplier_id'] = $supplier->get_id(); $conditions['customer_region_id'] = $customer_region_id; $current_supplier = $customer_region_supplier_links_table->get_rows_where($conditions); if (count($current_supplier) > 0) { #print_r('saul'); $input->set_attribute_str('checked', 'checked'); } $input_li->append_tag_to_content($input); $input_li->append_str_to_content($supplier->get_name()); // $input_li->append_tag_to_content(new HTMLTags_BR()); } $input_msg_box = new HTMLTags_Span(); $input_msg_box->set_attribute_str('id', 'supplier_id' . 'msg'); $input_msg_box->set_attribute_str('class', 'rules'); $input_li->append_tag_to_content($input_msg_box); return $input_li; }
<?php /** * Account management options for the My Account Page * * @copyright Clear Line Web Design, 2007-08-21 */ /* * Create the singleton objects. */ $page_manager = PublicHTML_PageManager::get_instance(); $account_management_div = new HTMLTags_Div(); $account_management_div->set_attribute_str('id', 'account_management_div'); //$account_management_div->append_tag_to_content(new HTMLTags_P($p_text)); $account_management_div->append_tag_to_content(new HTMLTags_Heading(3, 'Account Management')); $options_ul = new HTMLTags_UL(); /* * Link to change your password */ $password_reset_li = new HTMLTags_LI(); $password_reset_li->append_str_to_content($page_manager->get_inc_file_as_string('body.a.password-reset')); $options_ul->append_tag_to_content($password_reset_li); /* * Link to change your customer_region */ $customer_region_li = new HTMLTags_LI(); $customer_region_li->append_str_to_content($page_manager->get_inc_file_as_string('body.a.shipping-details-link')); $options_ul->append_tag_to_content($customer_region_li); $account_management_div->append_tag_to_content($options_ul); echo $account_management_div->get_as_string();