|
@@ -2234,8 +2234,6 @@ class Exercise
|
|
|
['onclick' => 'activate_start_date()']
|
|
|
);
|
|
|
|
|
|
- $var = self::selectTimeLimit();
|
|
|
-
|
|
|
if (!empty($this->start_time)) {
|
|
|
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
|
|
|
} else {
|
|
@@ -2377,6 +2375,17 @@ class Exercise
|
|
|
|
|
|
$skillList = Skill::addSkillsToForm($form, ITEM_TYPE_EXERCISE, $this->iId);
|
|
|
|
|
|
+ $extraField = new ExtraField('exercise');
|
|
|
+ $extraField->addElements(
|
|
|
+ $form,
|
|
|
+ $this->iId,
|
|
|
+ [], //exclude
|
|
|
+ false, // filter
|
|
|
+ false, // tag as select
|
|
|
+ [], //show only fields
|
|
|
+ [], // order fields
|
|
|
+ [] // extra data
|
|
|
+ );
|
|
|
$form->addElement('html', '</div>'); //End advanced setting
|
|
|
$form->addElement('html', '</div>');
|
|
|
}
|
|
@@ -2589,6 +2598,11 @@ class Exercise
|
|
|
|
|
|
$iId = $this->save($type);
|
|
|
if (!empty($iId)) {
|
|
|
+ $values = $form->getSubmitValues();
|
|
|
+ $values['item_id'] = $iId;
|
|
|
+ $extraFieldValue = new ExtraFieldValue('exercise');
|
|
|
+ $extraFieldValue->saveFieldValues($values);
|
|
|
+
|
|
|
Skill::saveSkills($form, ITEM_TYPE_EXERCISE, $iId);
|
|
|
}
|
|
|
}
|
|
@@ -8597,4 +8611,49 @@ 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;
|
|
|
+ }
|
|
|
}
|