/**
  * @return
  *  HTMLTags_SimpleOLForm
  *  The form for editing the values of a user to be displayed in the
  *  admin section.
  */
 public function get_edit_user_form()
 {
     $user_row = $this->get_element();
     $edit_user_form = new HTMLTags_SimpleOLForm('edit_user');
     $redirect_script = Admin_AdminIncluderURLFactory::get_url('haddock', 'admin', 'manage-users', 'redirect-script');
     $action_href = clone $redirect_script;
     $action_href->set_get_variable('edit-user');
     $action_href->set_get_variable('user_id', $user_row->get_id());
     $edit_user_form->set_action($action_href);
     $edit_user_form->set_legend_text('Update user');
     /*
      * The user's name
      */
     $svm = Caching_SessionVarManager::get_instance();
     if ($svm->is_set('manage-users-form: name')) {
         $edit_user_form->add_input_name_with_value('name', $svm->get('manage-users-form: name'));
     } else {
         $edit_user_form->add_input_name_with_value('name', $user_row->get_name());
     }
     /*
      * The type of admin user.
      */
     $login_manager = Admin_LoginManager::get_instance();
     $user_types = $login_manager->get_user_types();
     $user_types_select = HTMLTags_SelectFactory::make_select_for_str_array($user_types);
     $user_types_select->set_attribute_str('id', 'type');
     $user_types_select->set_attribute_str('name', 'type');
     if ($svm->is_set('manage-users-form: type')) {
         $user_types_select->set_value($svm->get('manage-users-form: type'));
     } else {
         $user_types_select->set_value($user_row->get_type());
     }
     $edit_user_form->add_input_tag('type', $user_types_select);
     /*
      * The user's real name
      */
     if ($svm->is_set('manage-users-form: real_name')) {
         $edit_user_form->add_input_name_with_value('real_name', $svm->get('manage-users-form: real_name'));
     } else {
         $edit_user_form->add_input_name_with_value('real_name', $user_row->get_real_name());
     }
     /*
      * The user's email
      */
     if ($svm->is_set('manage-users-form: email')) {
         $edit_user_form->add_input_name_with_value('email', $svm->get('manage-users-form: email'));
     } else {
         $edit_user_form->add_input_name_with_value('email', $user_row->get_email());
     }
     $edit_user_form->set_submit_text('Update');
     $cancel_href = clone $redirect_script;
     $cancel_href->set_get_variable('cancel');
     $edit_user_form->set_cancel_location($cancel_href);
     return $edit_user_form;
 }
 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_tag_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_row = $this->get_element();
     $products_table = $database->get_table('hpi_shop_products');
     $product_editing_form = new HTMLTags_SimpleOLForm('product_tag_editing');
     $product_editing_action = clone $redirect_script_url;
     $product_editing_action->set_get_variable('edit_tags', '1');
     $product_editing_action->set_get_variable('product_id', $product_row->get_id());
     $product_editing_form->set_action($product_editing_action);
     $product_editing_form->set_legend_text('Edit the tags for this product');
     /*
      * The tags
      */
     $value_of_tags_input = $this->get_tags_as_space_separated();
     $product_editing_form->add_input_name_with_value('tags', $value_of_tags_input, 'Tags (Space separated)');
     /*
      * The update button.
      */
     $product_editing_form->set_submit_text('Update');
     $product_editing_form->set_cancel_location($cancel_location);
     return $product_editing_form;
 }
     */
    $username = $project_directory->get_database_username_suggestion();
    $database = $project_directory->get_database_name_suggestion();
    /*
     * Generate a random password.
     */
    $password_length = 12;
    $password_generator = Security_PasswordGenerator::get_instance();
    $password = $password_generator->get_password($password_length);
}
/*
 * -----------------------------------------------------------------------------
 */
$password_management_form = new HTMLTags_SimpleOLForm('password_management');
$p_m_f_action_url = new HTMLTags_URL();
$p_m_f_action_url->set_file('/admin/redirect-script.php');
$p_m_f_action_url->set_get_variable('module', 'database');
$p_m_f_action_url->set_get_variable('page', 'passwords-file-management');
$password_management_form->set_action($p_m_f_action_url);
$password_management_form->set_legend_text('Password Management');
$password_management_form->add_input_name_with_value('host', $host);
$password_management_form->add_input_name_with_value('username', $username);
$password_management_form->add_input_name_with_value('database', $database);
$password_management_form->add_input_name_with_value('password', $password);
$password_management_form->set_submit_text('Commit');
$password_management_form->set_cancel_location(new HTMLTags_URL('/admin/database/home.html'));
$content_div->append_tag_to_content($password_management_form);
/*
 * -----------------------------------------------------------------------------
 */
echo $content_div->get_as_string();