ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilOrgUnitExportGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
29  protected ilLanguage $lng;
32  protected \ILIAS\UI\Factory $ui_factory;
33 
34  public function __construct(ilObjOrgUnitGUI $a_parent_gui, /*null|ilObject|ilObjOrgUnit*/ ?ilObject $a_main_obj = null)
35  {
36  parent::__construct($a_parent_gui, $a_main_obj);
37 
38  global $DIC;
39  $ilToolbar = $DIC->toolbar();
40  $lng = $DIC->language();
41  $ilCtrl = $DIC->ctrl();
42 
43  $this->toolbar = $DIC->toolbar();
44  $this->lng = $DIC->language();
45  $this->ctrl = $DIC->ctrl();
46  $this->ui_factory = $DIC['ui.factory'];
47 
48  $this->ilObjOrgUnit = $a_parent_gui->getObject();
49 
50  if ($this->ilObjOrgUnit->getRefId() === ilObjOrgUnit::getRootOrgRefId()) {
51  //Simple XML and Simple XLS Export should only be available in the root orgunit folder as it always exports the whole tree
52  $this->extendExportGUI();
53  }
54  }
55 
56  public function listExportFiles(): void
57  {
58  if ($this->ilObjOrgUnit->getRefId() != ilObjOrgUnit::getRootOrgRefId()) {
59  parent::listExportFiles();
60  }
61  }
62 
63  private function extendExportGUI(): void
64  {
65  $this->toolbar->addComponent(
66  $this->ui_factory->link()->standard(
67  $this->lng->txt('simple_xml'),
68  $this->ctrl->getLinkTarget($this, "simpleExport")
69  )
70  );
71  $this->toolbar->addComponent(
72  $this->ui_factory->link()->standard(
73  $this->lng->txt('simple_xls'),
74  $this->ctrl->getLinkTarget($this, "simpleExportExcel")
75  )
76  );
77  }
78 
79  public function simpleExport(): void
80  {
81  $ilOrgUnitExporter = new ilOrgUnitExporter();
82  $ilOrgUnitExporter->sendAndCreateSimpleExportFile();
83  }
84 
85  public function simpleExportExcel(): void
86  {
87  $ilOrgUnitExporter = new ilOrgUnitExporter();
88  $ilOrgUnitExporter->simpleExportExcel(ilObjOrgUnit::getRootOrgRefId());
89  }
90 }
Class ilOrgUnitExportGUI.
__construct(ilObjOrgUnitGUI $a_parent_gui, ?ilObject $a_main_obj=null)
global $DIC
Definition: feed.php:28
Export User Interface Class.
__construct(VocabulariesInterface $vocabularies)
static getRootOrgRefId()