Period editing service functions
This commit is contained in:
parent
80d8f5c7a4
commit
6436d0367f
|
@ -1061,45 +1061,11 @@ class studyplanservice extends \external_api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
* *
|
|
||||||
* Read and write course display name *
|
|
||||||
* TODO: FINISH OR REMOVE *
|
|
||||||
* *
|
|
||||||
************************************************/
|
|
||||||
public static function read_course_displayname_parameters(){
|
|
||||||
return new \external_function_parameters( [
|
|
||||||
"cmid" => new \external_value(PARAM_INT, 'id of plan to export '),
|
|
||||||
] );
|
|
||||||
}
|
|
||||||
public static function read_course_displayname_returns(){
|
|
||||||
return new \external_value(PARAM_TEXT, 'title of course module');
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function read_course_displayname($cmid){
|
|
||||||
//$cm =
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function write_course_displayname_parameters(){
|
|
||||||
return new \external_function_parameters( [
|
|
||||||
"cmid" => new \external_value(PARAM_INT, 'id of plan to export '),
|
|
||||||
"title" => new \external_value(PARAM_TEXT, 'title of course module'),
|
|
||||||
] );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function write_course_displayname_returns(){
|
|
||||||
return success::structure();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function write_course_displayname($cmid,$title,$desc){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* *
|
* *
|
||||||
* Read and write course module title and desc *
|
* Read and write course module title and desc *
|
||||||
* TODO: DEPRECATE when implementing core completion *
|
* Used only in bistate aggregation method *
|
||||||
* *
|
* *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
|
@ -1174,5 +1140,45 @@ class studyplanservice extends \external_api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************
|
||||||
|
* *
|
||||||
|
* edit_period *
|
||||||
|
* *
|
||||||
|
************************/
|
||||||
|
|
||||||
|
public static function edit_period_parameters()
|
||||||
|
{
|
||||||
|
return new \external_function_parameters( [
|
||||||
|
"id" => new \external_value(PARAM_INT, 'id of study item'),
|
||||||
|
"fullname" => new \external_value(PARAM_TEXT, 'Full name of period'),
|
||||||
|
"shortname"=> new \external_value(PARAM_TEXT, 'Short name of period'),
|
||||||
|
"startdate" => new \external_value(PARAM_TEXT, 'start date of period'),
|
||||||
|
"enddate" => new \external_value(PARAM_TEXT, 'end date of period'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function edit_period_returns()
|
||||||
|
{
|
||||||
|
return period::structure();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function edit_period($id,$fullname,$shortname,$startdate,$enddate)
|
||||||
|
{
|
||||||
|
|
||||||
|
$p = period::findById($id);
|
||||||
|
webservicehelper::require_capabilities(self::CAP_EDIT,$p->page()->studyplan()->context());
|
||||||
|
|
||||||
|
|
||||||
|
$p->edit([
|
||||||
|
'fullname' => $fullname,
|
||||||
|
'shortname' => $shortname,
|
||||||
|
'startdate' => $startdate,
|
||||||
|
'enddate' => $enddate,
|
||||||
|
]);
|
||||||
|
return $p->model();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -462,24 +462,15 @@ $functions = [
|
||||||
'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required
|
'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required
|
||||||
'loginrequired' => true,
|
'loginrequired' => true,
|
||||||
],
|
],
|
||||||
'local_treestudyplan_read_course_displayname' => [ //web service function name
|
'local_treestudyplan_edit_period' => [ //web service function name
|
||||||
'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function
|
'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function
|
||||||
'methodname' => 'read_course_displayname', //external function name
|
'methodname' => 'edit_period', //external function name
|
||||||
'description' => 'Read title and desc for course module', //human readable description of the web service function
|
'description' => 'Edit period name and timing', //human readable description of the web service function
|
||||||
'type' => 'read', //database rights of the web service function (read, write)
|
'type' => 'write', //database rights of the web service function (read, write)
|
||||||
'ajax' => true,
|
'ajax' => true,
|
||||||
'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required
|
'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required
|
||||||
'loginrequired' => true,
|
'loginrequired' => true,
|
||||||
],
|
],
|
||||||
'local_treestudyplan_write_course_displayname' => [ //web service function name
|
|
||||||
'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function
|
|
||||||
'methodname' => 'write_course_displayname', //external function name
|
|
||||||
'description' => 'Write title and desc for course module', //human readable description of the web service function
|
|
||||||
'type' => 'read', //database rights of the web service function (read, write)
|
|
||||||
'ajax' => true,
|
|
||||||
'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required
|
|
||||||
'loginrequired' => true,
|
|
||||||
],
|
|
||||||
'local_treestudyplan_submit_cm_editform' => [ //web service function name
|
'local_treestudyplan_submit_cm_editform' => [ //web service function name
|
||||||
'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function
|
'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function
|
||||||
'methodname' => 'submit_cm_editform', //external function name
|
'methodname' => 'submit_cm_editform', //external function name
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
|
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
|
||||||
$plugin->version = 2023072700; // YYYYMMDDHH (year, month, day, iteration)
|
$plugin->version = 2023072701; // YYYYMMDDHH (year, month, day, iteration)
|
||||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
|
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
|
||||||
|
|
||||||
$plugin->dependencies = [
|
$plugin->dependencies = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user