PHPDoc documentation

This commit is contained in:
PMKuipers 2023-08-27 23:29:46 +02:00
parent 96f311a30b
commit 6bcc44f584
8 changed files with 26 additions and 26 deletions

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. // along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/** /**
* Handle badge information * Handle badge information
* @package local_treestudyplan * @package local_treestudyplan
* @copyright 2023 P.M. Kuipers * @copyright 2023 P.M. Kuipers
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

View File

@ -145,7 +145,7 @@ class courseinfo {
} }
/** /**
* Construct courseinfo based on course id and * Construct courseinfo based on course id and
* @param int $id Course id * @param int $id Course id
* @param studyitem|null $studyitem Studyitem linking this course (if applicable) * @param studyitem|null $studyitem Studyitem linking this course (if applicable)
*/ */
@ -178,7 +178,7 @@ class courseinfo {
return $DB->get_field(self::TABLE, "id", ['shortname' => $shortname]); return $DB->get_field(self::TABLE, "id", ['shortname' => $shortname]);
} }
/** /**
* Determine course timing [future, present or past] based on a course date * Determine course timing [future, present or past] based on a course date
* @param stdClass $course Course database record * @param stdClass $course Course database record
* @return string 'future', 'present' or 'past' * @return string 'future', 'present' or 'past'
@ -196,7 +196,7 @@ class courseinfo {
} }
} }
/** /**
* Determine course timing for this course [future, present or past] * Determine course timing for this course [future, present or past]
* @return string 'future', 'present' or 'past' * @return string 'future', 'present' or 'past'
*/ */
@ -248,7 +248,7 @@ class courseinfo {
], 'referenced course information', $value); ], 'referenced course information', $value);
} }
/** /**
* Webservice model for basic info * Webservice model for basic info
* @return array Webservice data model * @return array Webservice data model
*/ */

View File

