meraproject/module/academy/course/section/controller.php
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

40 lines
1.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?
namespace controller\academy\course\section;
use ms\ms\structure\msControllerTable;
use academy\course\Section;
use academy\Course;
class Api extends msControllerTable {
static $class = 'academy\course\Section';
// Работа с проифилями
static function profileSetName(){
if(IF_PROFILE){
$section = Section::isProfileMy($_POST['section_id']);
$name = trim($_POST['name']);
if($section and $name){
Section::updateById($section[Section::$ID],[Section::$NAME=>$name]);
}
}
}
static function profileCreate(){
$res = [];
if(IF_PROFILE and $course = Course::isProfileMy($_POST['course_id'])){
$r = Section::insert([
Section::$COURSE => $course[Course::$ID],
Section::$NAME => 'Новый раздел',
Section::$ACCOUNT => \Site::$owner_id,
]);
$res['id'] = $r->id;
}
echo je($res);
}
}