@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function validate_data($courses) |
| 17 | 17 | { |
| 18 | - $errors = array (); |
|
| 19 | - $coursecodes = array (); |
|
| 18 | + $errors = array(); |
|
| 19 | + $coursecodes = array(); |
|
| 20 | 20 | foreach ($courses as $index => $course) { |
| 21 | - $course['line'] = $index +1; |
|
| 21 | + $course['line'] = $index + 1; |
|
| 22 | 22 | |
| 23 | 23 | // 1. Check whether mandatory fields are set. |
| 24 | - $mandatory_fields = array ('Code', 'Title', 'CourseCategory'); |
|
| 24 | + $mandatory_fields = array('Code', 'Title', 'CourseCategory'); |
|
| 25 | 25 | foreach ($mandatory_fields as $field) { |
| 26 | 26 | if (empty($course[$field])) { |
| 27 | 27 | $course['error'] = get_lang($field.'Mandatory'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if(!empty($course['CourseCategory'])) { |
|
| 67 | + if (!empty($course['CourseCategory'])) { |
|
| 68 | 68 | $categoryInfo = CourseCategory::getCategory($course['CourseCategory']); |
| 69 | 69 | if (empty($categoryInfo)) { |
| 70 | 70 | CourseCategory::addNode($course['CourseCategory'], $course['CourseCategoryName'] ? $course['CourseCategoryName'] : $course['CourseCategory'], 'TRUE', null); |