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 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;
 }
$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);
    }
    $customer_regions_ul->append_tag_to_content($customer_region_li);
 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;
 }