mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-40313 Fix code and doc checker warnings.
This commit is contained in:
parent
efa5155a2a
commit
e22e749002
5 changed files with 157 additions and 37 deletions
|
@ -1,17 +1,47 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/**
|
||||
* Defines an abstract class for filtering/searching the question bank.
|
||||
*
|
||||
* @package core_question
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* An abstract class for filtering/searching questions.
|
||||
* See also init_search_conditions
|
||||
*
|
||||
* See also {@link question_bank_view::init_search_conditions()}.
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class core_question_bank_search_condition {
|
||||
/**
|
||||
* @return string An SQL fragment to be ANDed into the WHERE clause to filter which questions are shown
|
||||
* Return an SQL fragment to be ANDed into the WHERE clause to filter which questions are shown.
|
||||
* @return string SQL fragment. Must use named parameters.
|
||||
*/
|
||||
public abstract function where();
|
||||
|
||||
/**
|
||||
* @return array Parameters to be bound to the above WHERE clause fragment
|
||||
* Return parameters to be bound to the above WHERE clause fragment.
|
||||
* @return array parameter name => value.
|
||||
*/
|
||||
public function params() {
|
||||
return array();
|
||||
|
|
|
@ -1,27 +1,69 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/**
|
||||
* A search class to control from which category questions are listed.
|
||||
*
|
||||
* @package core_question
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* This class controls from which category questions are listed.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2013 Tim Hunt, Ray Morris and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_question_bank_search_condition_category extends core_question_bank_search_condition {
|
||||
/** @var stdClass The course record. */
|
||||
protected $course;
|
||||
|
||||
/** @var stdClass The category record. */
|
||||
protected $category;
|
||||
|
||||
/** @var array of contexts. */
|
||||
protected $contexts;
|
||||
|
||||
/** @var bool Whether to include questions from sub-categories. */
|
||||
protected $recurse;
|
||||
|
||||
/** @var string SQL fragment to add to the where clause. */
|
||||
protected $where;
|
||||
|
||||
/** @var array query param used in where. */
|
||||
protected $params;
|
||||
|
||||
/** @var string categoryID,contextID as used with question_bank_view->display(). */
|
||||
protected $cat;
|
||||
|
||||
/** @var int The maximum displayed length of the category info. */
|
||||
protected $maxinfolength;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $cat categoryID,contextID as used with question_bank_view->display()
|
||||
* @param boolean $recurse Whether to include questions from sub-categories
|
||||
* @param bool $recurse Whether to include questions from sub-categories
|
||||
* @param array $contexts Context objects as used by question_category_options()
|
||||
* @param moodle_url $baseurl The URL the form is submitted to
|
||||
* @param stdClass $course Course record
|
||||
* @param integer $maxinfolength The maximum displayed length of the category info
|
||||
* @param integer $maxinfolength The maximum displayed length of the category info.
|
||||
*/
|
||||
public function __construct($cat = null, $recurse = false, $contexts, $baseurl, $course, $maxinfolength = null) {
|
||||
$this->cat = $cat;
|
||||
|
@ -50,16 +92,10 @@ class core_question_bank_search_condition_category extends core_question_bank_se
|
|||
$this->where = 'q.category ' . $catidtest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string SQL fragment to be ANDed to the where clause to select which category of questions to display
|
||||
*/
|
||||
public function where() {
|
||||
return $this->where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns array Parameters to be bound to the SQL query to select which category of questions to display
|
||||
*/
|
||||
public function params() {
|
||||
return $this->params;
|
||||
}
|
||||
|
@ -87,7 +123,11 @@ class core_question_bank_search_condition_category extends core_question_bank_se
|
|||
}
|
||||
|
||||
/**
|
||||
* Display the drop down to select the category
|
||||
* Display the drop down to select the category.
|
||||
*
|
||||
* @param array $contexts of contexts that can be accessed from here.
|
||||
* @param moodle_url $pageurl the URL of this page.
|
||||
* @param string $current 'categoryID,contextID'.
|
||||
*/
|
||||
protected function display_category_form($contexts, $pageurl, $current) {
|
||||
global $OUTPUT;
|
||||
|
@ -127,6 +167,7 @@ class core_question_bank_search_condition_category extends core_question_bank_se
|
|||
|
||||
/**
|
||||
* Print the category description
|
||||
* @param stdClass $category the category information form the database.
|
||||
*/
|
||||
protected function print_category_info($category) {
|
||||
$formatoptions = new stdClass();
|
||||
|
|
|
@ -1,13 +1,46 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/**
|
||||
* This class controls whether hidden / deleted questions are hidden in the list.
|
||||
* A search class to control whether hidden / deleted questions are hidden in the list.
|
||||
*
|
||||
* @package core_question
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* This class controls whether hidden / deleted questions are hidden in the list.
|
||||
*
|
||||
* @copyright 2013 Ray Morris
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_question_bank_search_condition_hide extends core_question_bank_search_condition {
|
||||
protected $where = '';
|
||||
/** @var bool Whether to include old "deleted" questions. */
|
||||
protected $hide;
|
||||
|
||||
/** @var string SQL fragment to add to the where clause. */
|
||||
protected $where;
|
||||
|
||||
/**
|
||||
* @param bool $hide include old "deleted" questions.
|
||||
* Constructor.
|
||||
* @param bool $hide whether to include old "deleted" questions.
|
||||
*/
|
||||
public function __construct($hide = true) {
|
||||
$this->hide = $hide;
|
||||
|
@ -16,9 +49,6 @@ class core_question_bank_search_condition_hide extends core_question_bank_search
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string An SQL fragment to be ANDed into the WHERE clause to show or hide deleted/hidden questions
|
||||
*/
|
||||
public function where() {
|
||||
return $this->where;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue