ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $this->usage_cnt = count($this->mob->getUsages());
36 }

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 159 of file class.ilPCMediaObjectQuickEdit.php.

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

◆ getClass()

ilPCMediaObjectQuickEdit::getClass ( )

Get style class.

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

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

◆ getHorizontalAlign()

ilPCMediaObjectQuickEdit::getHorizontalAlign ( )

Get horizontal alignment.

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

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

◆ getTextRepresentation()

ilPCMediaObjectQuickEdit::getTextRepresentation ( )

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

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

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

◆ getTitle()

ilPCMediaObjectQuickEdit::getTitle ( )

Get title (always from mob)

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

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

◆ getUseFullscreen()

ilPCMediaObjectQuickEdit::getUseFullscreen ( )

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

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

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

◆ isTitleReadOnly()

ilPCMediaObjectQuickEdit::isTitleReadOnly ( )

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

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

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

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 173 of file class.ilPCMediaObjectQuickEdit.php.

173 : void
174 {
175 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
176 $std_item = $this->mob->getMediaItem("Standard");
177 if ($this->pcmedia->checkInstanceEditing()) {
178 if ($caption !== $std_item->getCaption()) { // in quick edit we derive if the value is equal to the item caption
179 $std_alias->setCaption($caption);
180 } else {
181 $std_alias->deriveCaption();
182 }
183 } else {
184 $std_alias->deriveCaption();
185 $std_item->setCaption($caption);
186 }
187 }

◆ setClass()

ilPCMediaObjectQuickEdit::setClass ( string  $class)

Set style class.

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

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

◆ setHorizontalAlign()

ilPCMediaObjectQuickEdit::setHorizontalAlign ( string  $align)

Set horizontal alignment.

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

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

◆ setTextRepresentation()

ilPCMediaObjectQuickEdit::setTextRepresentation ( string  $alt_text)

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

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

208 : void
209 {
210 $std_alias = $this->pcmedia->getStandardMediaAliasItem();
211 $std_item = $this->mob->getMediaItem("Standard");
212 if ($this->pcmedia->checkInstanceEditing()) {
213 if ($alt_text !== $std_item->getTextRepresentation()) { // in quick edit we derive if the value is equal to the item caption
214 $std_alias->setTextRepresentation($alt_text);
215 } else {
216 $std_alias->deriveTextRepresentation();
217 }
218 } else {
219 $std_alias->deriveTextRepresentation();
220 $std_item->setTextRepresentation($alt_text);
221 }
222 }

◆ setTitle()

ilPCMediaObjectQuickEdit::setTitle ( string  $title)

Set title.

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

59 : void
60 {
61 if (!$this->isTitleReadOnly()) {
62 $this->mob->setTitle($title);
63 }
64 }
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 117 of file class.ilPCMediaObjectQuickEdit.php.

117 : void
118 {
119 $full_alias = $this->pcmedia->getFullscreenMediaAliasItem();
120 // if fullscreen should be used...
121 if ($use_fullscreen) {
122 //... ensure mob has fullscreen
123 if (!$this->mob->hasFullscreenItem()) {
124 $std_item = $this->mob->getMediaItem("Standard");
125 $full_item = new ilMediaItem();
126 $this->mob->addMediaItem($full_item);
127 $full_item->setPurpose("Fullscreen");
128 $full_item->setLocationType($std_item->getLocationType());
129 $full_item->setFormat($std_item->getFormat());
130 $full_item->setLocation($std_item->getLocation());
131 }
132
133 //... ensure fullscreen alias exists
134 if (!$full_alias->exists()) {
135 $full_alias->insert();
136 $full_alias->deriveSize();
137 $full_alias->deriveCaption();
138 $full_alias->deriveTextRepresentation();
139 $full_alias->deriveParameters();
140 }
141 } else {
142 if ($this->pcmedia->checkInstanceEditing()) {
143 if ($full_alias->exists()) {
144 $full_alias->delete();
145 }
146 } else {
147 if ($this->mob->hasFullscreenItem()) {
148 $this->mob->removeMediaItem("Fullscreen");
149 }
150 }
151 }
152 }
Class ilMediaItem Media Item, component of a media object (file or reference)

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: