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

ofaj
jmontoyaa 10 years ago
commit 2f3d007cb0
  1. 48
      app/Migrations/Schema/V111/Version20160331103600.php
  2. 13
      main/admin/course_add.php
  3. 22
      main/admin/settings.lib.php
  4. 13
      main/create_course/add_course.php
  5. 28
      main/inc/ajax/course.ajax.php
  6. 34
      main/inc/lib/course.lib.php
  7. 2
      main/inc/lib/course_category.lib.php
  8. 15
      main/inc/lib/formvalidator/Element/SelectAjax.php
  9. 15
      main/install/data.sql
  10. 5
      main/lang/english/trad4all.inc.php
  11. 13
      main/lang/spanish/trad4all.inc.php
  12. 2
      user_portal.php

@ -0,0 +1,48 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160331103600
*/
class Version20160331103600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSettingCurrent(
'teacher_can_select_course_template',
null,
'radio',
'Course',
'true',
'TeacherCanSelectCourseTemplateTitle',
'TeacherCanSelectCourseTemplateComment',
null,
'',
1,
true,
false,
[
['value' => 'true', 'text' => 'Yes'],
['value' => 'false', 'text' => 'No'],
]
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

@ -103,6 +103,19 @@ $form->applyFilter('department_url', 'html_filter');
$form->addElement('select_language', 'course_language', get_lang('CourseLanguage'));
$form->applyFilter('select_language', 'html_filter');
if (api_get_setting('teacher_can_select_course_template') === 'true') {
$form->addElement(
'select_ajax',
'course_template',
[
get_lang('CourseTemplate'),
get_lang('PickACourseAsATemplateForThisNewCourse'),
],
null,
['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
);
}
$form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent'));
$group = array();

@ -1506,22 +1506,22 @@ function generate_settings_form($settings, $settings_by_access_list)
case 'custom':
break;
case 'select_course':
$courseSelect = $form->addElement(
'select_ajax',
$row['variable'],
[
get_lang($row['title']),
get_lang($row['comment']),
],
null,
['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
);
$courseSelectOptions = [];
if (!empty($row['selected_value'])) {
$course = $em->find('ChamiloCoreBundle:Course', $row['selected_value']);
$courseSelect->addOption($course->getTitle(), $course->getCode(), ['selected' => 'selected']);
$courseSelectOptions[$course->getId()] = $course->getTitle();
}
$form->addElement(
'select_ajax',
$row['variable'],
[get_lang($row['title']), get_lang($row['comment'])],
$courseSelectOptions,
['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
);
$default_values[$row['variable']] = $row['selected_value'];
break;
}

@ -221,6 +221,19 @@ if ($course_validation_feature) {
$obj = new GradeModel();
$obj->fill_grade_model_select_in_form($form);
if (api_get_setting('teacher_can_select_course_template') === 'true') {
$form->addElement(
'select_ajax',
'course_template',
[
get_lang('CourseTemplate'),
get_lang('PickACourseAsATemplateForThisNewCourse'),
],
null,
['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
);
}
$form->addElement('html', '</div>');
// Submit button.

@ -58,7 +58,7 @@ switch ($action) {
}
break;
case 'search_course':
if (api_is_platform_admin()) {
if (api_is_teacher()) {
if (!empty($_GET['session_id']) && intval($_GET['session_id'])) {
//if session is defined, lets find only courses of this session
$courseList = SessionManager::get_course_list_by_session_id(
@ -68,16 +68,20 @@ switch ($action) {
} else {
//if session is not defined lets search all courses STARTING with $_GET['q']
//TODO change this function to search not only courses STARTING with $_GET['q']
$courseList = CourseManager::get_courses_list(
0, //offset
0, //howMany
1, //$orderby = 1
'ASC',
-1, //visibility
$_GET['q'],
null, //$urlId
true //AlsoSearchCode
);
if (api_is_platform_admin()) {
$courseList = CourseManager::get_courses_list(
0, //offset
0, //howMany
1, //$orderby = 1
'ASC',
-1, //visibility
$_GET['q'],
null, //$urlId
true //AlsoSearchCode
);
} elseif (api_is_teacher()) {
$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id(), $_GET['q']);
}
}
$results = array();
@ -91,7 +95,7 @@ switch ($action) {
$title = $course['title'];
if (!empty($course['category_code'])) {
$parents = self::getParentsToString($course['category_code']);
$parents = CourseCategory::getParentsToString($course['category_code']);
$title = $parents . $course['title'];
}

@ -126,13 +126,25 @@ class CourseManager
// If parameter defined, copy the contents from a specific
// template course into this new course
$template = api_get_setting('course_creation_use_template');
if (!empty($template)) {
$teacherCanSelectCourseTemplate = api_get_setting('teacher_can_select_course_template') === 'true';
$courseTemplate = isset($params['course_template']) ? intval($params['course_template']) : 0;
$useTemplate = false;
if ($teacherCanSelectCourseTemplate && $courseTemplate) {
$useTemplate = true;
$originCourse = api_get_course_info_by_id($courseTemplate);
} elseif (!empty($template)) {
$useTemplate = true;
$originCourse = api_get_course_info_by_id($template);
}
if ($useTemplate) {
// Include the necessary libraries to generate a course copy
require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php';
// Call the course copy object
$originCourse = api_get_course_info_by_id($template);
$originCourse['official_code'] = $originCourse['code'];
$cb = new CourseBuilder(null, $originCourse);
$course = $cb->build(null, $originCourse['code']);
@ -921,10 +933,11 @@ class CourseManager
/**
* @param int $user_id
* @param string $startsWith Optional
* @return array An array with the course info of all the courses (real and virtual)
* of which the current user is course admin.
*/
public static function get_course_list_of_user_as_course_admin($user_id)
public static function get_course_list_of_user_as_course_admin($user_id, $startsWith = null)
{
if ($user_id != strval(intval($user_id))) {
return array();
@ -940,14 +953,15 @@ class CourseManager
course.code,
course.title,
course.id,
course.id as real_id
course.id as real_id,
course.category_code
FROM $tbl_course_user as course_rel_user
INNER JOIN $tbl_course as course
ON course.id = course_rel_user.c_id
WHERE
course_rel_user.user_id='$user_id' AND
course_rel_user.status='1'
ORDER BY course.title";
";
if (api_get_multiple_access_url()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@ -968,10 +982,18 @@ class CourseManager
access_url_id = $access_url_id AND
course_rel_user.user_id = '$user_id' AND
course_rel_user.status = '1'
ORDER BY course.title";
";
}
}
if (!empty($startsWith)) {
$startsWith = Database::escape_string($startsWith);
$sql .= " AND (course.title LIKE '$startsWith%' OR course.code LIKE '$startsWith%')";
}
$sql .= ' ORDER BY course.title';
$result_nb_cours = Database::query($sql);
if (Database::num_rows($result_nb_cours) > 0) {
while ($row = Database::fetch_array($result_nb_cours, 'ASSOC')) {

@ -360,7 +360,7 @@ class CourseCategory
while ($row = Database::fetch_array($result, 'ASSOC')) {
$parent = self::getCategory($row['parent_id']);
$children[] = $row;
$subChildren = self::getParents($parent['code']);
$subChildren = self::getParents($parent ? $parent['code'] : null);
$children = array_merge($children, $subChildren);
}

@ -115,4 +115,19 @@ JS;
return parent::toHtml() . $html;
}
/**
* We check the options and return only the values that _could_ have been
* selected. We also return a scalar value if select is not "multiple"
*/
function exportValue(&$submitValues, $assoc = false)
{
$value = $this->_findValue($submitValues);
if (!$value) {
$value = '';
}
return $this->_prepareValue($value, $assoc);
}
}

@ -1802,7 +1802,7 @@ VALUES
('show_full_skill_name_on_skill_wheel', 'true', 'Yes'),
('show_full_skill_name_on_skill_wheel', 'false', 'No');
-- Version 1.10.0.52
-- Version 1.11.0.1
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
VALUES
@ -1815,4 +1815,15 @@ VALUES
('messaging_allow_send_push_notification', 'true', 'Yes'),
('messaging_allow_send_push_notification', 'false', 'No');
UPDATE settings_current SET selected_value = '1.10.0.52' WHERE variable = 'chamilo_database_version';
-- Version 1.11.0.2
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
VALUES
('teacher_can_select_course_template', NULL, 'radio', 'Course', 'false', 'TeacherCanSelectCourseTemplateTitle', 'TeacherCanSelectCourseTemplateComment', NULL, NULL, 0);
INSERT INTO settings_options (variable, value, display_text)
VALUES
('teacher_can_select_course_template', 'true', 'Yes'),
('teacher_can_select_course_template', 'false', 'No');
UPDATE settings_current SET selected_value = '1.11.0.2' WHERE variable = 'chamilo_database_version';

@ -7627,4 +7627,9 @@ $NewLogoUpdated = "New logo uploaded";
$CurrentLogo = "Current logo";
$UpdateLogo = "Update logo";
$FollowedStudentBosses = "Followed student bosses";
$DatabaseManager = "Database manager";
$CourseTemplate = "Course template";
$PickACourseAsATemplateForThisNewCourse = "Pick a course as template for this new course";
$TeacherCanSelectCourseTemplateTitle = "Teacher can select a course as template";
$TeacherCanSelectCourseTemplateComment = "Allow pick a course as template for the new course that teacher is creating";
?>

@ -388,7 +388,7 @@ $ExerciseAutoLaunch = "Modo de lanzamiento automático de exámenes";
$AllowFastExerciseEdition = "Activar modo de edición rápida de exámenes";
$Username = "Nombre de usuario";
$SignIn = "Ingresar";
$YouAreReg = "Está registrado a";
$YouAreReg = "Ha sido registrado a la plataforma";
$ManageQuestionCategories = "Gestionar categorías globales de preguntas";
$ManageCourseFields = "Gestor de campos de cursos";
$ManageQuestionFields = "Gestor de campos de preguntas";
@ -2241,7 +2241,7 @@ $NumberOfSession = "Número de sesiones";
$DeleteSelectedSessionCategory = "Eliminar solo las categorias seleccionadas sin sesiones";
$DeleteSelectedFullSessionCategory = "Eliminar las categorias seleccionadas con las sesiones";
$EditTopRegister = "Editar Aviso";
$InsertTabs = "Insertar Tabs";
$InsertTabs = "Insertar pestaña o enlace";
$EditTabs = "Editar Tabs";
$AnnEmpty = "Los anuncios han sido borrados";
$AnnouncementModified = "El anuncio ha sido modificado";
@ -3959,7 +3959,7 @@ $MailHasBeenSent = "Recibirá un correo electrónico recordándole su nombre de
$PersonalSettings = "Sus datos han sido registrados.";
$Problem = "Para cualquier aclaración no dude en contactar con nosotros.";
$Is = "es";
$Address = "La dirección de";
$Address = "El enlace para acceder a la plataforma";
$FieldTypeFile = "Subida de archivo";
$YourReg = "Su registro en";
$UserFree = "El nombre de usuario que eligió ya existe. Use el botón de 'Atrás' de su navegador y elija uno diferente.";
@ -6918,7 +6918,7 @@ $SentAtX = "Enviado el: %s";
$dateTimeFormatShort = "%d %b %Y a las %I:%M %p";
$dateTimeFormatShortTimeFirst = "%I:%M %p, %d %b %Y";
$LoginToVote = "Debe estar conectado para poder votar";
$AddInMenu = "Agregar en el menu";
$AddInMenu = "Insertar en el menú principal";
$AllowUsersToChangeEmailWithNoPasswordTitle = "Permitir que los usuarios puedan cambiar su correo electrónico sin necesidad de solicitar la contraseña";
$AllowUsersToChangeEmailWithNoPasswordComment = "Cuando se modifica la cuenta del usuario";
$EnableHelpLinkTitle = "Habilitar el vínculo de ayuda";
@ -7652,4 +7652,9 @@ $NewLogoUpdated = "Nuevo logo subido";
$CurrentLogo = "Logo activo";
$UpdateLogo = "Cambiar el logo";
$FollowedStudentBosses = "Superiores de estudiante seguidos";
$DatabaseManager = "Gestor de base de datos";
$CourseTemplate = "Plantilla de curso";
$PickACourseAsATemplateForThisNewCourse = "Elegir un curso como plantilla para este nuevo curso";
$TeacherCanSelectCourseTemplateTitle = "El profesor puede seleccionar un curso como plantilla";
$TeacherCanSelectCourseTemplateComment = "Permitir elegir un curso como plantilla para el nuevo curso que el profesor está creando";
?>

@ -194,7 +194,7 @@ if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
$controller->tpl->assign('content', $courseAndSessions['html']);
if (api_get_setting('allow_browser_sniffer') == 'true') {
if ($_SESSION['sniff_navigator'] != "checked") {
if (isset($_SESSION['sniff_navigator']) && $_SESSION['sniff_navigator'] != "checked") {
$controller->tpl->assign('show_sniff', 1);
} else {
$controller->tpl->assign('show_sniff', 0);

Loading…
Cancel
Save