Пример #1
0
 protected function _update_next_deadline()
 {
     $rel_valid = $this->time_scheduled->is_valid();
     $test_valid = $this->time_testing_scheduled->is_valid();
     if ($rel_valid) {
         if ($test_valid) {
             if ($this->time_scheduled->less_than($this->time_testing_scheduled)) {
                 $this->time_next_deadline = $this->time_scheduled;
             } else {
                 $this->time_next_deadline = $this->time_testing_scheduled;
             }
         } else {
             $this->time_next_deadline = $this->time_scheduled;
         }
     } else {
         if ($test_valid) {
             $this->time_next_deadline = $this->time_testing_scheduled;
         } else {
             $this->time_next_deadline->clear();
         }
     }
 }
Пример #2
0
 /**
  * Does this form hold valid data for this album?
  * @param ALBUM $obj
  * @access private
  */
 protected function _post_validate($obj)
 {
     parent::_post_validate($obj);
     /** @var DATE_TIME $first_day_value */
     $first_day_value = $this->value_for('first_day');
     /** @var DATE_TIME $last_day_value */
     $last_day_value = $this->value_for('last_day');
     switch ($this->value_for('date_style')) {
         case Album_is_journal:
             $now = new DATE_TIME();
             if ($now->less_than($first_day_value)) {
                 $this->record_error('first_day', 'First day of a journal cannot be in the future.');
             }
             break;
         case Album_is_span:
             if ($last_day_value->less_than($first_day_value)) {
                 $this->record_error('last_day', 'First day must come before the last day.');
             }
             break;
     }
     if ($this->value_for('constrain_picture_size') && ($this->value_for('max_picture_width') == 0 || $this->value_for('max_picture_width') == 0)) {
         $this->record_error('picture', 'Please make sure that both picture width and height are greater than 0.');
     }
 }