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 ';
     $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 ';
         $input_label_text .= $currency->get_name();
         $input_label_text .= ' (';
         $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;
 }
 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;
 }
 public function get_supplier_shipping_price_editing_form($supplier_id, $product_category_id, $redirect_script_url, $cancel_href)
 {
     $supplier_shipping_prices_table = $this->get_element();
     $database = $supplier_shipping_prices_table->get_database();
     $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
     $suppliers_table = $database->get_table('hpi_shop_suppliers');
     $supplier = $suppliers_table->get_row_by_id($supplier_id);
     $product_categories_table = $database->get_table('hpi_shop_product_categories');
     $product_category = $product_categories_table->get_row_by_id($product_category_id);
     $supplier_shipping_price_editing_form = new HTMLTags_SimpleOLForm('supplier_shipping_price_editing');
     $supplier_shipping_price_editing_form->set_action($redirect_script_url);
     $legend_text = '';
     $legend_text .= 'Edit ';
     $legend_text .= $supplier->get_name();
     $legend_text .= "'s shipping prices for ";
     $legend_text .= $product_category->get_name();
     $supplier_shipping_price_editing_form->set_legend_text($legend_text);
     $customer_regions = $customer_regions_table->get_all_rows();
     foreach ($customer_regions as $customer_region) {
         $price_id = $customer_region->get_id();
         $conditions = array();
         $conditions['customer_region_id'] = $customer_region->get_id();
         $conditions['product_category_id'] = $product_category_id;
         $conditions['supplier_id'] = $supplier_id;
         $supplier_shipping_prices = $supplier_shipping_prices_table->get_rows_where($conditions);
         if (count($supplier_shipping_prices) > 0) {
             $current_first_price = $supplier_shipping_prices[0]->get_first_price();
             $current_additional_price = $supplier_shipping_prices[0]->get_additional_price();
         } else {
             $current_first_price = 0;
             $current_additional_price = 0;
         }
         /*
          * The first_price
          */
         $input_li = new HTMLTags_LI();
         $currency = $customer_region->get_currency();
         $input_label_text = '';
         $input_label_text .= 'Price of first item to ';
         $input_label_text .= $customer_region->get_name();
         $input_label_text .= ' (';
         $input_label_text .= $currency->get_symbol();
         $input_label_text .= ')';
         $input_label_title = 'first_price_';
         $input_label_title .= $customer_region->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_first_price);
         $input_li->append_tag_to_content($input);
         $supplier_shipping_price_editing_form->add_input_li($input_li);
         /*
          * The additional_price
          */
         $input_li = new HTMLTags_LI();
         $currency = $customer_region->get_currency();
         $input_label_text = '';
         $input_label_text .= 'Price of each additional item to ';
         $input_label_text .= $customer_region->get_name();
         $input_label_text .= ' (';
         $input_label_text .= $currency->get_symbol();
         $input_label_text .= ')';
         $input_label_title = 'additional_price_';
         $input_label_title .= $customer_region->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_additional_price);
         $input_li->append_tag_to_content($input);
         $supplier_shipping_price_editing_form->add_input_li($input_li);
     }
     /*
      * The add button.
      */
     $supplier_shipping_price_editing_form->set_submit_text('Edit');
     $supplier_shipping_price_editing_form->set_cancel_location($cancel_href);
     return $supplier_shipping_price_editing_form;
 }
 public function get_principal_tag_form_checkbox_li()
 {
     $mysql_user_factory = Database_MySQLUserFactory::get_instance();
     $mysql_user = $mysql_user_factory->get_for_this_project();
     $database = $mysql_user->get_database();
     $product_row = $this->get_element();
     $product_tags_table = $database->get_table('hpi_shop_product_tags');
     $input_li = new HTMLTags_LI();
     $input_label = new HTMLTags_Label('Tags');
     $input_label->set_attribute_str('for', 'principal_tag_id');
     $input_li->append_tag_to_content($input_label);
     $principal_tags = $product_tags_table->get_principal_tags();
     foreach ($principal_tags as $principal_tag) {
         $input = new HTMLTags_Input();
         $input->set_attribute_str('type', 'checkbox');
         $input->set_attribute_str('name', 'tag_' . $principal_tag->get_id());
         $input->set_value($principal_tag->get_id());
         if ($product_row->has_tag($principal_tag)) {
             #print_r('saul');
             $input->set_attribute_str('checked', 'checked');
         }
         $input_li->append_tag_to_content($input);
         $input_li->append_str_to_content($principal_tag->get_tag());
         //                        $input_li->append_tag_to_content(new HTMLTags_BR());
     }
     $input_msg_box = new HTMLTags_Span();
     $input_msg_box->set_attribute_str('id', 'principal_tag_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_supplier_form_checkbox_li($customer_region_id)
 {
     $input_li = new HTMLTags_LI();
     $input_label = new HTMLTags_Label('Suppliers');
     $input_label->set_attribute_str('for', 'supplier_id');
     $input_li->append_tag_to_content($input_label);
     $customer_region_supplier_links_table = $this->get_element();
     $database = $customer_region_supplier_links_table->get_database();
     $suppliers_table = $database->get_table('hpi_shop_suppliers');
     $suppliers = $suppliers_table->get_all_rows();
     foreach ($suppliers as $supplier) {
         $input = new HTMLTags_Input();
         $input->set_attribute_str('type', 'checkbox');
         $input->set_attribute_str('name', $supplier->get_id());
         $input->set_value($supplier->get_id());
         $conditions = array();
         $conditions['supplier_id'] = $supplier->get_id();
         $conditions['customer_region_id'] = $customer_region_id;
         $current_supplier = $customer_region_supplier_links_table->get_rows_where($conditions);
         if (count($current_supplier) > 0) {
             #print_r('saul');
             $input->set_attribute_str('checked', 'checked');
         }
         $input_li->append_tag_to_content($input);
         $input_li->append_str_to_content($supplier->get_name());
         //                        $input_li->append_tag_to_content(new HTMLTags_BR());
     }
     $input_msg_box = new HTMLTags_Span();
     $input_msg_box->set_attribute_str('id', 'supplier_id' . 'msg');
     $input_msg_box->set_attribute_str('class', 'rules');
     $input_li->append_tag_to_content($input_msg_box);
     return $input_li;
 }