public static function get_link_a_with_span($node) { $span = new HTMLTags_Span(); $span->append($node['url_title']); $a = new HTMLTags_A(); $a->append($span); $a->set_href(HTMLTags_URL::parse_and_make_url($node['url_href'])); $a->set_attribute_str('title', $node['url_title']); if ($node['open_in_new_window'] == 'Yes') { #echo ' target="_blank" '; $a->set_attribute_str('target', '_blank'); } return $a; }
public static function get_spans($str_to_split, $num_displayed_char) { $spans = array(); $str_to_split_shortened = ''; # Shorten the string if it needs it $max_length = $num_displayed_char; if (strlen($str_to_split) > $max_length) { # $str_to_split_shortened = substr($str_to_split, 0, $max_length); # $pos = strrpos($str_to_split, " "); # # if($pos === false) { # $str_to_split_shortened = substr($str_to_split, 0, $max_length)."..."; # # } # #$str_to_split_shortened = substr($str_to_split, 0, $pos)."..."; $str_to_split_shortened = substr($str_to_split, 0, $max_length); $truncated_span = new HTMLTags_Span(); $truncated_span->set_attribute_str('class', 'truncated'); $truncated_span->append_str_to_content($str_to_split_shortened); $truncated_span->append_str_to_content(' '); $truncated_span_show_link = new HTMLTags_A('More...'); #$truncated_span_show_link->set_attribute_str('onclick', 'javascript: showInline('); $truncated_span_show_link->set_attribute_str('class', 'show'); $truncated_span_show_link->set_attribute_str('title', 'Show the rest of this text'); $truncated_span_show_location = new HTMLTags_URL(); $truncated_span_show_location->set_file('#'); $truncated_span_show_link->set_href($truncated_span_show_location); $truncated_span->append_tag_to_content($truncated_span_show_link); array_push($spans, $truncated_span); $full_span = new HTMLTags_Span(); $full_span->set_attribute_str('class', 'full'); $full_span->append_str_to_content($str_to_split); $full_span->append_str_to_content(' '); $full_span_hide_link = new HTMLTags_A('...Hide'); $full_span_hide_link->set_attribute_str('class', 'hide'); $full_span_hide_link->set_attribute_str('title', 'hide the rest of this text'); $full_span_hide_location = new HTMLTags_URL(); $full_span_hide_location->set_file('#'); $full_span_hide_link->set_href($full_span_hide_location); $full_span->append_tag_to_content($full_span_hide_link); array_push($spans, $full_span); } else { $full_span = new HTMLTags_Span(); $full_span->append_str_to_content($str_to_split); array_push($spans, $full_span); } return $spans; }
public function __construct($item_reviewed, $review, $reviewer, $date_reviewed) { parent::__construct(); $this->set_attribute_str('class', 'hreview'); $item_div = new HTMLTags_Div(); $item_div->set_attribute_str('class', 'item'); $item_div->append_str_to_content($item_reviewed); $this->append_tag_to_content($item_div); $description_div = new HTMLTags_Div(); $description_div->set_attribute_str('class', 'description'); $description_p = new HTMLTags_P($review); $description_div->append_tag_to_content($description_p); $this->append_tag_to_content($description_div); $reviewer_vcard_span = new HTMLTags_Span(); $reviewer_vcard_span->set_attribute_str('class', 'reviewer vcard'); $reviewer_fn_span = new HTMLTags_Span(); $reviewer_fn_span->set_attribute_str('class', 'fn'); $reviewer_fn_span->append_str_to_content($reviewer); $reviewer_vcard_span->append_tag_to_content($reviewer_fn_span); $random_br_tag = new HTMLTags_BR(); $reviewer_vcard_span->append_tag_to_content($random_br_tag); $date_reviewed_abbr = new HTMLTags_Abbr(); $date_reviewed_abbr->set_attribute_str('class', 'dtreviewed'); $datetime_iso8601 = Formatting_DateTime::datetime_to_ISO8601($date_reviewed); $date_reviewed_abbr->set_attribute_str('title', $datetime_iso8601); $datetime_human_readable = Formatting_DateTime::datetime_to_human_readable($date_reviewed); $date_reviewed_abbr->append_str_to_content($datetime_human_readable); $reviewer_vcard_span->append_tag_to_content($date_reviewed_abbr); $this->append_tag_to_content($reviewer_vcard_span); return $this; }
public function get_status_form_select_li() { $input_li = new HTMLTags_LI(); $input_label = new HTMLTags_Label('Status'); $input_label->set_attribute_str('for', 'status_id'); $input_li->append_tag_to_content($input_label); $input_li->append_tag_to_content($this->get_status_form_select()); $input_msg_box = new HTMLTags_Span(); $input_msg_box->set_attribute_str('id', 'status_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_extra_photograph_form_checkbox_li() { $input_li = new HTMLTags_LI(); $input_label = new HTMLTags_Label('Extra Photographs'); $input_label->set_attribute_str('for', 'extra_photograph_id'); $input_li->append_tag_to_content($input_label); $products_table = $this->get_element(); $database = $products_table->get_database(); $photographs_table = $database->get_table('hpi_shop_photographs'); $photographs = $photographs_table->get_all_rows(); foreach ($photographs as $photograph) { $photograph_renderer = $photograph->get_renderer(); $input = new HTMLTags_Input(); $input->set_attribute_str('type', 'checkbox'); $input->set_attribute_str('name', 'extra_photograph_id_' . $photograph->get_id()); $input->set_value($photograph->get_id()); $input_li->append_tag_to_content($input); $input_li->append_tag_to_content($photograph_renderer->get_thumbnail_img()); } $input_msg_box = new HTMLTags_Span(); $input_msg_box->set_attribute_str('id', 'extra_photograph_id' . 'msg'); $input_msg_box->set_attribute_str('class', 'rules'); $input_li->append_tag_to_content($input_msg_box); return $input_li; }
private function get_span_with_id($content_str, $id_name) { $span = new HTMLTags_Span($content_str); $span->set_attribute_str('id', $id_name); return $span; }
public function add_input_tag($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; } $this->input_lis[] = $input_li; }
public function get_embed_div() { $embed_div_style = <<<TXT width: 400px; margin: 20px auto;text-align: center; TXT; $embed_img_style = <<<TXT display: inline; margin: 0; padding: 0;vertical-align: middle; TXT; $embed_a_style = <<<TXT display: block;text-align:center; TXT; $embed_span_style = <<<TXT display: block; font-size: 90%; text-align: center; TXT; $embed_div = new HTMLTags_Div(); $embed_div->set_attribute_str('style', $embed_div_style); $product = $this->get_element(); $design_photograph = $product->get_design_photograph(); $design_photograph_renderer = $design_photograph->get_renderer(); $design_medium_size_img = $design_photograph_renderer->get_absolute_medium_size_img(); $design_medium_size_img->set_attribute_str('style', $embed_img_style); $main_photograph = $product->get_main_photograph(); $main_photograph_renderer = $main_photograph->get_renderer(); $main_medium_size_img = $main_photograph_renderer->get_absolute_medium_size_img(); $main_medium_size_img->set_attribute_str('style', $embed_img_style); $design_img_a = new HTMLTags_A(); $this_product_location = $this->get_absolute_product_page_url(); $design_img_a->set_href($this_product_location); $main_img_a = new HTMLTags_A(); $this_product_location = $this->get_absolute_product_page_url(); $main_img_a->set_href($this_product_location); $product_name_a = new HTMLTags_A(); $this_product_location = $this->get_absolute_product_page_url(); $product_name_a->set_href($this_product_location); $main_img_a->append_tag_to_content($main_medium_size_img); $design_img_a->append_tag_to_content($design_medium_size_img); $embed_div->append_tag_to_content($main_img_a); $embed_div->append_tag_to_content($design_img_a); $product_name = $product->get_name(); $shop_mention_span = new HTMLTags_Span('Only at the Connected Films Shop'); $shop_mention_span->set_attribute_str('style', $embed_span_style); $product_name_a->append_str_to_content($product_name); $product_name_a->set_attribute_str('style', $embed_a_style); $embed_div->append_tag_to_content($product_name_a); $embed_div->append_tag_to_content($shop_mention_span); return $embed_div; }
* @copyright Clear Line Web Design, 2007-07-26 */ $page_manager = PublicHTML_PageManager::get_instance(); $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $customer_regions_table = $database->get_table('hpi_shop_customer_regions'); $customer_regions = $customer_regions_table->get_all_rows('sort_order', 'ASC'); $customer_regions_div = new HTMLTags_Div(); $customer_regions_div->set_attribute_str('id', 'tabs'); $customer_regions_ul = new HTMLTags_UL(); foreach ($customer_regions as $customer_region) { $customer_region_li = new HTMLTags_LI(); $customer_region_link_span = new HTMLTags_Span($customer_region->get_name()); if ($customer_region->get_id() == $_SESSION['customer_region_id']) { $double_span = new HTMLTags_Span(); $double_span->set_attribute_str('class', 'current'); $double_span->append_tag_to_content($customer_region_link_span); $customer_region_li->append_tag_to_content($double_span); } else { //$customer_region_link_file = '/'; //$customer_region_link_location = new HTMLTags_URL(); //$customer_region_link_location->set_file($customer_region_link_file); //$customer_region_link_location->set_get_variable('page', $page_manager->get_page()); $customer_region_link_location = $page_manager->get_script_uri(); $customer_region_link_location->set_get_variable('customer_region_session', $customer_region->get_id()); $customer_region_link_anchor = new HTMLTags_A(); $customer_region_link_anchor->set_href($customer_region_link_location); $customer_region_link_anchor->set_attribute_str('title', 'Change your location to ' . $customer_region->get_name()); $customer_region_link_anchor->append_tag_to_content($customer_region_link_span); $customer_region_li->append_tag_to_content($customer_region_link_anchor);
public function get_customer_region_selection_div() { $page_manager = PublicHTML_PageManager::get_instance(); // $mysql_user_factory = Database_MySQLUserFactory::get_instance(); // $mysql_user = $mysql_user_factory->get_for_this_project(); // $database = $mysql_user->get_database(); #$customer_regions_table = $database->get_table('hpi_shop_customer_regions'); $customer_regions_table = $this->get_element(); $customer_regions = $customer_regions_table->get_all_rows('sort_order', 'ASC'); $customer_regions_div = new HTMLTags_Div(); $customer_regions_div->set_attribute_str('id', 'tabs'); $customer_regions_ul = new HTMLTags_UL(); foreach ($customer_regions as $customer_region) { $customer_region_li = new HTMLTags_LI(); $customer_region_link_span = new HTMLTags_Span($customer_region->get_name()); if ($customer_region->get_id() == $_SESSION['customer_region_id']) { $double_span = new HTMLTags_Span(); $double_span->set_attribute_str('class', 'current'); $double_span->append_tag_to_content($customer_region_link_span); $customer_region_li->append_tag_to_content($double_span); } else { //$customer_region_link_file = '/'; //$customer_region_link_location = new HTMLTags_URL(); //$customer_region_link_location->set_file($customer_region_link_file); //$customer_region_link_location->set_get_variable('page', $page_manager->get_page()); $redirect_script_location = PublicHTML_PublicURLFactory::get_url('plug-ins', 'shop', 'customer-region', 'redirect-script'); $redirect_script_location->set_get_variable('customer_region_session', $customer_region->get_id()); $desired_location = $page_manager->get_script_uri(); if (isset($_GET['product_id'])) { $desired_location->set_get_variable('product_id', $_GET['product_id']); } if (isset($_GET['product_category_id'])) { $desired_location->set_get_variable('product_category_id', $_GET['product_category_id']); } $redirect_script_location->set_get_variable('desired_location', urlencode($desired_location->get_as_string())); $customer_region_link_anchor = new HTMLTags_A(); $customer_region_link_anchor->set_href($redirect_script_location); $customer_region_link_anchor->set_attribute_str('title', 'Change your location to ' . $customer_region->get_name()); $customer_region_link_anchor->append_tag_to_content($customer_region_link_span); $customer_region_li->append_tag_to_content($customer_region_link_anchor); } $customer_regions_ul->append_tag_to_content($customer_region_li); } $customer_regions_div->append_tag_to_content($customer_regions_ul); #echo $customer_regions_div->get_as_string(); return $customer_regions_div; }
public function get_customer_hcard() { $customer = $this->get_element(); $address = $customer->get_address(); $telephone_number = $customer->get_telephone_number(); //<div class="vcard"> // <div class="fn org">Wikimedia Foundation Inc.</div> // <div class="adr"> // <div class="street-address">200 2nd Ave. South #358</div> // <div> // <span class="locality">St. Petersburg</span>, // <abbr class="region" title="Florida">FL</abbr> <span class="postal-code">33701-4313</span> // </div> // <div class="country-name">USA</div> // </div> // <div>Phone: <span class="tel">+1-727-231-0101</span></div> // <div>Email: <span class="email">info@wikimedia.org</span></div> // <div> // <span class="tel"><span class="type">Fax</span>: // <span class="value">+1-727-258-0207</span></span> // </div> // </div> $hcard_div = new HTMLTags_DIV(); $hcard_div->set_attribute_str('class', 'vcard'); $fn_div = new HTMLTags_DIV(); $fn_div->set_attribute_str('class', 'fn'); $fn_div->append_str_to_content($customer->get_first_name() . ' ' . $customer->get_last_name()); $hcard_div->append_tag_to_content($fn_div); $adr_div = new HTMLTags_DIV(); $adr_div->set_attribute_str('class', 'adr'); $street_address_div = new HTMLTags_DIV(); $street_address_div->set_attribute_str('class', 'street-address'); $street_address_div->append_str_to_content($address->get_street_address() . ','); $adr_div->append_tag_to_content($street_address_div); $further_address_div = new HTMLTags_DIV(); $locality_span = new HTMLTags_Span(); $locality_span->set_attribute_str('class', 'locality'); $locality_span->append_str_to_content($address->get_locality()); $further_address_div->append_tag_to_content($locality_span); $region_span = new HTMLTags_Span(); $region_span->set_attribute_str('class', 'region'); $region_span->append_str_to_content($address->get_region()); $further_address_div->append_tag_to_content($region_span); $postal_code_span = new HTMLTags_Span(); $postal_code_span->set_attribute_str('class', 'postal_code'); $postal_code_span->append_str_to_content($address->get_postal_code()); $further_address_div->append_tag_to_content($postal_code_span); $adr_div->append_tag_to_content($further_address_div); $country_name_div = new HTMLTags_DIV(); $country_name_div->set_attribute_str('class', 'country-name'); $country_name_div->append_str_to_content($address->get_country_name()); $adr_div->append_tag_to_content($country_name_div); $hcard_div->append_tag_to_content($adr_div); $phone_div = new HTMLTags_DIV(); $phone_div->append_str_to_content('Phone: '); $phone_span = new HTMLTags_Span($telephone_number->get_telephone_number()); $phone_span->set_attribute_str('class', 'tel'); $phone_div->append_tag_to_content($phone_span); $hcard_div->append_tag_to_content($phone_div); $email_div = new HTMLTags_DIV(); $email_div->append_str_to_content('Email: '); $email_span = new HTMLTags_Span($customer->get_email_address()); $email_span->set_attribute_str('class', 'email'); $email_div->append_tag_to_content($email_span); $hcard_div->append_tag_to_content($email_div); return $hcard_div; }
<?php /** * Content of the home page of the shop plug-in. * * @copyright Clear Line Web Design, 2007-04-05 */ $page_manager = PublicHTML_PageManager::get_instance(); $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); // CONTENT DIV $content_div = new HTMLTags_Div(); $content_div->set_attribute_str('id', 'content'); $logo_span = new HTMLTags_Span(); $logo_span->set_attribute_str('class', 'logo'); $content_div->append_tag_to_content($logo_span); // HEADER $main_page_header_id = 'home'; $main_page_header_title = 'Home'; $main_page_header_h = new HTMLTags_Heading(2); $main_page_header_h->set_attribute_str('class', 'logo'); $main_page_header_h->set_attribute_str('id', $main_page_header_id); $main_page_header_h->append_str_to_content($main_page_header_title); $content_div->append_tag_to_content($main_page_header_h); // IF LOGGED IN MESSAGE if ($logged_in) { $content_div->append_str_to_content($page_manager->get_inc_file_as_string('body.p.logged-in-salutation')); } // WELCOME MESSAGE $content_div->append_str_to_content($page_manager->get_inc_file_as_string('body.p.welcome-message'));
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; }