|
@@ -2396,7 +2396,7 @@ class Exercise
|
|
|
|
|
|
$skillList = Skill::addSkillsToForm($form, ITEM_TYPE_EXERCISE, $this->iId);
|
|
|
|
|
|
- /*$extraField = new ExtraField('exercise');
|
|
|
+ $extraField = new ExtraField('exercise');
|
|
|
$extraField->addElements(
|
|
|
$form,
|
|
|
$this->iId,
|
|
@@ -2406,7 +2406,7 @@ class Exercise
|
|
|
[], //show only fields
|
|
|
[], // order fields
|
|
|
[] // extra data
|
|
|
- );*/
|
|
|
+ );
|
|
|
$form->addElement('html', '</div>'); //End advanced setting
|
|
|
$form->addElement('html', '</div>');
|
|
|
}
|
|
@@ -2678,10 +2678,10 @@ class Exercise
|
|
|
|
|
|
$iId = $this->save($type);
|
|
|
if (!empty($iId)) {
|
|
|
- /*$values = $form->getSubmitValues();
|
|
|
+ $values = $form->getSubmitValues();
|
|
|
$values['item_id'] = $iId;
|
|
|
$extraFieldValue = new ExtraFieldValue('exercise');
|
|
|
- $extraFieldValue->saveFieldValues($values);*/
|
|
|
+ $extraFieldValue->saveFieldValues($values);
|
|
|
|
|
|
Skill::saveSkills($form, ITEM_TYPE_EXERCISE, $iId);
|
|
|
}
|
|
@@ -9901,4 +9901,42 @@ class Exercise
|
|
|
|
|
|
return $group;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param array $exerciseResultInfo
|
|
|
+ *
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ public function hasResultsAccess($exerciseResultInfo)
|
|
|
+ {
|
|
|
+ $extraFieldValue = new ExtraFieldValue('exercise');
|
|
|
+ $value = $extraFieldValue->get_values_by_handler_and_field_variable(
|
|
|
+ $this->iId,
|
|
|
+ 'results_available_for_x_minutes'
|
|
|
+ );
|
|
|
+ if (!empty($value)) {
|
|
|
+ $value = (int) $value;
|
|
|
+ $endDate = new DateTime($exerciseResultInfo['exe_date']);
|
|
|
+ $endDate->add(new DateInterval('PT'.$value.'M'));
|
|
|
+ if (time() > $endDate->getTimestamp()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function getResultsAccess()
|
|
|
+ {
|
|
|
+ $extraFieldValue = new ExtraFieldValue('exercise');
|
|
|
+ $value = $extraFieldValue->get_values_by_handler_and_field_variable(
|
|
|
+ $this->iId,
|
|
|
+ 'results_available_for_x_minutes'
|
|
|
+ );
|
|
|
+ if (!empty($value)) {
|
|
|
+ return (int) $value;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|