$descr]); } } } static function profileSetName(){ if(IF_PROFILE){ $teacher = Teacher::isProfileMy($_POST['teacher_id']); $name = trim($_POST['name']); if($teacher and $name){ Teacher::updateById($teacher[Teacher::$ID],[Teacher::$NAME=>$name]); } } } static function profileSetAva(){ if(IF_PROFILE){ $teacher = Teacher::isProfileMy($_POST['teacher_id']); $img = Image::isProfileMy($_POST['image_id']); if($teacher and $img){ Teacher::updateById($teacher[Teacher::$ID],[Teacher::$IMAGE=>$img[Image::$ID]]); } } } static function profileCreate(){ $res = []; if(IF_PROFILE){ if($COURSE = Course::isProfileMy($_POST['course_id'])) { $r = Teacher::insert([ Teacher::$NAME => $_POST['name'], Teacher::$ACCOUNT => \Site::$owner_id, ]); $r = CourseTeacher::insert($a = [ CourseTeacher::$PROJECT => $COURSE[Course::$PROJECT], CourseTeacher::$COURSE => $COURSE[COURSE::$ID], CourseTeacher::$TEACHER => $r->id, CourseTeacher::$ACCOUNT => \Site::$owner_id, ]); $res['id'] = $r->id; } } echo je($res); } }