Пример #1
0
/* For licensing terms, see /license.txt */
/**
 * 	@package chamilo.admin
 */
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$category = isset($_GET['category']) ? $_GET['category'] : null;
$parentInfo = [];
if (!empty($category)) {
    $parentInfo = CourseCategoryManager::getCategory($category);
}
$categoryId = isset($_GET['id']) ? Security::remove_XSS($_GET['id']) : null;
if (!empty($categoryId)) {
    $categoryInfo = CourseCategoryManager::getCategory($categoryId);
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
$errorMsg = '';
if (!empty($action)) {
    if ($action == 'delete') {
        if (api_get_multiple_access_url()) {
            if (api_get_current_access_url_id() == 1 || isset($_configuration['enable_multiple_url_support_for_course_category']) && $_configuration['enable_multiple_url_support_for_course_category']) {
                CourseCategoryManager::deleteNode($categoryId);
                Display::addFlash(Display::return_message(get_lang('Deleted')));
                header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
                exit;
            }
        } else {
            CourseCategoryManager::deleteNode($categoryId);
            Display::addFlash(Display::return_message(get_lang('Deleted')));
 } else {
     // Ensure the database prefix + database name do not get over 40 characters.
     $maxlength = 40;
     // Build the form.
     $form = new FormValidator('add_course', 'post', 'course_request_edit.php?id=' . $id . '&caller=' . $caller);
     // Form title.
     $form->addElement('header', $tool_name);
     // Title.
     $form->addElement('text', 'title', get_lang('CourseName'), array('size' => '60', 'id' => 'title'));
     $form->applyFilter('title', 'html_filter');
     $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
     // Course category.
     $url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_category';
     $courseSelect = $form->addElement('select_ajax', 'category_code', get_lang('CourseFaculty'), null, array('url' => $url));
     if (!empty($course_request_info['category_code'])) {
         $data = CourseCategoryManager::getCategory($course_request_info['category_code']);
         $courseSelect->addOption($data['name'], $data['code'], ['selected' => 'selected']);
     }
     // Course code.
     $form->addText('wanted_code', get_lang('Code'), false, array('size' => '$maxlength', 'maxlength' => $maxlength));
     $form->applyFilter('wanted_code', 'html_filter');
     $form->addRule('wanted_code', get_lang('Max'), 'maxlength', $maxlength);
     $form->addRule('wanted_code', get_lang('ThisFieldIsRequired'), 'required');
     // The teacher.
     $titular = $form->addText('tutor_name', get_lang('Professor'), null, array('size' => '60', 'disabled' => 'disabled'));
     // Description of the requested course.
     $form->addElement('textarea', 'description', get_lang('Description'), array('style' => 'border:#A5ACB2 solid 1px; font-family:arial,verdana,helvetica,sans-serif; font-size:12px', 'rows' => '3', 'cols' => '116'));
     $form->addRule('description', get_lang('ThisFieldIsRequired'), 'required');
     // Objectives of the requested course.
     $form->addElement('textarea', 'objetives', get_lang('Objectives'), array('style' => 'border:#A5ACB2 solid 1px; font-family:arial,verdana,helvetica,sans-serif; font-size:12px', 'rows' => '3', 'cols' => '116'));
     $form->addRule('objetives', get_lang('ThisFieldIsRequired'), 'required');
Пример #3
0
        }
        $groupName = 'session_coaches[' . $sessionId . ']';
        $platformTeacherId = 'platform_teachers_by_session_' . $sessionId;
        $coachId = 'coaches_by_session_' . $sessionId;
        $platformTeacherName = 'platform_teachers_by_session';
        $coachName = 'coaches_by_session';
        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $sessionId;
        $form->addElement('advmultiselect', $groupName, Display::url($session['name'], $sessionUrl, array('target' => '_blank')) . ' - ' . get_lang('Coaches'), $allTeachers);
        $courseInfo[$groupName] = $sessionTeachers;
    }
}
// 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, array('url' => $url));
if (!empty($courseInfo['categoryCode'])) {
    $data = CourseCategoryManager::getCategory($courseInfo['categoryCode']);
    $categorySelect->addOption($data['name'], $data['code']);
}
$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
$form->applyFilter('department_name', 'html_filter');
$form->applyFilter('department_name', 'trim');
$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
$form->applyFilter('department_url', 'html_filter');
$form->applyFilter('department_url', 'trim');
$form->addElement('select_language', 'course_language', get_lang('CourseLanguage'));
$form->applyFilter('select_language', 'html_filter');
$group = array();
$group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);