/** * Gets the CSS classes (space-separated) for the Vacancies TD. * * @param tx_seminars_seminar $seminar the current seminar object * * @return string class attribute value filled with a list a space-separated CSS classes */ public function getVacanciesClasses(tx_seminars_seminar $seminar) { if (!$seminar->needsRegistration() || !$seminar->hasDate() && !$this->configGetter->getConfValueBoolean('allowRegistrationForEventsWithoutDate')) { return ''; } $classes = array(); if ($seminar->hasDate() && $seminar->hasStarted()) { $classes[] = 'event-begin-date-over'; } if ($seminar->hasVacancies()) { $classes[] = 'vacancies-available'; if ($seminar->hasUnlimitedVacancies()) { $classes[] = 'vacancies-unlimited'; } else { $classes[] = 'vacancies-' . $seminar->getVacancies(); } } else { $classes[] = 'vacancies-0'; if ($seminar->hasRegistrationQueue()) { $classes[] = 'has-registration-queue'; } } // We add this class in addition to the number of vacancies so that // user stylesheets still can use the number of vacancies even for // events for which the registration deadline is over. if ($seminar->hasDate() && $seminar->isRegistrationDeadlineOver()) { $classes[] = 'registration-deadline-over'; } $prefixedClasses = array_map(array($this, 'pi_getClassName'), $classes); return ' ' . implode(' ', $prefixedClasses); }
/** * Creates an e-mail introduction with the given event's title, date and * time prepended with the given introduction string. * * @param string $introductionBegin * the start of the introduction, must not be empty and contain %s as * place to fill the title of the event in * @param tx_seminars_seminar $event the event the introduction is for * * @return string the introduction with the event's title and if available * date and time, will not be empty */ public function createIntroduction($introductionBegin, tx_seminars_seminar $event) { $result = sprintf($introductionBegin, $event->getTitle()); if (!$event->hasDate()) { return $result; } $result .= ' ' . sprintf($this->translator->translate('email_eventDate'), $event->getDate('-')); if ($event->hasTime() && !$event->hasTimeslots()) { $timeToLabel = $this->translator->translate('email_timeTo'); $time = $event->getTime(' ' . $timeToLabel . ' '); $label = ' ' . (!$event->isOpenEnded() ? $this->translator->translate('email_timeFrom') : $this->translator->translate('email_timeAt')); $result .= sprintf($label, $time); } return $result; }
/** * Checks whether the given event allows registration, as far as its date is concerned. * * @param tx_seminars_seminar $event the event to check the registration for * * @return bool TRUE if the event allows registration by date, FALSE otherwise */ public function allowsRegistrationByDate(tx_seminars_seminar $event) { if ($event->hasDate()) { $result = !$event->isRegistrationDeadlineOver(); } else { $result = $event->getConfValueBoolean('allowRegistrationForEventsWithoutDate'); } return $result && $this->registrationHasStarted($event); }
/** * Creates an e-mail introduction with the given event's title, date and * time prepended with the given introduction string. * * @param string $introductionBegin * the start of the introduction, must not be empty and contain %s as * place to fill the title of the event in * @param tx_seminars_seminar $event the event the introduction is for * * @return string the introduction with the event's title and if available date and time, will not be empty * * @throws \InvalidArgumentException */ public function createIntroduction($introductionBegin, tx_seminars_seminar $event) { if ($introductionBegin === '') { throw new \InvalidArgumentException('$introductionBegin must not be empty.', 1440109640); } $result = sprintf($introductionBegin, $event->getTitle()); if (!$event->hasDate()) { return $result; } $result .= ' ' . sprintf($this->translator->translate('email_eventDate'), $event->getDate('-')); if ($event->hasTime() && !$event->hasTimeslots()) { $timeToLabelWithPlaceholders = $this->translator->translate('email_timeTo'); $time = $event->getTime(' ' . $timeToLabelWithPlaceholders . ' '); $label = ' ' . (!$event->isOpenEnded() ? $this->translator->translate('email_timeFrom') : $this->translator->translate('email_timeAt')); $result .= sprintf($label, $time); } return $result; }