Skip to content

Commit

Permalink
Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarnier committed May 24, 2017
2 parents 14d85f2 + 5e2c2c2 commit 4d06d1d
Show file tree
Hide file tree
Showing 56 changed files with 4,264 additions and 2,603 deletions.
2 changes: 2 additions & 0 deletions documentation/changelog.html
Expand Up @@ -141,10 +141,12 @@ <h4>For developers and sysadmins</h4>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/3d83d694ec1af9b0b59ad8d88d73762f2f481fec">3d83d694</a>) Improve Apache and Nginx rules in installation guide in English based on the .htaccess file</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d8f78f1660c941c25ac748ca3f2cc04b7697f83c">d8f78f16</a> - <a href="https://task.beeznest.com/issues/12476">BT#12476</a>) System announcements: rework to use an array of visibilities (requires database changes)</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4601bc570ed80cde5f77f29d4c48fa10a9a80f22">4601bc57</a>) New options added to setting 'email_alert_manager_on_new_quiz'</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/4071b1aaf3bc03b651fd42894b6c0b08e250447f">4071b1aa</a>) Added the <code>enabled_support_odf</code> configuration setting to allow edit ODF files</li>
</ul>

<h3>Improvements (minor features) and debug</h3>
<ul>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9977835a07e7d2c2f9630f82b2df312b5ac9f403">9977835a</a>) Wodo.TextEditor updated</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c14fdf78b1b2a59d49520579c7ac1b4ed9c14926">c14fdf78</a>) Add update-configuration to upgrade process from 1.10 to 1.11 to update the version number</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/98eb7229334bd7ce707c5b83f2494446b31f3c25">98eb7229</a>) Add migration fix for course_code column that shouldn't have been there in the first place</li>
<li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a17717aee7ca6e60b9b1e91cd78caf4b105de7f7">a17717ae</a> - <a href="https://task.beeznest.com/issues/12892">BT#12892</a>) Improve code for Question::resizePicture</li>
Expand Down
50 changes: 36 additions & 14 deletions main/admin/course_add.php
Expand Up @@ -4,6 +4,10 @@
/**
* @package chamilo.admin
*/

use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Entity\CourseCategory;

$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
Expand All @@ -14,8 +18,11 @@
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));


$em = Database::getManager();
/** @var CourseCategoryRepository $courseCategoriesRepo */
$courseCategoriesRepo = $em->getRepository('ChamiloCoreBundle:CourseCategory');
// Get all possible teachers.
$accessUrlId = api_get_current_access_url_id();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id,lastname,firstname
Expand All @@ -28,7 +35,7 @@
FROM $table_user as u
INNER JOIN $access_url_rel_user_table url_rel_user
ON (u.user_id=url_rel_user.user_id)
WHERE url_rel_user.access_url_id=".api_get_current_access_url_id()." AND status=1".$order_clause;
WHERE url_rel_user.access_url_id=".$accessUrlId." AND status=1".$order_clause;
}

$res = Database::query($sql);
Expand Down Expand Up @@ -85,19 +92,34 @@
);
$form->applyFilter('course_teachers', 'html_filter');

// Category code
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
$countCategories = $courseCategoriesRepo->countAllInAccessUrl($accessUrlId);

$form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
array(
'url' => $url
// 'formatResult' => 'function(item) { return item.name + "'" +item.code; }'
)
);
if ($countCategories >= 100) {
// Category code
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';

$form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
['url' => $url]
);
} else {
$categories = $courseCategoriesRepo->findAllInAccessUrl($accessUrlId);
$categoriesOptions = [null => get_lang('None')];

/** @var CourseCategory $category */
foreach ($categories as $category) {
$categoriesOptions[$category->getCode()] = $category->__toString();
}

$form->addSelect(
'category_code',
get_lang('CourseFaculty'),
$categoriesOptions
);
}

