original_string: public function set_hidden($hidden, $cascade=false) {
          parent::set_hidden($hidden, $cascade);
  
          if ($cascade) {
              if ($grades = grade_grade::fetch_all(array('itemid'=>$this->id))) {
                  foreach($grades as $grade) {
                      $grade->grade_item =& $this;
                      $grade->set_hidden($hidden, $cascade);
                  }
              }
          }
  
          //if marking item visible make sure category is visible MDL-21367
          if( !$hidden ) {
              $category_array = grade_category::fetch_all(array('id'=>$this->categoryid));
              if ($category_array && array_key_exists($this->categoryid, $category_array)) {
                  $category = $category_array[$this->categoryid];
                  //call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
                  //if($category->is_hidden()) {
                      $category->set_hidden($hidden, false);
                  //}
              }
          }
      }
code: public function set_hidden($hidden, $cascade=false) {
          parent::set_hidden($hidden, $cascade);
  
          if ($cascade) {
              if ($grades = grade_grade::fetch_all(array('itemid'=>$this->id))) {
                  foreach($grades as $grade) {
                      $grade->grade_item =& $this;
                      $grade->set_hidden($hidden, $cascade);
                  }
              }
          }
  
          //if marking item visible make sure category is visible MDL-21367
          if( !$hidden ) {
              $category_array = grade_category::fetch_all(array('id'=>$this->categoryid));
              if ($category_array && array_key_exists($this->categoryid, $category_array)) {
                  $category = $category_array[$this->categoryid];
                  //call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
                  //if($category->is_hidden()) {
                      $category->set_hidden($hidden, false);
                  //}
              }
          }
      }
code_tokens: public function set_hidden ( $ hidden , $ cascade = false ) { parent :: set_hidden ( $ hidden , $ cascade ) ; if ( $ cascade ) { if ( $ grades = grade_grade :: fetch_all ( array ( 'itemid' => $ this -> id ) ) ) { foreach ( $ grades as $ grade ) { $ grade -> grade_item = & $ this ; $ grade -> set_hidden ( $ hidden , $ cascade ) ; } } } //if marking item visible make sure category is visible MDL-21367 if ( ! $ hidden ) { $ category_array = grade_category :: fetch_all ( array ( 'id' => $ this -> categoryid ) ) ; if ( $ category_array && array_key_exists ( $ this -> categoryid , $ category_array ) ) { $ category = $ category_array [ $ this -> categoryid ] ; //call set_hidden on the category regardless of whether it is hidden as its parent might be hidden //if($category->is_hidden()) { $ category -> set_hidden ( $ hidden , false ) ; //} } } }
docstring: Set the hidden status of grade_item and all grades.
  
  0 mean always visible, 1 means always hidden and a number > 1 is a timestamp to hide until
  
  @param int $hidden new hidden status
  @param bool $cascade apply to child objects too
docstring_tokens: Set the hidden status of grade_item and all grades .