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 __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('"' . $datum . '"');
                         }
                         $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 static function get_1d_ol($tree_name, $class_name = NULL)
 {
     if (!isset($class_name)) {
         $class_name = 'navigation';
     }
     $nodes = Navigation_1DTreeRetriever::get_tree_nodes($tree_name);
     #print_r($nodes);
     #echo "<ul class=\"$class_name\">\n";
     $ul = new HTMLTags_OL();
     $ul->set_class($class_name);
     foreach ($nodes as $node) {
         #Navigation_NodeRenderer::render_node($node);
         $li = new HTMLTags_LI();
         $li->append(Navigation_NodesHelper::get_link_a($node));
         $ul->add_li($li);
     }
     return $ul;
 }
 public function get_tag_cloud_div($current_url, $javascript = FALSE)
 {
     $tag_row = $this->get_element();
     $database = $tag_row->get_database();
     $tags_table = $database->get_table('hpi_shop_product_tags');
     #$product_row = $products_table->get_row_by_id($_GET['product_id']);
     #$database = $product_row->get_database();
     $tag_cloud_div = new HTMLTags_Div();
     $tag_cloud_div->set_attribute_str('id', 'tag_cloud_div');
     $tag_cloud_list = new HTMLTags_OL();
     $tags = $tags_table->get_tags_with_counts();
     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);
         if ($javascript) {
             $onclick = 'javascript:return tagsOnClick(this);';
             $tag_cloud_link->set_attribute_str('onclick', $onclick);
         }
         #tag_cloud_link->set_attribute_str('id', 'product_page_link');
         #echo $tag->get_photo_count();
         if ($tag->get_photo_count() > 3) {
             $tag_cloud_link->set_attribute_str('class', 'ultra-popular');
         }
         $tag_cloud_link->set_attribute_str('rel', 'tag');
         $tag_cloud_link_span = new HTMLTags_Span();
         $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;
 }
 protected function get_content()
 {
     $content = new HTMLTags_TagContent();
     # The field set.
     $field_set = new HTMLTags_FieldSet();
     $field_set->append_tag_to_content($this->get_legend());
     $inputs_list = new HTMLTags_OL();
     $input_lis = $this->get_input_lis();
     if (count($input_lis) > 0) {
         foreach ($input_lis as $input_li) {
             $inputs_list->add_li($input_li);
         }
     } else {
         throw new Exception('No inputs set in HTMLTags_SimpleOLForm!');
     }
     $field_set->append_tag_to_content($inputs_list);
     $content->append_tag($field_set);
     foreach ($this->get_hidden_inputs() as $hidden_input) {
         $content->append_tag($hidden_input);
     }
     $submit_buttons_div = new HTMLTags_Div();
     $submit_buttons_div->set_attribute_str('class', 'submit_buttons_div');
     $submit_buttons_div->append_tag_to_content($this->get_submit_button());
     $submit_buttons_div->append_tag_to_content($this->get_cancel_button());
     $content->append_tag($submit_buttons_div);
     # The content
     return $content;
 }
             $field_class_li->append_tag_to_content($field_class_select);
             $table_fields_list->add_li($field_class_li);
         }
         $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);
 protected function get_content()
 {
     $content = new HTMLTags_TagContent();
     /* 
      * The Inputs
      */
     $inputs_list = new HTMLTags_OL();
     $input_lis = $this->get_input_lis();
     if (count($input_lis) > 0) {
         foreach ($input_lis as $input_li) {
             $inputs_list->add_li($input_li);
         }
     } else {
         throw new Exception('No inputs set in HTMLTags_SimpleOLForm!');
     }
     $content->append_tag($inputs_list);
     /*
      * The buttons
      */
     $submit_buttons_div = new HTMLTags_Div();
     $submit_buttons_div->set_attribute_str('class', 'submit_buttons_div');
     $submit_buttons_div->append_tag_to_content($this->get_submit_button());
     $content->append_tag($submit_buttons_div);
     /*
      * The hidden inputs.
      */
     foreach ($this->get_hidden_inputs() as $hidden_input) {
         $content->append_tag($hidden_input);
     }
     return $content;
 }
 $other_pages_ul->append_tag_to_content($refresh_page_li);
 $page_options_div->append_tag_to_content($other_pages_ul);
 $content_div->append_tag_to_content($page_options_div);
 /*
  * -------------------------------------------------------------------------
  * The order status selecting form.
  * -------------------------------------------------------------------------
  */
 $order_status_selecting_form = new HTMLTags_Form();
 $order_status_selecting_form->set_attribute_str('name', 'order_status_selecting');
 $order_status_selecting_form->set_attribute_str('method', 'GET');
 $order_status_selecting_form->set_attribute_str('class', 'table-select-form');
 $order_status_selecting_action = clone $current_page_url;
 //        $order_status_selecting_action->set_get_variable('status');
 $order_status_selecting_form->set_action(new HTMLTags_URL('/'));
 $inputs_ol = new HTMLTags_OL();
 /*
  * Select the status.
  */
 $status_li = new HTMLTags_LI();
 $status_label = new HTMLTags_Label('Order Status');
 $status_label->set_attribute_str('for', 'status');
 $status_li->append_tag_to_content($status_label);
 $status_select = new HTMLTags_Select();
 $status_select->set_attribute_str('id', 'status');
 $status_select->set_attribute_str('name', 'status');
 //        $possible_status = $status_table->get_all_rows('firm_name', 'ASC');
 $all_statuses_option = new HTMLTags_Option('all');
 $all_statuses_option->set_attribute_str('value', 'all');
 if (isset($_GET['status'])) {
     if ($_GET['status'] == 'all') {
 private function get_enter_plu_code_form()
 {
     $enter_plu_code_form = new HTMLTags_Form();
     $enter_plu_code_form->set_attribute_str('name', 'enter_plu_code');
     $enter_plu_code_form->set_attribute_str('method', 'GET');
     $enter_plu_code_form->set_attribute_str('class', 'table-select-form');
     $enter_plu_code_form->set_action(new HTMLTags_URL('/'));
     $inputs_ol = new HTMLTags_OL();
     /*
      * Select whether you want all products or just those with status==display
      */
     $li = new HTMLTags_LI();
     $label = new HTMLTags_Label('PLU Code');
     $label->set_attribute_str('for', 'plu_code');
     $li->append_tag_to_content($label);
     $input = new HTMLTags_Input();
     $input->set_attribute_str('name', 'plu_code');
     $li->append($input);
     $inputs_ol->append($li);
     /*
      * The submit button.
      */
     $go_button_li = new HTMLTags_LI();
     $go_button = new HTMLTags_Input();
     $go_button->set_attribute_str('type', 'submit');
     $go_button->set_attribute_str('value', 'Go');
     $go_button->set_attribute_str('class', 'submit');
     $go_button_li->append_tag_to_content($go_button);
     $inputs_ol->add_li($go_button_li);
     $enter_plu_code_form->append($inputs_ol);
     /*
      * The hidden inputs.
      */
     $current_page_url = $this->get_current_page_url();
     $enter_plu_code_action = clone $current_page_url;
     $enter_plu_code_action_get_vars = $enter_plu_code_action->get_get_variables();
     foreach (array_keys($enter_plu_code_action_get_vars) as $key) {
         $form_hidden_input = new HTMLTags_Input();
         $form_hidden_input->set_attribute_str('type', 'hidden');
         $form_hidden_input->set_attribute_str('name', $key);
         $form_hidden_input->set_attribute_str('value', $enter_plu_code_action_get_vars[$key]);
         $enter_plu_code_form->append_tag_to_content($form_hidden_input);
     }
     return $enter_plu_code_form;
 }
Exemplo n.º 10
0
 $other_pages_ul->append_tag_to_content($delete_all_li);
 $page_options_div->append_tag_to_content($other_pages_ul);
 $content_div->append_tag_to_content($page_options_div);
 /*
  * -------------------------------------------------------------------------
  * The product category selecting form.
  * -------------------------------------------------------------------------
  */
 $product_category_selecting_form = new HTMLTags_Form();
 $product_category_selecting_form->set_attribute_str('name', 'product_category_selecting');
 $product_category_selecting_form->set_attribute_str('method', 'GET');
 $product_category_selecting_form->set_attribute_str('class', 'table-select-form');
 $product_category_selecting_action = clone $current_page_url;
 //        $product_category_selecting_action->set_get_variable('product_category_id');
 $product_category_selecting_form->set_action(new HTMLTags_URL('/'));
 $inputs_ol = new HTMLTags_OL();
 /*
  * Select the product_category_id.
  */
 $product_category_li = new HTMLTags_LI();
 $product_category_label = new HTMLTags_Label('Product Category');
 $product_category_label->set_attribute_str('for', 'product_category_id');
 $product_category_li->append_tag_to_content($product_category_label);
 if (isset($_GET['product_category_id'])) {
     $product_category_form_select = $table_renderer->get_product_category_form_select($_GET['product_category_id']);
 } else {
     $product_category_form_select = $table_renderer->get_product_category_form_select();
 }
 $all_product_categories_option = new HTMLTags_Option('all');
 $all_product_categories_option->set_attribute_str('value', 'all');
 if ($_GET['product_category_id'] == 'all' || !isset($_GET['product_category_id'])) {
 public function get_simplified_customer_and_address_adding_form(HTMLTags_URL $redirect_script_url, HTMLTags_URL $cancel_url)
 {
     /* form should just have name, email one address box and postcode, country name already filled in */
     $customers_table = $this->get_element();
     $database = $customers_table->get_database();
     //$email_addresses_table = $database->get_table('hpi_shop_email_addresses');
     $telephone_numbers_table = $database->get_table('hpi_shop_telephone_numbers');
     $addresses_table = $database->get_table('hpi_shop_addresses');
     $customer_adding_form = new HTMLTags_Form('customer_adding');
     $customer_adding_form->set_attribute_str('class', 'cmxform');
     $customer_adding_form->set_attribute_str('id', 'customer-details-form');
     $customer_adding_form->set_action($redirect_script_url);
     #$customer_adding_form = new HTMLTags_TagContent();
     #
     # The Log In Details field set.
     #
     $log_in_details_field_set = new HTMLTags_FieldSet();
     $log_in_details_field_set->append_tag_to_content(new HTMLTags_Legend('Log In Details'));
     $log_in_details_field_set_inputs_list = new HTMLTags_OL();
     /*
      * The email_address
      */
     $email_address_field = $customers_table->get_field('email_address');
     $email_address_field_renderer = $email_address_field->get_renderer();
     $input_tag = $email_address_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'email_address');
     $email_address_li = $this->get_form_li('email_address', $input_tag);
     $log_in_details_field_set_inputs_list->append_tag_to_content($email_address_li);
     /*
      * The password
      */
     $password_field = $customers_table->get_field('password');
     $password_field_renderer = $password_field->get_renderer();
     $input_tag = $password_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'password');
     $password_li = $this->get_form_li('password', $input_tag);
     $log_in_details_field_set_inputs_list->append_tag_to_content($password_li);
     $log_in_details_field_set->append_tag_to_content($log_in_details_field_set_inputs_list);
     $customer_adding_form->append_tag_to_content($log_in_details_field_set);
     #
     # The Customer field set.
     #
     $customer_details_field_set = new HTMLTags_FieldSet();
     $customer_details_field_set->append_tag_to_content(new HTMLTags_Legend('Shipping Details'));
     $customer_details_field_set_inputs_list = new HTMLTags_OL();
     /*
      * The first_name
      */
     $first_name_field = $customers_table->get_field('first_name');
     $first_name_field_renderer = $first_name_field->get_renderer();
     $input_tag = $first_name_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'first_name');
     $first_name_li = $this->get_form_li('first_name', $input_tag);
     $customer_details_field_set_inputs_list->append_tag_to_content($first_name_li);
     /*
      * The last_name
      */
     $last_name_field = $customers_table->get_field('last_name');
     $last_name_field_renderer = $last_name_field->get_renderer();
     $input_tag = $last_name_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'last_name');
     $last_name_li = $this->get_form_li('last_name', $input_tag);
     $customer_details_field_set_inputs_list->append_tag_to_content($last_name_li);
     /*
      * The telephone_number
      */
     $telephone_number_field = $telephone_numbers_table->get_field('telephone_number');
     $telephone_number_field_renderer = $telephone_number_field->get_renderer();
     $input_tag = $telephone_number_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'telephone_number');
     $telephone_number_li = $this->get_form_li('telephone_number', $input_tag);
     $customer_details_field_set_inputs_list->append_tag_to_content($telephone_number_li);
     /*
      * The full_address
      * which will be put straight into street_address		 *
      * in add_simplified_customer()
      */
     $address_li = $this->get_address_form_input_li();
     $customer_details_field_set_inputs_list->append_tag_to_content($address_li);
     /*
      * The address_postal_code
      */
     $address_field = $addresses_table->get_field('postal_code');
     $address_field_renderer = $address_field->get_renderer();
     $input_tag = $address_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'postal_code');
     $address_postal_code_li = $this->get_form_li('postal_code', $input_tag);
     $customer_details_field_set_inputs_list->append_tag_to_content($address_postal_code_li);
     /*
      * The address_country_name
      */
     $address_field = $addresses_table->get_field('country_name');
     $address_field_renderer = $address_field->get_renderer();
     $input_tag = $address_field_renderer->get_form_input();
     $input_tag->set_attribute_str('id', 'country_name');
     if (isset($_SESSION['customer_region_id'])) {
         $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
         $customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']);
         $input_tag->set_attribute_str('value', $customer_region->get_name());
     }
     $address_country_name_li = $this->get_form_li('country_name', $input_tag);
     $customer_details_field_set_inputs_list->append_tag_to_content($address_country_name_li);
     $customer_details_field_set->append_tag_to_content($customer_details_field_set_inputs_list);
     $customer_adding_form->append_tag_to_content($customer_details_field_set);
     #
     # SUBMIT BUTTON
     #
     $submit_button = new HTMLTags_Input();
     $submit_button->set_attribute_str('type', 'submit');
     $submit_button->set_attribute_str('value', 'Add');
     $submit_button->set_attribute_str('class', 'submit');
     $submit_buttons_div = new HTMLTags_Div();
     $submit_buttons_div->set_attribute_str('class', 'submit_buttons_div');
     $submit_buttons_div->append_tag_to_content($submit_button);
     $cancel_button = new HTMLTags_Input();
     $onclick = 'document.location.href=(\'';
     $onclick .= $cancel_url->get_as_string();
     $onclick .= "')";
     $cancel_button->set_attribute_str('type', 'button');
     $cancel_button->set_attribute_str('value', 'Cancel');
     $cancel_button->set_attribute_str('onclick', $onclick);
     $cancel_button->set_attribute_str('class', 'submit');
     $submit_buttons_div->append_tag_to_content($cancel_button);
     $customer_adding_form->append_tag_to_content($submit_buttons_div);
     # The Fields:
     //                $last_added_id = $customers_table->add_simplified_customer(
     //                        $_POST['full_name'],
     //                        $_POST['password'],
     //                        $_POST['email_address'],
     //                        $_POST['telephone_number'],
     //                        $_POST['full_address'],
     //                        $_POST['postal_code'],
     //                        $_POST['country_name'],
     //                        $_POST['customer_region_id']
     //                )
     return $customer_adding_form;
 }