Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
commit e96bbd1252
  1. 39
      app/Migrations/Schema/V111/Version20160713180000.php
  2. 3
      main/install/data.sql
  3. 10
      main/install/index.php
  4. 9
      main/install/install.lib.php
  5. 71
      main/session/add_users_to_session.php
  6. 5
      main/work/upload.php

@ -0,0 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160713180000
* Add option to use SVG icons instead of their PNG version
* @package Application\Migrations\Schema\V111
*/
class Version20160713180000 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'allow_browser_sniffer'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'allow_browser_sniffer'");
}
/**
* @param Schema $schema
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function down(Schema $schema)
{
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle','AllowBrowserSnifferComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer','true','Yes') ");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer','false','No') ");
}
}

@ -269,7 +269,6 @@ VALUES
('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang','LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0),
('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0),
('courses_default_creation_visibility', NULL, 'radio', 'Course', '2', 'CoursesDefaultCreationVisibilityTitle', 'CoursesDefaultCreationVisibilityComment', NULL, NULL, 1),
('allow_browser_sniffer', NULL, 'radio', 'Tuning', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0),
('gradebook_enable_grade_model', NULL, 'radio', 'Gradebook', 'false', 'GradebookEnableGradeModelTitle', 'GradebookEnableGradeModelComment', NULL, NULL, 1),
('teachers_can_change_grade_model_settings', NULL, 'radio', 'Gradebook', 'true', 'TeachersCanChangeGradeModelSettingsTitle', 'TeachersCanChangeGradeModelSettingsComment', NULL, NULL, 1),
('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 0),
@ -596,8 +595,6 @@ VALUES
('courses_default_creation_visibility', '2', 'OpenToThePlatform'),
('courses_default_creation_visibility', '1', 'Private'),
('courses_default_creation_visibility', '0', 'CourseVisibilityClosed'),
('allow_browser_sniffer', 'true', 'Yes'),
('allow_browser_sniffer', 'false', 'No'),
('teachers_can_change_score_settings', 'true', 'Yes'),
('teachers_can_change_score_settings', 'false', 'No'),
('teachers_can_change_grade_model_settings', 'true', 'Yes'),

@ -258,8 +258,8 @@ if (!isset($_GET['running'])) {
$checkEmailByHashSent = 0;
$ShowEmailNotCheckedToStudent = 1;
$userMailCanBeEmpty = 1;
$allowSelfReg = 1;
$allowSelfRegProf = 1;
$allowSelfReg = 'approval';
$allowSelfRegProf = 1; //by default, a user can register as teacher (but moderation might be in place)
$encryptPassForm = 'bcrypt';
if (!empty($_GET['profile'])) {
$installationProfile = api_htmlentities($_GET['profile'], ENT_QUOTES);
@ -570,7 +570,7 @@ if (@$_POST['step2']) {
$encryptPassForm = 'none';
}
$allowSelfReg = false;
$allowSelfReg = 'approval';
$tmp = get_config_param_from_db('allow_registration');
if (!empty($tmp)) {
$allowSelfReg = $tmp;
@ -616,7 +616,7 @@ if (@$_POST['step2']) {
echo get_lang('AdminLogin') . ' : <strong>' . $loginForm . '</strong><br />';
echo get_lang('AdminPass') . ' : <strong>' . $passForm . '</strong><br /><br />'; /* TODO: Maybe this password should be hidden too? */
}
$allowSelfRegistrationLiteral = ($allowSelfReg == 'true') ? get_lang('Yes') : ($allowSelfReg == 'approval' ? get_lang('Approval') : get_lang('No'));
echo get_lang('AdminFirstName').' : '.$adminFirstName, '<br />', get_lang('AdminLastName').' : '.$adminLastName, '<br />';
echo get_lang('AdminEmail').' : '.$emailForm; ?><br />
<?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br />
@ -626,7 +626,7 @@ if (@$_POST['step2']) {
<?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br />
<?php echo get_lang('DBPassword').' : '.str_repeat('*', api_strlen($dbPassForm)); ?><br />
<?php echo get_lang('MainDB').' : <strong>'.$dbNameForm; ?></strong><br />
<?php echo get_lang('AllowSelfReg').' : '.($allowSelfReg ? get_lang('Yes') : get_lang('No')); ?><br />
<?php echo get_lang('AllowSelfReg').' : '. $allowSelfRegistrationLiteral; ?><br />
<?php echo get_lang('EncryptMethodUserPass').' : ';
echo $encryptPassForm;
?>

@ -1671,13 +1671,13 @@ function display_configuration_settings_form(
} else {
$html .= '<div class="control-group">';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .'
<input type="radio" name="allowSelfReg" value="true" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .'
</label>';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
<input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
</label>';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
<input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
</label>';
$html .= '</div>';
}
@ -1965,9 +1965,10 @@ function installSettings(
$allowTeacherSelfRegistration,
$installationProfile = ''
) {
$allowRegistration = $allowRegistration ? 'true' : 'false';
//$allowRegistration = $allowRegistration ? 'true' : 'false';
$allowTeacherSelfRegistration = $allowTeacherSelfRegistration ? 'true' : 'false';
error_log($allowRegistration);
// Use PHP 5.3 to avoid issue with weird peripherical auto-installers like travis-ci
$settings = array(
'Institution' => $organizationName,

@ -51,11 +51,21 @@ $new_field_list = array();
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
//if is enabled to filter and is a "<select>" field type
if ($extra_field[8]==1 && $extra_field[2]==4) {
if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_SELECT) {
$new_field_list[] = array(
'name'=> $extra_field[3],
'variable'=>$extra_field[1],
'data'=> $extra_field[9]
'name' => $extra_field[3],
'type' => $extra_field[2],
'variable' => $extra_field[1],
'data' => $extra_field[9],
);
}
if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_TAG) {
$options = UserManager::get_extra_user_data_for_tags($extra_field[1]);
$new_field_list[] = array(
'name' => $extra_field[3],
'type' => $extra_field[2],
'variable' => $extra_field[1],
'data' => $options['options'],
);
}
}
@ -386,19 +396,28 @@ if ($ajax_search) {
unset($users); //clean to free memory
} else {
//Filter by Extra Fields
$extra_field_result = [];
$use_extra_fields = false;
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) {
$result_list=array();
if (is_array($new_field_list) && count($new_field_list) > 0) {
$result_list = array();
foreach ($new_field_list as $new_field) {
$varname = 'field_'.$new_field['variable'];
$fieldtype = $new_field['type'];
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
$use_extra_fields = true;
$extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'],
$_POST[$varname]
);
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
$extra_field_result[]= UserManager::get_extra_user_data_by_tags(
intval($_POST['field_id']),
$_POST[$varname]
);
} else {
$extra_field_result[]= UserManager::get_extra_user_data_by_value(
$new_field['variable'],
$_POST[$varname]
);
}
}
}
}
@ -567,19 +586,31 @@ if ($add_type=='multiple') {
foreach ($new_field_list as $new_field) {
echo $new_field['name'];
$varname = 'field_'.$new_field['variable'];
$fieldtype = $new_field['type'];
echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked='';
if (isset($_POST[$varname])) {
if ($_POST[$varname]==$option[1]) {
$checked = 'selected="true"';
}
}
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
}
echo '</select>';
echo '&nbsp;&nbsp;';
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option['tag']) {
$checked = 'selected="true"';
}
}
echo '<option value="'.$option['tag'].'" '.$checked.'>'.$option['tag'].'</option>';
} else {
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option[1]) {
$checked = 'selected="true"';
}
}
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
}
}
echo '</select>';
$extraHidden = $fieldtype == ExtraField::FIELD_TYPE_TAG ? '<input type="hidden" name="field_id" value="'.$option['field_id'].'" />' : '';
echo $extraHidden;
echo '&nbsp;&nbsp;';
}
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
echo '<br /><br />';

@ -105,6 +105,11 @@ if ($form->validate()) {
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
if (!$result) {
Display::addFlash(Display::return_message(get_lang('UploadError'), 'error'));
} else {
Display::addFlash(Display::return_message(get_lang('UplUploadSucceeded'), 'success'));
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id);
exit;
} else {

Loading…
Cancel
Save