@ -49,7 +49,7 @@ class period {
/** /**
* Find record in database and return management object * Find record in database and return management object
* @param int $id Id of database record * @param int $id Id of database record
* @return self * @return self
*/ */
public static function find_by_id($id): self { public static function find_by_id($id): self {
if (!array_key_exists($id, self::$cache)) { if (!array_key_exists($id, self::$cache)) {

View File

@ -72,7 +72,7 @@ class studyitem {
/** /**
* Find record in database and return management object * Find record in database and return management object
* @param int $id Id of database record * @param int $id Id of database record
* @return self * @return self
*/ */
public static function find_by_id($id): self { public static function find_by_id($id): self {
if (!array_key_exists($id, self::$studyitemcache)) { if (!array_key_exists($id, self::$studyitemcache)) {
@ -320,8 +320,8 @@ class studyitem {
global $DB; global $DB;
foreach ($resequence as $sq) { foreach ($resequence as $sq) {
// Only change line_id if new line is within the same studyplan page // Only change line_id if new line is within the same studyplan page.
if ( studyitem::find_by_id($sq['id'])->studyline()->page()->id() == if ( self::find_by_id($sq['id'])->studyline()->page()->id() ==
studyline::find_by_id($sq['line_id'])->page()->id() ) { studyline::find_by_id($sq['line_id'])->page()->id() ) {
$DB->update_record(self::TABLE, [ $DB->update_record(self::TABLE, [
'id' => $sq['id'], 'id' => $sq['id'],

View File

@ -79,7 +79,7 @@ class studyline {
/** /**
* Find record in database and return management object * Find record in database and return management object
* @param int $id Id of database record * @param int $id Id of database record
* @return self * @return self
*/ */
public static function find_by_id($id): self { public static function find_by_id($id): self {
if (!array_key_exists($id, self::$studylinecache)) { if (!array_key_exists($id, self::$studylinecache)) {

View File

@ -53,7 +53,7 @@ class studyplan {
/** /**
* Find record in database and return management object * Find record in database and return management object
* @param int $id Id of database record * @param int $id Id of database record
* @return self * @return self
*/ */
public static function find_by_id($id): self { public static function find_by_id($id): self {
if (!array_key_exists($id, self::$studyplancache)) { if (!array_key_exists($id, self::$studyplancache)) {
@ -145,7 +145,7 @@ class studyplan {
], 'Basic studyplan info', $value); ], 'Basic studyplan info', $value);
} }
/** /**
* Webservice model for basic info * Webservice model for basic info
* @return array Webservice data model * @return array Webservice data model
*/ */

View File

@ -29,7 +29,7 @@ require_once($CFG->libdir.'/externallib.php');
*/ */
class studyplanpage { class studyplanpage {
/** /**
* Database table this class models for * Database table this class models for
* @var string */ * @var string */
const TABLE = "local_treestudyplan_page"; const TABLE = "local_treestudyplan_page";
@ -42,7 +42,7 @@ class studyplanpage {
* Holds database record * Holds database record
* @var stdClass * @var stdClass
*/ */
private $r; // Holds database record. private $r;
/** @var int */ /** @var int */
private $id; private $id;
/** @var studyplan*/ /** @var studyplan*/
@ -59,7 +59,7 @@ class studyplanpage {
/** /**
* Find record in database and return management object * Find record in database and return management object
* @param int $id Id of database record * @param int $id Id of database record
* @return self * @return self
*/ */
public static function find_by_id($id): self { public static function find_by_id($id): self {
if (!array_key_exists($id, self::$cache)) { if (!array_key_exists($id, self::$cache)) {
@ -157,7 +157,7 @@ class studyplanpage {
], 'Studyplan page basic info', $value); ], 'Studyplan page basic info', $value);
} }
/** /**
* Webservice model for basic info * Webservice model for basic info
* @return array Webservice data model * @return array Webservice data model
*/ */
@ -613,7 +613,7 @@ class studyplanpage {
/** /**
* Find a studyline in this page by its shortname * Find a studyline in this page by its shortname
* @param string $shortname * @param string $shortname
* @return studyline|null * @return studyline|null
*/ */
protected function find_studyline_by_shortname($shortname) { protected function find_studyline_by_shortname($shortname) {

View File

@ -474,7 +474,7 @@ class studyplanservice extends \external_api {
* Delete a study line * Delete a study line
* @param mixed $id Id of the studyline * @param mixed $id Id of the studyline
* @return array Success/fail model * @return array Success/fail model
* *
*/ */
public static function delete_studyline($id) { public static function delete_studyline($id) {
$o = studyline::find_by_id($id); $o = studyline::find_by_id($id);
@ -604,7 +604,7 @@ class studyplanservice extends \external_api {
/** /**
* Add a new study item * Add a new study item
* @param int $lineid * @param int $lineid
* @param string $type * @param string $type
* @param array $details * @param array $details
* @param int $slot * @param int $slot
* @param int $layer * @param int $layer
@ -912,7 +912,7 @@ class studyplanservice extends \external_api {
* @param bool $include Include grade or not * @param bool $include Include grade or not
* @param bool $required Mark grade as required or not * @param bool $required Mark grade as required or not
* @return array Success/Fail model * @return array Success/Fail model
* *
*/ */
public static function include_grade($gradeid, $itemid, $include, $required = false) { public static function include_grade($gradeid, $itemid, $include, $required = false) {
global $USER; global $USER;
@ -1001,7 +1001,7 @@ class studyplanservice extends \external_api {
* @param int $scaleid Id of scale to use * @param int $scaleid Id of scale to use
* @return array * @return array
*/ */
public static function force_studyplan_scale($studyplanid, $scaleid) { public static function force_studyplan_scale($studyplanid, $scaleid) {
global $DB; global $DB;
$dbman = $DB->get_manager(); $dbman = $DB->get_manager();
@ -1262,9 +1262,9 @@ class studyplanservice extends \external_api {
return studyplan::export_structure(); return studyplan::export_structure();
} }
/** /**
* Export studyplan * Export studyplan
* @param mixed $studyplanid Id of studyplan to export * @param mixed $studyplanid Id of studyplan to export
* @param string $format Export format [csv, json (default)] * @param string $format Export format [csv, json (default)]
* @return array * @return array
@ -1347,7 +1347,7 @@ class studyplanservice extends \external_api {
/** /**
* Import studyplan from file * Import studyplan from file
* @param string $content Content of file * @param string $content Content of file
* @param string $format Format of file * @param string $format Format of file
* @param int $contextid ID of context to import to * @param int $contextid ID of context to import to
* @return array Success/fail model * @return array Success/fail model
@ -1389,7 +1389,7 @@ class studyplanservice extends \external_api {
/** /**
* Import studylines into existing studtplan * Import studylines into existing studtplan
* @param int $studyplanid ID of studyplan to import to * @param int $studyplanid ID of studyplan to import to
* @param string $content Content of file * @param string $content Content of file
* @param string $format Format of file * @param string $format Format of file
* @return array Success/fail model * @return array Success/fail model
*/ */
@ -1436,7 +1436,7 @@ class studyplanservice extends \external_api {
/** /**
* Submit hacked course activity edit form to edit just name and description * Submit hacked course activity edit form to edit just name and description
* @deprecated will remove hacked edit form in the future * @deprecated will remove hacked edit form in the future
* @param mixed $cmid * @param mixed $cmid
* @param mixed $formdata * @param mixed $formdata
* @return array Success/fail structure * @return array Success/fail structure