Customizing Easy Forms - First steps - Easy Forms

# Customizing Easy Forms ¶

## Introduction ¶

Easy Forms is an application developed in object oriented PHP under the MVC pattern. If you have programming skills, it will be easy to customize Easy Forms according to your requirements.

However, this guide is intended for users who don't have programming knowledge.

> Note: @app refers to the application root directory.

## Changing the logo ¶

The first thing to do to customize your application is change the logo. The logo is not an image but a text that you can modify by simply renaming the application.

To change the logo you must follow the next steps:

1. Click on your username in the navigation menu.
2. Click "Settings".
3. Change the name to 'My Forms' or the name you prefer, better one short.
4. Click "Update".

The page will reload and will show a message to let you know that the update has been successful. Now 'My Forms' will appear as the application logo.

## Changing the number of rows ¶

By default are show 5 rows on the Form Manager, Submission Manager, User Manager and others. You can change this very easily.

For that:

1. Open the file `@app/config/params.php`.
2. Change the value of `'GridView.pagination.pageSize'` to `10 or the number of rows you want.
3. Save the file.

When you return to the app it will display the number of rows you have defined.

## Limit Access to the Login Page to Specific IP Addresses ¶

Securing your site is important. After all, it means you are protecting not only your personal information and data, but also any information your users collect on your site.

To limit the access to the login page to one or multiple static IP addresses:

1. Open the following file: `@app/config/params.php`
2. Add one or more IP Addresses to the 'App.User.validIps' key
3. Save the file

That's it! When an unauthorized visitor tries to access that page, they’ll see an error 404 - Page Not Found.

> Note: If you’re not sure what your IP address happens to be, just ask Google. Just type in “What is my IP” and Google will tell you.

## Change language ¶

Easy Forms comes with the English language by default. However, it let each user change the whole application language very easily, allowing them to see it in their own language.

### Change the application language for a user ¶

1. Go to the User Manager
2. Click on the "Actions" button of the User to update
3. Click "Update"
4. Change the language to Spanish
5. Click "Save"

From now on, if your user accesses the application, he will see the interface in Spanish.

> Note: Keep in mind that at any moment your user can change the application language. For this, he will only need to update the field Language of his User Profile.

### Change the default application language ¶

1. Open the configuration file `@app/config/web.php`.
2. Find the line: `'language' => 'en-US’`, and replace `'en-US'` for another language you have translated, to Spanish for example: `‘es-ES’`.

When you reload the application you will see that the application default language is Spanish.

## Add a new language ¶

To add a new language to the application, you basically need two things:

1. Translate English strings to the new language.
2. Add the new language to the list of languages supported by the application.

### 1. Translate strings ¶

To translate strings you must do the following:

1. Locate the `@app/messages` folder and create a new folder which name include the ISO language code (in lowercase) and the ISO country code (in uppercase), separated by a hyphen. For example, Brazilian Portuguese, 'pt-BR'.
2. Then copy the file app.php from the 'es-ES' folder and paste it into your new folder. Let's say in 'pt-BR'.
3. Then translate strings from English to the new language (To continue our example, replace strings in Spanish to Portuguese).
4. Save the file and the application will be translated to the new language.

### 2. Add new language to the application ¶

To add your new language:

1. Open the file @app/helpers/language.php
2. Add the line `"pt-BR" => Yii :: t ('app', 'Portuguese'),` to `suportedLanguage()` method.
3. Save the file

Following the example, the method should end like:

    public static function supportedLanguages()
    {
        return array(
            "en-US" => Yii::t('app', 'English'),
            "es-ES" => Yii::t('app', 'Spanish'),
            "pt-BR" => Yii::t('app', 'Portuguese'),
        );
    }

From now on, when you enter the application, you can change the language to portuguese from your User Profile.

> Note: Keep in mind that the text you type in the source code must be in English.

Additional Step

As added the 'Portuguese' string to the application, it is recommended to translate this string in both Spanish and Portuguese:

1. Open the file `@app/messages/es-ES/app.php` and add `‘Portuguese’ => ‘Portugués’,`.
2. Open the file `@app/messages/pt-BR/app.php` and add `‘Portuguese’ => ‘Português’,`.