ILIAS  release_8 Revision v8.24
class.ilForumLP.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25class ilForumLP extends ilObjectLP
26{
27 public function appendModeConfiguration(int $mode, ilRadioOption $modeElement): void
28 {
29 global $DIC;
30
32 $num_postings = new ilNumberInputGUI(
33 $DIC->language()->txt('trac_frm_contribution_num_postings'),
34 'number_of_postings'
35 );
36 $num_postings->allowDecimals(false);
37 $num_postings->setMinValue(1);
38 $num_postings->setMaxValue(99999);
39 $num_postings->setSize(4);
40 $num_postings->setRequired(true);
41 if (is_int(ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings())) {
42 $requiredNumberOfPostings = ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings();
43 $num_postings->setValue((string) $requiredNumberOfPostings);
44 }
45 $modeElement->addSubItem($num_postings);
46 }
47 }
48
49 public function saveModeConfiguration(ilPropertyFormGUI $form, bool &$modeChanged): void
50 {
51 $frm_properties = ilForumProperties::getInstance($this->obj_id);
52
53 $current_value = $frm_properties->getLpReqNumPostings();
54
55 if (is_numeric($form->getInput('number_of_postings'))) {
56 $frm_properties->setLpReqNumPostings(
57 (int) $form->getInput('number_of_postings')
58 );
59 } else {
60 $frm_properties->setLpReqNumPostings(null);
61 }
62 $frm_properties->update();
63
64 if ($current_value !== $frm_properties->getLpReqNumPostings()) {
65 $modeChanged = true;
66 }
67 }
68
69 public static function getDefaultModes(bool $lp_active): array
70 {
71 if (true === $lp_active) {
72 return [
75 ];
76 }
77
78 return [
80 ];
81 }
82
83 public function getDefaultMode(): int
84 {
86 }
87
88 public function getValidModes(): array
89 {
90 return [
93 ];
94 }
95}
Class ilForumLP.
static getDefaultModes(bool $lp_active)
Get available type-specific default modes (no administration needed)
appendModeConfiguration(int $mode, ilRadioOption $modeElement)
saveModeConfiguration(ilPropertyFormGUI $form, bool &$modeChanged)
static getInstance(int $a_obj_id=0)
const LP_MODE_CONTRIBUTION_TO_DISCUSSION
This class represents a number property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28