Exemple #1
0
/**
 * Displays step 4 of the installation - configuration settings about Chamilo itself.
 * @param string $installType
 * @param string $urlForm
 * @param string $languageForm
 * @param string $emailForm
 * @param string $adminFirstName
 * @param string $adminLastName
 * @param string $adminPhoneForm
 * @param string $campusForm
 * @param string $institutionForm
 * @param string $institutionUrlForm
 * @param string $encryptPassForm
 * @param bool $allowSelfReg
 * @param bool $allowSelfRegProf
 * @param string $loginForm
 * @param string $passForm
 */
function display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $allowSelfRegProf, $loginForm, $passForm)
{
    if ($installType != 'update' && empty($languageForm)) {
        $languageForm = $_SESSION['install_language'];
    }
    echo '<div class="RequirementHeading">';
    echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>";
    echo '</div>';
    echo '<p>' . get_lang('ConfigSettingsInfo') . ' <strong>main/inc/conf/configuration.php</strong></p>';
    // Parameter 1: administrator's login
    $html = '';
    $html .= display_configuration_parameter($installType, get_lang('AdminLogin'), 'loginForm', $loginForm, $installType == 'update');
    // Parameter 2: administrator's password
    if ($installType != 'update') {
        $html .= display_configuration_parameter($installType, get_lang('AdminPass'), 'passForm', $passForm, false);
    }
    // Parameters 3 and 4: administrator's names
    $html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
    $html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
    //Parameter 3: administrator's email
    $html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
    //Parameter 6: administrator's telephone
    $html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
    echo panel($html, get_lang('Administrator'), 'administrator');
    //echo '<table class="table">';
    //First parameter: language
    $html = '<div class="form-group">';
    $html .= '<label class="col-sm-6 control-label">' . get_lang('MainLang') . "</label>";
    if ($installType == 'update') {
        $html .= '<input type="hidden" name="languageForm" value="' . api_htmlentities($languageForm, ENT_QUOTES) . '" />' . $languageForm;
    } else {
        // new installation
        $html .= '<div class="col-sm-6">';
        $html .= display_language_selection_box('languageForm', $languageForm);
        $html .= '</div>';
    }
    $html .= "</div>";
    //Second parameter: Chamilo URL
    $html .= '<div class="form-group">';
    $html .= '<label class="col-sm-6 control-label">' . get_lang('ChamiloURL') . get_lang('ThisFieldIsRequired') . '</label>';
    if ($installType == 'update') {
        $html .= api_htmlentities($urlForm, ENT_QUOTES) . "\n";
    } else {
        $html .= '<div class="col-sm-6">';
        $html .= '<input class="form-control" type="text" size="40" maxlength="100" name="urlForm" value="' . api_htmlentities($urlForm, ENT_QUOTES) . '" />';
        $html .= '</div>';
    }
    $html .= '</div>';
    //Parameter 9: campus name
    $html .= display_configuration_parameter($installType, get_lang('CampusName'), 'campusForm', $campusForm);
    //Parameter 10: institute (short) name
    $html .= display_configuration_parameter($installType, get_lang('InstituteShortName'), 'institutionForm', $institutionForm);
    //Parameter 11: institute (short) name
    $html .= display_configuration_parameter($installType, get_lang('InstituteURL'), 'institutionUrlForm', $institutionUrlForm);
    $html .= '<div class="form-group">
            <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass") . '</label>
        <div class="col-sm-6">';
    if ($installType == 'update') {
        $html .= '<input type="hidden" name="encryptPassForm" value="' . $encryptPassForm . '" />' . $encryptPassForm;
    } else {
        $html .= '<div class="checkbox">
                    <label>
                        <input  type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" ' . ($encryptPassForm == 'bcrypt' ? 'checked="checked" ' : '') . '/> bcrypt
                    </label>';
        $html .= '<label>
                        <input  type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" ' . ($encryptPassForm == 'sha1' ? 'checked="checked" ' : '') . '/> sha1
                    </label>';
        $html .= '<label>
                        <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" ' . ($encryptPassForm == 'md5' ? 'checked="checked" ' : '') . '/> md5
                    </label>';
        $html .= '<label>
                        <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" ' . ($encryptPassForm == 'none' ? 'checked="checked" ' : '') . '/>' . get_lang('None') . '
                    </label>';
        $html .= '</div>';
    }
    $html .= '</div></div>';
    $html .= '<div class="form-group">
            <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg') . '</label>
            <div class="col-sm-6">';
    if ($installType == 'update') {
        $html .= '<input type="hidden" name="allowSelfReg" value="' . $allowSelfReg . '" />' . $allowSelfReg ? get_lang('Yes') : get_lang('No');
    } else {
        $html .= '<div class="control-group">';
        $html .= '<label class="checkbox-inline">
                        <input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" ' . ($allowSelfReg ? 'checked="checked" ' : '') . ' /> ' . get_lang('Yes') . '
                    </label>';
        $html .= '<label class="checkbox-inline">
                        <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" ' . ($allowSelfReg ? '' : 'checked="checked" ') . ' /> ' . get_lang('No') . '
                    </label>';
        $html .= '</div>';
    }
    $html .= '</div>';
    $html .= '</div>';
    $html .= '<div class="form-group">';
    $html .= '<label class="col-sm-6 control-label">' . get_lang('AllowSelfRegProf') . '</label>
        <div class="col-sm-6">';
    if ($installType == 'update') {
        $html .= '<input type="hidden" name="allowSelfRegProf" value="' . $allowSelfRegProf . '" />' . $allowSelfRegProf ? get_lang('Yes') : get_lang('No');
    } else {
        $html .= '<div class="control-group">
                <label class="checkbox-inline">
                    <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" ' . ($allowSelfRegProf ? 'checked="checked" ' : '') . '/>
                ' . get_lang('Yes') . '
                </label>';
        $html .= '<label class="checkbox-inline">
                    <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" ' . ($allowSelfRegProf ? '' : 'checked="checked" ') . ' />
                   ' . get_lang('No') . '
                </label>';
        $html .= '</div>';
    }
    $html .= '</div>
    </div>';
    echo panel($html, get_lang('Platform'), 'platform');
    ?>
 
    <div class='form-group'>
        <div class="col-sm-6">
            <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php 
    echo get_lang('Previous');
    ?>
" ><i class="fa fa-backward"> </i> <?php 
    echo get_lang('Previous');
    ?>
</button>
            <input type="hidden" name="is_executable" id="is_executable" value="-" />
        </div>
        <div class="col-sm-6">
            <button class="btn btn-success" type="submit" name="step5" value="<?php 
    echo get_lang('Next');
    ?>
 &gt;" ><i class="fa fa-forward"> </i> <?php 
    echo get_lang('Next');
    ?>
</button>
        </div>   
    </div>
    
    <?php 
}
/**
 * Displays step 4 of the installation - configuration settings about Chamilo itself.
 */
