コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 /**
  * Returns a UL that tells the customer about this product.
  *
  * Details:
  * 	- Price
  * 	- The date the product was first listed
  * 	- The availability of the product.
  */
 public function get_product_details_ul()
 {
     $product = $this->get_element();
     $product_details_ul = new HTMLTags_UL();
     /*
      * The price.
      */
     $product_price_li = new HTMLTags_LI();
     //                $product_price_li->append_str_to_content('Price: ');
     $product_price_span = new HTMLTags_Span();
     $product_price_span->set_attribute_str('class', 'price');
     $database = $product->get_database();
     $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
     $customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']);
     $currency = $customer_region->get_currency();
     $product_currency_price = $product->get_product_currency_price($currency->get_id());
     #print_r($product_currency_price);
     //
     //                $product_price_span
     //                        ->append_str_to_content($currency->get_symbol());
     //                $product_price_span
     //                        ->append_str_to_content($product_currency_price->get_price());
     $sum_of_money = new Shop_SumOfMoney($product_currency_price->get_price(), $currency);
     $product_price_span->append_str_to_content($sum_of_money->get_as_string());
     $product_price_li->append_tag_to_content($product_price_span);
     $product_details_ul->append_tag_to_content($product_price_li);
     /*
      * When the product was listed.
      */
     //
     //                $product_listed_li = new HTMLTags_LI();
     //                $product_listed_li->append_str_to_content('Listed: ');
     //                $product_listed_abbr = new HTMLTags_Abbr();
     //                $product_listed_abbr->set_attribute_str('class', 'dtlisted');
     //                $date_added = $product->get_added();
     //                $datetime_iso8601 = Formatting_DateTime::datetime_to_ISO8601($date_added);
     //                $product_listed_abbr->set_attribute_str('title', $datetime_iso8601);
     //                $datetime_human_readable =
     //                        Formatting_DateTime::datetime_to_human_readable($date_added);
     //                $product_listed_abbr->append_str_to_content($datetime_human_readable);
     //                $product_listed_li->append_tag_to_content($product_listed_abbr);
     //                $product_details_ul->append_tag_to_content($product_listed_li);
     //
     /*
      * The availability of the product.
      */
     $product_availability_li = new HTMLTags_LI();
     //                $product_availability_li->append_str_to_content('Availability: ');
     $product_availability_span = new HTMLTags_Span();
     $product_availability_span->set_attribute_str('class', 'availability');
     if (!$product->uses_stock_level()) {
         $product_availability_span->append_str_to_content('In Stock');
     } else {
         if ($product->is_out_of_stock()) {
             $product_availability_span->append_str_to_content('Out of Stock');
         } else {
             #print_r($product->get_available_stock_level());exit;
             $product_availability_span->append_str_to_content($product->get_available_stock_level() . ' in Stock');
         }
     }
     $product_availability_li->append_tag_to_content($product_availability_span);
     $product_details_ul->append_tag_to_content($product_availability_li);
     return $product_details_ul;
 }
コード例 #4
0
 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() . '&nbsp;' . $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:&nbsp;');
     $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:&nbsp;');
     $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;
 }