original_string: public function need_confirm_regrading($controller) {
          $data = $this->get_data();
          if (isset($data->guide['regrade'])) {
              // We have already displayed the confirmation on the previous step.
              return false;
          }
          if (!isset($data->saveguide) || !$data->saveguide) {
              // We only need confirmation when button 'Save guide' is pressed.
              return false;
          }
          if (!$controller->has_active_instances()) {
              // Nothing to re-grade, confirmation not needed.
              return false;
          }
          $changelevel = $controller->update_or_check_guide($data);
          if ($changelevel == 0) {
              // No changes in the guide, no confirmation needed.
              return false;
          }
  
          // Freeze form elements and pass the values in hidden fields.
          // TODO description_editor does not freeze the normal way!
          $form = $this->_form;
          foreach (array('guide', 'name'/*, 'description_editor'*/) as $fieldname) {
              $el =& $form->getElement($fieldname);
              $el->freeze();
              $el->setPersistantFreeze(true);
              if ($fieldname == 'guide') {
                  $el->add_regrade_confirmation($changelevel);
              }
          }
  
          // Replace button text 'saveguide' and unfreeze 'Back to edit' button.
          $this->findbutton('saveguide')->setValue(get_string('continue'));
          $el =& $this->findbutton('editguide');
          $el->setValue(get_string('backtoediting', 'gradingform_guide'));
          $el->unfreeze();
  
          return true;
      }
code: public function need_confirm_regrading($controller) {
          $data = $this->get_data();
          if (isset($data->guide['regrade'])) {
              // We have already displayed the confirmation on the previous step.
              return false;
          }
          if (!isset($data->saveguide) || !$data->saveguide) {
              // We only need confirmation when button 'Save guide' is pressed.
              return false;
          }
          if (!$controller->has_active_instances()) {
              // Nothing to re-grade, confirmation not needed.
              return false;
          }
          $changelevel = $controller->update_or_check_guide($data);
          if ($changelevel == 0) {
              // No changes in the guide, no confirmation needed.
              return false;
          }
  
          // Freeze form elements and pass the values in hidden fields.
          // TODO description_editor does not freeze the normal way!
          $form = $this->_form;
          foreach (array('guide', 'name'/*, 'description_editor'*/) as $fieldname) {
              $el =& $form->getElement($fieldname);
              $el->freeze();
              $el->setPersistantFreeze(true);
              if ($fieldname == 'guide') {
                  $el->add_regrade_confirmation($changelevel);
              }
          }
  
          // Replace button text 'saveguide' and unfreeze 'Back to edit' button.
          $this->findbutton('saveguide')->setValue(get_string('continue'));
          $el =& $this->findbutton('editguide');
          $el->setValue(get_string('backtoediting', 'gradingform_guide'));
          $el->unfreeze();
  
          return true;
      }
code_tokens: public function need_confirm_regrading ( $ controller ) { $ data = $ this -> get_data ( ) ; if ( isset ( $ data -> guide [ 'regrade' ] ) ) { // We have already displayed the confirmation on the previous step. return false ; } if ( ! isset ( $ data -> saveguide ) || ! $ data -> saveguide ) { // We only need confirmation when button 'Save guide' is pressed. return false ; } if ( ! $ controller -> has_active_instances ( ) ) { // Nothing to re-grade, confirmation not needed. return false ; } $ changelevel = $ controller -> update_or_check_guide ( $ data ) ; if ( $ changelevel == 0 ) { // No changes in the guide, no confirmation needed. return false ; } // Freeze form elements and pass the values in hidden fields. // TODO description_editor does not freeze the normal way! $ form = $ this -> _form ; foreach ( array ( 'guide' , 'name' /*, 'description_editor'*/ ) as $ fieldname ) { $ el = & $ form -> getElement ( $ fieldname ) ; $ el -> freeze ( ) ; $ el -> setPersistantFreeze ( true ) ; if ( $ fieldname == 'guide' ) { $ el -> add_regrade_confirmation ( $ changelevel ) ; } } // Replace button text 'saveguide' and unfreeze 'Back to edit' button. $ this -> findbutton ( 'saveguide' ) -> setValue ( get_string ( 'continue' ) ) ; $ el = & $ this -> findbutton ( 'editguide' ) ; $ el -> setValue ( get_string ( 'backtoediting' , 'gradingform_guide' ) ) ; $ el -> unfreeze ( ) ; return true ; }
docstring: Check if there are changes in the guide and it is needed to ask user whether to
  mark the current grades for re-grading. User may confirm re-grading and continue,
  return to editing or cancel the changes
  
  @param gradingform_guide_controller $controller
docstring_tokens: Check if there are changes in the guide and it is needed to ask user whether to mark the current grades for re - grading . User may confirm re - grading and continue return to editing or cancel the changes