Skip to content

Commit

Permalink
MDL-75362 gradereport_singleview: CiBot complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Oct 20, 2022
1 parent 84d8c98 commit 7973d6b
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 39 deletions.
15 changes: 12 additions & 3 deletions grade/report/singleview/classes/local/screen/grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@
*/
class grade extends tablelike implements selectable_items, filterable_items {

/** @var int $totalitemcount Used for paging */
/**
* Used for paging
* @var int $totalitemcount
*/
private int $totalitemcount = 0;

/** @var bool $requiresextra True if this is a manual grade item */
/**
* True if this is a manual grade item
* @var bool $requiresextra
*/
private bool $requiresextra = false;

/** @var bool $requirepaging True if there are more users than our limit. */
/**
* True if there are more users than our limit.
* @var bool $requirepaging
*/
private bool $requirespaging = true;

/**
Expand Down
46 changes: 35 additions & 11 deletions grade/report/singleview/classes/local/screen/screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,52 @@
*/
abstract class screen {

/** @var int $courseid The id of the course */
/**
* The id of the course
* @var int $courseid
*/
protected int $courseid;

/** @var int|null $itemid Either a user id or a grade_item id */
/**
* Either a user id or a grade_item id
* @var int|null $itemid
*/
protected ?int $itemid;

/** @var int $groupid The currently set groupid (if set) */
/**
* The currently set groupid (if set)
* @var int $groupid
*/
protected $groupid;

/** @var context_course $context The course context */
/**
* The course context
* @var context_course $context
*/
protected context_course $context;

/** @var int $page The page number */
/**
* The page number
* @var int $page
*/
protected int $page;

/** @var int $perpage Results per page */
/**
* Results per page
* @var int $perpage
*/
protected int $perpage;

/** @var array $items List of items on the page, they could be users or grade_items */
/**
* List of items on the page, they could be users or grade_items
* @var array $items
*/
protected array $items;

/** @var array $validperpage List of allowed values for 'perpage' setting */
/**
* List of allowed values for 'perpage' setting
* @var array $validperpage
*/
protected static array $validperpage = [20, 50, 100, 200, 400, 1000, 5000];

/**
Expand Down Expand Up @@ -222,21 +246,21 @@ public function heading(): string {
*
* @param boolean $selfitemisempty True if no item has been selected yet.
*/
public abstract function init(bool $selfitemisempty = false);
abstract public function init(bool $selfitemisempty = false);

/**
* Get the type of items in the list.
*
* @return string
*/
public abstract function item_type(): string;
abstract public function item_type(): string;

/**
* Get the entire screen as a string.
*
* @return string
*/
public abstract function html(): string;
abstract public function html(): string;

/**
* Does this screen support paging?
Expand Down
2 changes: 1 addition & 1 deletion grade/report/singleview/classes/local/screen/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function html(): string {
$url = new moodle_url('/grade/report/singleview/index.php', $params);

$select = new \single_select($url, 'itemid', $options, '', ['' => $screen->select_label()]);
$select->set_label($screen->select_label(), ['class'=>'accesshide']);
$select->set_label($screen->select_label(), ['class' => 'accesshide']);
$html .= $OUTPUT->render($select);
}
$html = $OUTPUT->container($html, 'selectitems');
Expand Down
21 changes: 15 additions & 6 deletions grade/report/singleview/classes/local/screen/tablelike.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,38 @@
*/
abstract class tablelike extends screen {

/** @var array $headers A list of table headers */
/**
* A list of table headers
* @var array $headers
*/
protected array $headers = [];

/** @var array $initerrors A list of errors that mean we should not show the table */
/**
* A list of errors that mean we should not show the table
* @var array $initerrors
*/
protected array $initerrors = [];

/** @var array $definition Describes the columns in the table */
/**
* Describes the columns in the table
* @var array $definition
*/
protected array $definition = [];

/**
* Format a row of the table
*
* @param mixed $item
* @var mixed $item
* @return array
*/
public abstract function format_line($item): array;
abstract public function format_line($item): array;

/**
* Get the summary for this table.
*
* @return string
*/
public abstract function summary(): string;
abstract public function summary(): string;

/**
* Get the table headers
Expand Down
2 changes: 1 addition & 1 deletion grade/report/singleview/classes/local/screen/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function original_headers(): array {
* @param grade_item $item
* @return array
*/
public function format_line($item): array{
public function format_line($item): array {
global $OUTPUT;

$grade = $this->fetch_grade_or_default($item, $this->item->id);
Expand Down
15 changes: 12 additions & 3 deletions grade/report/singleview/classes/local/ui/dropdown_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@
*/
class dropdown_attribute extends element {

/** @var string $selected Who is selected ? */
/**
* Who is selected?
* @var string $selected
*/
private string $selected;

/** @var array $options List of options ? */
/**
* List of options
* @var array $options
*/
private array $options;

/** @var bool $isdisabled Is this input disabled. */
/**
* Is this input disabled.
* @var bool $isdisabled
*/
private bool $isdisabled;

/**
Expand Down
15 changes: 12 additions & 3 deletions grade/report/singleview/classes/local/ui/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@
*/
abstract class element {

/** @var string $name The first bit of the name for this input. */
/**
* The first bit of the name for this input.
* @var string $name
*/
public string $name;

/** @var string $value The value for this input. */
/**
* The value for this input.
* @var string $value
*/
public string $value;

/** @var string $label The form label for this input. */
/**
* The form label for this input.
* @var string $label
*/
public string $label;

/**
Expand Down
10 changes: 8 additions & 2 deletions grade/report/singleview/classes/local/ui/exclude.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@
*/
class exclude extends grade_attribute_format implements be_checked, be_disabled {

/** @var string $name The name of the input */
/**
* The name of the input
* @var string $name
*/
public string $name = 'exclude';

/** @var bool $disabled Is the checkbox disabled? */
/**
* Is the checkbox disabled?
* @var bool $disabled
*/
public $disabled = false;

/**
Expand Down
5 changes: 4 additions & 1 deletion grade/report/singleview/classes/local/ui/feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
*/
class feedback extends grade_attribute_format implements unique_value, be_disabled {

/** @var string $name Name of this input */
/**
* Name of this input
* @var string $name
*/
public string $name = 'feedback';

/**
Expand Down
5 changes: 4 additions & 1 deletion grade/report/singleview/classes/local/ui/finalgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
*/
class finalgrade extends grade_attribute_format implements unique_value, be_disabled {

/** @var string $name Name of this input */
/**
* Name of this input
* @var string $name
*/
public string $name = 'finalgrade';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,22 @@
*/
abstract class grade_attribute_format extends attribute_format implements unique_name {

/** @var string $name The first part of the name attribute of the form input */
/**
* The first part of the name attribute of the form input
* @var string $name
*/
public string $name;

/** @var null|string $label The label of the input */
/**
* The label of the input
* @var null|string $label
*/
public ?string $label;

/** @var grade_grade $grade The grade_grade of the input */
/**
* The grade_grade of the input
* @var grade_grade $grade
*/
public grade_grade $grade;

/**
Expand All @@ -70,5 +79,5 @@ public function get_name(): string {
* @param string $value The value from the form.
* @return string Any error message
*/
public abstract function set(string $value);
abstract public function set(string $value);
}
5 changes: 4 additions & 1 deletion grade/report/singleview/classes/local/ui/override.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
*/
class override extends grade_attribute_format implements be_checked, be_disabled {

/** @var string $name The name for this input */
/**
* The name for this input
* @var string $name
*/
public string $name = 'override';

/**
Expand Down
5 changes: 4 additions & 1 deletion grade/report/singleview/classes/local/ui/text_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
*/
class text_attribute extends element {

/** @var bool $isdisabled Is this input disabled? */
/**
* Is this input disabled?
* @var bool $isdisabled
*/
private bool $isdisabled;

/**
Expand Down
9 changes: 8 additions & 1 deletion grade/report/singleview/classes/report/singleview.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ public function process_action($target, $action) {
* @param int $itemid The id of the user or grade item
* @param string|null $unused Used to be group id but that was removed and this is now unused.
*/
public function __construct(int $courseid, object $gpr, context_course $context, string $itemtype, int $itemid, ?string $unused = null) {
public function __construct(
int $courseid,
object $gpr,
context_course $context,
string $itemtype,
int $itemid,
?string $unused = null
) {
parent::__construct($courseid, $gpr, $context);

$base = '/grade/report/singleview/index.php';
Expand Down

0 comments on commit 7973d6b

Please sign in to comment.