| @@ -25,9 +25,8 @@ | ||
| 25 | 25 | /** |
| 26 | 26 | * LP_Admin_Editor_Course constructor. |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - | |
| 30 | 29 | } |
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Do the action depending on ajax calls with params |
| @@ -56,12 +55,18 @@ | ||
| 56 | 55 | $this->section_curd = new LP_Section_CURD( $course_id ); |
| 57 | 56 | $this->result = array( $args['type'] ); |
| 58 | 57 | |
| 59 | 58 | $this->call( $args['type'], array( $args ) ); |
| 59 | + //LP_Course_Post_Type::instance()->save_post( $course_id, null, true ); | |
| 60 | + $bg = LP_Background_Single_Course::instance(); | |
| 61 | + $bg->data( | |
| 62 | + array( | |
| 63 | + 'handle_name' => 'save_post', | |
| 64 | + 'course_id' => $course_id, | |
| 65 | + 'data' => [], | |
| 66 | + ) | |
| 67 | + )->dispatch(); | |
| 60 | 68 | |
| 61 | - $course_post = get_post( $course_id ); | |
| 62 | - LP_Course_Post_Type::instance()->save( $course_id, $course_post ); | |
| 63 | - | |
| 64 | 69 | return $this->get_result(); |
| 65 | 70 | } |
| 66 | 71 | |
| 67 | 72 | /** |
| @@ -137,18 +142,18 @@ | ||
| 137 | 142 | return false; |
| 138 | 143 | } |
| 139 | 144 | |
| 140 | 145 | $data = array( |
| 141 | - 'section_id' => $section['id'], | |
| 142 | - 'section_name' => $section['title'], | |
| 143 | - 'section_description' => $section['description'], | |
| 144 | - 'section_order' => $section['order'], | |
| 145 | - 'section_course_id' => $section['course_id'], | |
| 146 | + 'section_id' => $section['id'] ?? $section['section_id'] ?? 0, | |
| 147 | + 'section_name' => $section['title'] ?? $section['section_name'] ?? '', | |
| 148 | + 'section_description' => $section['description'] ?? $section['section_description'] ?? '', | |
| 149 | + 'section_order' => $section['order'] ?? $section['section_order'] ?? 0, | |
| 150 | + 'section_course_id' => $this->course->get_id(), | |
| 146 | 151 | ); |
| 147 | 152 | |
| 148 | 153 | $this->result = $this->section_curd->update( $data ); |
| 149 | 154 | |
| 150 | - return true; | |
| 155 | + return $this->result; | |
| 151 | 156 | } |
| 152 | 157 | |
| 153 | 158 | /** |
| 154 | 159 | * @param array $args |