|
|
@ -865,9 +865,8 @@ class AddCourse |
|
|
|
$course_id = 0; |
|
|
|
$course_id = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ($ok_to_register_course) { |
|
|
|
if ($ok_to_register_course) { |
|
|
|
$courseManager = Container::$container->get('chamilo_core.entity.manager.course_manager'); |
|
|
|
$repo = Container::getCourseRepository(); |
|
|
|
/** @var \Chamilo\CoreBundle\Entity\Course $course */ |
|
|
|
$course = new \Chamilo\CoreBundle\Entity\Course(); |
|
|
|
$course = $courseManager->create(); |
|
|
|
|
|
|
|
$urlId = 1; |
|
|
|
$urlId = 1; |
|
|
|
if (api_get_current_access_url_id() !== -1) { |
|
|
|
if (api_get_current_access_url_id() !== -1) { |
|
|
|
$urlId = api_get_current_access_url_id(); |
|
|
|
$urlId = api_get_current_access_url_id(); |
|
|
@ -886,7 +885,6 @@ class AddCourse |
|
|
|
->setDiskQuota($disk_quota) |
|
|
|
->setDiskQuota($disk_quota) |
|
|
|
->setCreationDate(new \DateTime()) |
|
|
|
->setCreationDate(new \DateTime()) |
|
|
|
->setExpirationDate(new \DateTime($expiration_date)) |
|
|
|
->setExpirationDate(new \DateTime($expiration_date)) |
|
|
|
//->setLastEdit() |
|
|
|
|
|
|
|
->setDepartmentName($department_name) |
|
|
|
->setDepartmentName($department_name) |
|
|
|
->setDepartmentUrl($department_url) |
|
|
|
->setDepartmentUrl($department_url) |
|
|
|
->setSubscribe($subscribe) |
|
|
|
->setSubscribe($subscribe) |
|
|
@ -894,11 +892,16 @@ class AddCourse |
|
|
|
->setVisualCode($visual_code) |
|
|
|
->setVisualCode($visual_code) |
|
|
|
->addUrl($url) |
|
|
|
->addUrl($url) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
$repo->getEntityManager()->persist($course); |
|
|
|
$courseManager->save($course, true); |
|
|
|
$repo->getEntityManager()->flush(); |
|
|
|
$course_id = $course->getId(); |
|
|
|
$course_id = $course->getId(); |
|
|
|
|
|
|
|
|
|
|
|
if ($course_id) { |
|
|
|
if ($course_id) { |
|
|
|
|
|
|
|
$repo->addResourceNode( |
|
|
|
|
|
|
|
$course, |
|
|
|
|
|
|
|
api_get_user_entity(api_get_user_id()), |
|
|
|
|
|
|
|
$url |
|
|
|
|
|
|
|
); |
|
|
|
$sort = api_max_sort_value('0', api_get_user_id()); |
|
|
|
$sort = api_max_sort_value('0', api_get_user_id()); |
|
|
|
// Default true |
|
|
|
// Default true |
|
|
|
$addTeacher = isset($params['add_user_as_teacher']) ? $params['add_user_as_teacher'] : true; |
|
|
|
$addTeacher = isset($params['add_user_as_teacher']) ? $params['add_user_as_teacher'] : true; |
|
|
|