public function test_arrays_same_at_key_missing_is_blank() { $this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array(), array(), 'key')); $this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array(), array('key' => 1), 'key')); $this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array(), 'key')); $this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => 1), 'key')); $this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => 2), 'key')); $this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array('key' => 1), array('key' => '1'), 'key')); $this->assertFalse(question_utils::arrays_same_at_key_missing_is_blank(array('key' => '0'), array('key' => ''), 'key')); $this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(array(), array('key' => ''), 'key')); }
public function is_same_response(array $prevresponse, array $newresponse) { if (array_key_exists('answer', $prevresponse) && $prevresponse['answer'] !== $this->responsetemplate) { $value1 = (string) $prevresponse['answer']; } else { $value1 = ''; } if (array_key_exists('answer', $newresponse) && $newresponse['answer'] !== $this->responsetemplate) { $value2 = (string) $newresponse['answer']; } else { $value2 = ''; } return $value1 === $value2 && ($this->attachments == 0 || question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'attachments')); }
public function is_same_response(array $prevresponse, array $newresponse) { if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer')) { return false; } if ($this->has_separate_unit_field()) { return question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'unit'); } return true; }
public function is_same_response(array $prevresponse, array $newresponse) { return question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer') && ($this->attachments == 0 || question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'attachments')); }
public function is_same_response(array $prevresponse, array $newresponse) { return question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer'); }
protected function is_same_prt_input($index, $prtinput1, $prtinput2) { foreach ($this->prts[$index]->get_required_variables(array_keys($this->inputs)) as $name) { if (!question_utils::arrays_same_at_key_missing_is_blank($prtinput1, $prtinput2, $name)) { return false; } } return true; }
public function is_same_response(array $prevresponse, array $newresponse) { foreach ($this->get_parameters() as $param) { if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer_' . $param)) { return false; } } return true; }
public function is_same_response(array $prevresponse, array $newresponse) { if (!question_utils::arrays_same_at_key_missing_is_blank( $prevresponse, $newresponse, 'answer')) { return false; } if ($this->unitdisplay == qtype_numerical::UNITSELECT) { return question_utils::arrays_same_at_key_missing_is_blank( $prevresponse, $newresponse, 'unit'); } return false; }
/** This function is used by the question engine to prevent regrading of * unchanged submissions. * * @param array $prevresponse * @param array $newresponse * @return boolean */ public function is_same_response(array $prevresponse, array $newresponse) { if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer') || !question_utils::arrays_same_at_key_integer($prevresponse, $newresponse, 'rating')) { return false; } return true; }