private static function get_link_a_to_admin_section($link_text, HTMLTags_URL $href)
 {
     $a = new HTMLTags_A($link_text);
     $a->set_href($href);
     $a->set_attribute_str('target', '_blank');
     return $a;
 }
 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 __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 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;
 }
 /**
  * Appends an HTMLTags_A object to the list so
  * that users can link to the admin page where the
  * rows in the table are reordered.
  */
 public static function append_reorder_html_a_to_list(&$html_as, $xml_config_file_name)
 {
     $a = new HTMLTags_A('Reorder');
     $url = self::get_reorder_table_admin_page($xml_config_file_name);
     $a->set_href($url);
     $html_as[] = $a;
 }
 /**
  * There should be some way to override that capitalisation.
  */
 public function append_sortable_field_name($sortable_field_name)
 {
     $th = new HTMLTags_TH();
     $s_f_n_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($sortable_field_name, '_');
     $sort_link = new HTMLTags_A($s_f_n_l_o_ws->get_words_as_capitalised_string());
     $sort_link->set_href($this->get_next_href($sortable_field_name));
     $th->append_tag_to_content($sort_link);
     $this->append_tag_to_content($th);
 }
 public static function get_frame_png_thumbnail_img_a(Oedipus_Frame $frame, $max_width = 250, $max_height = 185)
 {
     $url = Oedipus_DramaHelper::get_drama_page_url_for_frame_id($frame->get_id());
     $a = new HTMLTags_A();
     $a->set_href($url);
     $a->set_attribute_str('title', 'View this Frame');
     $img = self::get_frame_png_thumbnail_img($frame, $max_width, $max_height);
     $a->append_tag_to_content($img);
     return $a;
 }
 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;
 }
 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;
 }
 public static function get_link_to_edit_video_admin_page_div($video_id)
 {
     $div = new HTMLTags_Div();
     $div->set_attribute_str('class', 'admin');
     $a = new HTMLTags_A('Edit this Video');
     $a->set_attribute_str('class', 'edit');
     $a->set_href(VideoLibrary_URLHelper::get_edit_external_video_admin_page_url($video_id));
     $div->append($a);
     return $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;
 }
 public function get_product_id_with_link_td()
 {
     $td = new HTMLTags_TD();
     $product = $this->get_element();
     $link = new HTMLTags_A($product->get('product_id'));
     $url = Admin_AdminIncluderURLFactory::get_url('plug-ins', 'trackit-stock-management', 'product', 'html');
     $url->set_get_variable('product_id', $product->get_id());
     $link->set_href($url);
     $td->append_tag_to_content($link);
     return $td;
 }
 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;
 }
 protected function get_thumbnail_queue_link($id)
 {
     $div = new HTMLTags_Div();
     $u = $this->get_redirect_script_url();
     $u->set_get_variable('action', 'requeue_video_in_thumbnail_queue');
     $u->set_get_variable('id', $id);
     $a = new HTMLTags_A('Refetch Thumbnail');
     $a->set_href($u);
     $div->append($a);
     return $div->get_as_string();
 }
 private function get_drama_tr(Oedipus_Drama $drama)
 {
     $tr = new HTMLTags_TR();
     //$tr->set_attribute_str('id', 'drama');
     $link = new HTMLTags_A($drama->get_name());
     $link->set_href($this->get_drama_page_url_for_drama($drama));
     $name_td = $this->get_td_with_id($link->get_as_string(), 'name');
     $tr->append($name_td);
     $added_td = $this->get_td_with_id($drama->get_human_readable_added(), 'added');
     $tr->append($added_td);
     return $tr;
 }
 private function get_admin_users_td($a_text, $admin_page)
 {
     $user_row = $this->get_element();
     $td = new HTMLTags_TD();
     $confirm_url = Admin_AdminIncluderURLFactory::get_url('haddock', 'admin', $admin_page, 'html');
     $confirm_url->set_get_variable('user_id', $user_row->get_id());
     $a = new HTMLTags_A($a_text);
     $a->set_href($confirm_url);
     $a->set_attribute_str('class', 'cool_button');
     $td->append_tag_to_content($a);
     return $td;
 }
 protected function get_other_page_link_as()
 {
     $as = array();
     /**
      * Link to the reset all confirmation page.
      */
     $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);
     $as[] = $delete_all_a;
     return $as;
 }
 protected function get_top_links_as()
 {
     $as = array();
     $top_links = $this->reorder_table_admin_page_config_file->get_top_links();
     #print_r($top_links);
     foreach ($top_links as $top_link) {
         $a = new HTMLTags_A($top_link['title']);
         $a->set_href(new HTMLTags_URL($top_link['url']));
         $as[] = $a;
     }
     #print_r($as);
     return $as;
 }
 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;
 }
 public function get_content()
 {
     $content = new HTMLTags_TagContent();
     $content->append_str($this->question);
     $content->append_tag(new HTMLTags_BR());
     $action_a = new HTMLTags_A($this->yes_str);
     $action_a->set_href($this->action);
     $content->append_tag($action_a);
     $content->append_str('&nbsp;');
     $cancel_a = new HTMLTags_A($this->no_str);
     $cancel_a->set_href($this->cancel);
     $content->append_tag($cancel_a);
     return $content;
 }
 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('&nbsp;');
         $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('&nbsp;');
         $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 get_admin_currencies_html_table_tr($current_page_url)
 {
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     /*
      * The data.
      */
     $name_field = $table->get_field('name');
     $name_td = $this->get_data_html_table_td($name_field);
     $html_row->append_tag_to_content($name_td);
     $iso_4217_code_field = $table->get_field('iso_4217_code');
     $iso_4217_code_td = $this->get_data_html_table_td($iso_4217_code_field);
     $html_row->append_tag_to_content($iso_4217_code_td);
     $symbol_field = $table->get_field('symbol');
     $symbol_td = $this->get_data_html_table_td($symbol_field);
     $html_row->append_tag_to_content($symbol_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     $edit_location = clone $current_page_url;
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     $delete_location = clone $current_page_url;
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
 public function get_data_html_table_td_with_image(Database_Field $field)
 {
     $row = $this->get_element();
     if ($field->get_name() == 'image' && $row->has_full_size_image()) {
         #print_r($field);
         $field_renderer = $field->get_renderer();
         $img_tag = $this->get_img_in_public_images();
         #print_r($img_tag);
         $full_a = new HTMLTags_A();
         $full_size_image = $row->get_full_size_image();
         #print_r($full_size_image);
         $full_size_image_renderer = $full_size_image->get_renderer();
         $full_size_image_url = $full_size_image_renderer->get_html_url_in_public_images();
         $full_a->set_href($full_size_image_url);
         $full_a->append_tag_to_content($img_tag);
         $data_html_table_td = $field_renderer->get_data_html_table_td($full_a->get_as_string());
         return $data_html_table_td;
     } else {
         return parent::get_data_html_table_td($field);
     }
 }
 public function __construct($message, $no_script_href = '', $status = NULL)
 {
     #echo "\$message: $message\n";
     #echo "\$no_script_href: $no_script_href\n";
     parent::__construct();
     $this->set_attribute_str('id', 'lastActionBox');
     #if (strlen($no_script_href) > 0) {
     #    $this->set_attribute_str('class', 'noscript');
     #}
     if ($status == 'error') {
         $this->set_attribute_str('class', 'error');
     }
     $p = new HTMLTags_P();
     $hide_a = new HTMLTags_A('Hide');
     $hide_a->set_attribute_str('id', 'lastActionBoxA');
     $hide_a->set_href(new HTMLTags_URL($no_script_href));
     #if (strlen($no_script_href) < 1) {
     #    $hide_a->set_href(new HTMLTags_URL('#'));
     #} else {
     #    $hide_a->set_href(new HTMLTags_URL($no_script_href));
     #}
     $hide_a->set_attribute_str('id', 'lastActionBoxHide');
     $hide_a->set_attribute_str('title', 'Hide this notice');
     $p->append_tag_to_content($hide_a);
     $p->append_str_to_content($message);
     $this->append_tag_to_content($p);
 }
 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_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 function get_edited_confirmation_div()
    {
        $order = $this->get_element();
        $product = $order->get_product();
        $confirmation_div = new HTMLTags_Div();
        $confirmation_text = <<<TXT
You have changed the amount of&nbsp;
TXT;
        $confirmation_text .= $product->get_name();
        $confirmation_text .= <<<TXT
&nbsp;in your Shopping Basket.
TXT;
        $confirmation_text_p = new HTMLTags_P($confirmation_text);
        $confirmation_div->append_tag_to_content($confirmation_text_p);
        $all_products_link = new HTMLTags_A('View All Products');
        //            $all_products_link->set_attribute_str('class', 'all_products');
        $all_products_location = new HTMLTags_URL();
        $all_products_location->set_file('/products.html');
        //            $all_products_location->set_get_variable('page', 'orders');
        $all_products_link->set_href($all_products_location);
        $confirmation_div->append_tag_to_content($all_products_link);
        return $confirmation_div;
    }