Documentation fix
This commit is contained in:
parent
f0847a0f14
commit
3c7369ce6b
|
@ -19,20 +19,20 @@ abstract class formbase extends moodleform {
|
|||
* Generate form data from parameters
|
||||
* Also validate parameters and access permissions here
|
||||
*
|
||||
* @param array $params The parameters for form initialization
|
||||
* @param object $params The parameters for form initialization
|
||||
* @return array Form data based on parameters
|
||||
*/
|
||||
abstract public static function init_data(array $params);
|
||||
abstract public static function init_data(object $params);
|
||||
|
||||
/**
|
||||
* Validate security access for this form based on the provided parameters
|
||||
* Return true if validation passes, false or throw an exception if it does not.
|
||||
*
|
||||
* @param array $params The parameters for form initialization
|
||||
* @param object $params The parameters for form initialization
|
||||
* @return bool True if security validation passes.
|
||||
* @throws \moodle_exception if access denied for a specific reason.
|
||||
*/
|
||||
abstract public static function check_security(array $params);
|
||||
abstract public static function check_security(object $params);
|
||||
|
||||
/**
|
||||
* Process the submission and perform necessary actions
|
||||
|
|
|
@ -1,33 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace local_treestudyplan\local\forms;
|
||||
|
||||
use local_treestudyplan\studyplan;
|
||||
use local_treestudyplan\local\helpers\webservicehelper;
|
||||
/**
|
||||
* Moodleform class for the studyplan editor. A Moodleform is used here to facilitate a rich editor
|
||||
* in the studyplan description
|
||||
*/
|
||||
class studyplan_editform extends formbase {
|
||||
|
||||
/**
|
||||
* Capability required to edit study plans
|
||||
* @var string
|
||||
*/
|
||||
const CAP_EDIT = "local/treestudyplan:editstudyplan";
|
||||
/**
|
||||
* Validate security access for this form based on the provided parameters
|
||||
* Return true if validation passes, false or throw an exception if it does not.
|
||||
*
|
||||
* @param array $params The parameters for form initialization
|
||||
* @param object $params The parameters for form initialization
|
||||
* @return bool True if security validation passes.
|
||||
* @throws \moodle_exception if access denied for a specific reason.
|
||||
*/
|
||||
public static function check_security(array $params) {
|
||||
|
||||
public static function check_security(object $params) {
|
||||
$plan = studyplan::find_by_id($params->studyplanid);
|
||||
webservicehelper::require_capabilities(self::CAP_EDIT,$plan->context());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate form data from parameters
|
||||
* Also validate parameters and access permissions here
|
||||
*
|
||||
* @param array $params The parameters for form initialization
|
||||
* @param object $params The parameters for form initialization
|
||||
* @return array Form data based on parameters
|
||||
*/
|
||||
public static function init_data(array $params) {
|
||||
public static function init_data(object $params) {
|
||||
$plan = studyplan::find_by_id($params->studyplanid);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user