ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilContainerStartObjectsGUI Class Reference

Class ilContainerStartObjectsGUI. More...

+ Collaboration diagram for ilContainerStartObjectsGUI:

Public Member Functions

 __construct (ilObject $a_parent_obj)
 
 executeCommand ()
 
 setTabs (string $a_active="manage")
 
 askDeleteStarter (array $start_obj_ids)
 
 addStarter (array $selected_ref_ids)
 

Protected Member Functions

 checkPermission (string $a_cmd)
 
 listStructureObject ()
 
 buildObjectsTable ()
 
 saveSortingObject ()
 
 deleteStarterObject ()
 
 selectStarterObject ()
 
 buildPossibleObjectsTable ()
 

Protected Attributes

ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
UIFactory $ui_factory
 
ilObject $object
 
ilContainerStartObjects $start_object
 
StandardGUIRequest $request
 
ILIAS Style Content GUIService $content_style_gui
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilContainerStartObjectsGUI::__construct ( ilObject  $a_parent_obj)

Definition at line 47 of file class.ilContainerStartObjectsGUI.php.

References $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObject\getRefId(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\settings(), and ILIAS\Repository\toolbar().

48  {
49  global $DIC;
50 
51  $this->access = $DIC->access();
52  $this->settings = $DIC->settings();
53  $this->toolbar = $DIC->toolbar();
54  $this->ui_factory = $DIC->ui()->factory();
55  $ilCtrl = $DIC->ctrl();
56  $ilTabs = $DIC->tabs();
57  $lng = $DIC->language();
58  $tpl = $DIC["tpl"];
59 
60  $this->ctrl = $ilCtrl;
61  $this->tabs_gui = $ilTabs;
62  $this->lng = $lng;
63  $this->tpl = $tpl;
64  $this->object = $a_parent_obj;
65 
66  $this->start_object = new ilContainerStartObjects(
67  $this->object->getRefId(),
68  $this->object->getId()
69  );
70 
71  $this->request = $DIC->container()
72  ->internal()
73  ->gui()
74  ->standardRequest();
75 
76  $this->lng->loadLanguageModule("crs");
77  $cs = $DIC->contentStyle();
78  $this->content_style_domain = $cs->domain()->styleForRefId($a_parent_obj->getRefId());
79  $this->content_style_gui = $cs->gui();
80  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ addStarter()

ilContainerStartObjectsGUI::addStarter ( array  $selected_ref_ids)
Parameters
int[]$selected_ref_ids

Definition at line 287 of file class.ilContainerStartObjectsGUI.php.

References checkPermission(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

287  : void
288  {
289  $this->checkPermission('write');
290 
291  if (count($selected_ref_ids) === 0) {
292  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
293  $this->ctrl->redirect($this, "selectStarter");
294  }
295 
296  $added = 0;
297  foreach ($selected_ref_ids as $item_ref_id) {
298  if (!$this->start_object->exists($item_ref_id)) {
299  ++$added;
300  $this->start_object->add($item_ref_id);
301  }
302  }
303  if ($added) {
304  $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_added_starters'), true);
305  $this->ctrl->redirect($this, "listStructure");
306  } else {
307  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('crs_starters_already_assigned'), true);
308  $this->ctrl->redirect($this, "selectStarter");
309  }
310  }
+ Here is the call graph for this function:

◆ askDeleteStarter()

ilContainerStartObjectsGUI::askDeleteStarter ( array  $start_obj_ids)
Parameters
int[]$start_obj_ids

Definition at line 212 of file class.ilContainerStartObjectsGUI.php.

References ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setTabs().

212  : void
213  {
214  if (count($start_obj_ids) === 0) {
215  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
216  $this->ctrl->redirect($this, "listStructure");
217  }
218 
219  $this->checkPermission('write');
220  $this->setTabs();
221 
222  // display confirmation message
223  $cgui = new ilConfirmationGUI();
224  $cgui->setFormAction($this->ctrl->getFormAction($this, "listStructure"));
225  $cgui->setHeaderText($this->lng->txt("crs_starter_delete_sure"));
226  $cgui->setCancel($this->lng->txt("cancel"), "listStructure");
227  $cgui->setConfirm($this->lng->txt("remove"), "deleteStarter");
228 
229  // list objects that should be deleted
230  $all = $this->start_object->getStartObjects();
231  foreach ($start_obj_ids as $starter_id) {
232  $obj_id = ilObject::_lookupObjId($all[$starter_id]["item_ref_id"]);
233  $title = ilObject::_lookupTitle($obj_id);
234  $icon = ilObject::_getIcon($obj_id, "tiny");
235  $alt = $this->lng->txt('obj_' . ilObject::_lookupType($obj_id));
236  $cgui->addItem("starter[]", (string) $starter_id, $title, $icon, $alt);
237  }
238 
239  $this->tpl->setContent($cgui->getHTML());
240  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ buildObjectsTable()

ilContainerStartObjectsGUI::buildObjectsTable ( )
protected

Definition at line 180 of file class.ilContainerStartObjectsGUI.php.

References ILIAS\Repository\lng().

Referenced by listStructureObject(), and saveSortingObject().

181  {
182  $builder = new ObjectsTableBuilder(
183  $this,
184  'listStructure',
185  $this->start_object,
186  $this->lng,
187  $this->ui_factory
188  );
189  return $builder->getTable();
190  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPossibleObjectsTable()

ilContainerStartObjectsGUI::buildPossibleObjectsTable ( )
protected

Definition at line 272 of file class.ilContainerStartObjectsGUI.php.

References ILIAS\Repository\lng().

Referenced by selectStarterObject().

273  {
274  $builder = new PossibleObjectsTableBuilder(
275  $this,
276  'selectStarter',
277  $this->start_object,
278  $this->lng,
279  $this->ui_factory
280  );
281  return $builder->getTable();
282  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPermission()

ilContainerStartObjectsGUI::checkPermission ( string  $a_cmd)
protected

Definition at line 127 of file class.ilContainerStartObjectsGUI.php.

References $access, $ref_id, ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilUtil\redirect().

Referenced by addStarter(), askDeleteStarter(), deleteStarterObject(), executeCommand(), listStructureObject(), and selectStarterObject().

127  : void
128  {
129  $ilAccess = $this->access;
130 
131  $ref_id = $this->object->getRefId();
132  if (!$ilAccess->checkAccess($a_cmd, "", $ref_id)) {
133  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
134  ilUtil::redirect("goto.php?target=" . $this->object->getType() . "_" . $ref_id);
135  }
136  }
$ref_id
Definition: ltiauth.php:65
static redirect(string $a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteStarterObject()

ilContainerStartObjectsGUI::deleteStarterObject ( )
protected

Definition at line 242 of file class.ilContainerStartObjectsGUI.php.

References checkPermission(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

242  : void
243  {
244  $this->checkPermission('write');
245 
246  if (count($this->request->getStartObjIds()) === 0) {
247  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
248  } else {
249  foreach ($this->request->getStartObjIds() as $starter_id) {
250  $this->start_object->delete((int) $starter_id);
251  }
252 
253  $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_starter_deleted'), true);
254  }
255 
256  $this->ctrl->redirect($this, "listStructure");
257  }
+ Here is the call graph for this function:

◆ executeCommand()

ilContainerStartObjectsGUI::executeCommand ( )

Definition at line 82 of file class.ilContainerStartObjectsGUI.php.

References ilPageObject\_exists(), checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilPageObjectGUI\setStyleId().

82  : void
83  {
84  switch ($this->ctrl->getNextClass($this)) {
85  case "ilcontainerstartobjectspagegui":
86  $this->checkPermission("write");
87  $this->tabs_gui->clearTargets();
88  $this->tabs_gui->setBackTarget(
89  $this->lng->txt("back"),
90  $this->ctrl->getLinkTarget($this, "listStructure")
91  );
92 
93  if (!ilContainerStartObjectsPage::_exists("cstr", $this->object->getId())) {
94  // doesn't exist -> create new one
95  $new_page_object = new ilContainerStartObjectsPage();
96  $new_page_object->setParentId($this->object->getId());
97  $new_page_object->setId($this->object->getId());
98  $new_page_object->createFromXML();
99  unset($new_page_object);
100  }
101 
102  $this->content_style_gui->addCss(
103  $this->tpl,
104  $this->object->getRefId()
105  );
106 
107  $this->ctrl->setReturnByClass("ilcontainerstartobjectspagegui", "edit");
108  $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
109  $pgui->setStyleId(
110  $this->content_style_domain->getEffectiveStyleId()
111  );
112 
113  $ret = $this->ctrl->forwardCommand($pgui);
114  if ($ret) {
115  $this->tpl->setContent($ret);
116  }
117  break;
118 
119  default:
120  $cmd = $this->ctrl->getCmd("listStructure");
121  $cmd .= "Object";
122  $this->$cmd();
123  break;
124  }
125  }
Container start objects page GUI class.
Container start objects page object.
setStyleId(int $a_styleid)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:

◆ listStructureObject()

ilContainerStartObjectsGUI::listStructureObject ( )
protected

Definition at line 151 of file class.ilContainerStartObjectsGUI.php.

References $ilSetting, $settings, $toolbar, buildObjectsTable(), checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setTabs().

151  : void
152  {
153  $ilToolbar = $this->toolbar;
155 
156  $this->checkPermission('write');
157  $this->setTabs();
158 
159  $ilToolbar->addButton(
160  $this->lng->txt('crs_add_starter'),
161  $this->ctrl->getLinkTarget($this, 'selectStarter')
162  );
163 
164  // :TODO: depending on this setting?
165  if ($ilSetting->get("enable_cat_page_edit")) {
166  $ilToolbar->addButton(
167  $this->lng->txt("cntr_text_media_editor"),
168  $this->ctrl->getLinkTargetByClass("ilContainerStartObjectsPageGUI", "edit")
169  );
170  }
171 
172  $table = $this->buildObjectsTable();
173  if ($table->handleCommand()) {
174  return;
175  }
176 
177  $this->tpl->setContent($table->render());
178  }
global $ilSetting
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ saveSortingObject()

ilContainerStartObjectsGUI::saveSortingObject ( )
protected

Definition at line 192 of file class.ilContainerStartObjectsGUI.php.

References buildObjectsTable(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

192  : void
193  {
194  $table = $this->buildObjectsTable();
195  $pos = $table->getData();
196  if (is_array($pos)) {
197  $counter = 0;
198  foreach ($pos as $start_id) {
199  $counter += 10;
200  $this->start_object->setObjectPos($start_id, $counter);
201  }
202 
203  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cntr_saved_sorting'), true);
204  }
205 
206  $this->ctrl->redirect($this, "listStructure");
207  }
+ Here is the call graph for this function:

◆ selectStarterObject()

ilContainerStartObjectsGUI::selectStarterObject ( )
protected

Definition at line 259 of file class.ilContainerStartObjectsGUI.php.

References buildPossibleObjectsTable(), checkPermission(), and setTabs().

259  : void
260  {
261  $this->checkPermission('write');
262  $this->setTabs();
263 
264  $table = $this->buildPossibleObjectsTable();
265  if ($table->handleCommand()) {
266  return;
267  }
268 
269  $this->tpl->setContent($table->render());
270  }
+ Here is the call graph for this function:

◆ setTabs()

ilContainerStartObjectsGUI::setTabs ( string  $a_active = "manage")

Definition at line 138 of file class.ilContainerStartObjectsGUI.php.

References $ilSetting, $settings, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by askDeleteStarter(), listStructureObject(), and selectStarterObject().

138  : void
139  {
141 
142  $this->tabs_gui->addSubTab(
143  "manage",
144  $this->lng->txt("cntr_manage"),
145  $this->ctrl->getLinkTarget($this, "listStructure")
146  );
147 
148  $this->tabs_gui->activateSubTab($a_active);
149  }
global $ilSetting
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilContainerStartObjectsGUI::$access
protected

Definition at line 37 of file class.ilContainerStartObjectsGUI.php.

Referenced by checkPermission().

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilContainerStartObjectsGUI::$content_style_domain
protected

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

◆ $content_style_gui

ILIAS Style Content GUIService ilContainerStartObjectsGUI::$content_style_gui
protected

Definition at line 44 of file class.ilContainerStartObjectsGUI.php.

◆ $ctrl

ilCtrl ilContainerStartObjectsGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilContainerStartObjectsGUI::$lng
protected

Definition at line 35 of file class.ilContainerStartObjectsGUI.php.

Referenced by __construct().

◆ $object

ilObject ilContainerStartObjectsGUI::$object
protected

Definition at line 41 of file class.ilContainerStartObjectsGUI.php.

◆ $request

StandardGUIRequest ilContainerStartObjectsGUI::$request
protected

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

◆ $settings

ilSetting ilContainerStartObjectsGUI::$settings
protected

Definition at line 38 of file class.ilContainerStartObjectsGUI.php.

Referenced by listStructureObject(), and setTabs().

◆ $start_object

ilContainerStartObjects ilContainerStartObjectsGUI::$start_object
protected

Definition at line 42 of file class.ilContainerStartObjectsGUI.php.

◆ $tabs_gui

ilTabsGUI ilContainerStartObjectsGUI::$tabs_gui
protected

Definition at line 34 of file class.ilContainerStartObjectsGUI.php.

◆ $toolbar

ilToolbarGUI ilContainerStartObjectsGUI::$toolbar
protected

Definition at line 39 of file class.ilContainerStartObjectsGUI.php.

Referenced by listStructureObject().

◆ $tpl

ilGlobalTemplateInterface ilContainerStartObjectsGUI::$tpl
protected

Definition at line 36 of file class.ilContainerStartObjectsGUI.php.

Referenced by __construct().

◆ $ui_factory

UIFactory ilContainerStartObjectsGUI::$ui_factory
protected

Definition at line 40 of file class.ilContainerStartObjectsGUI.php.


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