ILIAS  release_8 Revision v8.24
ilPCMediaObjectQuickEdit Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilPCMediaObjectQuickEdit:

Public Member Functions

 __construct (ilPCMediaObject $pcmedia)
 
 getTitle ()
 Get title (always from mob) More...
 
 isTitleReadOnly ()
 Is title read only? (If more than one usage exists) More...
 
 setTitle (string $title)
 Set title. More...
 
 getClass ()
 Get style class. More...
 
 setClass (string $class)
 Set style class. More...
 
 getHorizontalAlign ()
 Get horizontal alignment. More...
 
 setHorizontalAlign (string $align)
 Set horizontal alignment. More...
 
 getUseFullscreen ()
 Using fullscreen? Yes, if mob has fullscreen item and fullscreen alias exists. More...
 
 setUseFullscreen (bool $use_fullscreen)
 
 getCaption ()
 Get caption from pc, if set, from mob otherwise. More...
 
 setCaption (string $caption)
 Set caption (pc if more usages, otherwise mob) More...
 
 getTextRepresentation ()
 Get text representation from pc, if set, from mob otherwise. More...
 
 setTextRepresentation (string $alt_text)
 Set text representation (pc if more usages, otherwise mob) More...
 

Protected Attributes

ilPCMediaObject $pcmedia
 
ilObjMediaObject $mob
 
int $usage_cnt
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Manages business logic in media slate editing

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilPCMediaObjectQuickEdit.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCMediaObjectQuickEdit::__construct ( ilPCMediaObject  $pcmedia)

Definition at line 30 of file class.ilPCMediaObjectQuickEdit.php.

32 {
33 $this->pcmedia = $pcmedia;
34 $this->mob = $pcmedia->getMediaObject();
35 if (!is_null($this->mob)) {
36 $this->usage_cnt = count($this->mob->getUsages());
37 }
38 }

References $pcmedia, and ilPCMediaObject\getMediaObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ getCaption()

ilPCMediaObjectQuickEdit::getCaption ( )

Get caption from pc, if set, from mob otherwise.

Definition at line 162 of file class.ilPCMediaObjectQuickEdit.php.

162 : string
163 {
164 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
165 $std_item = $this->mob->getMediaItem("Standard");
166
167 if (trim($std_alias->getCaption()) == "") {
168 return trim($std_item->getCaption());
169 }
170 return trim($std_alias->getCaption());
171 }

◆ getClass()

ilPCMediaObjectQuickEdit::getClass ( )

Get style class.

Definition at line 73 of file class.ilPCMediaObjectQuickEdit.php.

73 : string
74 {
75 $selected = $this->pcmedia->getClass();
76 if ($selected == "") {
77 $selected = "MediaContainer";
78 }
79 return $selected;
80 }

◆ getHorizontalAlign()

ilPCMediaObjectQuickEdit::getHorizontalAlign ( )

Get horizontal alignment.

Definition at line 96 of file class.ilPCMediaObjectQuickEdit.php.

96 : string
97 {
98 return $this->pcmedia->getStandardMediaAliasItem()->getHorizontalAlign();
99 }

◆ getTextRepresentation()

ilPCMediaObjectQuickEdit::getTextRepresentation ( )

Get text representation from pc, if set, from mob otherwise.

Definition at line 193 of file class.ilPCMediaObjectQuickEdit.php.

193 : string
194 {
195 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
196 $std_item = $this->mob->getMediaItem("Standard");
197
198 if (trim($std_alias->getTextRepresentation()) == "") {
199 return trim($std_item->getTextRepresentation());
200 }
201 return trim($std_alias->getTextRepresentation());
202 }

◆ getTitle()

ilPCMediaObjectQuickEdit::getTitle ( )

Get title (always from mob)

Definition at line 45 of file class.ilPCMediaObjectQuickEdit.php.

45 : string
46 {
47 return $this->mob->getTitle();
48 }

◆ getUseFullscreen()

ilPCMediaObjectQuickEdit::getUseFullscreen ( )

Using fullscreen? Yes, if mob has fullscreen item and fullscreen alias exists.

Definition at line 114 of file class.ilPCMediaObjectQuickEdit.php.

114 : bool
115 {
116 return ($this->mob->hasFullscreenItem() && $this->pcmedia->getFullscreenMediaAliasItem()->exists());
117 }

◆ isTitleReadOnly()

ilPCMediaObjectQuickEdit::isTitleReadOnly ( )

Is title read only? (If more than one usage exists)

