$descr]); } } } static function profileSetName(){ if(IF_PROFILE){ $lesson = Lesson::isProfileMy($_POST['lesson_id']); $name = trim($_POST['name']); if($lesson and $name){ Lesson::updateById($lesson[Lesson::$ID],[Lesson::$NAME=>$name]); } } } static function profileCreate(){ $res = []; if(IF_PROFILE and $course = Course::isProfileMy($_POST['course_id'])){ $course_id = $course[Course::$ID]; $sections = Course::getLessons($course_id); $section = array_pop($sections['sections']); $section_id = $section[Section::$ID]; $r = Lesson::insert([ Lesson::$COURSE => $course_id, Lesson::$SECTION => $section_id, Lesson::$NAME => 'Новый урок', Lesson::$ACCOUNT => \Site::$owner_id, ]); $res['id'] = $r->id; } echo je($res); } }