function display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $allowSelfRegProf, $loginForm, $passForm)
{
    if ($installType != 'update' && empty($languageForm)) {
        $languageForm = $_SESSION['install_language'];
    }
    echo '<div class="RequirementHeading">';
    echo "<h2>" . display_step_sequence() . translate("CfgSetting") . "</h2>";
    echo '</div>';
    echo '<div class="RequirementContent">';
    echo '<p>' . translate('ConfigSettingsInfo') . ' ' . Display::label('config/configuration.php', 'info') . '</p>';
    echo '</div>';
    echo '<fieldset>';
    echo '<legend>' . translate('Administrator') . '</legend>';
    echo '<table class="data_table_no_border">';
    //Parameter 1: administrator's login
    display_configuration_parameter($installType, translate('AdminLogin'), 'loginForm', $loginForm, $installType == 'update');
    //Parameter 2: administrator's password
    if ($installType != 'update') {
        display_configuration_parameter($installType, translate('AdminPass'), 'passForm', $passForm, false);
    }
    //Parameters 3 and 4: administrator's names
    if (api_is_western_name_order()) {
        display_configuration_parameter($installType, translate('AdminFirstName'), 'adminFirstName', $adminFirstName);
        display_configuration_parameter($installType, translate('AdminLastName'), 'adminLastName', $adminLastName);
    } else {
        display_configuration_parameter($installType, translate('AdminLastName'), 'adminLastName', $adminLastName);
        display_configuration_parameter($installType, translate('AdminFirstName'), 'adminFirstName', $adminFirstName);
    }
    //Parameter 3: administrator's email
    display_configuration_parameter($installType, translate('AdminEmail'), 'emailForm', $emailForm);
    //Parameter 6: administrator's telephone
    display_configuration_parameter($installType, translate('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
    echo '</table>';
    echo '</fieldset>';
    echo '<fieldset>';
    echo '<legend>' . translate('Platform') . '</legend>';
    echo '<table class="data_table_no_border">';
    //First parameter: language
    echo "<tr>";
    echo '<td>' . translate('MainLang') . "&nbsp;&nbsp;</td>";
    if ($installType == 'update') {
        echo '<td><input type="hidden" name="languageForm" value="' . api_htmlentities($languageForm, ENT_QUOTES) . '" />' . $languageForm . "</td>";
    } else {
        // new installation
        echo '<td>';
        display_language_selection_box('languageForm', $languageForm);
        echo "</td>\n";
    }
    echo "</tr>\n";
    //Second parameter: Chamilo URL
    echo "<tr>";
    echo '<td>' . translate('ChamiloURL') . ' (<font color="red">' . translate('ThisFieldIsRequired') . "</font>)&nbsp;&nbsp;</td>";
    if ($installType == 'update') {
        echo '<td>' . api_htmlentities($urlForm, ENT_QUOTES) . "</td>\n";
    } else {
        echo '<td><input type="text" size="40" maxlength="100" name="urlForm" value="' . api_htmlentities($urlForm, ENT_QUOTES) . '" />' . "</td>";
    }
    echo "</tr>";
    //Parameter 9: campus name
    display_configuration_parameter($installType, translate('CampusName'), 'campusForm', $campusForm);
    //Parameter 10: institute (short) name
    display_configuration_parameter($installType, translate('InstituteShortName'), 'institutionForm', $institutionForm);
    //Parameter 11: institute (short) name
    display_configuration_parameter($installType, translate('InstituteURL'), 'institutionUrlForm', $institutionUrlForm);
    ?>
<tr>
    <td><?php 
    echo translate("EncryptMethodUserPass");
    ?>
 :</td>
    <?php 
    if ($installType == 'update') {
        ?>
    <td><input type="hidden" name="encryptPassForm"
               value="<?php 
        echo $encryptPassForm;
        ?>
"/><?php 
        echo $encryptPassForm;
        ?>
</td>
    <?php 
    } else {
        ?>
    <td>
        <div class="control-group">
            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="encryptPassForm" value="sha1"
                       id="encryptPass1" <?php 
        echo $encryptPassForm == 'sha1' ? 'checked="checked" ' : '';
        ?>
/><?php 
        echo 'sha1';
        ?>
            </label>

            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="encryptPassForm" value="md5"
                       id="encryptPass0" <?php 
        echo $encryptPassForm == 1 ? 'checked="checked" ' : '';
        ?>
/><?php 
        echo 'md5';
        ?>
            </label>

            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="encryptPassForm" value="none"
                       id="encryptPass2" <?php 
        echo $encryptPassForm === '0' or $encryptPassForm === 0 ? 'checked="checked" ' : '';
        ?>
/><?php 
        echo translate('None');
        ?>
            </label>

        </div>
    </td>
    <?php 
    }
    ?>
</tr>
<tr>
    <td><?php 
    echo translate('AllowSelfReg');
    ?>
 :</td>

    <?php 
    if ($installType == 'update') {
        ?>
    <td><input type="hidden" name="allowSelfReg"
               value="<?php 
        echo $allowSelfReg;
        ?>
"/><?php 
        echo $allowSelfReg ? translate('Yes') : translate('No');
        ?>
    </td>
    <?php 
    } else {
        ?>
    <td>
        <div class="control-group">
            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="allowSelfReg" value="1"
                       id="allowSelfReg1" <?php 
        echo $allowSelfReg ? 'checked="checked" ' : '';
        ?>
/> <?php 
        echo translate('Yes');
        ?>
            </label>
            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="allowSelfReg" value="0"
                       id="allowSelfReg0" <?php 
        echo $allowSelfReg ? '' : 'checked="checked" ';
        ?>
/><?php 
        echo translate('No');
        ?>
            </label>
        </div>
    </td>
    <?php 
    }
    ?>

</tr>
<tr>
    <td><?php 
    echo translate('AllowSelfRegProf');
    ?>
 :</td>

    <?php 
    if ($installType == 'update') {
        ?>
    <td><input type="hidden" name="allowSelfRegProf"
               value="<?php 
        echo $allowSelfRegProf;
        ?>
"/><?php 
        echo $allowSelfRegProf ? translate('Yes') : translate('No');
        ?>
</td>
    <?php 
    } else {
        ?>
    <td>
        <div class="control-group">
            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="allowSelfRegProf" value="1"
                       id="allowSelfRegProf1" <?php 
        echo $allowSelfRegProf ? 'checked="checked" ' : '';
        ?>
/>
                <?php 
        echo translate('Yes');
        ?>
            </label>
            <label class="checkbox inline">
                <input class="checkbox" type="radio" name="allowSelfRegProf" value="0"
                       id="allowSelfRegProf0" <?php 
        echo $allowSelfRegProf ? '' : 'checked="checked" ';
        ?>
/>
                <?php 
        echo translate('No');
        ?>
            </label>
        </div>
    </td>
    <?php 
    }
    ?>

</tr>
<tr>
    <td>
        <button type="submit" class="btn back" name="step3" value="&lt; <?php 
    echo translate('Previous');
    ?>
"/>
            <?php 
    echo translate('Previous');
    ?>
</button>
    </td>
    <td align="right">
        <input type="hidden" name="is_executable" id="is_executable" value="-"/>
        <button class="btn next" type="submit" name="step5" value="<?php 
    echo translate('Next');
    ?>
 &gt;"/>
            <?php 
    echo translate('Next');
    ?>
</button></td>
</tr>
</fieldset>
</table>
    <?php 
}