Beispiel #1
0
$values['activate_legal'] = $all_course_information['activate_legal'];
$courseSettings = CourseManager::getCourseSettingVariables($appPlugin);
foreach ($courseSettings as $setting) {
    $result = api_get_course_setting($setting);
    if ($result != '-1') {
        $values[$setting] = $result;
    }
}
$form->setDefaults($values);
// Validate form
if ($form->validate() && is_settings_editable()) {
    $updateValues = $form->exportValues();
    // update course picture
    $picture = $_FILES['picture'];
    if (!empty($picture['name'])) {
        $picture_uri = CourseManager::update_course_picture($course_code, $picture['name'], $picture['tmp_name'], $updateValues['cropResult']);
    }
    $visibility = $updateValues['visibility'];
    $deletePicture = isset($updateValues['delete_picture']) ? $updateValues['delete_picture'] : '';
    if ($deletePicture) {
        CourseManager::deleteCoursePicture($course_code);
    }
    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) {
        $courseInfo = api_get_course_info_by_id($courseId);
        // Check if
        if ($courseInfo['visibility'] == COURSE_VISIBILITY_HIDDEN && $visibility != $courseInfo['visibility']) {
            $num = CourseManager::countActiveCourses($urlId);
            if ($num >= $_configuration[$urlId]['hosting_limit_active_courses']) {
                api_warn_hosting_contact('hosting_limit_active_courses');
Beispiel #2
0
    }
    $a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname) . ' (' . $s_username . ')';
}
$categories = getCategoriesCanBeAddedInCourse($_course['categoryCode']);
$linebreak = '<div class="row"><div class="label"></div><div class="formw" style="border-bottom:1px dashed grey"></div></div>';
// Build the form
$form = new FormValidator('update_course', 'post', api_get_self() . '?' . api_get_cidreq());
// COURSE SETTINGS
$form->addElement('html', '<div><h3>' . Display::return_icon('settings.png', Security::remove_XSS(get_lang('CourseSettings')), '', ICON_SIZE_SMALL) . ' ' . Security::remove_XSS(get_lang('CourseSettings')) . '</h3><div>');
$image_html = '';
// Sending image
if ($form->validate() && is_settings_editable()) {
    // update course picture
    $picture = $_FILES['picture'];
    if (!empty($picture['name'])) {
        $picture_uri = CourseManager::update_course_picture($course_code, $picture['name'], $picture['tmp_name']);
    }
}
// Display course picture
$course_path = api_get_path(SYS_COURSE_PATH) . $currentCourseRepository;
// course path
if (file_exists($course_path . '/course-pic85x85.png')) {
    $course_web_path = api_get_path(WEB_COURSE_PATH) . $currentCourseRepository;
    // course web path
    $course_medium_image = $course_web_path . '/course-pic85x85.png?' . rand(1, 1000);
    // redimensioned image 85x85
    $image_html = '<div class="row"><div class="formw"><img src="' . $course_medium_image . '" /></div></div>';
}
$form->addElement('html', $image_html);
$form->add_textfield('title', get_lang('Title'), true, array('class' => 'span6'));
$form->applyFilter('title', 'html_filter');