Skip to content

Commit

Permalink
GitHub Linting: fix phpdoc for top-level pages, forms and /tests
Browse files Browse the repository at this point in the history
  • Loading branch information
semteacher committed Dec 20, 2023
1 parent 090ab57 commit 39cf22d
Show file tree
Hide file tree
Showing 30 changed files with 387 additions and 29 deletions.
23 changes: 23 additions & 0 deletions categoriesform.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,25 @@

require_once($CFG->libdir . '/formslib.php');

/**
* Class for handling categories form
*
* @package mod_booking
* @copyright 2022 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_booking_categories_form extends moodleform {

/**
* Show sub categories.
*
* @param int $catid
* @param string $dashes
* @param array $options
*
* @return array
*
*/
private function show_sub_categories($catid, $dashes = '', $options = []) {
global $DB;
$dashes .= '&nbsp;&nbsp;';
Expand All @@ -41,6 +58,12 @@ private function show_sub_categories($catid, $dashes = '', $options = []) {
return $options;
}

/**
*
* {@inheritDoc}
* @see moodleform::definition()
*
*/
public function definition() {
global $DB, $COURSE;

Expand Down
9 changes: 9 additions & 0 deletions db/mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Booking module mobile params script
*
* @package mod_booking
* @copyright 2009-2023 David Bogner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$addons = [
Expand Down
8 changes: 8 additions & 0 deletions db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Booking module scheduled tasks definition
*
* @package mod_booking
* @copyright 2009-2023 David Bogner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$tasks = [
Expand Down
16 changes: 16 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Booking module databese upgrade script
*
* @package mod_booking
* @copyright 2009-2023 David Bogner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Xmldb booking upgrade
*
* @param string $oldversion
*
* @return bool
*
*/
function xmldb_booking_upgrade($oldversion) {
global $CFG, $DB;

Expand Down
9 changes: 9 additions & 0 deletions edit_optiontemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Handling editing of option tepmplates
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use mod_booking\form\option_form;
use mod_booking\singleton_service;

Expand Down
25 changes: 22 additions & 3 deletions importexcel_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Handling importexcel form
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

require_once("$CFG->libdir/formslib.php");


/**
* Class to handle importexcel form
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class importexcel_form extends moodleform {

/**
Expand All @@ -38,9 +53,13 @@ public function definition() {
}

/**
* Form validation
*
* @param array $data
* @param array $files
*
* @return array
*
* {@inheritDoc}
* @see moodleform::validation()
*/
public function validation($data, $files) {
return [];
Expand Down
8 changes: 8 additions & 0 deletions lang/de/booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* German translation of the booking module
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

global $CFG;

// General strings.
Expand Down
8 changes: 8 additions & 0 deletions lang/en/booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* English lang strings of the booking module
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

global $CFG;

// General strings.
Expand Down
6 changes: 4 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2828,13 +2828,15 @@ function booking_show_subcategories($catid, $courseid) {
/**
* Returns list of user objects that are subscribed to this booking
*
* @param stdClass $course the course
* @param booking $booking the booking
* @param stdClass $course
* @param int $optionid
* @param int $id
* @param int $groupid group id, or 0 for all.
* @param stdClass $context the booking context, to save re-fetching it where possible.
* @param string $fields requested user fields (with "u." table prefix)
*
* @return array list of users.
*
*/
function booking_subscribed_teachers($course, $optionid, $id, $groupid = 0, $context = null,
$fields = null) {
Expand Down
52 changes: 49 additions & 3 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Module setup form
*
* @package mod_booking
* @copyright 2021 Wunderbyte GmbH <[email protected]>
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -36,17 +36,29 @@
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/mod/booking/lib.php');


/**
* Class to handle booking module setup form
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_booking_mod_form extends moodleform_mod {

/**
* $options
*
* @var array
*/
public $options = [];

/**
* Return an array of categories catid as key and categoryname as value
*
* @param int $cat_id
* @param int $catid
* @param string $dashes
* @param array $options
*
* @return array of course category names indexed by category id
*/
public function show_sub_categories($catid, $dashes = '', $options = []) {
Expand All @@ -63,6 +75,12 @@ public function show_sub_categories($catid, $dashes = '', $options = []) {
return $options;
}

/**
* Add completion rules.
*
* @return array
*
*/
public function add_completion_rules() {
$mform = & $this->_form;

Expand All @@ -81,10 +99,23 @@ public function add_completion_rules() {
return ['enablecompletiongroup'];
}

/**
* Completion rule enabled.
*
* @param array $data
*
* @return bool
*
*/
public function completion_rule_enabled($data) {
return !empty($data['enablecompletion'] != 0);
}

/**
*
* {@inheritDoc}
* @see moodleform_mod::definition()
*/
public function definition() {
global $CFG, $DB, $COURSE, $USER, $PAGE, $OUTPUT;

Expand Down Expand Up @@ -1150,6 +1181,15 @@ public function data_preprocessing(&$defaultvalues) {
}
}

/**
* Form validation.
*
* @param array $data
* @param array $files
*
* @return array
*
*/
public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
Expand Down Expand Up @@ -1206,6 +1246,12 @@ public function data_postprocessing($data) {
// TODO: ... if mailtemplatessource is set to 1 on saving.
}

/**
* Get form data.
*
* @return object
*
*/
public function get_data() {
$data = parent::get_data();
if ($data) {
Expand Down
9 changes: 9 additions & 0 deletions moveoption.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Handling move option pahe
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use mod_booking\singleton_service;

require_once(__DIR__ . '/../../config.php');
Expand Down
9 changes: 9 additions & 0 deletions mybookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Handling my bookings page
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__ . '/../../config.php');
require_once($CFG->dirroot . '/mod/booking/locallib.php');

Expand Down
9 changes: 9 additions & 0 deletions option_date_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Handling option date template page
*
* @package mod_booking
* @copyright 2023 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use mod_booking\booking;
use mod_booking\singleton_service;

Expand Down
21 changes: 18 additions & 3 deletions otherbookingaddrule_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@

require_once("$CFG->libdir/formslib.php");


/**
* Class to hanfling other booking add role form
*
* @package mod_booking
* @copyright 2021 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class otherbookingaddrule_form extends moodleform {

/**
Expand Down Expand Up @@ -73,14 +79,23 @@ public function definition() {
}

/**
* Form validation.
*
* @param array $data
* @param mixed $files
*
* @return array
*
* {@inheritDoc}
* @see moodleform::validation()
*/
public function validation($data, $files) {
return [];
}

/**
*
* {@inheritDoc}
* @see moodleform::get_data()
*/
public function get_data() {
$data = parent::get_data();

Expand Down
Loading

0 comments on commit 39cf22d

Please sign in to comment.