예제 #1
0
 /**
  * Only real Hack of this block, replace the
  * contextid of the block with the linked
  * module's ID.  If no ID, then hide the 
  * the button.
  *
  * @return void
  **/
 function _add_edit_controls($options)
 {
     parent::_add_edit_controls($options);
     if ($this->edit_controls !== NULL) {
         if (!empty($this->config->cmid)) {
             $blockcontext = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
             $modulecontext = get_context_instance(CONTEXT_MODULE, $this->config->cmid);
             $this->edit_controls = str_replace("contextid={$blockcontext->id}", "contextid={$modulecontext->id}", $this->edit_controls);
         } else {
             if (empty($this->instance->pinned)) {
                 // No linked module so hide the role assign widget for non-pinned instances
                 $this->edit_controls = str_replace('<div class="commands"><a', '<div class="commands"><a style="position: absolute; display: none;"', $this->edit_controls);
             }
         }
     }
 }