mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
improved hiding support in grade/
This commit is contained in:
parent
e3fa6587ee
commit
f60c61b1b2
11 changed files with 98 additions and 60 deletions
|
@ -1053,22 +1053,24 @@ class grade_category extends grade_object {
|
|||
* Sets the grade_item's hidden variable and updates the grade_item.
|
||||
* Method named after grade_item::set_hidden().
|
||||
* @param int $hidden 0, 1 or a timestamp int(10) after which date the item will be hidden.
|
||||
* @param boolean $cascade apply to child objects too
|
||||
* @return void
|
||||
*/
|
||||
function set_hidden($hidden) {
|
||||
function set_hidden($hidden, $cascade=false) {
|
||||
$this->load_grade_item();
|
||||
$this->grade_item->set_hidden($hidden);
|
||||
if ($children = grade_item::fetch_all(array('categoryid'=>$this->id))) {
|
||||
foreach($children as $child) {
|
||||
$child->set_hidden($hidden);
|
||||
if ($cascade) {
|
||||
if ($children = grade_item::fetch_all(array('categoryid'=>$this->id))) {
|
||||
foreach($children as $child) {
|
||||
$child->set_hidden($hidden, $cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($children = grade_category::fetch_all(array('parent'=>$this->id))) {
|
||||
foreach($children as $child) {
|
||||
$child->set_hidden($hidden);
|
||||
if ($children = grade_category::fetch_all(array('parent'=>$this->id))) {
|
||||
foreach($children as $child) {
|
||||
$child->set_hidden($hidden, $cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue