. /** * Webservice class for handling studyplan reports * @package local_treestudyplan * @copyright 2023 P.M. Kuipers * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace local_treestudyplan; defined('MOODLE_INTERNAL') || die(); use local_treestudyplan\local\helpers\webservicehelper; require_once($CFG->libdir.'/externallib.php'); /** * Webservice class for handling studyplan reports */ class reportservice extends \external_api { /** * Capability required to view studyplans (for other users) * @var string */ const CAP_VIEW = "local/treestudyplan:viewuserreports"; public static function get_report_structure_parameters() : \external_function_parameters { return new \external_function_parameters([ "pageid" => new \external_value(PARAM_INT, 'id of studyplan page'), "firstperiod" => new \external_value(PARAM_INT, 'first period to include in report',VALUE_DEFAULT), "lastperiod" => new \external_value(PARAM_INT, 'last perioe to include in report',VALUE_DEFAULT), ]); } /** * Return value description for webservice function list_user_studyplans */ public static function get_report_structure_returns() : \external_description { return new \external_single_structure([ ]); } /** * Get studyplan page structure for a report * @param int $pageid ID of user to check specific info for * @param int|null $firstperiod First period to include in report * @param int|null $lastperiod Last period to include in report * @return object */ public static function get_report_structure($pageid,$firstperiod=null,$lastperiod=null) { } public static function get_report_data_parameters() : \external_function_parameters { return new \external_function_parameters([ "pageid" => new \external_value(PARAM_INT, 'id of studyplan page'), "userid" => new \external_value(PARAM_INT, 'id of user'), "firstperiod" => new \external_value(PARAM_INT, 'first period to include in report',VALUE_DEFAULT), "lastperiod" => new \external_value(PARAM_INT, 'last period to include in report',VALUE_DEFAULT), ]); } /** * Return value description for webservice function list_user_studyplans */ public static function get_report_data_returns() : \external_description { return new \external_single_structure([ ]); } /** * Get studyplan page structure for a report * @param int $pageid ID of user to check specific info for * @param int $userid ID of user to check specific info for * @param int|null $firstperiod First period to include in report * @param int|null $lastperiod Last period to include in report * @return object */ public static function get_report_data($pageid,$userid,$firstperiod=null,$lastperiod=null) { } public static function get_report_details_parameters() : \external_function_parameters { return new \external_function_parameters([ "itemid" => new \external_value(PARAM_INT, 'id of studyitem'), "userid" => new \external_value(PARAM_INT, 'id of user'), ]); } /** * Return value description for webservice function list_user_studyplans */ public static function get_report_details_returns() : \external_description { return new \external_single_structure([ ]); } /** * Get study item details for a user * @param int $itemid ID of study item * @param int $userid ID of user to check specific info for * @return array */ public static function get_report_details($itemid,$userid) { } }