diff --git a/main/admin/course_request_edit.php b/main/admin/course_request_edit.php index 42f086ab96..41aeec1cab 100644 --- a/main/admin/course_request_edit.php +++ b/main/admin/course_request_edit.php @@ -7,7 +7,7 @@ * @author Ivan Tcholakov , 2010 */ -/* INIT SECTION */ +// Initialization section. // Language files that need to be included. $language_file = array('admin', 'create_course'); @@ -40,19 +40,22 @@ $course_validation_feature = api_get_setting('course_validation') == 'true'; $id = intval($_GET['id']); $caller = intval($_GET['caller']); -// Code for testing purposes, to be removed. -$message = 'id = '.$id.';
caller = "'.get_caller_name($caller).'";'; -$is_error_message = false; - if ($course_validation_feature) { - // Actions, if any. + // Retrieve request's data from the corresponding database record. + $course_request_info = CourseRequestManager::get_course_request_info($id); + if (!is_array($course_request_info)) { + // Prepare an error message notifying that the course request has not been found or does not exist. + $message = get_lang('CourseRequestHasNotBeenFound'); + $is_error_message = true; + } } else { - $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; - $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); - $is_error_message = true; + // Prepare an error message notifying that the course validation feature has not been enabled. + $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; + $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); + $is_error_message = true; } @@ -84,6 +87,7 @@ if (!empty($message)) { } if (!$course_validation_feature) { + // Disabled course validation feature - show nothing after the error message. Display :: display_footer(); exit; } @@ -96,10 +100,42 @@ echo ''.Display::return_icon('course_reque echo ''.Display::return_icon('course_request_rejected.gif', get_lang('RejectedCourseRequests')).get_lang('RejectedCourseRequests').''; echo ''; -// The form. +if (!is_array($course_request_info)) { + // Not accessible database record - show the error message and the action bar. + Display :: display_footer(); + exit; +} + +// Build the form. +$form = new FormValidator('add_course'); + +// 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->addElement('static', null, null, get_lang('Ex')); + +$categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), array()); +$form->applyFilter('category_code', 'html_filter'); +CourseManager::select_and_sort_categories($categories_select); +$form->addElement('static', null, null, get_lang('TargetFac')); + +// Other form's elements... //... +// Set the default values based on the corresponding database record. + +//... + +// Validate the form and perform the ordered actions. + +//... + +// Display the form. +$form->display(); + // The footer. Display :: display_footer(); - diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index a0dd948d08..85fe36b763 100755 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -76,7 +76,6 @@ $dbnamelength = strlen($_configuration['db_prefix']); $maxlength = 40 - $dbnamelength; // Build the form. -$categories = array(); $form = new FormValidator('add_course'); // Form title @@ -85,11 +84,10 @@ $form->addElement('header', '', $tool_name); // Title $form->addElement('text', 'title', get_lang('CourseName'), array('size' => '60', 'id' => 'title')); $form->applyFilter('title', 'html_filter'); - $form->addElement('static', null, null, get_lang('Ex')); -$categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), $categories); -$form->applyFilter('category_code', 'html_filter'); +$categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), array()); +$form->applyFilter('category_code', 'html_filter'); CourseManager::select_and_sort_categories($categories_select); $form->addElement('static', null, null, get_lang('TargetFac')); diff --git a/main/lang/bulgarian/create_course.inc.php b/main/lang/bulgarian/create_course.inc.php index b00b7ba3b6..0fb998301a 100644 --- a/main/lang/bulgarian/create_course.inc.php +++ b/main/lang/bulgarian/create_course.inc.php @@ -145,4 +145,5 @@ $CourseRequestRejectedEmailText = "За съжаление Вашата заяв $CourseCreationFailed = "Курсът не е създаден поради появила се грешка."; $CourseRequestCreationFailed = "Заявката за нов курс не е създадена поради появила се грешка."; $CourseRequestEdit = "Редактиране на заявка за нов курс"; +$CourseRequestHasNotBeenFound = "Заявката за нов курс, до която искате достъп не е намерена или не съществува."; ?> \ No newline at end of file diff --git a/main/lang/english/create_course.inc.php b/main/lang/english/create_course.inc.php index 3c3eb533a5..953f449fbe 100644 --- a/main/lang/english/create_course.inc.php +++ b/main/lang/english/create_course.inc.php @@ -145,4 +145,5 @@ $CourseRequestRejectedEmailText = "To our regret we have to inform you that the $CourseCreationFailed = "The training has not been created due to internal error."; $CourseRequestCreationFailed = "The training request has not been created due to internal error."; $CourseRequestEdit = "Edit a training request"; +$CourseRequestHasNotBeenFound = "The training request you wanted to access has not been found or it does not exist."; ?> \ No newline at end of file