// Course department
$form->addText(
Expand Down
56 changes: 42 additions & 14 deletions main/admin/course_edit.php
Expand Up @@ -3,6 +3,10 @@
/**
* @package chamilo.admin
*/

use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Entity\CourseCategory;

$cidReset = true;

require_once __DIR__.'/../inc/global.inc.php';
Expand All @@ -12,6 +16,11 @@

$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$em = Database::getManager();
/** @var CourseCategoryRepository $courseCategoriesRepo */
$courseCategoriesRepo = $em->getRepository('ChamiloCoreBundle:CourseCategory');
// Get all possible teachers.
$urlId = api_get_current_access_url_id();

$courseId = isset($_GET['id']) ? $_GET['id'] : null;

Expand Down Expand Up @@ -58,7 +67,7 @@
INNER JOIN $access_url_rel_user_table url_rel_user
ON (u.user_id=url_rel_user.user_id)
WHERE
url_rel_user.access_url_id=".api_get_current_access_url_id()." AND
url_rel_user.access_url_id = $urlId AND
status = 1" . $order_clause;
} else {
$sql = "SELECT user_id, lastname, firstname
Expand Down Expand Up @@ -173,20 +182,39 @@
}
}

// Category code
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
$countCategories = $courseCategoriesRepo->countAllInAccessUrl($urlId);

$categorySelect = $form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
array('url' => $url)
);
if ($countCategories >= 100) {
// Category code
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';

$categorySelect = $form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
['url' => $url]
);

if (!empty($courseInfo['categoryCode'])) {
$data = \CourseCategory::getCategory($courseInfo['categoryCode']);
$categorySelect->addOption($data['name'], $data['code']);
}
} else {
$courseInfo['category_code'] = $courseInfo['categoryCode'];
$categories = $courseCategoriesRepo->findAllInAccessUrl($urlId);
$categoriesOptions = [null => get_lang('None')];

/** @var CourseCategory $category */
foreach ($categories as $category) {
$categoriesOptions[$category->getCode()] = $category->__toString();
}

if (!empty($courseInfo['categoryCode'])) {
$data = CourseCategory::getCategory($courseInfo['categoryCode']);
$categorySelect->addOption($data['name'], $data['code']);
$form->addSelect(
'category_code',
get_lang('CourseFaculty'),
$categoriesOptions
);
}

$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
Expand Down Expand Up @@ -248,7 +276,7 @@
$visibility = $course['visibility'];

global $_configuration;
$urlId = api_get_current_access_url_id();

if (isset($_configuration[$urlId]) &&
isset($_configuration[$urlId]['hosting_limit_active_courses']) &&
$_configuration[$urlId]['hosting_limit_active_courses'] > 0
Expand Down
45 changes: 36 additions & 9 deletions main/create_course/add_course.php
Expand Up @@ -12,6 +12,9 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com>
*/

use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Entity\CourseCategory;

// Flag forcing the "current course" reset.
$cidReset = true;

Expand All @@ -26,6 +29,12 @@
// Section for the tabs.
$this_section = SECTION_COURSES;

$em = Database::getManager();
/** @var CourseCategoryRepository $courseCategoriesRepo */
$courseCategoriesRepo = $em->getRepository('ChamiloCoreBundle:CourseCategory');
// Get all possible teachers.
$accessUrlId = api_get_current_access_url_id();

// "Course validation" feature. This value affects the way of a new course creation:
// true - the new course is requested only and it is created after approval;
// false - the new course is created immediately, after filling this form.
Expand Down Expand Up @@ -80,16 +89,34 @@ function setFocus(){
'<div id="advanced_params_options" style="display:none">'
);

// Category category.
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
$countCategories = $courseCategoriesRepo->countAllInAccessUrl($accessUrlId);

$form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
array('url' => $url)
);
if ($countCategories >= 100) {
// Category code
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';

$form->addElement(
'select_ajax',
'category_code',
get_lang('CourseFaculty'),
null,
['url' => $url]
);
} else {
$categories = $courseCategoriesRepo->findAllInAccessUrl($accessUrlId);
$categoriesOptions = [null => get_lang('None')];

/** @var CourseCategory $category */
foreach ($categories as $category) {
$categoriesOptions[$category->getCode()] = $category->__toString();
}

$form->addSelect(
'category_code',
get_lang('CourseFaculty'),
$categoriesOptions
);
}

// Course code
$form->addText(
Expand Down

0 comments on commit 4d06d1d

Please sign in to comment.