public function get_admin_pages_html_table() { $pages_table = $this->get_element(); $admin_pages_html_table = new HTMLTags_Table(); $admin_pages_html_table->set_attribute_str('id', 'admin_pages_table'); /* * The head */ $thead = new HTMLTags_THead(); $header_tr = new HTMLTags_TR(); $header_tr->append_tag_to_content(new HTMLTags_TH('Name')); $header_tr->append_tag_to_content(new HTMLTags_TH('Author')); $header_tr->append_tag_to_content(new HTMLTags_TH('Title')); $actions_th = new HTMLTags_TH('Actions'); $actions_th->set_attribute_str('colspan', 2); $header_tr->append_tag_to_content($actions_th); $thead->append_tag_to_content($header_tr); $admin_pages_html_table->append_tag_to_content($thead); /* * The body. */ $tbody = new HTMLTags_TBody(); $pages = $pages_table->get_pages_viewable_by_currently_logged_in_user(); foreach ($pages as $page) { $page_renderer = $page->get_renderer(); $tbody->append_tag_to_content($page_renderer->get_admin_page_html_table_tr()); } $admin_pages_html_table->append_tag_to_content($tbody); return $admin_pages_html_table; }
protected function get_tbody() { $tbody = new HTMLTags_TBody(); $data_trs = $this->get_data_trs(); foreach ($data_trs as $data_tr) { $tbody->append_tag_to_content($data_tr); } return $tbody; }
/** * Renders the HTML table that contains the data and the * links to other pages to do stuff to individual items. */ protected function render_data_table() { /* * The table. */ $rows_html_table = new HTMLTags_Table(); $rows_html_table->set_attribute_str('class', 'table_pages'); /* * ---------------------------------------- * The caption for the HTML table displaying the products. * ---------------------------------------- */ $caption_str = $this->get_data_table_caption_content(); $rows_html_table->append_tag_to_content(new HTMLTags_Caption($caption_str)); /* * ---------------------------------------- * The heading row of the HTML table that displays the products. * ---------------------------------------- */ $thead = new HTMLTags_THead(); $sort_href = $this->get_current_base_url(); $sort_href->set_get_variable('limit', $this->get_current_limit()); $sort_href->set_get_variable('offset', $this->get_current_offset()); $heading_row = new Database_SortableHeadingTR($sort_href, $this->get_current_direction()); $fields = $this->get_data_table_fields(); #print_r($fields); foreach ($fields as $field) { if (isset($field['sortable']) && strtolower($field['sortable']) == 'no') { $heading_row->append_nonsortable_field_name($field['col_name'], isset($field['title']) ? $field['title'] : NULL); } else { $heading_row->append_sortable_field_name($field['col_name'], isset($field['title']) ? $field['title'] : NULL); } } foreach ($this->get_data_table_action_ths() as $action_th) { $heading_row->append_tag_to_content($action_th); } $thead->append_tag_to_content($heading_row); $rows_html_table->append_tag_to_content($thead); /* * ---------------------------------------- * Fetch the rows from the database table. * ---------------------------------------- */ $tbody = new HTMLTags_TBody(); $rows = $this->get_matching_rows(); /* * Display some of the contents of the table. */ foreach ($rows as $row) { $data_tr = $this->get_data_html_table_tr($row); $tbody->append_tag_to_content($data_tr); } $rows_html_table->append_tag_to_content($tbody); echo $rows_html_table->get_as_string(); }
public function get_all_orders_table($current_page_url) { $supplier = $this->get_element(); $database = $supplier->get_database(); $orders_table = $database->get_table('hpi_shop_orders'); $all_orders_table = new HTMLTags_Table(); $all_orders_table->set_attribute_str('id', 'shopping-basket-table'); $caption = new HTMLTags_Caption('Your Orders'); $all_orders_table->append_tag_to_content($caption); $thead = new HTMLTags_THead(); $thead_tr = new HTMLTags_TR(); $added_th = new HTMLTags_TH('Date of Purchase'); $id_th = new HTMLTags_TH('Order No.'); $product_th = new HTMLTags_TH('Product'); $customer_th = new HTMLTags_TH('Customer'); $quantity_th = new HTMLTags_TH('Amount'); $status_th = new HTMLTags_TH('Status'); $set_status_th = new HTMLTags_TH('Set Status'); $thead_tr->append_tag_to_content($added_th); $thead_tr->append_tag_to_content($id_th); $thead_tr->append_tag_to_content($product_th); $thead_tr->append_tag_to_content($customer_th); $thead_tr->append_tag_to_content($quantity_th); $thead_tr->append_tag_to_content($status_th); $thead_tr->append_tag_to_content($set_status_th); $thead->append_tag_to_content($thead_tr); $all_orders_table->append_tag_to_content($thead); // $tfoot = new HTMLTags_TFoot(); // $tfoot_tr = new HTMLTags_TR(); // $sub_total_th= new HTMLTags_TH('Sub-Total'); // $blank_td= new HTMLTags_TD(''); // $sub_total_td = new HTMLTags_TD($sub_total_price->get_as_string()); // // $tfoot_tr->append_tag_to_content($sub_total_th); // $tfoot_tr->append_tag_to_content($blank_td); // $tfoot_tr->append_tag_to_content($blank_td); // $tfoot_tr->append_tag_to_content($sub_total_td); // $tfoot_tr->append_tag_to_content($blank_td); // // $tfoot->append_tag_to_content($tfoot_tr); // $all_orders_table->append_tag_to_content($tfoot); $tbody = new HTMLTags_TBody(); try { $orders = $orders_table->get_orders_for_supplier($supplier, $order_by = 'added'); } catch (Exception $e) { /* * Shouldn't something happen here? */ } #print_r($orders); foreach ($orders as $order) { $order_renderer = $order->get_renderer(); $order_tr = $order_renderer->get_public_order_supplier_tr($current_page_url); $tbody->append_tag_to_content($order_tr); } $all_orders_table->append_tag_to_content($tbody); return $all_orders_table; }
public function get_checkout_shopping_basket_for_current_session_table() { $shopping_baskets_table = $this->get_element(); $database = $shopping_baskets_table->get_database(); $customer_regions_table = $database->get_table('hpi_shop_customer_regions'); $customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']); $currency = $customer_region->get_currency(); $shopping_baskets_table = $this->get_element(); $checkout_shopping_basket_table = new HTMLTags_Table(); $checkout_shopping_basket_table->set_attribute_str('id', 'shopping-basket-table'); $caption = new HTMLTags_Caption('Your Shopping Basket'); $checkout_shopping_basket_table->append_tag_to_content($caption); // THEAD $thead = new HTMLTags_THead(); $thead_tr = new HTMLTags_TR(); $name_th = new HTMLTags_TH('Name'); $price_th = new HTMLTags_TH('Unit Price'); $quantity_th = new HTMLTags_TH('Amount'); $sub_total_th = new HTMLTags_TH('Sub-Total'); $thead_tr->append_tag_to_content($name_th); $thead_tr->append_tag_to_content($price_th); $thead_tr->append_tag_to_content($quantity_th); $thead_tr->append_tag_to_content($sub_total_th); $thead->append_tag_to_content($thead_tr); $checkout_shopping_basket_table->append_tag_to_content($thead); // TFOOT $tfoot = new HTMLTags_TFoot(); $blank_td = new HTMLTags_TD(''); // TFOOT - sub-total-tr $tfoot_sub_total_tr = new HTMLTags_TR(); $sub_total_price = new Shop_SumOfMoney($shopping_baskets_table->get_sub_total_for_current_session($customer_region), $currency); $sub_total_th = new HTMLTags_TH('Sub-Total'); $sub_total_td = new HTMLTags_TD($sub_total_price->get_as_string()); $tfoot_sub_total_tr->append_tag_to_content($blank_td); $tfoot_sub_total_tr->append_tag_to_content($blank_td); $tfoot_sub_total_tr->append_tag_to_content($sub_total_th); $tfoot_sub_total_tr->append_tag_to_content($sub_total_td); $tfoot->append_tag_to_content($tfoot_sub_total_tr); // TFOOT - shipping-tr $shipping_price = new Shop_SumOfMoney($shopping_baskets_table->get_shipping_total_for_current_session($customer_region->get_id()), $currency); $tfoot_shipping_tr = new HTMLTags_TR(); $shipping_th = new HTMLTags_TH('Shipping'); $shipping_td = new HTMLTags_TD($shipping_price->get_as_string()); $tfoot_shipping_tr->append_tag_to_content($blank_td); $tfoot_shipping_tr->append_tag_to_content($blank_td); $tfoot_shipping_tr->append_tag_to_content($shipping_th); $tfoot_shipping_tr->append_tag_to_content($shipping_td); $tfoot->append_tag_to_content($tfoot_shipping_tr); // TFOOT - total-tr $total_price = new Shop_SumOfMoney($shopping_baskets_table->get_total_for_current_session($customer_region->get_id()), $currency); $tfoot_total_tr = new HTMLTags_TR(); $total_th = new HTMLTags_TH('Total'); $total_td = new HTMLTags_TD($total_price->get_as_string()); $tfoot_total_tr->append_tag_to_content($blank_td); $tfoot_total_tr->append_tag_to_content($blank_td); $tfoot_total_tr->append_tag_to_content($total_th); $tfoot_total_tr->append_tag_to_content($total_td); $tfoot->append_tag_to_content($tfoot_total_tr); $checkout_shopping_basket_table->append_tag_to_content($tfoot); // TBODY $tbody = new HTMLTags_TBody(); try { $shopping_baskets = $shopping_baskets_table->get_shopping_baskets_for_current_session(); } catch (Exception $e) { } if (count($shopping_baskets) > 0) { foreach ($shopping_baskets as $shopping_basket) { $shopping_basket_renderer = $shopping_basket->get_renderer(); $shopping_basket_tr = $shopping_basket_renderer->get_checkout_shopping_basket_tr(); $tbody->append_tag_to_content($shopping_basket_tr); } } $checkout_shopping_basket_table->append_tag_to_content($tbody); return $checkout_shopping_basket_table; }
public function get_checkout_order_for_current_session_table() { $orders_table = $this->get_element(); $database = $orders_table->get_database(); $customer_regions_table = $database->get_table('hpi_shop_customer_regions'); $orders_table = $this->get_element(); $checkout_order_table = new HTMLTags_Table(); $caption = new HTMLTags_Caption('Your Shopping Basket'); $checkout_order_table->append_tag_to_content($caption); // THEAD $thead = new HTMLTags_THead(); $thead_tr = new HTMLTags_TR(); $name_th = new HTMLTags_TH('Name'); $price_th = new HTMLTags_TH('Unit Price'); $quantity_th = new HTMLTags_TH('Amount'); $sub_total_th = new HTMLTags_TH('Sub-Total'); $thead_tr->append_tag_to_content($name_th); $thead_tr->append_tag_to_content($price_th); $thead_tr->append_tag_to_content($quantity_th); $thead_tr->append_tag_to_content($sub_total_th); $thead->append_tag_to_content($thead_tr); $checkout_order_table->append_tag_to_content($thead); // TFOOT $tfoot = new HTMLTags_TFoot(); $blank_td = new HTMLTags_TD(''); // TFOOT - sub-total-tr $tfoot_sub_total_tr = new HTMLTags_TR(); $sub_total_th = new HTMLTags_TH('Sub-Total'); $sub_total_td = new HTMLTags_TD($orders_table->get_sub_total_for_current_session()); $tfoot_sub_total_tr->append_tag_to_content($blank_td); $tfoot_sub_total_tr->append_tag_to_content($blank_td); $tfoot_sub_total_tr->append_tag_to_content($sub_total_th); $tfoot_sub_total_tr->append_tag_to_content($sub_total_td); $tfoot->append_tag_to_content($tfoot_sub_total_tr); // TFOOT - shipping-tr $tfoot_shipping_tr = new HTMLTags_TR(); $shipping_th = new HTMLTags_TH('Shipping'); $shipping_td = new HTMLTags_TD($orders_table->get_shipping_total_for_current_session()); $tfoot_shipping_tr->append_tag_to_content($blank_td); $tfoot_shipping_tr->append_tag_to_content($blank_td); $tfoot_shipping_tr->append_tag_to_content($shipping_th); $tfoot_shipping_tr->append_tag_to_content($shipping_td); $tfoot->append_tag_to_content($tfoot_shipping_tr); // TFOOT - total-tr $tfoot_total_tr = new HTMLTags_TR(); $total_th = new HTMLTags_TH('Total'); $total_td = new HTMLTags_TD($orders_table->get_total_for_current_session($shipping_location)); $tfoot_total_tr->append_tag_to_content($blank_td); $tfoot_total_tr->append_tag_to_content($blank_td); $tfoot_total_tr->append_tag_to_content($total_th); $tfoot_total_tr->append_tag_to_content($total_td); $tfoot->append_tag_to_content($tfoot_total_tr); $checkout_order_table->append_tag_to_content($tfoot); // TBODY $tbody = new HTMLTags_TBody(); try { $orders = $orders_table->get_orders_for_current_session(); } catch (Exception $e) { } if (count($orders) > 0) { foreach ($orders as $order) { $order_renderer = $order->get_renderer(); $order_tr = $order_renderer->get_checkout_order_tr(); $tbody->append_tag_to_content($order_tr); } } $checkout_order_table->append_tag_to_content($tbody); return $checkout_order_table; }