| Línea 249... | Línea 249... | 
          
            | 249 |         // Open and close dates.
 | 249 |         // Open and close dates.
 | 
          
            | 250 |         $mform->addElement('date_time_selector', 'allowsubmissionsfromdate',
 | 250 |         $mform->addElement('date_time_selector', 'allowsubmissionsfromdate',
 | 
          
            | 251 |             get_string('allowsubmissionsfromdate', 'assign'), array('optional' => true));
 | 251 |             get_string('allowsubmissionsfromdate', 'assign'), array('optional' => true));
 | 
          
            | 252 |         $mform->setDefault('allowsubmissionsfromdate', $assigninstance->allowsubmissionsfromdate);
 | 252 |         $mform->setDefault('allowsubmissionsfromdate', $assigninstance->allowsubmissionsfromdate);
 | 
          
            | Línea -... | Línea 253... | 
          
            | - |   | 253 |  
 | 
          
            | - |   | 254 |         // Add the option to recalculate the penalty if there is existing grade.
 | 
          
            | - |   | 255 |         if (\mod_assign\penalty\helper::is_penalty_enabled($assigninstance->id) && $this->assign->count_grades() > 0) {
 | 
          
            | - |   | 256 |             // Create notification.
 | 
          
            | - |   | 257 |             $notice = $OUTPUT->notification(get_string('penaltyduedatechangemessage', 'assign'), 'warning', false);
 | 
          
            | - |   | 258 |             $mform->addElement('html', $notice);
 | 
          
            | - |   | 259 |             $mform->addElement('select', 'recalculatepenalty', get_string('modgraderecalculatepenalty', 'grades'), [
 | 
          
            | - |   | 260 |                 '' => get_string('choose'),
 | 
          
            | - |   | 261 |                 'no' => get_string('no'),
 | 
          
            | - |   | 262 |                 'yes' => get_string('yes'),
 | 
          
            | - |   | 263 |             ]);
 | 
          
            | - |   | 264 |             $mform->addHelpButton('recalculatepenalty', 'modgraderecalculatepenalty', 'grades');
 | 
          
            | - |   | 265 |         }
 | 
          
            | 253 |  
 | 266 |  
 | 
          
            | 254 |         $mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'assign'), array('optional' => true));
 | 267 |         $mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'assign'), array('optional' => true));
 | 
          
            | - |   | 268 |         $mform->setDefault('duedate', $assigninstance->duedate);
 | 
          
            | Línea 255... | Línea 269... | 
          
            | 255 |         $mform->setDefault('duedate', $assigninstance->duedate);
 | 269 |         $mform->disabledIf('duedate', 'recalculatepenalty', 'eq', '');
 | 
          
            | 256 |  
 | 270 |  
 | 
          
            | Línea 257... | Línea 271... | 
          
            | 257 |         $mform->addElement('date_time_selector', 'cutoffdate', get_string('cutoffdate', 'assign'), array('optional' => true));
 | 271 |         $mform->addElement('date_time_selector', 'cutoffdate', get_string('cutoffdate', 'assign'), array('optional' => true));
 | 
          
            | Línea 285... | Línea 299... | 
          
            | 285 |         $mform->closeHeaderBefore('buttonbar');
 | 299 |         $mform->closeHeaderBefore('buttonbar');
 | 
          
            | Línea 286... | Línea 300... | 
          
            | 286 |  
 | 300 |  
 | 
          
            | Línea 287... | Línea 301... | 
          
            | 287 |     }
 | 301 |     }
 | 
          
            | - |   | 302 |  
 | 
          
            | - |   | 303 |     /**
 | 
          
            | - |   | 304 |      * Override definition after data has been set.
 | 
          
            | - |   | 305 |      *
 | 
          
            | - |   | 306 |      * The value of date time selector will be lost in a POST request, if the selector is disabled.
 | 
          
            | - |   | 307 |      * So, we need to set the value again.
 | 
          
            | - |   | 308 |      *
 | 
          
            | - |   | 309 |      * return void
 | 
          
            | - |   | 310 |      */
 | 
          
            | - |   | 311 |     public function definition_after_data() {
 | 
          
            | - |   | 312 |         $mform = $this->_form;
 | 
          
            | - |   | 313 |  
 | 
          
            | - |   | 314 |         // The value of date time selector will be lost in a POST request.
 | 
          
            | - |   | 315 |         $recalculatepenalty = optional_param('recalculatepenalty', null, PARAM_TEXT);
 | 
          
            | - |   | 316 |         if ($recalculatepenalty === '') {
 | 
          
            | - |   | 317 |             $mform->setConstant('duedate', $mform->_defaultValues['duedate']);
 | 
          
            | - |   | 318 |         }
 | 
          
            | - |   | 319 |     }
 | 
          
            | 288 |  
 | 320 |  
 | 
          
            | 289 |     /**
 | 321 |     /**
 | 
          
            | 290 |      * Validate the submitted form data.
 | 322 |      * Validate the submitted form data.
 | 
          
            | 291 |      *
 | 323 |      *
 | 
          
            | 292 |      * @param array $data array of ("fieldname"=>value) of submitted data
 | 324 |      * @param array $data array of ("fieldname"=>value) of submitted data
 |