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

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

+ Inheritance diagram for ilPCPlaceHolderGUI:
+ Collaboration diagram for ilPCPlaceHolderGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 edit ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 initCreationForm ()
 Property Form. More...
 
 cancel ()
 Cancel. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 displayValidationError ()
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 

Data Fields

const TYPE_TEXT = "Text"
 
const TYPE_QUESTION = "Question"
 
const TYPE_MEDIA = "Media"
 
const TYPE_VERIFICATION = "Verification"
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 

Protected Member Functions

 insert ()
 
 create ()
 
 edit_object ()
 
 forward_edit ()
 
 saveProperties ()
 save placeholder properties in db and return to page edit screen More...
 
 getAvailableTypes (string $a_selected_type="")
 
 getTypeCaptions ()
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 

Protected Attributes

ilPropertyFormGUI $form_gui
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
LOMServices $lom_services
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

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 User Interface for Place Holder Management

Author
Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m @ilCtrl_Calls ilPCPlaceHolderGUI: ilPCMediaObjectGUI

Definition at line 25 of file class.ilPCPlaceHolderGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCPlaceHolderGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Reimplemented from ilPageContentGUI.

Definition at line 33 of file class.ilPCPlaceHolderGUI.php.

38 {
39 global $DIC;
40
41 $this->lng = $DIC->language();
42 $this->pg_obj = $a_pg_obj;
43 $this->content_obj = $a_content_obj;
44 $this->hier_id = $a_hier_id;
45 $this->pc_id = $a_pc_id;
46
47 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
48 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilPCPlaceHolderGUI::cancel ( )

Cancel.

Reimplemented from ilPageContentGUI.

Definition at line 219 of file class.ilPCPlaceHolderGUI.php.

219 : void
220 {
221 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
222 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ create()

ilPCPlaceHolderGUI::create ( )
protected

Definition at line 74 of file class.ilPCPlaceHolderGUI.php.

74 : void
75 {
76 $plach_height = $this->request->getString("plach_height");
77 if ($plach_height == "" ||
78 !preg_match("/[0-9]+/", $plach_height)) {
79 $this->insert();
80 return;
81 }
82
83 $this->content_obj = new ilPCPlaceHolder($this->getPage());
84 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
85 $this->content_obj->setHeight($plach_height . "px");
86 $this->content_obj->setContentClass(
87 $this->request->getString("plach_type")
88 );
89 $this->updated = $this->pg_obj->update();
90 if ($this->updated === true) {
91 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
92 } else {
93 $this->insert();
94 }
95 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), and insert().

+ Here is the call graph for this function:

◆ edit()

ilPCPlaceHolderGUI::edit ( )

Definition at line 97 of file class.ilPCPlaceHolderGUI.php.

97 : void
98 {
99 if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
100 $this->edit_object();
101 } else {
102 $this->forward_edit();
103 }
104 }

References edit_object(), forward_edit(), and ilPageContentGUI\getPageConfig().

Referenced by saveProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_object()

ilPCPlaceHolderGUI::edit_object ( )
protected

Definition at line 116 of file class.ilPCPlaceHolderGUI.php.

116 : void
117 {
118 $this->propertyGUI(
119 "saveProperties",
120 $this->content_obj->getContentClass(),
121 $this->content_obj->getHeight(),
122 "save"
123 );
124 }

Referenced by edit(), and saveProperties().

+ Here is the caller graph for this function:

◆ executeCommand()

ilPCPlaceHolderGUI::executeCommand ( )

Definition at line 50 of file class.ilPCPlaceHolderGUI.php.

50 : void
51 {
52 // get next class that processes or forwards current command
53 $next_class = $this->ctrl->getNextClass($this);
54 // get current command
55 $cmd = $this->ctrl->getCmd();
56
57 switch ($next_class) {
58 case 'ilpcmediaobjectgui': //special handling
59 $media_gui = new ilPCMediaObjectGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
60 $ret = $this->ctrl->forwardCommand($media_gui);
61 break;
62
63 default:
64 $this->$cmd();
65 break;
66 }
67 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ forward_edit()

ilPCPlaceHolderGUI::forward_edit ( )
protected

Definition at line 126 of file class.ilPCPlaceHolderGUI.php.

126 : void
127 {
128 switch ($this->content_obj->getContentClass()) {
129 case self::TYPE_MEDIA:
130 $this->ctrl->saveParameterByClass(
131 ilPCMediaObjectGUI::class,
132 ["pc_id", "hier_id", "obj_id", "active_node"]
133 );
134 $this->ctrl->redirectByClass(
135 [ilPCMediaObjectGUI::class],
136 "insert"
137 );
138 break;
139
141 $this->ctrl->saveParameterByClass(
142 ilPCQuestionGUI::class,
143 ["pc_id", "hier_id", "obj_id", "active_node"]
144 );
145 $this->ctrl->redirectByClass(
146 [ilPCQuestionGUI::class],
147 "insert"
148 );
149 break;
150
151 default:
152 break;
153 }
154 }

References ILIAS\Repository\ctrl(), TYPE_MEDIA, and TYPE_QUESTION.

Referenced by edit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableTypes()

ilPCPlaceHolderGUI::getAvailableTypes ( string  $a_selected_type = "")
protected

Definition at line 224 of file class.ilPCPlaceHolderGUI.php.

226 : array {
227 // custom config?
228 if (method_exists($this->getPage()->getPageConfig(), "getAvailablePlaceholderTypes")) {
229 $types = $this->getPage()->getPageConfig()->getAvailablePlaceholderTypes();
230 } else {
231 $types = array(self::TYPE_TEXT, self::TYPE_MEDIA, self::TYPE_QUESTION);
232 }
233 return $types;
234 }

References ilPageContentGUI\getPage().

Referenced by initCreationForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleId()

ilPCPlaceHolderGUI::getStyleId ( )

Reimplemented from ilPageContentGUI.

Definition at line 111 of file class.ilPCPlaceHolderGUI.php.

111 : int
112 {
113 return $this->styleid;
114 }

References ilPageContentGUI\$styleid.

◆ getTypeCaptions()

ilPCPlaceHolderGUI::getTypeCaptions ( )
protected

Definition at line 236 of file class.ilPCPlaceHolderGUI.php.

236 : array
237 {
239
240 return array(
241 self::TYPE_TEXT => $lng->txt("cont_ed_plachtext"),
242 self::TYPE_MEDIA => $lng->txt("cont_ed_plachmedia"),
243 self::TYPE_QUESTION => $lng->txt("cont_ed_plachquestion"),
244 self::TYPE_VERIFICATION => $lng->txt("cont_ed_plachverification")
245 );
246 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $lng.

Referenced by initCreationForm().

+ Here is the caller graph for this function:

◆ initCreationForm()

ilPCPlaceHolderGUI::initCreationForm ( )

Property Form.

Definition at line 184 of file class.ilPCPlaceHolderGUI.php.

185 {
187
188 $this->form_gui = new ilPropertyFormGUI();
189 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
190 $this->form_gui->setTitle($lng->txt("cont_ed_plachprop"));
191
192 $ttype_input = new ilRadioGroupInputGUI($lng->txt("type"), "plach_type");
193 $type_captions = $this->getTypeCaptions();
194 foreach ($this->getAvailableTypes("") as $type) {
195 $ttype_input->addOption(new ilRadioOption($type_captions[$type], $type));
196 }
197 $ttype_input->setValue("Text");
198 $ttype_input->setRequired(true);
199 $this->form_gui->addItem($ttype_input);
200
201 /*
202 $theight_input = new ilTextInputGUI($lng->txt("height"), "plach_height");
203 $theight_input->setSize(4);
204 $theight_input->setMaxLength(3);
205 $theight_input->setTitle($lng->txt("height") . " (px)");
206 $theight_input->setRequired(true);
207 $this->form_gui->addItem($theight_input);
208
209 $theight_input->setValue(preg_replace("/px/", "", $a_height));*/
210 if ($this->content_obj) {
211 $ttype_input->setValue($this->content_obj->getContentClass());
212 }
213
214 $this->form_gui->addCommandButton("insert", $lng->txt("insert"));
215 $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
216 return $this->form_gui;
217 }
getAvailableTypes(string $a_selected_type="")
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.

References $form_gui, ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), getAvailableTypes(), getTypeCaptions(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ insert()

ilPCPlaceHolderGUI::insert ( )
protected

Definition at line 69 of file class.ilPCPlaceHolderGUI.php.

69 : void
70 {
71 $this->propertyGUI("create", self::TYPE_TEXT, "100px", "insert");
72 }

Referenced by create().

+ Here is the caller graph for this function:

◆ saveProperties()

ilPCPlaceHolderGUI::saveProperties ( )
protected

save placeholder properties in db and return to page edit screen

Definition at line 160 of file class.ilPCPlaceHolderGUI.php.

160 : void
161 {
162 $plach_height = $this->request->getString("plach_height");
163 if ($plach_height == "" ||
164 !preg_match("/[0-9]+/", $plach_height)) {
165 $this->edit_object();
166 return;
167 }
168
169 $this->content_obj->setContentClass($this->request->getString("plach_type"));
170 $this->content_obj->setHeight($plach_height . "px");
171
172 $this->updated = $this->pg_obj->update();
173 if ($this->updated === true) {
174 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
175 } else {
176 $this->pg_obj->addHierIDs();
177 $this->edit();
178 }
179 }

References ILIAS\Repository\ctrl(), edit(), and edit_object().

+ Here is the call graph for this function:

◆ setStyleId()

ilPCPlaceHolderGUI::setStyleId ( int  $a_styleid)

Reimplemented from ilPageContentGUI.

Definition at line 106 of file class.ilPCPlaceHolderGUI.php.

106 : void
107 {
108 $this->styleid = $a_styleid;
109 }

Field Documentation

◆ $form_gui

ilPropertyFormGUI ilPCPlaceHolderGUI::$form_gui
protected

Definition at line 31 of file class.ilPCPlaceHolderGUI.php.

Referenced by initCreationForm().

◆ TYPE_MEDIA

const ilPCPlaceHolderGUI::TYPE_MEDIA = "Media"

◆ TYPE_QUESTION

const ilPCPlaceHolderGUI::TYPE_QUESTION = "Question"

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

Referenced by forward_edit().

◆ TYPE_TEXT

const ilPCPlaceHolderGUI::TYPE_TEXT = "Text"

◆ TYPE_VERIFICATION

const ilPCPlaceHolderGUI::TYPE_VERIFICATION = "Verification"

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