public function get_rss_titles_ul(RSS_RSS $rss, $limit = 10)
 {
     //                print_r($rss->get_xml());exit;
     $items = $rss->get_items();
     $tempCounter = 0;
     $ul = new HTMLTags_UL();
     $ul->set_attribute_str('class', 'rss');
     foreach ($items as $item) {
         # DISPLAY ONLY 10 ITEMS.
         if ($tempCounter < $limit + 1) {
             $li = new HTMLTags_LI();
             if ($tempCounter % 2 == 0) {
                 $li->set_attribute_str('class', 'odd');
             }
             $a = new HTMLTags_A();
             $url = new HTMLTags_URL();
             $url->set_file($item->get_url_filename());
             $a->set_href($url);
             $a->append($item->get_title());
             $li->append($a);
             $ul->append($li);
         }
         $tempCounter += 1;
     }
     return $ul;
 }
 public function get_input_lis()
 {
     $input_lis = array();
     $visible_fields = $this->get_visible_fields();
     foreach ($visible_fields as $visible_field) {
         if ($visible_field->get_name() != 'id') {
             $input_li = new HTMLTags_LI();
             $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($visible_field->get_name(), '_');
             $label_text = $l_t_l_o_ws->get_words_as_capitalised_string();
             $input_label = new HTMLTags_Label($label_text);
             $input_label->set_attribute_str('for', $visible_field->get_name());
             #$input_label->set_attribute_str('id', $visible_field->get_name());
             $input_li->append_tag_to_content($input_label);
             $field_renderer = $visible_field->get_renderer();
             $input_tag = $field_renderer->get_form_input();
             #print_r($visible_field);
             if ($visible_field->has_default()) {
                 $input_tag->set_value($visible_field->get_default());
             }
             $input_li->append_tag_to_content($input_tag);
             $input_lis[] = $input_li;
         }
     }
     return $input_lis;
 }
 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 __construct(HaddockProjectOrganisation_ProjectDirectory $project_directory)
 {
     parent::__construct();
     $m_w_a_ss = $project_directory->get_modules_with_admin_sections();
     foreach ($m_w_a_ss as $m_w_a_s) {
         $module_li = new HTMLTags_LI();
         $module_a = new HTMLTags_A();
         //$module_href = new HTMLTags_URL();
         #if (
         #    is_a(
         #        $m_w_a_s,
         #        'HaddockProjectOrganisation_ProjectSpecificDirectory'
         #    )
         #) {
         #    $module_name = 'project-specific';
         #} else {
         #    $module_name_l_o_ws = $m_w_a_s->get_module_name_as_l_o_w();
         #    $module_name = $module_name_l_o_ws->get_words_as_delimited_lc_string('-');
         #}
         //$module_name = $m_w_a_s->get_admin_section_directory_name();
         //
         //#$module_href->set_file('/admin/' . $module_name . '/home.html');
         //$module_href->set_file('/admin/hc/' . $module_name . '/home.html');
         $module_href = $m_w_a_s->get_admin_section_home_page_href();
         $module_a->set_href($module_href);
         $module_config_file = $m_w_a_s->get_module_config_file();
         $module_span = new HTMLTags_Span($module_config_file->get_admin_section_title());
         $module_a->append_tag_to_content($module_span);
         $module_li->append_tag_to_content($module_a);
         $this->add_li($module_li);
     }
 }
 public function get_input_lis()
 {
     $input_lis = array();
     $visible_fields = $this->get_visible_fields();
     $row_renderer = $this->row->get_renderer();
     foreach ($visible_fields as $visible_field) {
         $input_li = new HTMLTags_LI();
         $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($visible_field->get_name(), '_');
         $label_text = $l_t_l_o_ws->get_words_as_capitalised_string();
         $input_label = new HTMLTags_Label($label_text);
         $input_label->set_attribute_str('for', $visible_field->get_name());
         #$input_label->set_attribute_str('id', $name);
         $input_li->append_tag_to_content($input_label);
         #$field_renderer = $visible_field->get_renderer();
         #
         #$input_tag = $field_renderer->get_form_input();
         #
         #echo '$visible_field->get_name(): ' . $visible_field->get_name() . "\n";
         #
         #$input_tag->set_value(
         #    $this->row->get($visible_field->get_name())
         #);
         $input_tag = $row_renderer->get_input_tag_for_field($visible_field);
         $input_li->append_tag_to_content($input_tag);
         $input_lis[] = $input_li;
     }
     return $input_lis;
 }
 public static function get_login_status_ul()
 {
     $user_login_manager = UserLogin_LoginManager::get_instance();
     $ul = new HTMLTags_UL();
     if (!$user_login_manager->is_logged_in()) {
         $login_li = new HTMLTags_LI();
         $login_url = UserLogin_URLHelper::get_login_page_url();
         $login_a = new HTMLTags_A('Login');
         $login_a->set_href($login_url);
         $login_li->append($login_a);
         $ul->append($login_li);
         $register_li = new HTMLTags_LI();
         $register_url = UserLogin_URLHelper::get_registration_page_url();
         $register_a = new HTMLTags_A('Register');
         $register_a->set_href($register_url);
         $register_li->append($register_a);
         $ul->append($register_li);
     } else {
         $name_li = new HTMLTags_LI();
         $name_li->set_attribute_str('id', 'user-name');
         $name_li->append($user_login_manager->get_name());
         $ul->append($name_li);
         $log_out_li = new HTMLTags_LI();
         $log_out_li->append($user_login_manager->get_log_out_a());
         $ul->append($log_out_li);
     }
     return $ul;
 }
 public function get_tag_cloud_div($current_url, $javascript = FALSE)
 {
     $tags_table = $this->get_element();
     #$database = $productgraph_row->get_database();
     #$tags_table = $database->get_table('hpi_shop_product_tags');
     #$productgraph_row = $productgraphs_table->get_row_by_id($_GET['productgraph_id']);
     #$database = $productgraph_row->get_database();
     $tag_cloud_div = new HTMLTags_Div();
     $tag_cloud_div->set_attribute_str('id', 'tag_cloud_div');
     $tag_cloud_heading = new HTMLTags_Heading(3);
     $tag_cloud_heading->append_str_to_content('All Tags');
     $tag_cloud_div->append_tag_to_content($tag_cloud_heading);
     $tag_cloud_list = new HTMLTags_OL();
     $tags = $tags_table->get_tags_with_counts('hpi_shop_product_tags.tag', 'ASC');
     foreach ($tags as $tag) {
         $tag_cloud_line = new HTMLTags_LI();
         $tag_cloud_href = clone $current_url;
         $tag_cloud_href->set_get_variable('tag_id', $tag->get_id());
         $tag_cloud_link = new HTMLTags_A();
         $tag_cloud_link->set_href($tag_cloud_href);
         $tag_cloud_link->set_attribute_str('id', $tag->get_id());
         if ($javascript) {
             $onclick = 'javascript:return tagsOnClick(this);';
             $tag_cloud_link->set_attribute_str('onclick', $onclick);
         }
         #tag_cloud_link->set_attribute_str('id', 'productgraph_page_link');
         #echo $tag->get_product_count();
         /*
          * RFI 2007-03-27
          * 
          * Is this the right way around?
          *
          * Aren't tags with a lower product count less popular?
          */
         #if ($tag->get_product_count() > 3) {
         #    $tag_cloud_link->set_attribute_str('class', 'not-very-popular');
         #}
         $popularity_css_class = $tag->get_popularity_css_class();
         #echo "\$popularity_css_class: $popularity_css_class\n\n";
         $tag_cloud_link->set_attribute_str('class', $popularity_css_class);
         $tag_cloud_link->set_attribute_str('rel', 'tag');
         $tag_product_count = $tag->get_product_count();
         if ($tag_product_count == 1) {
             $tag_product_count_span_text = $tag_product_count . ' product is tagged with ';
         } else {
             $tag_product_count_span_text = $tag_product_count . ' products are tagged with ';
         }
         $tag_cloud_link_span = new HTMLTags_Span($tag_product_count_span_text);
         $tag_cloud_link->append_tag_to_content($tag_cloud_link_span);
         $tag_cloud_link->append_str_to_content($tag->get_tag());
         $tag_cloud_line->append_tag_to_content($tag_cloud_link);
         $tag_cloud_list->append_tag_to_content($tag_cloud_line);
     }
     $tag_cloud_div->append_tag_to_content($tag_cloud_list);
     return $tag_cloud_div;
 }
 private function get_add_new_character_li()
 {
     $add_new_character_url = $this->get_add_new_character_url();
     $link = new HTMLTags_A('add a new character');
     $link->set_href($add_new_character_url);
     $li = new HTMLTags_LI();
     $li->append_tag_to_content($link);
     $li->set_attribute_str('id', 'add_new_character');
     return $li;
 }
 private function get_edit_li()
 {
     $edit_url = $this->get_edit_url();
     $link = new HTMLTags_A('Edit this frame');
     $link->set_href($edit_url);
     $li = new HTMLTags_LI();
     $li->append_tag_to_content($link);
     $li->set_attribute_str('id', 'edit-frame');
     return $li;
 }
 private function get_delete_option_li()
 {
     $delete_option_url = $this->get_delete_option_url();
     $link = new HTMLTags_A('delete this Option');
     $link->set_href($delete_option_url);
     $li = new HTMLTags_LI();
     $li->append_tag_to_content($link);
     $li->set_attribute_str('id', 'delete_option');
     return $li;
 }
 protected function get_add_act_li()
 {
     $li = new HTMLTags_LI();
     $a = new HTMLTags_A('Add Act');
     $a->set_attribute_str('id', 'add');
     $a->set_attribute_str('title', 'Add an Act');
     $a->set_href(Oedipus_DramaHelper::get_add_act_url($this->drama->get_id()));
     $li->append($a);
     return $li;
 }
 public function get_html_ul()
 {
     $ul = new HTMLTags_UL();
     foreach ($this->get_option_button_tags() as $obt) {
         $li = new HTMLTags_LI();
         $li->append_tag_to_content($obt);
         $ul->add_li($li);
     }
     return $ul;
 }
 private function get_share_drama_li()
 {
     $share_drama_url = $this->get_share_drama_url();
     $link = new HTMLTags_A('Share this Drama');
     $link->set_href($share_drama_url);
     $link->set_attribute_str('id', 'selected');
     $li = new HTMLTags_LI();
     $li->append_tag_to_content($link);
     $li->set_attribute_str('id', 'share-drama');
     return $li;
 }
 public function get_product_currency_price_editing_form($product_id, $redirect_script_url, $cancel_href)
 {
     $product_currency_prices_table = $this->get_element();
     $database = $product_currency_prices_table->get_database();
     $products_table = $database->get_table('hpi_shop_products');
     $currencies_table = $database->get_table('hpi_shop_currencies');
     $product = $products_table->get_row_by_id($product_id);
     $product_currency_price_editing_form = new HTMLTags_SimpleOLForm('product_currency_price_editing');
     $product_currency_price_editing_form->set_action($redirect_script_url);
     $legend_text = '';
     $legend_text .= 'Edit prices for&nbsp;';
     $legend_text .= $product->get_name();
     $product_currency_price_editing_form->set_legend_text($legend_text);
     $currencies = $currencies_table->get_all_rows();
     foreach ($currencies as $currency) {
         /*
          * The price
          */
         $conditions = array();
         $conditions['product_id'] = $product_id;
         $conditions['currency_id'] = $currency->get_id();
         $product_currency_price = $product_currency_prices_table->get_rows_where($conditions);
         if (count($product_currency_price) > 0) {
             $current_price = $product_currency_price[0]->get_price();
         } else {
             $current_price = 0;
         }
         $input_li = new HTMLTags_LI();
         $input_label_text = '';
         $input_label_text .= 'Price in&nbsp;';
         $input_label_text .= $currency->get_name();
         $input_label_text .= '&nbsp;(';
         $input_label_text .= $currency->get_symbol();
         $input_label_text .= ')';
         $input_label_title = '';
         $input_label_title .= $currency->get_id();
         $input_label = new HTMLTags_Label($input_label_text);
         $input_label->set_attribute_str('for', $input_label_title);
         $input_li->append_tag_to_content($input_label);
         $input = new HTMLTags_Input();
         $input->set_attribute_str('type', 'text');
         $input->set_attribute_str('name', $input_label_title);
         $input->set_value($current_price);
         $input_li->append_tag_to_content($input);
         $product_currency_price_editing_form->add_input_li($input_li);
     }
     /*
      * The add button.
      */
     $product_currency_price_editing_form->set_submit_text('Edit');
     $product_currency_price_editing_form->set_cancel_location($cancel_href);
     return $product_currency_price_editing_form;
 }
 protected function render_top_links_ul()
 {
     $page_options_div = new HTMLTags_Div();
     $page_options_div->set_attribute_str('id', 'page-options');
     $other_pages_ul = new HTMLTags_UL();
     foreach ($this->get_top_links_as() as $a) {
         $li = new HTMLTags_LI();
         $li->append_tag_to_content($a);
         $other_pages_ul->append_tag_to_content($li);
     }
     $page_options_div->append_tag_to_content($other_pages_ul);
     echo $page_options_div->get_as_string();
 }
 private function get_status_radio_button_li($name)
 {
     $input_tag = new HTMLTags_Input();
     $input_tag->set_attribute_str('type', 'radio');
     $input_tag->set_attribute_str('name', 'status');
     $input_tag->set_attribute_str('id', $name);
     $input_tag->set_attribute_str('value', $name);
     if ($this->drama->get_status() == $name) {
         $input_tag->set_attribute_str('checked', 'checked');
     }
     $input_li = new HTMLTags_LI();
     $input_li->append_tag_to_content($input_tag);
     $input_label = new HTMLTags_Label(ucfirst($name));
     $input_label->set_attribute_str('for', $name);
     $input_label->set_attribute_str('class', 'radio');
     $input_li->append_tag_to_content($input_label);
     return $input_li;
 }
 public static function get_gallery_div_for_images($images)
 {
     $div = new HTMLTags_Div();
     $div->set_attribute_str('class', 'gallery_div');
     $main_image_div = new HTMLTags_Div();
     $main_image_div->set_attribute_str('id', 'main_image');
     $div->append($main_image_div);
     $ul = new HTMLTags_UL();
     $ul->set_attribute_str('class', 'gallery_demo_unstyled');
     $first = TRUE;
     foreach ($images as $image) {
         $li = new HTMLTags_LI();
         if ($first) {
             $li->set_attribute_str('class', 'active');
             $first = FALSE;
         }
         $li->append($image->get_image_img());
         $ul->append($li);
     }
     $div->append($ul);
     return $div;
 }
 private function get_drama_li(Oedipus_Drama $drama)
 {
     $drama_url = $this->get_drama_page_url_for_drama($drama);
     $link = new HTMLTags_A();
     /*
      * Put the Link, image, added date etc.
      * in separate <span></span>
      */
     $name_span = $this->get_span_with_id($drama->get_name(), 'name');
     $added_span = $this->get_span_with_id($drama->get_human_readable_added(), 'added');
     $link->append_tag_to_content($name_span);
     $link->append_tag_to_content($added_span);
     $link->set_href($drama_url);
     $li = new HTMLTags_LI();
     $li->append_tag_to_content($link);
     $li->set_attribute_str('id', 'drama');
     //                foreach ($drama->get_frames() as $frame)
     //                {
     //                        $li->append_tag_to_content($this->get_oedipus_png_frame($frame));
     //                }
     return $li;
 }
 public function get_first_tier_navigation_ul()
 {
     $pages = $this->get_pages_for_first_tier_navigation();
     $ul = new HTMLTags_UL();
     foreach ($pages as $page) {
         $li = new HTMLTags_LI();
         if (($this->get_current_page_class_string() == 'VideoLibrary_SearchPage' || $this->get_current_page_class_string() == 'VideoLibrary_HomePage') && $page['name'] == 'home' || $this->get_current_page_class_string() == 'VideoLibrary_TagsPage' && $page['name'] == 'tags') {
             $li->set_attribute_str('class', 'selected');
         }
         $a = new HTMLTags_A();
         $url = new HTMLTags_URL();
         $url->set_file($page['href']);
         $a->set_href($url);
         if ($page['open-in-new-window'] == 'yes') {
             $a->set_attribute_str('target', '_blank');
         }
         $span = new HTMLTags_Span($page['title']);
         $a->append($span);
         $li->append($a);
         $ul->append($li);
     }
     return $ul;
 }
 public function get_product_category_li_in_public()
 {
     $product_category_li = new HTMLTags_LI();
     $product_category = $this->get_element();
     $product_category_link = new HTMLTags_A($product_category->get_name());
     $product_category_location = new HTMLTags_URL();
     $product_category_location->set_file('/');
     $product_category_location->set_get_variable('section', 'plug-ins');
     $product_category_location->set_get_variable('module', 'shop');
     $product_category_location->set_get_variable('page', 'product-category');
     $product_category_location->set_get_variable('product_category_id', $product_category->get_id());
     $product_category_link->set_href($product_category_location);
     $product_category_li->append_tag_to_content($product_category_link);
     return $product_category_li;
 }
 public static function get_mailing_list_links_ul()
 {
     $links = array("Mailing List" => "/?section=haddock&module=admin&page=admin-includer&type=html&admin-section=plug-ins&admin-page=mailing-list&admin-module=mailing-list", "People CSV" => "/MailingList_ListAddressesAdminPage");
     $ul = new HTMLTags_UL();
     $ul->set_attribute_str('class', 'inline');
     foreach ($links as $key => $value) {
         $li = new HTMLTags_LI();
         $url = new HTMLTags_URL();
         $url->set_file($value);
         $a = new HTMLTags_A($key);
         $a->set_href($url);
         $li->append($a);
         $ul->append($li);
     }
     return $ul;
 }
 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('&quot;' . $datum . '&quot;');
                         }
                         $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_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;
 }
 /**
  * Renders a UL that contains links to other pages
  * to do with this one.
  * e.g. the 'delete_everything' version of this page.
  */
 protected function render_other_pages_ul()
 {
     $page_options_div = new HTMLTags_Div();
     $page_options_div->set_attribute_str('id', 'page-options');
     $other_pages_ul = new HTMLTags_UL();
     /**
      * Link to the add row form.
      */
     $add_row_li = new HTMLTags_LI();
     $add_row_a = new HTMLTags_A($this->get_add_something_link_text());
     $add_row_href = $this->get_add_something_page_url();
     $add_row_a->set_href($add_row_href);
     $add_row_li->append_tag_to_content($add_row_a);
     $other_pages_ul->append_tag_to_content($add_row_li);
     /**
      * Link to the delete all confirmation page.
      */
     $delete_all_li = new HTMLTags_LI();
     $delete_all_a = new HTMLTags_A($this->get_delete_everything_link_text());
     $delete_all_href = $this->get_current_base_url();
     $delete_all_href->set_get_variable('content', 'delete_everything');
     $delete_all_a->set_href($delete_all_href);
     $delete_all_li->append_tag_to_content($delete_all_a);
     $other_pages_ul->append_tag_to_content($delete_all_li);
     $page_options_div->append_tag_to_content($other_pages_ul);
     echo $page_options_div->get_as_string();
 }
     } elseif (isset($_GET['last_added_id'])) {
         $message = 'Added product_brand id: ' . $_GET['last_added_id'];
     }
     $last_error_box_div = new HTMLTags_LastActionBoxDiv($message, $current_page_url->get_as_string(), 'message');
     $content_div->append_tag_to_content($last_error_box_div);
 }
 /**
  * Links to other pages in the admin section.
  */
 $page_options_div = new HTMLTags_Div();
 $page_options_div->set_attribute_str('id', 'page-options');
 $other_pages_ul = new HTMLTags_UL();
 /**
  * Link to the add row form.
  */
 $add_row_li = new HTMLTags_LI();
 $add_row_a = new HTMLTags_A('Add New Product Brand');
 $add_row_href = clone $current_page_url;
 $add_row_href->set_get_variable('add_row');
 $add_row_a->set_href($add_row_href);
 $add_row_li->append_tag_to_content($add_row_a);
 $other_pages_ul->append_tag_to_content($add_row_li);
 /**
  * Link to the delete all confirmation page.
  */
 #$delete_all_li = new HTMLTags_LI();
 #
 #$delete_all_a = new HTMLTags_A('Delete All Photographs');
 #
 #$delete_all_href = new HTMLTags_URL();
 #
 public static function get_pager_div($start, $duration, $total_videos_count, $results_page_url)
 {
     $div = new HTMLTags_Div();
     $div->set_attribute_str('class', 'pager');
     //print_r($total_videos_count . ' || ' . $duration);exit;
     /*
      * Find how many pages, any remainder has to count as a new page
      */
     $pages = ceil($total_videos_count / $duration);
     if ($pages > 1) {
         /*
          * Find current page
          */
         if ($start > 0) {
             $current_page = ceil($start / $duration) + 1;
         } else {
             $current_page = 1;
         }
         //print_r($start . ' || ' . $duration . "\n");
         //print_r($pages . ' || ' . $current_page);exit;
         $ul = new HTMLTags_UL();
         $first = TRUE;
         /*
          * Previous Link
          */
         if ($current_page > 1) {
             $prev_li = new HTMLTags_LI();
             $prev_li->set_attribute_str('class', 'prev');
             $prev_a = new HTMLTags_A('Previous');
             $prev_a->set_href(VideoLibrary_URLHelper::get_results_page_url($results_page_url, ($current_page - 2) * $duration, $duration));
             $prev_li->append($prev_a);
             $ul->append($prev_li);
         }
         /*
          * Middle Links:
          *
          * (if there are 7 pages)
          * << 1 2 3 4 5 6 7>>
          *
          * (if we're on page 5 of 8)
          * << 1 2 ... 4 5 6 7 8 >>
          *
          * (if we're on page 50 of 100)
          * << 1 2 ... 49 50 51 ... 99 100 >>
          *
          */
         $ellipsis = 0;
         $previous_line_was_ellipsis = FALSE;
         for ($page = 1; $page <= $pages; $page++) {
             if ($pages <= 9 or $page == 1 or $page == 2 or $page == $current_page or $page == $pages - 1 or $page == $pages or $page == $current_page - 1 or $page == $current_page + 1) {
                 $li = new HTMLTags_LI();
                 $li_class = "";
                 if ($first) {
                     $li_class .= 'first ';
                     $first = FALSE;
                 } elseif ($page == $pages) {
                     $li_class .= 'last ';
                 }
                 if ($page == $current_page) {
                     $li_class .= 'selected ';
                     $span = new HTMLTags_Span($page);
                     $li->append($span);
                 } else {
                     $a = new HTMLTags_A($page);
                     $a->set_href(VideoLibrary_URLHelper::get_results_page_url($results_page_url, ($page - 1) * $duration, $duration));
                     $li->append($a);
                 }
                 $li->set_attribute_str('class', trim($li_class));
                 $ul->append($li);
                 $previous_line_was_ellipsis = FALSE;
             } elseif (!$previous_line_was_ellipsis && $ellipsis <= 1) {
                 $li = new HTMLTags_LI();
                 $li->set_attribute_str('class', 'ellipsis');
                 $li->append('<span>&hellip;</span>');
                 $ul->append($li);
                 $ellipsis++;
                 $previous_line_was_ellipsis = TRUE;
             }
         }
         /*
          * Next page link
          */
         if ($current_page < $pages) {
             $next_li = new HTMLTags_LI();
             $next_li->set_attribute_str('class', 'next');
             $next_a = new HTMLTags_A('Next');
             $next_a->set_href(VideoLibrary_URLHelper::get_results_page_url($results_page_url, $current_page * $duration, $duration));
             $next_li->append($next_a);
             $ul->append($next_li);
         }
         $div->append($ul);
         //print_r($div->get_as_string());exit;
     }
     return $div;
 }
 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;
    }
         }
         $table_li->append_tag_to_content($table_fields_list);
         $field_classes_list->append_tag_to_content($table_li);
     }
     $d_c_n_c_field_set->append_tag_to_content($field_classes_list);
 }
 /*
  * The field renderers.
  */
 if (count($field_renderer_files) > 0) {
     $field_renderers_heading = new HTMLTags_Heading(3, 'Field Renderers');
     $d_c_n_c_field_set->append_tag_to_content($field_renderers_heading);
     $table_names = array_keys($field_renderer_files);
     $field_renderers_list = new HTMLTags_OL();
     foreach ($table_names as $table_name) {
         $table_li = new HTMLTags_LI();
         $table_name_heading = new HTMLTags_Heading(4, $table_name);
         $table_li->append_tag_to_content($table_name_heading);
         $table_fields_list = new HTMLTags_OL();
         $field_names = array_keys($field_renderer_files[$table_name]);
         foreach ($field_names as $field_name) {
             $field_renderer_li = new HTMLTags_LI();
             $input_name = 'field-' . $table_name . '-' . $field_name . '-renderer';
             $field_renderer_select_label = new HTMLTags_Label($field_name);
             $field_renderer_select_label->set_attribute_str('for', $input_name);
             $field_renderer_li->append_tag_to_content($field_renderer_select_label);
             $field_renderer_select = new HTMLTags_Select();
             $field_renderer_select->set_attribute_str('id', $input_name);
             $field_renderer_select->set_attribute_str('name', $input_name);
             $current_field_renderer_class_file = null;
             if (isset($database_class_name_file)) {