public function get_row_adding_form(HTMLTags_URL $row_adding_action, HTMLTags_URL $cancel_href) { $table = $this->get_element(); $row_adding_form = new HTMLTags_SimpleOLForm('files_adding'); $row_adding_form->set_attribute_str('enctype', 'multipart/form-data'); $row_adding_form->set_attribute_str('class', 'basic-form'); $file_input_tag = new HTMLTags_Input(); $file_input_tag_name = 'user_file[]'; $file_input_tag->set_attribute_str('type', 'file'); $file_input_tag->set_attribute_str('id', $file_input_tag_name); $file_input_tag->set_attribute_str('name', $file_input_tag_name); $row_adding_form->add_input_tag($file_input_tag_name, $file_input_tag, 'File'); $row_adding_form->add_hidden_input('MAX_FILE_SIZE', '1000000'); $row_adding_form->set_action($row_adding_action); $row_adding_form->set_legend_text('Add file.'); $row_adding_form->set_submit_text('Add'); $row_adding_form->set_cancel_location($cancel_href); return $row_adding_form; }
public function get_photograph_adding_form($photograph_adding_action, $cancel_location) { $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $photographs_table = $database->get_table('hpi_shop_photographs'); $photograph_adding_form = new HTMLTags_SimpleOLForm('photograph_adding'); $photograph_adding_form->set_attribute_str('enctype', 'multipart/form-data'); #$photograph_adding_action->set_get_variable('table', $photographs_table->get_name()); $photograph_adding_form->set_action($photograph_adding_action); $photograph_adding_form->set_legend_text('Add a photograph'); /* * The name */ $name_field = $photographs_table->get_field('name'); $name_field_renderer = $name_field->get_renderer(); $input_tag = $name_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'name'); $photograph_adding_form->add_input_tag('name', $input_tag); /* THE FULL SIZE IMAGE UPLOAD */ $full_size_image_file_input_tag = new HTMLTags_Input(); $full_size_image_file_input_tag_name = 'display_photograph_file[]'; $full_size_image_file_input_tag->set_attribute_str('type', 'file'); $full_size_image_file_input_tag->set_attribute_str('id', $full_size_image_file_input_tag_name); $full_size_image_file_input_tag->set_attribute_str('name', $full_size_image_file_input_tag_name); $photograph_adding_form->add_input_tag($full_size_image_file_input_tag_name, $full_size_image_file_input_tag, 'Full Size File'); /* THE MEDIUM SIZE IMAGE UPLOAD */ $medium_size_image_file_input_tag = new HTMLTags_Input(); $medium_size_image_file_input_tag_name = 'medium_photograph_file[]'; $medium_size_image_file_input_tag->set_attribute_str('type', 'file'); $medium_size_image_file_input_tag->set_attribute_str('id', $medium_size_image_file_input_tag_name); $medium_size_image_file_input_tag->set_attribute_str('name', $medium_size_image_file_input_tag_name); $photograph_adding_form->add_input_tag($medium_size_image_file_input_tag_name, $medium_size_image_file_input_tag, 'Medium Size File'); /* THE THUMBNAIL IMAGE UPLOAD */ $thumbnail_image_file_input_tag = new HTMLTags_Input(); $thumbnail_image_file_input_tag_name = 'thumbnail_photograph_file[]'; $thumbnail_image_file_input_tag->set_attribute_str('type', 'file'); $thumbnail_image_file_input_tag->set_attribute_str('id', $thumbnail_image_file_input_tag_name); $thumbnail_image_file_input_tag->set_attribute_str('name', $thumbnail_image_file_input_tag_name); $photograph_adding_form->add_input_tag($thumbnail_image_file_input_tag_name, $thumbnail_image_file_input_tag, 'Thumbnail File'); $photograph_adding_form->add_hidden_input('MAX_FILE_SIZE', '1000000'); /* * The add button. */ $photograph_adding_form->set_submit_text('Add'); $photograph_adding_form->set_cancel_location($cancel_location); return $photograph_adding_form; }
public function get_log_file_adding_form() { $log_file_adding_form = new HTMLTags_SimpleOLForm('csv_adding'); $log_file_adding_form->set_attribute_str('enctype', 'multipart/form-data'); $legend_text = 'Add a log file'; $log_file_adding_form->set_legend_text($legend_text); /* * THE FILE */ $file_input_tag = new HTMLTags_Input(); $file_input_tag_name = 'user_file[]'; $file_input_tag->set_attribute_str('type', 'file'); $file_input_tag->set_attribute_str('id', $file_input_tag_name); $file_input_tag->set_attribute_str('name', $file_input_tag_name); $log_file_adding_form->add_input_tag($file_input_tag_name, $file_input_tag, 'File'); $log_file_adding_form->add_hidden_input('MAX_FILE_SIZE', '1000000'); $log_file_adding_form->set_submit_text('Add'); return $log_file_adding_form; }
public function get_order_editing_form(HTMLTags_URL $redirect_script_url, HTMLTags_URL $cancel_url) { $order_row = $this->get_element(); $database = $order_row->get_database(); $orders_table = $database->get_table('hpi_shop_orders'); $order_editing_form = new HTMLTags_SimpleOLForm('order_editing'); $order_editing_form->set_attribute_str('class', 'cmxform'); $order_editing_form->set_action($redirect_script_url); $order_editing_form->set_legend_text('Set the status of this order'); /* * The status */ $status_li = $this->get_status_form_select_li(); $order_editing_form->add_input_li($status_li); /* * The edit button. */ $order_editing_form->set_submit_text('Update'); $order_editing_form->set_cancel_location($cancel_url); return $order_editing_form; }
$comment_form_div->append_tag_to_content($form_notification_div); $comment_adding_action_url = new HTMLTags_URL(); $comment_adding_action_url->set_file('/'); $comment_adding_action_url->set_get_variable('section', 'plug-ins'); $comment_adding_action_url->set_get_variable('module', 'shop'); $comment_adding_action_url->set_get_variable('page', 'product'); $comment_adding_action_url->set_get_variable('type', 'redirect-script'); $comment_adding_action_url->set_get_variable('product_id', $_GET['product_id']); $cancel_location = new HTMLTags_URL(); $cancel_location->set_file('/'); $cancel_location->set_get_variable('section', 'plug-ins'); $cancel_location->set_get_variable('module', 'shop'); $cancel_location->set_get_variable('page', 'product'); $cancel_location->set_get_variable('product_id', $_GET['product_id']); $comment_adding_form = new HTMLTags_SimpleOLForm('comment_adding'); $comment_adding_form->set_attribute_str('class', 'cmxform'); $comment_adding_form->set_attribute_str('id', 'comment-form'); $comment_adding_action = $comment_adding_action_url; $comment_adding_action->set_get_variable('add_comment'); $comment_adding_form->set_action($comment_adding_action); $comment_adding_form->set_legend_text('What do you think?'); #$comment_adding_form->add_input_name('name'); /* * Name input */ $name_input = new HTMLTags_Input(); $name_input->set_attribute_str('name', 'name'); if ($log_in_manager->is_logged_in()) { $user = $log_in_manager->get_user(); $name_input->set_attribute_str('value', $user->get_first_name()); }
public function get_password_reset_form(HTMLTags_URL $form_location, HTMLTags_URL $redirect_script_location, HTMLTags_URL $desired_location, HTMLTags_URL $cancel_page_location) { $password_reset_form = new HTMLTags_SimpleOLForm('create_new_account'); $password_reset_form->set_attribute_str('id', $this->get_password_reset_form_id()); $password_reset_form->set_attribute_str('class', $this->get_password_reset_form_css_class()); $svm = Caching_SessionVarManager::get_instance(); /* * The action. */ $password_reset_script_location = clone $redirect_script_location; $password_reset_script_location->set_get_variable('password_reset'); $password_reset_script_location->set_get_variable('desired_location', urlencode($desired_location->get_as_string())); $password_reset_script_location->set_get_variable('form_location', urlencode($form_location->get_as_string())); $password_reset_form->set_action($password_reset_script_location); $password_reset_form->set_legend_text('Reset Password'); /* * The input tags. */ if ($svm->is_set('password-reset: email')) { $password_reset_form->add_input_name_with_value('email', $svm->get('password-reset: email')); } else { if ($this->is_logged_in()) { $password_reset_form->add_input_name_with_value('email', $this->get_name()); } else { $password_reset_form->add_input_name('email'); } } /* * The submit button. */ $password_reset_form->set_submit_text('Reset'); /* * The cancel button */ $cancel_location = clone $redirect_script_location; $cancel_location->set_get_variable('cancel'); $cancel_location->set_get_variable('cancel_page_location', urlencode($cancel_page_location->get_as_string())); $password_reset_form->set_cancel_location($cancel_location); return $password_reset_form; }
public function get_login_form_div($name = NULL) { $login_form_div = new HTMLTags_Div(); $login_form = new HTMLTags_SimpleOLForm('login'); $login_form->set_attribute_str('class', $this->get_login_form_css_class()); $login_form->set_attribute_str('id', $this->get_login_form_id()); $login_form->set_action($this->get_login_script_url()); $login_form->set_legend_text($this->get_login_form_legend_text()); if ($name == NULL) { $login_form->add_input_name($this->get_login_name_field_name()); } else { $login_form->add_input_name_with_value($this->get_login_name_field_name(), $name); } $password_input = new HTMLTags_Input(); $password_input->set_attribute_str('name', 'password'); $password_input->set_attribute_str('type', 'password'); $login_form->add_input_tag('password', $password_input); $login_form->set_submit_text('Login'); $login_form->set_cancel_location($this->get_login_cancel_url()); $login_form_div->append_tag_to_content($login_form); return $login_form_div; }
public function get_product_brand_adding_form($product_brand_adding_action, $cancel_location) { // $mysql_user_factory = Database_MySQLUserFactory::get_instance(); // $mysql_user = $mysql_user_factory->get_for_this_project(); // $database = $mysql_user->get_database(); // $product_brands_table = $database->get_table('hpi_shop_product_brands'); $product_brands_table = $this->get_element(); $product_brand_adding_form = new HTMLTags_SimpleOLForm('product_brand_adding'); $product_brand_adding_form->set_attribute_str('enctype', 'multipart/form-data'); #$product_brand_adding_action->set_get_variable('table', $product_brands_table->get_name()); $product_brand_adding_form->set_action($product_brand_adding_action); $product_brand_adding_form->set_legend_text('Add a product_brand'); /* * The name */ $name_field = $product_brands_table->get_field('name'); $name_field_renderer = $name_field->get_renderer(); $input_tag = $name_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'name'); $product_brand_adding_form->add_input_tag('name', $input_tag); /* * The owner */ $owner_field = $product_brands_table->get_field('owner'); $owner_field_renderer = $owner_field->get_renderer(); $input_tag = $owner_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'owner'); $product_brand_adding_form->add_input_tag('owner', $input_tag); /* * The description */ $description_field = $product_brands_table->get_field('description'); $description_field_renderer = $description_field->get_renderer(); $input_tag = $description_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'description'); $product_brand_adding_form->add_input_tag('description', $input_tag); /* * The url */ $url_field = $product_brands_table->get_field('url'); $url_field_renderer = $url_field->get_renderer(); $input_tag = $url_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'url'); $product_brand_adding_form->add_input_tag('url', $input_tag); /* THE FULL SIZE IMAGE UPLOAD */ $full_size_image_file_input_tag = new HTMLTags_Input(); $full_size_image_file_input_tag_name = 'display_image_file[]'; $full_size_image_file_input_tag->set_attribute_str('type', 'file'); $full_size_image_file_input_tag->set_attribute_str('id', $full_size_image_file_input_tag_name); $full_size_image_file_input_tag->set_attribute_str('name', $full_size_image_file_input_tag_name); $product_brand_adding_form->add_input_tag($full_size_image_file_input_tag_name, $full_size_image_file_input_tag, 'Photograph File'); /* THE THUMBNAIL IMAGE UPLOAD */ $thumbnail_image_file_input_tag = new HTMLTags_Input(); $thumbnail_image_file_input_tag_name = 'thumbnail_image_file[]'; $thumbnail_image_file_input_tag->set_attribute_str('type', 'file'); $thumbnail_image_file_input_tag->set_attribute_str('id', $thumbnail_image_file_input_tag_name); $thumbnail_image_file_input_tag->set_attribute_str('name', $thumbnail_image_file_input_tag_name); $product_brand_adding_form->add_input_tag($thumbnail_image_file_input_tag_name, $thumbnail_image_file_input_tag, 'Thumbnail File'); $product_brand_adding_form->add_hidden_input('MAX_FILE_SIZE', '1000000'); /* * The add button. */ $product_brand_adding_form->set_submit_text('Add'); $product_brand_adding_form->set_cancel_location($cancel_location); return $product_brand_adding_form; }
public function get_product_brand_editing_form($redirect_script_url, $cancel_location) { $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $product_brand_row = $this->get_element(); $product_brands_table = $database->get_table('hpi_shop_product_brands'); $product_brand_editing_form = new HTMLTags_SimpleOLForm('product_brand_editing'); $product_brand_editing_form->set_attribute_str('enctype', 'multipart/form-data'); $product_brand_editing_action = clone $redirect_script_url; $product_brand_editing_action->set_get_variable('edit_id', $product_brand_row->get_id()); $product_brand_editing_form->set_action($product_brand_editing_action); $product_brand_editing_form->set_legend_text('Edit this product_brand'); /* * The name */ $name_field = $product_brands_table->get_field('name'); $name_field_renderer = $name_field->get_renderer(); $input_tag = $name_field_renderer->get_form_input(); $input_tag->set_value($product_brand_row->get_name()); $input_tag->set_attribute_str('id', 'name'); $product_brand_editing_form->add_input_tag('name', $input_tag); /* * The owner */ $owner_field = $product_brands_table->get_field('owner'); $owner_field_renderer = $owner_field->get_renderer(); $input_tag = $owner_field_renderer->get_form_input(); $input_tag->set_value($product_brand_row->get_owner()); $input_tag->set_attribute_str('id', 'owner'); $product_brand_editing_form->add_input_tag('owner', $input_tag); /* * The description */ $description_field = $product_brands_table->get_field('description'); $description_field_renderer = $description_field->get_renderer(); $input_tag = $description_field_renderer->get_form_input(); $input_tag->set_value($product_brand_row->get_description()); $input_tag->set_attribute_str('id', 'description'); $product_brand_editing_form->add_input_tag('description', $input_tag); /* * The url */ $url_field = $product_brands_table->get_field('url'); $url_field_renderer = $url_field->get_renderer(); $input_tag = $url_field_renderer->get_form_input(); $input_tag->set_value($product_brand_row->get_url()); $input_tag->set_attribute_str('id', 'url'); $product_brand_editing_form->add_input_tag('url', $input_tag); /* * The update button. */ $product_brand_editing_form->set_submit_text('Update'); $product_brand_editing_form->set_cancel_location($cancel_location); return $product_brand_editing_form; }
public function get_customer_details_editing_form(HTMLTags_URL $form_location, HTMLTags_URL $redirect_script_location, HTMLTags_URL $desired_location, HTMLTags_URL $cancel_page_location) { $customer = $this->get_element(); $database = $customer->get_database(); $customers_table = $database->get_table('hpi_shop_customers'); $telephone_numbers_table = $database->get_table('hpi_shop_telephone_numbers'); $addresses_table = $database->get_table('hpi_shop_addresses'); $customer_details_form = new HTMLTags_SimpleOLForm('customer_details'); $customer_details_form->set_attribute_str('id', $this->get_customer_details_form_id()); $customer_details_form->set_attribute_str('class', $this->get_customer_details_form_css_class()); $svm = Caching_SessionVarManager::get_instance(); /* * The action. */ $customer_details_script_location = clone $redirect_script_location; $customer_details_script_location->set_get_variable('customer_details'); $customer_details_script_location->set_get_variable('desired_location', urlencode($desired_location->get_as_string())); $customer_details_script_location->set_get_variable('form_location', urlencode($form_location->get_as_string())); $customer_details_form->set_action($customer_details_script_location); $customer_details_form->set_legend_text($this->get_customer_details_form_legend_text()); /* * The input tags. */ /* * 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'); $input_tag->set_attribute_str('value', $customer->get_first_name()); $customer_details_form->add_input_tag('first_name', $input_tag); /* * 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'); $input_tag->set_attribute_str('value', $customer->get_last_name()); $customer_details_form->add_input_tag('last_name', $input_tag); /* * 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'); if ($customer->get_telephone_number_id() != 0) { $telephone_number = $customer->get_telephone_number(); $input_tag->set_attribute_str('value', $telephone_number->get_telephone_number()); } $customer_details_form->add_input_tag('telephone_number', $input_tag); // /* // * The address (to be put striaght into street_address) // */ // $address_li = $this->get_address_form_input_li(); // $customer_details_form->add_input_li($address_li); /* * The address_street_address */ $address_field = $addresses_table->get_field('street_address'); $address_field_renderer = $address_field->get_renderer(); $input_tag = $address_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'street_address'); if ($customer->get_address_id() != 0) { $address = $customer->get_address(); $input_tag->set_attribute_str('value', $address->get_street_address()); } $customer_details_form->add_input_tag('street_address', $input_tag); /* * The address_locality */ $address_field = $addresses_table->get_field('locality'); $address_field_renderer = $address_field->get_renderer(); $input_tag = $address_field_renderer->get_form_input(); $input_tag->set_attribute_str('id', 'locality'); if ($customer->get_address_id() != 0) { $address = $customer->get_address(); $input_tag->set_attribute_str('value', $address->get_locality()); } $customer_details_form->add_input_tag('locality', $input_tag, 'City'); /* * 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'); if ($customer->get_address_id() != 0) { $address = $customer->get_address(); $input_tag->set_attribute_str('value', $address->get_postal_code()); } $customer_details_form->add_input_tag('postal_code', $input_tag); /* * 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 ($customer->get_address_id() != 0) { $address = $customer->get_address(); if ($address->get_country_name() != '') { $input_tag->set_value($address->get_country_name()); } } elseif (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_value($customer_region->get_name()); } $customer_details_form->add_input_tag('country_name', $input_tag); /* * The customer_region_id */ $customer_region_li = $this->get_customer_region_form_select_li(); $customer_details_form->add_input_li($customer_region_li); /* * The submit button. */ $customer_details_form->set_submit_text('Confirm'); /* * The cancel button */ $cancel_location = clone $redirect_script_location; $cancel_location->set_get_variable('cancel'); $cancel_location->set_get_variable('cancel_page_location', urlencode($cancel_page_location->get_as_string())); $customer_details_form->set_cancel_location($cancel_location); return $customer_details_form; }