ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilForumLP Class Reference

Class ilForumLP. More...

+ Inheritance diagram for ilForumLP:
+ Collaboration diagram for ilForumLP:

Public Member Functions

 appendModeConfiguration (int $mode)
 
 saveModeConfiguration (string $selected_group, array $group_data, bool &$modeChanged)
 
 getDefaultMode ()
 
 getValidModes ()
 
 getModeText (int $mode)
 
- Public Member Functions inherited from ilObjectLP
 resetCaches ()
 
 isAnonymized ()
 
 getDefaultMode ()
 
 getValidModes ()
 
 getCurrentMode ()
 
 isActive ()
 
 getModeText (int $mode)
 
 getModeInfoText (int $mode)
 
 getSettingsInfo ()
 
 getCollectionInstance ()
 
 getMembers (bool $search=true)
 
 resetLPDataForCompleteObject (bool $recursive=true)
 
 resetLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 
 getMailTemplateId ()
 
 hasIndividualModeOptions ()
 
 initInvidualModeOptions ()
 Post vars for input groups is taken from array keys. More...
 
 shouldFetchIndividualModeFromFormSubmission ()
 
 fetchIndividualModeFromFormSubmission (string $selected_group, array $group_data)
 
 appendModeConfiguration (int $mode)
 
 saveModeConfiguration (string $selected_group, array $group_data, bool &$modeChanged)
 

Static Public Member Functions

static getDefaultModes (bool $lp_active)
 Get available type-specific default modes (no administration needed) More...
 
- Static Public Member Functions inherited from ilObjectLP
static getInstance (int $obj_id)
 
static getTypeClass (string $type)
 
static getSupportedObjectTypes ()
 
static isSupportedObjectType (string $type)
 
static handleMove (int $source_ref_id)
 
static getLPMemberships (int $usr_id, array $obj_ids, ?int $parent_ref_id=null, bool $mapped_ref_ids=false)
 Get all objects where given user is member (from LP POV) More...
 
static supportsSpentSeconds (string $obj_type)
 
static supportsMark (string $obj_type)
 
static supportsMatrixView (string $obj_type)
 
static getDefaultModes (bool $lp_active)
 Get available type-specific default modes (no administration needed) More...
 
static saveTypeDefaults (array $data)
 
static getTypeDefault (string $type)
 

Additional Inherited Members

- Protected Member Functions inherited from ilObjectLP
 __construct (int $obj_id)
 
 resetCustomLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 gatherLPUsers ()
 
 updateParentCollections ()
 
- Static Protected Member Functions inherited from ilObjectLP
static isLPMember (array &$res, int $usr_id, array $obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
static findMembershipsByPath (array &$res, int $usr_id, int $parent_ref_id, array $obj_ids, bool $mapped_ref_ids=false)
 Find (lp-relevant) memberships by path. More...
 
static getTypeDefaultFromDB (string $type)
 
- Protected Attributes inherited from ilObjectLP
ilTree $tree
 
ilDBInterface $db
 
ilObjectDefinition $objectDefinition
 
int $obj_id
 
ilLPCollection $collection_instance = null
 
int $mode = null
 
- Static Protected Attributes inherited from ilObjectLP
static array $type_defaults = null
 

Detailed Description

Class ilForumLP.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 27 of file class.ilForumLP.php.

Member Function Documentation

◆ appendModeConfiguration()

ilForumLP::appendModeConfiguration ( int  $mode)
Returns
array<string, Input> A map of Input elements mapped to a corresponding key

Reimplemented from ilObjectLP.

Definition at line 29 of file class.ilForumLP.php.

29 : array
30 {
31 global $DIC;
32
34 return [];
35 }
36
37 $ui_factory = $DIC->ui()->factory();
38 $refinery = $DIC->refinery();
39 $lng = $DIC->language();
40
41 $num_postings = $ui_factory->input()->field()->numeric(
42 $lng->txt('trac_frm_contribution_num_postings')
43 )->withAdditionalTransformation(
44 $refinery->in()->series([
45 $refinery->int()->isGreaterThanOrEqual(1),
46 $refinery->int()->isLessThanOrEqual(99999)
47 ])
48 )->withRequired(true);
49
50 if (is_int(ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings())) {
51 $requiredNumberOfPostings = ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings();
52 $num_postings = $num_postings->withValue($requiredNumberOfPostings);
53 }
54
55 return ['number_of_postings' => $num_postings];
56 }
static getInstance(int $a_obj_id=0)
const LP_MODE_CONTRIBUTION_TO_DISCUSSION
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