Definition at line 53 of file class.ilPCMediaObjectQuickEdit.php.

53 : bool
54 {
55 return ($this->usage_cnt > 1);
56 }

Referenced by setTitle().

+ Here is the caller graph for this function:

◆ setCaption()

ilPCMediaObjectQuickEdit::setCaption ( string  $caption)

Set caption (pc if more usages, otherwise mob)

Definition at line 176 of file class.ilPCMediaObjectQuickEdit.php.

176 : void
177 {
178 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
179 $std_item = $this->mob->getMediaItem("Standard");
180 if ($this->pcmedia->checkInstanceEditing()) {
181 $std_alias->setCaption($caption);
182 } else {
183 $std_alias->deriveCaption();
184 $std_item->setCaption($caption);
185 }
186 }

◆ setClass()

ilPCMediaObjectQuickEdit::setClass ( string  $class)

Set style class.

Definition at line 85 of file class.ilPCMediaObjectQuickEdit.php.

85 : void
86 {
87 $this->pcmedia->setClass($class);
88 }

◆ setHorizontalAlign()

ilPCMediaObjectQuickEdit::setHorizontalAlign ( string  $align)

Set horizontal alignment.

Definition at line 104 of file class.ilPCMediaObjectQuickEdit.php.

104 : void
105 {
106 $this->pcmedia->getStandardMediaAliasItem()->setHorizontalAlign($align);
107 }

◆ setTextRepresentation()

ilPCMediaObjectQuickEdit::setTextRepresentation ( string  $alt_text)

Set text representation (pc if more usages, otherwise mob)

Definition at line 207 of file class.ilPCMediaObjectQuickEdit.php.

207 : void
208 {
209 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
210 $std_item = $this->mob->getMediaItem("Standard");
211 if ($this->pcmedia->checkInstanceEditing()) {
212 $std_alias->setTextRepresentation($alt_text);
213 } else {
214 $std_alias->deriveTextRepresentation();
215 $std_item->setTextRepresentation($alt_text);
216 }
217 }

◆ setTitle()

ilPCMediaObjectQuickEdit::setTitle ( string  $title)

Set title.

Definition at line 61 of file class.ilPCMediaObjectQuickEdit.php.

61 : void
62 {
63 if (!$this->isTitleReadOnly()) {
64 $this->mob->setTitle($title);
65 }
66 }
isTitleReadOnly()
Is title read only? (If more than one usage exists)

References isTitleReadOnly().

+ Here is the call graph for this function:

◆ setUseFullscreen()

ilPCMediaObjectQuickEdit::setUseFullscreen ( bool  $use_fullscreen)

Definition at line 119 of file class.ilPCMediaObjectQuickEdit.php.

119 : void
120 {
121 $full_alias = $this->pcmedia->getFullscreenMediaAliasItem();
122 // if fullscreen should be used...
123 if ($use_fullscreen) {
124
125 //... ensure mob has fullscreen
126 if (!$this->mob->hasFullscreenItem()) {
127 $std_item = $this->mob->getMediaItem("Standard");
128 $full_item = new ilMediaItem();
129 $this->mob->addMediaItem($full_item);
130 $full_item->setPurpose("Fullscreen");
131 $full_item->setLocationType($std_item->getLocationType());
132 $full_item->setFormat($std_item->getFormat());
133 $full_item->setLocation($std_item->getLocation());
134 }
135
136 //... ensure fullscreen alias exists
137 if (!$full_alias->exists()) {
138 $full_alias->insert();
139 $full_alias->deriveSize();
140 $full_alias->deriveCaption();
141 $full_alias->deriveTextRepresentation();
142 $full_alias->deriveParameters();
143 }
144 } else {
145 if ($this->pcmedia->checkInstanceEditing()) {
146 if ($full_alias->exists()) {
147 $full_alias->delete();
148 }
149 } else {
150 if ($this->mob->hasFullscreenItem()) {
151 $this->mob->removeMediaItem("Fullscreen");
152 }
153 }
154 }
155 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $mob

ilObjMediaObject ilPCMediaObjectQuickEdit::$mob
protected

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

◆ $pcmedia

ilPCMediaObject ilPCMediaObjectQuickEdit::$pcmedia
protected

Definition at line 26 of file class.ilPCMediaObjectQuickEdit.php.

Referenced by __construct().

◆ $usage_cnt

int ilPCMediaObjectQuickEdit::$usage_cnt
protected

Definition at line 28 of file class.ilPCMediaObjectQuickEdit.php.


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