original_string: public function process_url_show_hide() {
          if ($blockid = optional_param('bui_hideid', null, PARAM_INT)) {
              $newvisibility = 0;
          } else if ($blockid = optional_param('bui_showid', null, PARAM_INT)) {
              $newvisibility = 1;
          } else {
              return false;
          }
  
          require_sesskey();
  
          $block = $this->page->blocks->find_instance($blockid);
  
          if (!$this->page->user_can_edit_blocks()) {
              throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('hideshowblocks'));
          } else if (!$block->instance_can_be_hidden()) {
              return false;
          }
  
          blocks_set_visibility($block->instance, $this->page, $newvisibility);
  
          // If the page URL was a guses, it will contain the bui_... param, so we must make sure it is not there.
          $this->page->ensure_param_not_in_url('bui_hideid');
          $this->page->ensure_param_not_in_url('bui_showid');
  
          return true;
      }
code: public function process_url_show_hide() {
          if ($blockid = optional_param('bui_hideid', null, PARAM_INT)) {
              $newvisibility = 0;
          } else if ($blockid = optional_param('bui_showid', null, PARAM_INT)) {
              $newvisibility = 1;
          } else {
              return false;
          }
  
          require_sesskey();
  
          $block = $this->page->blocks->find_instance($blockid);
  
          if (!$this->page->user_can_edit_blocks()) {
              throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('hideshowblocks'));
          } else if (!$block->instance_can_be_hidden()) {
              return false;
          }
  
          blocks_set_visibility($block->instance, $this->page, $newvisibility);
  
          // If the page URL was a guses, it will contain the bui_... param, so we must make sure it is not there.
          $this->page->ensure_param_not_in_url('bui_hideid');
          $this->page->ensure_param_not_in_url('bui_showid');
  
          return true;
      }
code_tokens: public function process_url_show_hide ( ) { if ( $ blockid = optional_param ( 'bui_hideid' , null , PARAM_INT ) ) { $ newvisibility = 0 ; } else if ( $ blockid = optional_param ( 'bui_showid' , null , PARAM_INT ) ) { $ newvisibility = 1 ; } else { return false ; } require_sesskey ( ) ; $ block = $ this -> page -> blocks -> find_instance ( $ blockid ) ; if ( ! $ this -> page -> user_can_edit_blocks ( ) ) { throw new moodle_exception ( 'nopermissions' , '' , $ this -> page -> url -> out ( ) , get_string ( 'hideshowblocks' ) ) ; } else if ( ! $ block -> instance_can_be_hidden ( ) ) { return false ; } blocks_set_visibility ( $ block -> instance , $ this -> page , $ newvisibility ) ; // If the page URL was a guses, it will contain the bui_... param, so we must make sure it is not there. $ this -> page -> ensure_param_not_in_url ( 'bui_hideid' ) ; $ this -> page -> ensure_param_not_in_url ( 'bui_showid' ) ; return true ; }
docstring: Handle showing or hiding a block.
  @return boolean true if anything was done. False if not.
docstring_tokens: Handle showing or hiding a block .