19declare(strict_types=1);
32 protected \ilDBInterface
$db;
40 $this->set_factory =
$data->settings();
48 public function hasEnded(array $survey_ids): array
53 "SELECT survey_id, enddate FROM svy_svy " .
54 " WHERE " .
$db->
in(
"survey_id", $survey_ids,
false,
"integer"),
60 $has_ended[(
int) $rec[
"survey_id"]] = !((
int) $rec[
"enddate"] === 0 || $this->
toUnixTS($rec[
"enddate"]) > time());
75 "SELECT survey_id, obj_fi FROM svy_svy " .
76 " WHERE " .
$db->
in(
"survey_id", $survey_ids,
false,
"integer"),
82 $obj_ids[(
int) $rec[
"survey_id"]] = (
int) $rec[
"obj_fi"];
95 if ($date > 0 && preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $date, $matches)) {
96 return (
int) mktime((
int) $matches[4], (
int) $matches[5], (
int) $matches[6], (
int) $matches[2], (
int) $matches[3], (
int) $matches[1]);
111 "SELECT startdate, enddate, anonymize, survey_id FROM svy_svy " .
112 " WHERE " . $db->in(
"survey_id", $survey_ids,
false,
"integer"),
117 while ($rec = $db->fetchAssoc($set)) {
118 $settings[(
int) $rec[
"survey_id"]] = $this->set_factory->accessSettings(
119 $this->toUnixTS($rec[
"startdate"] ??
''),
120 $this->toUnixTS($rec[
"enddate"] ??
''),
121 in_array($rec[
"anonymize"], [
"1",
"3"],
true)
Survey internal data service.
Survey settings db repository.
__construct(InternalDataService $data, \ilDBInterface $db)
SettingsFactory $set_factory
hasEnded(array $survey_ids)
Check if surveys have ended.
toUnixTS(string $date)
Unix time from survey date.
getAccessSettings(array $survey_ids)
getObjIdsForSurveyIds(array $survey_ids)
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")
if(!file_exists('../ilias.ini.php'))