original_string: function get_valid_calendar_event_timestart_range(\calendar_event $event) {
          $instance = $this->get_instance();
          $submissionsfromdate = $instance->allowsubmissionsfromdate;
          $cutoffdate = $instance->cutoffdate;
          $duedate = $instance->duedate;
          $gradingduedate = $instance->gradingduedate;
          $mindate = null;
          $maxdate = null;
  
          if ($event->eventtype == ASSIGN_EVENT_TYPE_DUE) {
              // This check is in here because due date events are currently
              // the only events that can be overridden, so we can save a DB
              // query if we don't bother checking other events.
              if ($this->is_override_calendar_event($event)) {
                  // This is an override event so there is no valid timestart
                  // range to set it to.
                  return [false, false];
              }
  
              if ($submissionsfromdate) {
                  $mindate = [
                      $submissionsfromdate,
                      get_string('duedatevalidation', 'assign'),
                  ];
              }
  
              if ($cutoffdate) {
                  $maxdate = [
                      $cutoffdate,
                      get_string('cutoffdatevalidation', 'assign'),
                  ];
              }
  
              if ($gradingduedate) {
                  // If we don't have a cutoff date or we've got a grading due date
                  // that is earlier than the cutoff then we should use that as the
                  // upper limit for the due date.
                  if (!$cutoffdate || $gradingduedate < $cutoffdate) {
                      $maxdate = [
                          $gradingduedate,
                          get_string('gradingdueduedatevalidation', 'assign'),
                      ];
                  }
              }
          } else if ($event->eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE) {
              if ($duedate) {
                  $mindate = [
                      $duedate,
                      get_string('gradingdueduedatevalidation', 'assign'),
                  ];
              } else if ($submissionsfromdate) {
                  $mindate = [
                      $submissionsfromdate,
                      get_string('gradingduefromdatevalidation', 'assign'),
                  ];
              }
          }
  
          return [$mindate, $maxdate];
      }
code: function get_valid_calendar_event_timestart_range(\calendar_event $event) {
          $instance = $this->get_instance();
          $submissionsfromdate = $instance->allowsubmissionsfromdate;
          $cutoffdate = $instance->cutoffdate;
          $duedate = $instance->duedate;
          $gradingduedate = $instance->gradingduedate;
          $mindate = null;
          $maxdate = null;
  
          if ($event->eventtype == ASSIGN_EVENT_TYPE_DUE) {
              // This check is in here because due date events are currently
              // the only events that can be overridden, so we can save a DB
              // query if we don't bother checking other events.
              if ($this->is_override_calendar_event($event)) {
                  // This is an override event so there is no valid timestart
                  // range to set it to.
                  return [false, false];
              }
  
              if ($submissionsfromdate) {
                  $mindate = [
                      $submissionsfromdate,
                      get_string('duedatevalidation', 'assign'),
                  ];
              }
  
              if ($cutoffdate) {
                  $maxdate = [
                      $cutoffdate,
                      get_string('cutoffdatevalidation', 'assign'),
                  ];
              }
  
              if ($gradingduedate) {
                  // If we don't have a cutoff date or we've got a grading due date
                  // that is earlier than the cutoff then we should use that as the
                  // upper limit for the due date.
                  if (!$cutoffdate || $gradingduedate < $cutoffdate) {
                      $maxdate = [
                          $gradingduedate,
                          get_string('gradingdueduedatevalidation', 'assign'),
                      ];
                  }
              }
          } else if ($event->eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE) {
              if ($duedate) {
                  $mindate = [
                      $duedate,
                      get_string('gradingdueduedatevalidation', 'assign'),
                  ];
              } else if ($submissionsfromdate) {
                  $mindate = [
                      $submissionsfromdate,
                      get_string('gradingduefromdatevalidation', 'assign'),
                  ];
              }
          }
  
          return [$mindate, $maxdate];
      }
code_tokens: function get_valid_calendar_event_timestart_range ( \ calendar_event $ event ) { $ instance = $ this -> get_instance ( ) ; $ submissionsfromdate = $ instance -> allowsubmissionsfromdate ; $ cutoffdate = $ instance -> cutoffdate ; $ duedate = $ instance -> duedate ; $ gradingduedate = $ instance -> gradingduedate ; $ mindate = null ; $ maxdate = null ; if ( $ event -> eventtype == ASSIGN_EVENT_TYPE_DUE ) { // This check is in here because due date events are currently // the only events that can be overridden, so we can save a DB // query if we don't bother checking other events. if ( $ this -> is_override_calendar_event ( $ event ) ) { // This is an override event so there is no valid timestart // range to set it to. return [ false , false ] ; } if ( $ submissionsfromdate ) { $ mindate = [ $ submissionsfromdate , get_string ( 'duedatevalidation' , 'assign' ) , ] ; } if ( $ cutoffdate ) { $ maxdate = [ $ cutoffdate , get_string ( 'cutoffdatevalidation' , 'assign' ) , ] ; } if ( $ gradingduedate ) { // If we don't have a cutoff date or we've got a grading due date // that is earlier than the cutoff then we should use that as the // upper limit for the due date. if ( ! $ cutoffdate || $ gradingduedate < $ cutoffdate ) { $ maxdate = [ $ gradingduedate , get_string ( 'gradingdueduedatevalidation' , 'assign' ) , ] ; } } } else if ( $ event -> eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE ) { if ( $ duedate ) { $ mindate = [ $ duedate , get_string ( 'gradingdueduedatevalidation' , 'assign' ) , ] ; } else if ( $ submissionsfromdate ) { $ mindate = [ $ submissionsfromdate , get_string ( 'gradingduefromdatevalidation' , 'assign' ) , ] ; } } return [ $ mindate , $ maxdate ] ; }
docstring: This function calculates the minimum and maximum cutoff values for the timestart of
  the given event.
  
  It will return an array with two values, the first being the minimum cutoff value and
  the second being the maximum cutoff value. Either or both values can be null, which
  indicates there is no minimum or maximum, respectively.
  
  If a cutoff is required then the function must return an array containing the cutoff
  timestamp and error string to display to the user if the cutoff value is violated.
  
  A minimum and maximum cutoff return value will look like:
  [
  [1505704373, 'The due date must be after the sbumission start date'],
  [1506741172, 'The due date must be before the cutoff date']
  ]
  
  If the event does not have a valid timestart range then [false, false] will
  be returned.
  
  @param calendar_event $event The calendar event to get the time range for
  @return array
docstring_tokens: This function calculates the minimum and maximum cutoff values for the timestart of the given event .