References $DIC, $lng, ilObjectLP\$mode, ILIAS\UI\examples\Layout\Page\Standard\$refinery, ilForumProperties\getInstance(), and ilLPObjSettings\LP_MODE_CONTRIBUTION_TO_DISCUSSION.

+ Here is the call graph for this function:

◆ getDefaultMode()

ilForumLP::getDefaultMode ( )

Reimplemented from ilObjectLP.

Definition at line 95 of file class.ilForumLP.php.

95 : int
96 {
98 }

References ilLPObjSettings\LP_MODE_DEACTIVATED.

◆ getDefaultModes()

static ilForumLP::getDefaultModes ( bool  $lp_active)
static

Get available type-specific default modes (no administration needed)

Returns
int[]

Reimplemented from ilObjectLP.

Definition at line 81 of file class.ilForumLP.php.

81 : array
82 {
83 if ($lp_active) {
84 return [
87 ];
88 }
89
90 return [
92 ];
93 }

References ilLPObjSettings\LP_MODE_CONTRIBUTION_TO_DISCUSSION, and ilLPObjSettings\LP_MODE_DEACTIVATED.

◆ getModeText()

ilForumLP::getModeText ( int  $mode)

Reimplemented from ilObjectLP.

Definition at line 108 of file class.ilForumLP.php.

108 : string
109 {
110 global $DIC;
111
112 $text = parent::getModeText($mode);
113
115 $mode === $this->getCurrentMode() &&
116 is_int(($number_of_postings = ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings()))) {
117 try {
118 $text = sprintf(
119 match ($number_of_postings) {
120 1 => $DIC->language()->txt('trac_frm_contribution_num_postings_info_s'),
121 default => $DIC->language()->txt('trac_frm_contribution_num_postings_info_p')
122 },
123 $text,
124 $number_of_postings
125 );
126 } catch (Throwable) {
127 }
128 }
129
130 return $text;
131 }

References $DIC, ilForumProperties\getInstance(), and ilLPObjSettings\LP_MODE_CONTRIBUTION_TO_DISCUSSION.

+ Here is the call graph for this function:

◆ getValidModes()

ilForumLP::getValidModes ( )
Returns
int[]

Reimplemented from ilObjectLP.

Definition at line 100 of file class.ilForumLP.php.

References ilLPObjSettings\LP_MODE_CONTRIBUTION_TO_DISCUSSION, and ilLPObjSettings\LP_MODE_DEACTIVATED.

◆ saveModeConfiguration()

ilForumLP::saveModeConfiguration ( string  $selected_group,
array  $group_data,
bool &  $modeChanged 
)
Parameters
string$selected_grouppost var of the selected group
array<string,mixed>$group_data data of the that group as array, as processed by the KS

Reimplemented from ilObjectLP.

Definition at line 58 of file class.ilForumLP.php.

62 : void {
63 $frm_properties = ilForumProperties::getInstance($this->obj_id);
64
65 $current_value = $frm_properties->getLpReqNumPostings();
66
67 if (is_numeric($group_data['number_of_postings'] ?? null)) {
68 $frm_properties->setLpReqNumPostings(
69 (int) $group_data['number_of_postings']
70 );
71 } else {
72 $frm_properties->setLpReqNumPostings(null);
73 }
74 $frm_properties->update();
75
76 if ($current_value !== $frm_properties->getLpReqNumPostings()) {
77 $modeChanged = true;
78 }
79 }

The documentation for this class was generated from the following file: