| Total Complexity | 176 |
| Total Lines | 1783 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like Event often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Event, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 27 | class Event extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * @var \DateTime |
||
| 31 | */ |
||
| 32 | protected $tstamp; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var bool |
||
| 36 | */ |
||
| 37 | protected $hidden = false; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var \DateTime |
||
| 41 | */ |
||
| 42 | protected $starttime; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var \DateTime |
||
| 46 | */ |
||
| 47 | protected $endtime; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Title |
||
| 51 | * |
||
| 52 | * @var string |
||
| 53 | */ |
||
| 54 | protected $title = ''; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Teaser |
||
| 58 | * |
||
| 59 | * @var string |
||
| 60 | */ |
||
| 61 | protected $teaser = ''; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Description |
||
| 65 | * |
||
| 66 | * @var string |
||
| 67 | */ |
||
| 68 | protected $description = ''; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Program/Schedule |
||
| 72 | * |
||
| 73 | * @var string |
||
| 74 | */ |
||
| 75 | protected $program = ''; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Custom Text |
||
| 79 | * |
||
| 80 | * @var string |
||
| 81 | */ |
||
| 82 | protected $customText = ''; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Startdate and time |
||
| 86 | * |
||
| 87 | * @var \DateTime |
||
| 88 | */ |
||
| 89 | protected $startdate; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Enddate and time |
||
| 93 | * |
||
| 94 | * @var \DateTime |
||
| 95 | */ |
||
| 96 | protected $enddate; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * Max participants |
||
| 100 | * |
||
| 101 | * @var int |
||
| 102 | */ |
||
| 103 | protected $maxParticipants = 0; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Max registrations per user |
||
| 107 | * |
||
| 108 | * @var int |
||
| 109 | */ |
||
| 110 | protected $maxRegistrationsPerUser = 1; |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Price |
||
| 114 | * |
||
| 115 | * @var float |
||
| 116 | */ |
||
| 117 | protected $price = 0.0; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Currency |
||
| 121 | * |
||
| 122 | * @var string |
||
| 123 | */ |
||
| 124 | protected $currency = ''; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * Enable payment |
||
| 128 | * |
||
| 129 | * @var bool |
||
| 130 | */ |
||
| 131 | protected $enablePayment = false; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * Restrict payment methods |
||
| 135 | * |
||
| 136 | * @var bool |
||
| 137 | */ |
||
| 138 | protected $restrictPaymentMethods = false; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Selected payment methods |
||
| 142 | * |
||
| 143 | * @var string |
||
| 144 | */ |
||
| 145 | protected $selectedPaymentMethods = ''; |
||
| 146 | |||
| 147 | /** |
||
| 148 | * Category |
||
| 149 | * |
||
| 150 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Category> |
||
| 151 | * @Extbase\ORM\Lazy |
||
| 152 | */ |
||
| 153 | protected $category; |
||
| 154 | |||
| 155 | /** |
||
| 156 | * Related |
||
| 157 | * |
||
| 158 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Event> |
||
| 159 | * @Extbase\ORM\Lazy |
||
| 160 | */ |
||
| 161 | protected $related; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * Registration |
||
| 165 | * |
||
| 166 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration> |
||
| 167 | * @Extbase\ORM\Cascade("remove") |
||
| 168 | * @Extbase\ORM\Lazy |
||
| 169 | */ |
||
| 170 | protected $registration; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * Registration waitlist |
||
| 174 | * |
||
| 175 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration> |
||
| 176 | * @Extbase\ORM\Lazy |
||
| 177 | */ |
||
| 178 | protected $registrationWaitlist; |
||
| 179 | |||
| 180 | /** |
||
| 181 | * Registration fields |
||
| 182 | * |
||
| 183 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration\Field> |
||
| 184 | * @Extbase\ORM\Lazy |
||
| 185 | */ |
||
| 186 | protected $registrationFields; |
||
| 187 | |||
| 188 | /** |
||
| 189 | * Registration start date |
||
| 190 | * |
||
| 191 | * @var \DateTime |
||
| 192 | */ |
||
| 193 | protected $registrationStartdate; |
||
| 194 | |||
| 195 | /** |
||
| 196 | * Registration deadline date |
||
| 197 | * |
||
| 198 | * @var \DateTime |
||
| 199 | */ |
||
| 200 | protected $registrationDeadline; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * The image |
||
| 204 | * |
||
| 205 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 206 | * @Extbase\ORM\Lazy |
||
| 207 | */ |
||
| 208 | protected $image; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * Additional files |
||
| 212 | * |
||
| 213 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 214 | * @Extbase\ORM\Lazy |
||
| 215 | */ |
||
| 216 | protected $files; |
||
| 217 | |||
| 218 | /** |
||
| 219 | * The Location |
||
| 220 | * |
||
| 221 | * @var \DERHANSEN\SfEventMgt\Domain\Model\Location |
||
| 222 | */ |
||
| 223 | protected $location; |
||
| 224 | |||
| 225 | /** |
||
| 226 | * Room |
||
| 227 | * |
||
| 228 | * @var string |
||
| 229 | */ |
||
| 230 | protected $room; |
||
| 231 | |||
| 232 | /** |
||
| 233 | * Enable registration |
||
| 234 | * |
||
| 235 | * @var bool |
||
| 236 | */ |
||
| 237 | protected $enableRegistration = false; |
||
| 238 | |||
| 239 | /** |
||
| 240 | * Enable waitlist |
||
| 241 | * |
||
| 242 | * @var bool |
||
| 243 | */ |
||
| 244 | protected $enableWaitlist = false; |
||
| 245 | |||
| 246 | /** |
||
| 247 | * Enable waitlist |
||
| 248 | * |
||
| 249 | * @var bool |
||
| 250 | */ |
||
| 251 | protected $enableWaitlistMoveup = false; |
||
| 252 | |||
| 253 | /** |
||
| 254 | * Link |
||
| 255 | * |
||
| 256 | * @var string |
||
| 257 | */ |
||
| 258 | protected $link; |
||
| 259 | |||
| 260 | /** |
||
| 261 | * Top event |
||
| 262 | * |
||
| 263 | * @var bool |
||
| 264 | */ |
||
| 265 | protected $topEvent = false; |
||
| 266 | |||
| 267 | /** |
||
| 268 | * The additionalImage |
||
| 269 | * |
||
| 270 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 271 | * @Extbase\ORM\Lazy |
||
| 272 | */ |
||
| 273 | protected $additionalImage; |
||
| 274 | |||
| 275 | /** |
||
| 276 | * The organisator |
||
| 277 | * |
||
| 278 | * @var \DERHANSEN\SfEventMgt\Domain\Model\Organisator |
||
| 279 | */ |
||
| 280 | protected $organisator; |
||
| 281 | |||
| 282 | /** |
||
| 283 | * Notify admin |
||
| 284 | * |
||
| 285 | * @var bool |
||
| 286 | */ |
||
| 287 | protected $notifyAdmin = true; |
||
| 288 | |||
| 289 | /** |
||
| 290 | * Notify organisator |
||
| 291 | * |
||
| 292 | * @var bool |
||
| 293 | */ |
||
| 294 | protected $notifyOrganisator = false; |
||
| 295 | |||
| 296 | /** |
||
| 297 | * Enable cancel of registration |
||
| 298 | * |
||
| 299 | * @var bool |
||
| 300 | */ |
||
| 301 | protected $enableCancel = false; |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Deadline for cancel |
||
| 305 | * |
||
| 306 | * @var \DateTime |
||
| 307 | */ |
||
| 308 | protected $cancelDeadline; |
||
| 309 | |||
| 310 | /** |
||
| 311 | * Enable auto confirmation |
||
| 312 | * |
||
| 313 | * @var bool |
||
| 314 | */ |
||
| 315 | protected $enableAutoconfirm = false; |
||
| 316 | |||
| 317 | /** |
||
| 318 | * Unique email check |
||
| 319 | * |
||
| 320 | * @var bool |
||
| 321 | */ |
||
| 322 | protected $uniqueEmailCheck = false; |
||
| 323 | |||
| 324 | /** |
||
| 325 | * @var string |
||
| 326 | */ |
||
| 327 | protected $metaKeywords = ''; |
||
| 328 | |||
| 329 | /** |
||
| 330 | * @var string |
||
| 331 | */ |
||
| 332 | protected $metaDescription = ''; |
||
| 333 | |||
| 334 | /** |
||
| 335 | * @var string |
||
| 336 | */ |
||
| 337 | protected $alternativeTitle = ''; |
||
| 338 | |||
| 339 | /** |
||
| 340 | * Price options |
||
| 341 | * |
||
| 342 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\PriceOption> |
||
| 343 | * @Extbase\ORM\Cascade("remove") |
||
| 344 | * @Extbase\ORM\Lazy |
||
| 345 | */ |
||
| 346 | protected $priceOptions; |
||
| 347 | |||
| 348 | /** |
||
| 349 | * Speaker |
||
| 350 | * |
||
| 351 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Speaker> |
||
| 352 | * @Extbase\ORM\Lazy |
||
| 353 | */ |
||
| 354 | protected $speaker; |
||
| 355 | |||
| 356 | /** |
||
| 357 | * Constructor |
||
| 358 | */ |
||
| 359 | public function __construct() |
||
| 360 | { |
||
| 361 | $this->category = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 362 | $this->related = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 363 | $this->registration = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 364 | $this->registrationWaitlist = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 365 | $this->registrationFields = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 366 | $this->image = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 367 | $this->files = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 368 | $this->additionalImage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 369 | $this->priceOptions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 370 | $this->speaker = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * Get timestamp |
||
| 375 | * |
||
| 376 | * @return \DateTime |
||
| 377 | */ |
||
| 378 | public function getTstamp() |
||
| 379 | { |
||
| 380 | return $this->tstamp; |
||
| 381 | } |
||
| 382 | |||
| 383 | /** |
||
| 384 | * Set time stamp |
||
| 385 | * |
||
| 386 | * @param \DateTime $tstamp time stamp |
||
| 387 | */ |
||
| 388 | public function setTstamp($tstamp) |
||
| 389 | { |
||
| 390 | $this->tstamp = $tstamp; |
||
| 391 | } |
||
| 392 | |||
| 393 | /** |
||
| 394 | * Get hidden flag |
||
| 395 | * |
||
| 396 | * @return bool |
||
| 397 | */ |
||
| 398 | public function getHidden() |
||
| 399 | { |
||
| 400 | return $this->hidden; |
||
| 401 | } |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Set hidden flag |
||
| 405 | * |
||
| 406 | * @param bool $hidden hidden flag |
||
| 407 | */ |
||
| 408 | public function setHidden($hidden) |
||
| 409 | { |
||
| 410 | $this->hidden = $hidden; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * Get start time |
||
| 415 | * |
||
| 416 | * @return \DateTime |
||
| 417 | */ |
||
| 418 | public function getStarttime() |
||
| 419 | { |
||
| 420 | return $this->starttime; |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * Set start time |
||
| 425 | * |
||
| 426 | * @param \DateTime $starttime start time |
||
| 427 | */ |
||
| 428 | public function setStarttime($starttime) |
||
| 429 | { |
||
| 430 | $this->starttime = $starttime; |
||
| 431 | } |
||
| 432 | |||
| 433 | /** |
||
| 434 | * Get endtime |
||
| 435 | * |
||
| 436 | * @return \DateTime |
||
| 437 | */ |
||
| 438 | public function getEndtime() |
||
| 439 | { |
||
| 440 | return $this->endtime; |
||
| 441 | } |
||
| 442 | |||
| 443 | /** |
||
| 444 | * Set end time |
||
| 445 | * |
||
| 446 | * @param \DateTime $endtime end time |
||
| 447 | */ |
||
| 448 | public function setEndtime($endtime) |
||
| 449 | { |
||
| 450 | $this->endtime = $endtime; |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * Returns the title |
||
| 455 | * |
||
| 456 | * @return string $title |
||
| 457 | */ |
||
| 458 | public function getTitle() |
||
| 459 | { |
||
| 460 | return $this->title; |
||
| 461 | } |
||
| 462 | |||
| 463 | /** |
||
| 464 | * Sets the title |
||
| 465 | * |
||
| 466 | * @param string $title Title |
||
| 467 | */ |
||
| 468 | public function setTitle($title) |
||
| 469 | { |
||
| 470 | $this->title = $title; |
||
| 471 | } |
||
| 472 | |||
| 473 | /** |
||
| 474 | * Returns the teaser |
||
| 475 | * |
||
| 476 | * @return string |
||
| 477 | */ |
||
| 478 | public function getTeaser() |
||
| 479 | { |
||
| 480 | return $this->teaser; |
||
| 481 | } |
||
| 482 | |||
| 483 | /** |
||
| 484 | * Sets the teaser |
||
| 485 | * |
||
| 486 | * @param string $teaser Teaser |
||
| 487 | */ |
||
| 488 | public function setTeaser($teaser) |
||
| 489 | { |
||
| 490 | $this->teaser = $teaser; |
||
| 491 | } |
||
| 492 | |||
| 493 | /** |
||
| 494 | * Returns the description |
||
| 495 | * |
||
| 496 | * @return string $description |
||
| 497 | */ |
||
| 498 | public function getDescription() |
||
| 499 | { |
||
| 500 | return $this->description; |
||
| 501 | } |
||
| 502 | |||
| 503 | /** |
||
| 504 | * Sets the description |
||
| 505 | * |
||
| 506 | * @param string $description Description |
||
| 507 | */ |
||
| 508 | public function setDescription($description) |
||
| 509 | { |
||
| 510 | $this->description = $description; |
||
| 511 | } |
||
| 512 | |||
| 513 | /** |
||
| 514 | * Returns the program |
||
| 515 | * |
||
| 516 | * @return string $program |
||
| 517 | */ |
||
| 518 | public function getProgram() |
||
| 519 | { |
||
| 520 | return $this->program; |
||
| 521 | } |
||
| 522 | |||
| 523 | /** |
||
| 524 | * Sets the program |
||
| 525 | * |
||
| 526 | * @param string $program The program |
||
| 527 | */ |
||
| 528 | public function setProgram($program) |
||
| 529 | { |
||
| 530 | $this->program = $program; |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @return string |
||
| 535 | */ |
||
| 536 | public function getCustomText() |
||
| 537 | { |
||
| 538 | return $this->customText; |
||
| 539 | } |
||
| 540 | |||
| 541 | /** |
||
| 542 | * @param string $customText |
||
| 543 | */ |
||
| 544 | public function setCustomText($customText) |
||
| 545 | { |
||
| 546 | $this->customText = $customText; |
||
| 547 | } |
||
| 548 | |||
| 549 | /** |
||
| 550 | * Returns the startdate |
||
| 551 | * |
||
| 552 | * @return \DateTime $startdate |
||
| 553 | */ |
||
| 554 | public function getStartdate() |
||
| 555 | { |
||
| 556 | return $this->startdate; |
||
| 557 | } |
||
| 558 | |||
| 559 | /** |
||
| 560 | * Sets the startdate |
||
| 561 | * |
||
| 562 | * @param \DateTime $startdate Startdate |
||
| 563 | */ |
||
| 564 | public function setStartdate(\DateTime $startdate) |
||
| 565 | { |
||
| 566 | $this->startdate = $startdate; |
||
| 567 | } |
||
| 568 | |||
| 569 | /** |
||
| 570 | * Returns the enddate |
||
| 571 | * |
||
| 572 | * @return \DateTime $enddate |
||
| 573 | */ |
||
| 574 | public function getEnddate() |
||
| 575 | { |
||
| 576 | return $this->enddate; |
||
| 577 | } |
||
| 578 | |||
| 579 | /** |
||
| 580 | * Sets the enddate |
||
| 581 | * |
||
| 582 | * @param \DateTime $enddate Enddate |
||
| 583 | */ |
||
| 584 | public function setEnddate(\DateTime $enddate) |
||
| 585 | { |
||
| 586 | $this->enddate = $enddate; |
||
| 587 | } |
||
| 588 | |||
| 589 | /** |
||
| 590 | * Returns the participants |
||
| 591 | * |
||
| 592 | * @return int $participants |
||
| 593 | */ |
||
| 594 | public function getMaxParticipants() |
||
| 595 | { |
||
| 596 | return $this->maxParticipants; |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Sets the participants |
||
| 601 | * |
||
| 602 | * @param int $participants Participants |
||
| 603 | */ |
||
| 604 | public function setMaxParticipants($participants) |
||
| 605 | { |
||
| 606 | $this->maxParticipants = $participants; |
||
| 607 | } |
||
| 608 | |||
| 609 | /** |
||
| 610 | * Returns the price |
||
| 611 | * |
||
| 612 | * @return float $price |
||
| 613 | */ |
||
| 614 | public function getPrice() |
||
| 615 | { |
||
| 616 | return $this->price; |
||
| 617 | } |
||
| 618 | |||
| 619 | /** |
||
| 620 | * Sets the price |
||
| 621 | * |
||
| 622 | * @param float $price Price |
||
| 623 | */ |
||
| 624 | public function setPrice($price) |
||
| 625 | { |
||
| 626 | $this->price = $price; |
||
| 627 | } |
||
| 628 | |||
| 629 | /** |
||
| 630 | * Returns the currency |
||
| 631 | * |
||
| 632 | * @return string $currency |
||
| 633 | */ |
||
| 634 | public function getCurrency() |
||
| 635 | { |
||
| 636 | return $this->currency; |
||
| 637 | } |
||
| 638 | |||
| 639 | /** |
||
| 640 | * Sets the currency |
||
| 641 | * |
||
| 642 | * @param string $currency Currency |
||
| 643 | */ |
||
| 644 | public function setCurrency($currency) |
||
| 645 | { |
||
| 646 | $this->currency = $currency; |
||
| 647 | } |
||
| 648 | |||
| 649 | /** |
||
| 650 | * Returns if payment is enabled |
||
| 651 | * |
||
| 652 | * @return bool |
||
| 653 | */ |
||
| 654 | public function getEnablePayment() |
||
| 655 | { |
||
| 656 | return $this->enablePayment; |
||
| 657 | } |
||
| 658 | |||
| 659 | /** |
||
| 660 | * Sets enablePayment |
||
| 661 | * |
||
| 662 | * @param bool $enablePayment |
||
| 663 | */ |
||
| 664 | public function setEnablePayment($enablePayment) |
||
| 665 | { |
||
| 666 | $this->enablePayment = $enablePayment; |
||
| 667 | } |
||
| 668 | |||
| 669 | /** |
||
| 670 | * Returns if payment methods should be restricted |
||
| 671 | * |
||
| 672 | * @return bool |
||
| 673 | */ |
||
| 674 | public function getRestrictPaymentMethods() |
||
| 675 | { |
||
| 676 | return $this->restrictPaymentMethods; |
||
| 677 | } |
||
| 678 | |||
| 679 | /** |
||
| 680 | * Sets if payment methods should be restricted |
||
| 681 | * |
||
| 682 | * @param bool $restrictPaymentMethods |
||
| 683 | */ |
||
| 684 | public function setRestrictPaymentMethods($restrictPaymentMethods) |
||
| 685 | { |
||
| 686 | $this->restrictPaymentMethods = $restrictPaymentMethods; |
||
| 687 | } |
||
| 688 | |||
| 689 | /** |
||
| 690 | * Returns selected payment methods |
||
| 691 | * |
||
| 692 | * @return string |
||
| 693 | */ |
||
| 694 | public function getSelectedPaymentMethods() |
||
| 695 | { |
||
| 696 | return $this->selectedPaymentMethods; |
||
| 697 | } |
||
| 698 | |||
| 699 | /** |
||
| 700 | * Sets selected payment methods |
||
| 701 | * |
||
| 702 | * @param string $selectedPaymentMethods |
||
| 703 | */ |
||
| 704 | public function setSelectedPaymentMethods($selectedPaymentMethods) |
||
| 705 | { |
||
| 706 | $this->selectedPaymentMethods = $selectedPaymentMethods; |
||
| 707 | } |
||
| 708 | |||
| 709 | /** |
||
| 710 | * Adds a Category |
||
| 711 | * |
||
| 712 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Category $category Category |
||
| 713 | */ |
||
| 714 | public function addCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $category) |
||
| 715 | { |
||
| 716 | $this->category->attach($category); |
||
| 717 | } |
||
| 718 | |||
| 719 | /** |
||
| 720 | * Removes a Category |
||
| 721 | * |
||
| 722 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove The Category to be removed |
||
| 723 | */ |
||
| 724 | public function removeCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove) |
||
| 725 | { |
||
| 726 | $this->category->detach($categoryToRemove); |
||
| 727 | } |
||
| 728 | |||
| 729 | /** |
||
| 730 | * Returns the category |
||
| 731 | * |
||
| 732 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 733 | */ |
||
| 734 | public function getCategory() |
||
| 735 | { |
||
| 736 | return $this->category; |
||
| 737 | } |
||
| 738 | |||
| 739 | /** |
||
| 740 | * Returns the category |
||
| 741 | * |
||
| 742 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 743 | */ |
||
| 744 | public function getCategories() |
||
| 745 | { |
||
| 746 | return $this->category; |
||
| 747 | } |
||
| 748 | |||
| 749 | /** |
||
| 750 | * Sets the category |
||
| 751 | * |
||
| 752 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $category Category |
||
| 753 | */ |
||
| 754 | public function setCategory(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $category) |
||
| 755 | { |
||
| 756 | $this->category = $category; |
||
| 757 | } |
||
| 758 | |||
| 759 | /** |
||
| 760 | * Returns related events |
||
| 761 | * |
||
| 762 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 763 | */ |
||
| 764 | public function getRelated() |
||
| 765 | { |
||
| 766 | return $this->related; |
||
| 767 | } |
||
| 768 | |||
| 769 | /** |
||
| 770 | * Sets related events |
||
| 771 | * |
||
| 772 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $related |
||
| 773 | */ |
||
| 774 | public function setRelated($related) |
||
| 775 | { |
||
| 776 | $this->related = $related; |
||
| 777 | } |
||
| 778 | |||
| 779 | /** |
||
| 780 | * Adds a related event |
||
| 781 | * |
||
| 782 | * @param Event $event |
||
| 783 | */ |
||
| 784 | public function addRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event) |
||
| 785 | { |
||
| 786 | $this->related->attach($event); |
||
| 787 | } |
||
| 788 | |||
| 789 | /** |
||
| 790 | * Removes a related event |
||
| 791 | * |
||
| 792 | * @param Event $event |
||
| 793 | */ |
||
| 794 | public function removeRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event) |
||
| 795 | { |
||
| 796 | $this->related->detach($event); |
||
| 797 | } |
||
| 798 | |||
| 799 | /** |
||
| 800 | * Adds a Registration |
||
| 801 | * |
||
| 802 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration |
||
| 803 | */ |
||
| 804 | public function addRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration) |
||
| 805 | { |
||
| 806 | $this->registration->attach($registration); |
||
| 807 | } |
||
| 808 | |||
| 809 | /** |
||
| 810 | * Removes a Registration |
||
| 811 | * |
||
| 812 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration |
||
| 813 | */ |
||
| 814 | public function removeRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove) |
||
| 815 | { |
||
| 816 | $this->registration->detach($registrationToRemove); |
||
| 817 | } |
||
| 818 | |||
| 819 | /** |
||
| 820 | * Returns the Registration |
||
| 821 | * |
||
| 822 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration |
||
| 823 | */ |
||
| 824 | public function getRegistration() |
||
| 825 | { |
||
| 826 | return $this->registration; |
||
| 827 | } |
||
| 828 | |||
| 829 | /** |
||
| 830 | * Sets the Registration |
||
| 831 | * |
||
| 832 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration |
||
| 833 | */ |
||
| 834 | public function setRegistration(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration) |
||
| 835 | { |
||
| 836 | $this->registration = $registration; |
||
| 837 | } |
||
| 838 | |||
| 839 | /** |
||
| 840 | * Adds an image |
||
| 841 | * |
||
| 842 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image Image |
||
| 843 | */ |
||
| 844 | public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) |
||
| 845 | { |
||
| 846 | $this->image->attach($image); |
||
| 847 | } |
||
| 848 | |||
| 849 | /** |
||
| 850 | * Removes an image |
||
| 851 | * |
||
| 852 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove Image |
||
| 853 | */ |
||
| 854 | public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove) |
||
| 855 | { |
||
| 856 | $this->image->detach($imageToRemove); |
||
| 857 | } |
||
| 858 | |||
| 859 | /** |
||
| 860 | * Returns all items of the field image |
||
| 861 | * |
||
| 862 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $image |
||
| 863 | */ |
||
| 864 | public function getImage() |
||
| 865 | { |
||
| 866 | return $this->image; |
||
| 867 | } |
||
| 868 | |||
| 869 | /** |
||
| 870 | * Special getter to return images when accesses as {event.images} |
||
| 871 | * |
||
| 872 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 873 | */ |
||
| 874 | public function getImages() |
||
| 875 | { |
||
| 876 | return $this->image; |
||
| 877 | } |
||
| 878 | |||
| 879 | /** |
||
| 880 | * Returns all image items configured for list view |
||
| 881 | * |
||
| 882 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 883 | */ |
||
| 884 | public function getListViewImages() |
||
| 885 | { |
||
| 886 | return $this->getImagesByType(ShowInPreviews::LIST_VIEWS); |
||
| 887 | } |
||
| 888 | |||
| 889 | /** |
||
| 890 | * Returns the first list view image as file reference object |
||
| 891 | * |
||
| 892 | * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference|null |
||
| 893 | */ |
||
| 894 | public function getFirstListViewImage() |
||
| 895 | { |
||
| 896 | $images = $this->getImagesByType(ShowInPreviews::LIST_VIEWS); |
||
| 897 | $image = $images->current(); |
||
| 898 | |||
| 899 | if (is_a($image, \TYPO3\CMS\Extbase\Domain\Model\FileReference::class)) { |
||
| 900 | return $image; |
||
| 901 | } else { |
||
| 902 | return null; |
||
| 903 | } |
||
| 904 | } |
||
| 905 | |||
| 906 | /** |
||
| 907 | * Returns all image items configured for list view |
||
| 908 | * |
||
| 909 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 910 | */ |
||
| 911 | public function getDetailViewImages() |
||
| 912 | { |
||
| 913 | return $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS); |
||
| 914 | } |
||
| 915 | |||
| 916 | /** |
||
| 917 | * Returns the first detail view image as file reference object |
||
| 918 | * |
||
| 919 | * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference|null |
||
| 920 | */ |
||
| 921 | public function getFirstDetailViewImage() |
||
| 922 | { |
||
| 923 | $images = $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS); |
||
| 924 | $image = $images->current(); |
||
| 925 | |||
| 926 | if (is_a($image, \TYPO3\CMS\Extbase\Domain\Model\FileReference::class)) { |
||
| 927 | return $image; |
||
| 928 | } else { |
||
| 929 | return null; |
||
| 930 | } |
||
| 931 | } |
||
| 932 | |||
| 933 | /** |
||
| 934 | * Returns all image items by the given type |
||
| 935 | * |
||
| 936 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
||
| 937 | */ |
||
| 938 | protected function getImagesByType(int $type) |
||
| 939 | { |
||
| 940 | $result = new ObjectStorage(); |
||
| 941 | |||
| 942 | foreach ($this->image as $image) { |
||
| 943 | /** @var FileReference $fileReference */ |
||
| 944 | $fileReference = $image->getOriginalResource(); |
||
|
|
|||
| 945 | if ($fileReference && $fileReference->hasProperty('show_in_views') && |
||
| 946 | in_array($fileReference->getProperty('show_in_views'), [$type, ShowInPreviews::ALL_VIEWS]) |
||
| 947 | ) { |
||
| 948 | $result->attach($image); |
||
| 949 | } |
||
| 950 | } |
||
| 951 | |||
| 952 | return $result; |
||
| 953 | } |
||
| 954 | |||
| 955 | /** |
||
| 956 | * Sets the image |
||
| 957 | * |
||
| 958 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $image Image |
||
| 959 | */ |
||
| 960 | public function setImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $image) |
||
| 961 | { |
||
| 962 | $this->image = $image; |
||
| 963 | } |
||
| 964 | |||
| 965 | /** |
||
| 966 | * Adds a file |
||
| 967 | * |
||
| 968 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file File |
||
| 969 | */ |
||
| 970 | public function addFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $file) |
||
| 971 | { |
||
| 972 | $this->files->attach($file); |
||
| 973 | } |
||
| 974 | |||
| 975 | /** |
||
| 976 | * Removes a file |
||
| 977 | * |
||
| 978 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove File |
||
| 979 | */ |
||
| 980 | public function removeFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove) |
||
| 981 | { |
||
| 982 | $this->files->detach($fileToRemove); |
||
| 983 | } |
||
| 984 | |||
| 985 | /** |
||
| 986 | * Returns the files |
||
| 987 | * |
||
| 988 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files |
||
| 989 | */ |
||
| 990 | public function getFiles() |
||
| 991 | { |
||
| 992 | return $this->files; |
||
| 993 | } |
||
| 994 | |||
| 995 | /** |
||
| 996 | * Sets the files |
||
| 997 | * |
||
| 998 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files Files |
||
| 999 | */ |
||
| 1000 | public function setFiles(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $files) |
||
| 1001 | { |
||
| 1002 | $this->files = $files; |
||
| 1003 | } |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * Returns if the registration for this event is logically possible |
||
| 1007 | * |
||
| 1008 | * @return bool |
||
| 1009 | */ |
||
| 1010 | public function getRegistrationPossible() |
||
| 1028 | } |
||
| 1029 | |||
| 1030 | /** |
||
| 1031 | * Returns the amount of free places |
||
| 1032 | * |
||
| 1033 | * @return int |
||
| 1034 | */ |
||
| 1035 | public function getFreePlaces() |
||
| 1036 | { |
||
| 1037 | return $this->maxParticipants - $this->getRegistrations()->count(); |
||
| 1038 | } |
||
| 1039 | |||
| 1040 | /** |
||
| 1041 | * Sets the location |
||
| 1042 | * |
||
| 1043 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Location $location Location |
||
| 1044 | */ |
||
| 1045 | public function setLocation($location) |
||
| 1046 | { |
||
| 1047 | $this->location = $location; |
||
| 1048 | } |
||
| 1049 | |||
| 1050 | /** |
||
| 1051 | * Returns the location |
||
| 1052 | * |
||
| 1053 | * @return \DERHANSEN\SfEventMgt\Domain\Model\Location |
||
| 1054 | */ |
||
| 1055 | public function getLocation() |
||
| 1056 | { |
||
| 1057 | return $this->location; |
||
| 1058 | } |
||
| 1059 | |||
| 1060 | /** |
||
| 1061 | * Returns the room |
||
| 1062 | * |
||
| 1063 | * @return string |
||
| 1064 | */ |
||
| 1065 | public function getRoom() |
||
| 1066 | { |
||
| 1067 | return $this->room; |
||
| 1068 | } |
||
| 1069 | |||
| 1070 | /** |
||
| 1071 | * Sets the room |
||
| 1072 | * |
||
| 1073 | * @param string $room |
||
| 1074 | */ |
||
| 1075 | public function setRoom($room) |
||
| 1076 | { |
||
| 1077 | $this->room = $room; |
||
| 1078 | } |
||
| 1079 | |||
| 1080 | /** |
||
| 1081 | * Sets enableRegistration |
||
| 1082 | * |
||
| 1083 | * @param bool $enableRegistration EnableRegistration |
||
| 1084 | */ |
||
| 1085 | public function setEnableRegistration($enableRegistration) |
||
| 1086 | { |
||
| 1087 | $this->enableRegistration = $enableRegistration; |
||
| 1088 | } |
||
| 1089 | |||
| 1090 | /** |
||
| 1091 | * Returns if registration is enabled |
||
| 1092 | * |
||
| 1093 | * @return bool |
||
| 1094 | */ |
||
| 1095 | public function getEnableRegistration() |
||
| 1096 | { |
||
| 1097 | return $this->enableRegistration; |
||
| 1098 | } |
||
| 1099 | |||
| 1100 | /** |
||
| 1101 | * Returns enableWaitlist |
||
| 1102 | * |
||
| 1103 | * @return bool |
||
| 1104 | */ |
||
| 1105 | public function getEnableWaitlist() |
||
| 1106 | { |
||
| 1107 | return $this->enableWaitlist; |
||
| 1108 | } |
||
| 1109 | |||
| 1110 | /** |
||
| 1111 | * Sets enableWaitlist |
||
| 1112 | * |
||
| 1113 | * @param bool $enableWaitlist |
||
| 1114 | */ |
||
| 1115 | public function setEnableWaitlist($enableWaitlist) |
||
| 1116 | { |
||
| 1117 | $this->enableWaitlist = $enableWaitlist; |
||
| 1118 | } |
||
| 1119 | |||
| 1120 | /** |
||
| 1121 | * @return bool |
||
| 1122 | */ |
||
| 1123 | public function getEnableWaitlistMoveup(): bool |
||
| 1124 | { |
||
| 1125 | return $this->enableWaitlistMoveup; |
||
| 1126 | } |
||
| 1127 | |||
| 1128 | /** |
||
| 1129 | * @param bool $enableWaitlistMoveup |
||
| 1130 | */ |
||
| 1131 | public function setEnableWaitlistMoveup($enableWaitlistMoveup): void |
||
| 1132 | { |
||
| 1133 | $this->enableWaitlistMoveup = $enableWaitlistMoveup; |
||
| 1134 | } |
||
| 1135 | |||
| 1136 | /** |
||
| 1137 | * Sets the registration startdate |
||
| 1138 | * |
||
| 1139 | * @param \DateTime $registrationStartdate RegistrationStartdate |
||
| 1140 | */ |
||
| 1141 | public function setRegistrationStartdate(\DateTime $registrationStartdate) |
||
| 1142 | { |
||
| 1143 | $this->registrationStartdate = $registrationStartdate; |
||
| 1144 | } |
||
| 1145 | |||
| 1146 | /** |
||
| 1147 | * Returns the registration startdate |
||
| 1148 | * |
||
| 1149 | * @return \DateTime |
||
| 1150 | */ |
||
| 1151 | public function getRegistrationStartdate() |
||
| 1152 | { |
||
| 1153 | return $this->registrationStartdate; |
||
| 1154 | } |
||
| 1155 | |||
| 1156 | /** |
||
| 1157 | * Sets the registration deadline |
||
| 1158 | * |
||
| 1159 | * @param \DateTime $registrationDeadline RegistrationDeadline |
||
| 1160 | */ |
||
| 1161 | public function setRegistrationDeadline(\DateTime $registrationDeadline) |
||
| 1162 | { |
||
| 1163 | $this->registrationDeadline = $registrationDeadline; |
||
| 1164 | } |
||
| 1165 | |||
| 1166 | /** |
||
| 1167 | * Returns the registration deadline |
||
| 1168 | * |
||
| 1169 | * @return \DateTime |
||
| 1170 | */ |
||
| 1171 | public function getRegistrationDeadline() |
||
| 1172 | { |
||
| 1173 | return $this->registrationDeadline; |
||
| 1174 | } |
||
| 1175 | |||
| 1176 | /** |
||
| 1177 | * Sets the link |
||
| 1178 | * |
||
| 1179 | * @param string $link Link |
||
| 1180 | */ |
||
| 1181 | public function setLink($link) |
||
| 1182 | { |
||
| 1183 | $this->link = $link; |
||
| 1184 | } |
||
| 1185 | |||
| 1186 | /** |
||
| 1187 | * Returns the link |
||
| 1188 | * |
||
| 1189 | * @return string |
||
| 1190 | */ |
||
| 1191 | public function getLink() |
||
| 1192 | { |
||
| 1193 | return $this->link; |
||
| 1194 | } |
||
| 1195 | |||
| 1196 | /** |
||
| 1197 | * Sets topEvent |
||
| 1198 | * |
||
| 1199 | * @param bool $topEvent TopEvent |
||
| 1200 | */ |
||
| 1201 | public function setTopEvent($topEvent) |
||
| 1202 | { |
||
| 1203 | $this->topEvent = $topEvent; |
||
| 1204 | } |
||
| 1205 | |||
| 1206 | /** |
||
| 1207 | * Returns if topEvent is checked |
||
| 1208 | * |
||
| 1209 | * @return bool |
||
| 1210 | */ |
||
| 1211 | public function getTopEvent() |
||
| 1212 | { |
||
| 1213 | return $this->topEvent; |
||
| 1214 | } |
||
| 1215 | |||
| 1216 | /** |
||
| 1217 | * Returns max regisrations per user |
||
| 1218 | * |
||
| 1219 | * @return int |
||
| 1220 | */ |
||
| 1221 | public function getMaxRegistrationsPerUser() |
||
| 1222 | { |
||
| 1223 | return $this->maxRegistrationsPerUser; |
||
| 1224 | } |
||
| 1225 | |||
| 1226 | /** |
||
| 1227 | * Sets max registrations per user |
||
| 1228 | * |
||
| 1229 | * @param int $maxRegistrationsPerUser MaxRegistrationsPerUser |
||
| 1230 | */ |
||
| 1231 | public function setMaxRegistrationsPerUser($maxRegistrationsPerUser) |
||
| 1232 | { |
||
| 1233 | $this->maxRegistrationsPerUser = $maxRegistrationsPerUser; |
||
| 1234 | } |
||
| 1235 | |||
| 1236 | /** |
||
| 1237 | * Adds an additionalImage |
||
| 1238 | * |
||
| 1239 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage The Image |
||
| 1240 | */ |
||
| 1241 | public function addAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage) |
||
| 1242 | { |
||
| 1243 | $this->additionalImage->attach($additionalImage); |
||
| 1244 | } |
||
| 1245 | |||
| 1246 | /** |
||
| 1247 | * Removes an additionalImage |
||
| 1248 | * |
||
| 1249 | * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove The Image |
||
| 1250 | */ |
||
| 1251 | public function removeAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove) |
||
| 1252 | { |
||
| 1253 | $this->additionalImage->detach($additionalImageToRemove); |
||
| 1254 | } |
||
| 1255 | |||
| 1256 | /** |
||
| 1257 | * Returns the additionalImage |
||
| 1258 | * |
||
| 1259 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage |
||
| 1260 | */ |
||
| 1261 | public function getAdditionalImage() |
||
| 1262 | { |
||
| 1263 | return $this->additionalImage; |
||
| 1264 | } |
||
| 1265 | |||
| 1266 | /** |
||
| 1267 | * Sets the additionalImage |
||
| 1268 | * |
||
| 1269 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage The Image |
||
| 1270 | */ |
||
| 1271 | public function setAdditionalImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage) |
||
| 1272 | { |
||
| 1273 | $this->additionalImage = $additionalImage; |
||
| 1274 | } |
||
| 1275 | |||
| 1276 | /** |
||
| 1277 | * Returns the organisator |
||
| 1278 | * |
||
| 1279 | * @return Organisator |
||
| 1280 | */ |
||
| 1281 | public function getOrganisator() |
||
| 1282 | { |
||
| 1283 | return $this->organisator; |
||
| 1284 | } |
||
| 1285 | |||
| 1286 | /** |
||
| 1287 | * Sets the organisator |
||
| 1288 | * |
||
| 1289 | * @param Organisator $organisator The organisator |
||
| 1290 | */ |
||
| 1291 | public function setOrganisator($organisator) |
||
| 1292 | { |
||
| 1293 | $this->organisator = $organisator; |
||
| 1294 | } |
||
| 1295 | |||
| 1296 | /** |
||
| 1297 | * Returns notifyAdmin |
||
| 1298 | * |
||
| 1299 | * @return bool |
||
| 1300 | */ |
||
| 1301 | public function getNotifyAdmin() |
||
| 1302 | { |
||
| 1303 | return $this->notifyAdmin; |
||
| 1304 | } |
||
| 1305 | |||
| 1306 | /** |
||
| 1307 | * Sets notifyAdmin |
||
| 1308 | * |
||
| 1309 | * @param bool $notifyAdmin NotifyAdmin |
||
| 1310 | */ |
||
| 1311 | public function setNotifyAdmin($notifyAdmin) |
||
| 1312 | { |
||
| 1313 | $this->notifyAdmin = $notifyAdmin; |
||
| 1314 | } |
||
| 1315 | |||
| 1316 | /** |
||
| 1317 | * Returns if notifyAdmin is set |
||
| 1318 | * |
||
| 1319 | * @return bool |
||
| 1320 | */ |
||
| 1321 | public function getNotifyOrganisator() |
||
| 1322 | { |
||
| 1323 | return $this->notifyOrganisator; |
||
| 1324 | } |
||
| 1325 | |||
| 1326 | /** |
||
| 1327 | * Sets notifyOrganisator |
||
| 1328 | * |
||
| 1329 | * @param bool $notifyOrganisator NotifyOrganisator |
||
| 1330 | */ |
||
| 1331 | public function setNotifyOrganisator($notifyOrganisator) |
||
| 1332 | { |
||
| 1333 | $this->notifyOrganisator = $notifyOrganisator; |
||
| 1334 | } |
||
| 1335 | |||
| 1336 | /** |
||
| 1337 | * Sets enableCancel |
||
| 1338 | * |
||
| 1339 | * @param bool $enableCancel EnableCancel |
||
| 1340 | */ |
||
| 1341 | public function setEnableCancel($enableCancel) |
||
| 1342 | { |
||
| 1343 | $this->enableCancel = $enableCancel; |
||
| 1344 | } |
||
| 1345 | |||
| 1346 | /** |
||
| 1347 | * Returns if registration can be canceled |
||
| 1348 | * |
||
| 1349 | * @return bool |
||
| 1350 | */ |
||
| 1351 | public function getEnableCancel() |
||
| 1352 | { |
||
| 1353 | return $this->enableCancel; |
||
| 1354 | } |
||
| 1355 | |||
| 1356 | /** |
||
| 1357 | * Sets the cancel deadline |
||
| 1358 | * |
||
| 1359 | * @param \DateTime $cancelDeadline CancelDeadline |
||
| 1360 | */ |
||
| 1361 | public function setCancelDeadline(\DateTime $cancelDeadline) |
||
| 1362 | { |
||
| 1363 | $this->cancelDeadline = $cancelDeadline; |
||
| 1364 | } |
||
| 1365 | |||
| 1366 | /** |
||
| 1367 | * Returns the cancel deadline |
||
| 1368 | * |
||
| 1369 | * @return \DateTime |
||
| 1370 | */ |
||
| 1371 | public function getCancelDeadline() |
||
| 1372 | { |
||
| 1373 | return $this->cancelDeadline; |
||
| 1374 | } |
||
| 1375 | |||
| 1376 | /** |
||
| 1377 | * Returns if autoconfirmation is enabled |
||
| 1378 | * |
||
| 1379 | * @return bool |
||
| 1380 | */ |
||
| 1381 | public function getEnableAutoconfirm() |
||
| 1382 | { |
||
| 1383 | return $this->enableAutoconfirm; |
||
| 1384 | } |
||
| 1385 | |||
| 1386 | /** |
||
| 1387 | * Sets enable autoconfirm |
||
| 1388 | * |
||
| 1389 | * @param bool $enableAutoconfirm |
||
| 1390 | */ |
||
| 1391 | public function setEnableAutoconfirm($enableAutoconfirm) |
||
| 1392 | { |
||
| 1393 | $this->enableAutoconfirm = $enableAutoconfirm; |
||
| 1394 | } |
||
| 1395 | |||
| 1396 | /** |
||
| 1397 | * Returns uniqueEmailCheck |
||
| 1398 | * |
||
| 1399 | * @return bool |
||
| 1400 | */ |
||
| 1401 | public function getUniqueEmailCheck() |
||
| 1402 | { |
||
| 1403 | return $this->uniqueEmailCheck; |
||
| 1404 | } |
||
| 1405 | |||
| 1406 | /** |
||
| 1407 | * Sets UniqueEmailCheck |
||
| 1408 | * |
||
| 1409 | * @param bool $uniqueEmailCheck |
||
| 1410 | */ |
||
| 1411 | public function setUniqueEmailCheck($uniqueEmailCheck) |
||
| 1412 | { |
||
| 1413 | $this->uniqueEmailCheck = $uniqueEmailCheck; |
||
| 1414 | } |
||
| 1415 | |||
| 1416 | /** |
||
| 1417 | * @return string |
||
| 1418 | */ |
||
| 1419 | public function getMetaKeywords(): string |
||
| 1420 | { |
||
| 1421 | return $this->metaKeywords; |
||
| 1422 | } |
||
| 1423 | |||
| 1424 | /** |
||
| 1425 | * @param string $metaKeywords |
||
| 1426 | */ |
||
| 1427 | public function setMetaKeywords(string $metaKeywords): void |
||
| 1428 | { |
||
| 1429 | $this->metaKeywords = $metaKeywords; |
||
| 1430 | } |
||
| 1431 | |||
| 1432 | /** |
||
| 1433 | * @return string |
||
| 1434 | */ |
||
| 1435 | public function getMetaDescription(): string |
||
| 1436 | { |
||
| 1437 | return $this->metaDescription; |
||
| 1438 | } |
||
| 1439 | |||
| 1440 | /** |
||
| 1441 | * @param string $metaDescription |
||
| 1442 | */ |
||
| 1443 | public function setMetaDescription(string $metaDescription): void |
||
| 1444 | { |
||
| 1445 | $this->metaDescription = $metaDescription; |
||
| 1446 | } |
||
| 1447 | |||
| 1448 | /** |
||
| 1449 | * @return string |
||
| 1450 | */ |
||
| 1451 | public function getAlternativeTitle(): string |
||
| 1452 | { |
||
| 1453 | return $this->alternativeTitle; |
||
| 1454 | } |
||
| 1455 | |||
| 1456 | /** |
||
| 1457 | * @param string $alternativeTitle |
||
| 1458 | */ |
||
| 1459 | public function setAlternativeTitle(string $alternativeTitle): void |
||
| 1462 | } |
||
| 1463 | |||
| 1464 | /** |
||
| 1465 | * @return string |
||
| 1466 | */ |
||
| 1467 | public function getMetaTitle(): string |
||
| 1468 | { |
||
| 1469 | return $this->getAlternativeTitle() !== '' ? $this->getAlternativeTitle() : $this->getTitle(); |
||
| 1470 | } |
||
| 1471 | |||
| 1472 | |||
| 1473 | /** |
||
| 1474 | * Returns price options |
||
| 1475 | * |
||
| 1476 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\PriceOption> |
||
| 1477 | */ |
||
| 1478 | public function getPriceOptions() |
||
| 1479 | { |
||
| 1480 | return $this->priceOptions; |
||
| 1481 | } |
||
| 1482 | |||
| 1483 | /** |
||
| 1484 | * Sets price options |
||
| 1485 | * |
||
| 1486 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $priceOptions |
||
| 1487 | */ |
||
| 1488 | public function setPriceOptions($priceOptions) |
||
| 1489 | { |
||
| 1490 | $this->priceOptions = $priceOptions; |
||
| 1491 | } |
||
| 1492 | |||
| 1493 | /** |
||
| 1494 | * Adds a price option |
||
| 1495 | * |
||
| 1496 | * @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option |
||
| 1497 | */ |
||
| 1498 | public function addPriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption) |
||
| 1499 | { |
||
| 1500 | $this->priceOptions->attach($priceOption); |
||
| 1501 | } |
||
| 1502 | |||
| 1503 | /** |
||
| 1504 | * Removes a Registration |
||
| 1505 | * |
||
| 1506 | * @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option |
||
| 1507 | */ |
||
| 1508 | public function removePriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption) |
||
| 1509 | { |
||
| 1510 | $this->priceOptions->detach($priceOption); |
||
| 1511 | } |
||
| 1512 | |||
| 1513 | /** |
||
| 1514 | * Returns all active price options sorted by date ASC |
||
| 1515 | * |
||
| 1516 | * @return array |
||
| 1517 | */ |
||
| 1518 | public function getActivePriceOptions() |
||
| 1519 | { |
||
| 1520 | $activePriceOptions = []; |
||
| 1521 | if ($this->getPriceOptions()) { |
||
| 1522 | $compareDate = new \DateTime('today midnight'); |
||
| 1523 | foreach ($this->getPriceOptions() as $priceOption) { |
||
| 1524 | if ($priceOption->getValidUntil() >= $compareDate) { |
||
| 1525 | $activePriceOptions[$priceOption->getValidUntil()->getTimestamp()] = $priceOption; |
||
| 1526 | } |
||
| 1527 | } |
||
| 1528 | } |
||
| 1529 | ksort($activePriceOptions); |
||
| 1530 | |||
| 1531 | return $activePriceOptions; |
||
| 1532 | } |
||
| 1533 | |||
| 1534 | /** |
||
| 1535 | * Returns the current price of the event respecting possible price options |
||
| 1536 | * |
||
| 1537 | * @return float |
||
| 1538 | */ |
||
| 1539 | public function getCurrentPrice() |
||
| 1540 | { |
||
| 1541 | $activePriceOptions = $this->getActivePriceOptions(); |
||
| 1542 | if (count($activePriceOptions) >= 1) { |
||
| 1543 | // Sort active price options and return first element |
||
| 1544 | return reset($activePriceOptions)->getPrice(); |
||
| 1545 | } |
||
| 1546 | // Just return the price field |
||
| 1547 | return $this->price; |
||
| 1548 | } |
||
| 1549 | |||
| 1550 | /** |
||
| 1551 | * Returns registrationWaitlist |
||
| 1552 | * |
||
| 1553 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 1554 | */ |
||
| 1555 | public function getRegistrationWaitlist() |
||
| 1556 | { |
||
| 1557 | return $this->registrationWaitlist; |
||
| 1558 | } |
||
| 1559 | |||
| 1560 | /** |
||
| 1561 | * Sets registrationWaitlist |
||
| 1562 | * |
||
| 1563 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration |
||
| 1564 | */ |
||
| 1565 | public function setRegistrationWaitlist(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration) |
||
| 1566 | { |
||
| 1567 | $this->registrationWaitlist = $registration; |
||
| 1568 | } |
||
| 1569 | |||
| 1570 | /** |
||
| 1571 | * Adds a Registration to the waitlist |
||
| 1572 | * |
||
| 1573 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration |
||
| 1574 | */ |
||
| 1575 | public function addRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration) |
||
| 1576 | { |
||
| 1577 | $this->registrationWaitlist->attach($registration); |
||
| 1578 | } |
||
| 1579 | |||
| 1580 | /** |
||
| 1581 | * Removes a Registration from the waitlist |
||
| 1582 | * |
||
| 1583 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration |
||
| 1584 | */ |
||
| 1585 | public function removeRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove) |
||
| 1586 | { |
||
| 1587 | $this->registrationWaitlist->detach($registrationToRemove); |
||
| 1588 | } |
||
| 1589 | |||
| 1590 | /** |
||
| 1591 | * Returns, if cancellation for registrations of the event is possible |
||
| 1592 | * |
||
| 1593 | * @return bool |
||
| 1594 | */ |
||
| 1595 | public function getCancellationPossible() |
||
| 1596 | { |
||
| 1597 | $today = new \DateTime('today'); |
||
| 1598 | |||
| 1599 | return ($this->getEnableCancel() && $this->getCancelDeadline() > $today) || |
||
| 1600 | ($this->getEnableCancel() && $this->getCancelDeadline() === null && $this->getStartdate() > $today); |
||
| 1601 | } |
||
| 1602 | |||
| 1603 | /** |
||
| 1604 | * Returns speaker |
||
| 1605 | * |
||
| 1606 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 1607 | */ |
||
| 1608 | public function getSpeaker() |
||
| 1609 | { |
||
| 1610 | return $this->speaker; |
||
| 1611 | } |
||
| 1612 | |||
| 1613 | /** |
||
| 1614 | * Sets speaker |
||
| 1615 | * |
||
| 1616 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $speaker |
||
| 1617 | */ |
||
| 1618 | public function setSpeaker($speaker) |
||
| 1619 | { |
||
| 1620 | $this->speaker = $speaker; |
||
| 1621 | } |
||
| 1622 | |||
| 1623 | /** |
||
| 1624 | * Adds a speaker |
||
| 1625 | * |
||
| 1626 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker |
||
| 1627 | */ |
||
| 1628 | public function addSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker) |
||
| 1629 | { |
||
| 1630 | $this->speaker->attach($speaker); |
||
| 1631 | } |
||
| 1632 | |||
| 1633 | /** |
||
| 1634 | * Removes a speaker |
||
| 1635 | * |
||
| 1636 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker |
||
| 1637 | */ |
||
| 1638 | public function removeSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker) |
||
| 1639 | { |
||
| 1640 | $this->speaker->detach($speaker); |
||
| 1641 | } |
||
| 1642 | |||
| 1643 | /** |
||
| 1644 | * Returns registrationFields |
||
| 1645 | * |
||
| 1646 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 1647 | */ |
||
| 1648 | public function getRegistrationFields() |
||
| 1649 | { |
||
| 1650 | return $this->registrationFields; |
||
| 1651 | } |
||
| 1652 | |||
| 1653 | /** |
||
| 1654 | * Sets registrationWaitlist |
||
| 1655 | * |
||
| 1656 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields |
||
| 1657 | */ |
||
| 1658 | public function setRegistrationFields(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields) |
||
| 1659 | { |
||
| 1660 | $this->registrationFields = $registrationFields; |
||
| 1661 | } |
||
| 1662 | |||
| 1663 | /** |
||
| 1664 | * Adds a registrationField |
||
| 1665 | * |
||
| 1666 | * @param Field $registrationField |
||
| 1667 | */ |
||
| 1668 | public function addRegistrationFields(Field $registrationField) |
||
| 1671 | } |
||
| 1672 | |||
| 1673 | /** |
||
| 1674 | * Removed a registrationField |
||
| 1675 | * |
||
| 1676 | * @param Field $registrationField |
||
| 1677 | */ |
||
| 1678 | public function removeRegistrationFields(Field $registrationField) |
||
| 1679 | { |
||
| 1680 | $this->registrationFields->detach($registrationField); |
||
| 1681 | } |
||
| 1682 | |||
| 1683 | /** |
||
| 1684 | * Returns an array with registration field uids |
||
| 1685 | * |
||
| 1686 | * @return array |
||
| 1687 | */ |
||
| 1688 | public function getRegistrationFieldsUids() |
||
| 1689 | { |
||
| 1690 | $result = []; |
||
| 1691 | foreach ($this->registrationFields as $registrationField) { |
||
| 1692 | $result[] = $registrationField->getUid(); |
||
| 1693 | } |
||
| 1694 | |||
| 1695 | return $result; |
||
| 1696 | } |
||
| 1697 | |||
| 1698 | /** |
||
| 1699 | * Returns an array with registration field uids and titles |
||
| 1700 | * [uid => title] |
||
| 1701 | * |
||
| 1702 | * @return array |
||
| 1703 | */ |
||
| 1704 | public function getRegistrationFieldUidsWithTitle() |
||
| 1705 | { |
||
| 1706 | $result = []; |
||
| 1707 | foreach ($this->registrationFields as $registrationField) { |
||
| 1708 | $result[$registrationField->getUid()] = $registrationField->getTitle(); |
||
| 1709 | } |
||
| 1710 | |||
| 1711 | return $result; |
||
| 1712 | } |
||
| 1713 | |||
| 1714 | /** |
||
| 1715 | * Special getter to return the amount of registrations that are saved to default language |
||
| 1716 | * Required since TYPO3 9.5 (#82363) |
||
| 1717 | * |
||
| 1718 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 1719 | */ |
||
| 1720 | public function getRegistrations() |
||
| 1721 | { |
||
| 1722 | $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
||
| 1723 | if ($languageAspect->getId() > 0) { |
||
| 1724 | return $this->getRegistrationsDefaultLanguage(false); |
||
| 1725 | } |
||
| 1726 | |||
| 1727 | return $this->registration; |
||
| 1728 | } |
||
| 1729 | |||
| 1730 | /** |
||
| 1731 | * Special getter to return the amount of waitlist registrations that are saved to default language |
||
| 1732 | * Required since TYPO3 9.5 (#82363) |
||
| 1733 | * |
||
| 1734 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
||
| 1735 | */ |
||
| 1736 | public function getRegistrationsWaitlist() |
||
| 1737 | { |
||
| 1738 | $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
||
| 1739 | if ($languageAspect->getId() > 0) { |
||
| 1740 | return $this->getRegistrationsDefaultLanguage(true); |
||
| 1741 | } |
||
| 1742 | |||
| 1743 | return $this->registrationWaitlist; |
||
| 1744 | } |
||
| 1745 | |||
| 1746 | /** |
||
| 1747 | * Returns an objectStorage object holding all registrations in the default language. |
||
| 1748 | * Ensures expected behavior of getRegistration() and getRegistrationWaitlist() since TYPO3 issue #82363 |
||
| 1749 | * |
||
| 1750 | * @param bool $waitlist |
||
| 1751 | * @return ObjectStorage |
||
| 1752 | */ |
||
| 1753 | protected function getRegistrationsDefaultLanguage(bool $waitlist = false) |
||
| 1754 | { |
||
| 1755 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
||
| 1756 | $result = $objectManager->get(ObjectStorage::class); |
||
| 1757 | $registrationRepository = $objectManager->get(RegistrationRepository::class); |
||
| 1758 | $registrations = $registrationRepository->findByEventAndWaitlist($this, $waitlist); |
||
| 1759 | foreach ($registrations as $registration) { |
||
| 1760 | $result->attach($registration); |
||
| 1761 | } |
||
| 1762 | |||
| 1763 | return $result; |
||
| 1764 | } |
||
| 1765 | |||
| 1766 | /** |
||
| 1767 | * Returns if the event ends on the same day |
||
| 1768 | * |
||
| 1769 | * @return bool |
||
| 1770 | */ |
||
| 1771 | public function getEndsSameDay(): bool |
||
| 1778 | } |
||
| 1779 | |||
| 1780 | /** |
||
| 1781 | * Returns the challenge for the challenge/response spam check |
||
| 1782 | * |
||
| 1783 | * @return string |
||
| 1784 | */ |
||
| 1785 | public function getSpamCheckChallenge(): string |
||
| 1786 | { |
||
| 1787 | return MiscUtility::getSpamCheckChallenge($this->getUid()); |
||
| 1788 | } |
||
| 1789 | |||
| 1790 | /** |
||
| 1791 | * Returns a string to be used as overlay value for the <core:icon> ViewHelper in the Backend Modules |
||
| 1792 | * |
||
| 1793 | * @return string |
||
| 1794 | */ |
||
| 1795 | public function getBackendIconOverlay(): string |
||
| 1810 | } |
||
| 1811 | } |
||
| 1812 |