, Ghent University * @author Roan Embrechts, refactoring * @author Jose Manuel Abuin Mosquera , Centro de Supercomputacion de Galicia * "Course validation" feature, technical adaptation for Chamilo 1.8.8: * @author Ivan Tcholakov */ // Flag forcing the "current course" reset. $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; // Check access rights. if (!api_is_allowed_to_create_course()) { api_not_allowed(true); exit; } // 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. $course_validation_feature = false; if (api_get_setting('course_validation') === 'true' && !api_is_platform_admin() ) { $course_validation_feature = true; } $htmlHeadXtra[] = ''; $interbreadcrumb[] = [ 'url' => api_get_path(WEB_PATH).'user_portal.php', 'name' => get_lang('MyCourses'), ]; // Displaying the header. $tool_name = $course_validation_feature ? get_lang('CreateCourseRequest') : get_lang('CreateSite'); $tpl = new Template($tool_name); // Build the form. $form = new FormValidator('add_course'); // Form title $form->addElement('header', $tool_name); // Title $form->addElement( 'text', 'title', [ get_lang('CourseName'), get_lang('Ex'), ], [ 'id' => 'title', ] ); $form->applyFilter('title', 'html_filter'); $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); if ($course_validation_feature) { // Description of the requested course. $form->addElement( 'textarea', 'description', get_lang('Description'), ['rows' => '3'] ); $form->addRule('description', get_lang('ThisFieldIsRequired'), 'required'); } if (!api_get_configuration_value('course_creation_form_set_course_category_mandatory')) { $form->addButtonAdvancedSettings('advanced_params'); $form->addElement( 'html', '