ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjStudyProgrammeSettingsGUI Class Reference

ilObjStudyProgrammeSettingsGUI: ilStudyProgrammeCommonSettingsGUI More...

+ Collaboration diagram for ilObjStudyProgrammeSettingsGUI:

Public Member Functions

 __construct (ilGlobalTemplateInterface $tpl, ilCtrl $ilCtrl, ilLanguage $lng, Factory $input_factory, Renderer $renderer, Psr\Http\Message\ServerRequestInterface $request, ILIAS\Refinery\Factory $refinery_factory, ILIAS\Data\Factory $data_factory, ilStudyProgrammeTypeRepository $type_repository, ilStudyProgrammeCommonSettingsGUI $common_settings_gui, ilTabsGUI $tabs, ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper)
 
 setRefId (int $ref_id)
 
 executeCommand ()
 

Data Fields

const PROP_TITLE = "title"
 
const PROP_DESC = "desc"
 
const PROP_DEADLINE = "deadline"
 
const PROP_VALIDITY_OF_QUALIFICATION = "validity_qualification"
 
const OPT_NO_DEADLINE = 'opt_no_deadline'
 
const OPT_DEADLINE_PERIOD = "opt_deadline_period"
 
const OPT_DEADLINE_DATE = "opt_deadline_date"
 
const OPT_NO_VALIDITY_OF_QUALIFICATION = 'opt_no_validity_qualification'
 
const OPT_VALIDITY_OF_QUALIFICATION_PERIOD = "opt_validity_qualification_period"
 
const OPT_VALIDITY_OF_QUALIFICATION_DATE = "opt_validity_qualification_date"
 

Protected Member Functions

 view ()
 
 update ()
 
 buildModalHeading (string $label, bool $current_node)
 
 buildForm (ilObjStudyProgramme $prg, string $submit_action)
 
 buildFormElements (InputFieldFactory $ff, ilObjectTranslation $trans, array $sp_types, ilStudyProgrammeSettings $settings)
 
 getEditSection (InputFieldFactory $ff, ilObjectTranslation $trans)
 
 getObject ()
 
 txt (string $code)
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ILIAS UI Component Input Factory $input_factory
 
ILIAS UI Renderer $renderer
 
Psr Http Message ServerRequestInterface $request
 
ILIAS Refinery Factory $refinery_factory
 
ILIAS Data Factory $data_factory
 
ilStudyProgrammeTypeRepository $type_repository
 
ilStudyProgrammeCommonSettingsGUI $common_settings_gui
 
ilTabsGUI $tabs
 
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
 
ilObjStudyProgramme $object
 
string $tmp_heading
 
int $ref_id
 

Private Attributes

const TAB_SETTINGS = 'settings'
 
const TAB_COMMON_SETTINGS = 'commonSettings'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeSettingsGUI::__construct ( ilGlobalTemplateInterface  $tpl,
ilCtrl  $ilCtrl,
ilLanguage  $lng,
Factory  $input_factory,
Renderer  $renderer,
Psr\Http\Message\ServerRequestInterface  $request,
ILIAS\Refinery\Factory  $refinery_factory,
ILIAS\Data\Factory  $data_factory,
ilStudyProgrammeTypeRepository  $type_repository,
ilStudyProgrammeCommonSettingsGUI  $common_settings_gui,
ilTabsGUI  $tabs,
ILIAS\HTTP\Wrapper\RequestWrapper  $request_wrapper 
)

Definition at line 64 of file class.ilObjStudyProgrammeSettingsGUI.php.

References $common_settings_gui, $data_factory, $input_factory, $lng, $refinery_factory, $renderer, $request, $request_wrapper, $tabs, $tpl, $type_repository, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), and ILIAS\Repository\tabs().

77  {
78  $this->tpl = $tpl;
79  $this->ctrl = $ilCtrl;
80  $this->lng = $lng;
81  $this->input_factory = $input_factory;
82  $this->renderer = $renderer;
83  $this->request = $request;
84  $this->refinery_factory = $refinery_factory;
85  $this->data_factory = $data_factory;
86  $this->type_repository = $type_repository;
87  $this->common_settings_gui = $common_settings_gui;
88  $this->tabs = $tabs;
89  $this->request_wrapper = $request_wrapper;
90 
91  $this->object = null;
92 
93  $lng->loadLanguageModule("prg");
94  }
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
loadLanguageModule(string $a_module)
Load language module.
Psr Http Message ServerRequestInterface $request
ilStudyProgrammeCommonSettingsGUI $common_settings_gui
ILIAS UI Component Input Factory $input_factory
+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilObjStudyProgrammeSettingsGUI::buildForm ( ilObjStudyProgramme  $prg,
string  $submit_action 
)
protected

Definition at line 221 of file class.ilObjStudyProgrammeSettingsGUI.php.

References ILIAS\LTI\ToolProvider\$settings, buildFormElements(), ilContainer\getObjectTranslation(), ilObjStudyProgramme\getSettings(), ilObject\setDescription(), ilObject\setTitle(), ilObjStudyProgramme\updateCustomIcon(), and ilObjStudyProgramme\updateSettings().

Referenced by view().

225  $trans = $prg->getObjectTranslation();
226  $ff = $this->input_factory->field();
227  $sp_types = $this->type_repository->getAllTypesArray();
228  $settings = $prg->getSettings();
229 
230  return $this->input_factory->container()->form()->standard(
231  $submit_action,
232  $this->buildFormElements(
233  $ff,
234  $trans,
235  $sp_types,
236  $settings
237  )
238  )->withAdditionalTransformation(
239  $this->refinery_factory->custom()->transformation(
240  function ($values) use ($prg) {
241  $object_data = $values[0];
242  $prg->setTitle($object_data[self::PROP_TITLE]);
243  $prg->setDescription($object_data[self::PROP_DESC]);
244 
245  $settings = $prg->getSettings()
246  ->withAssessmentSettings($values['prg_assessment'])
247  ->withDeadlineSettings($values['prg_deadline'])
248  ->withValidityOfQualificationSettings($values['prg_validity_of_qualification'])
249  ->withAutoMailSettings($values['automail_settings'])
250  ->withTypeSettings($values['prg_type']);
251 
252  $prg->updateSettings($settings);
253  $prg->updateCustomIcon();
254  return $prg;
255  }
256  )
257  );
258  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
setTitle(string $title)
buildFormElements(InputFieldFactory $ff, ilObjectTranslation $trans, array $sp_types, ilStudyProgrammeSettings $settings)
setDescription(string $desc)
updateSettings(ilStudyProgrammeSettings $settings)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFormElements()

ilObjStudyProgrammeSettingsGUI::buildFormElements ( InputFieldFactory  $ff,
ilObjectTranslation  $trans,
array  $sp_types,
ilStudyProgrammeSettings  $settings 
)
protected

Definition at line 260 of file class.ilObjStudyProgrammeSettingsGUI.php.

References ilStudyProgrammeSettings\getAssessmentSettings(), ilStudyProgrammeSettings\getAutoMailSettings(), ilStudyProgrammeSettings\getDeadlineSettings(), getEditSection(), ilStudyProgrammeSettings\getTypeSettings(), ilStudyProgrammeSettings\getValidityOfQualificationSettings(), and ILIAS\Repository\lng().

Referenced by buildForm().

265  : array {
266  $return = [
267  $this->getEditSection($ff, $trans),
268  "prg_type" => $settings
269  ->getTypeSettings()
270  ->toFormInput($ff, $this->lng, $this->refinery_factory, $sp_types)
271  ,
272  "prg_assessment" => $settings
274  ->toFormInput($ff, $this->lng, $this->refinery_factory)
275  ,
276  "prg_deadline" => $settings
278  ->toFormInput($ff, $this->lng, $this->refinery_factory, $this->data_factory)
279  ,
280  "prg_validity_of_qualification" => $settings
282  ->toFormInput($ff, $this->lng, $this->refinery_factory, $this->data_factory)
283  ,
284  "automail_settings" => $settings
286  ->toFormInput($ff, $this->lng, $this->refinery_factory)
287  ];
288 
289  return $return;
290  }
getEditSection(InputFieldFactory $ff, ilObjectTranslation $trans)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildModalHeading()

ilObjStudyProgrammeSettingsGUI::buildModalHeading ( string  $label,
bool  $current_node 
)
protected

Definition at line 195 of file class.ilObjStudyProgrammeSettingsGUI.php.

References ILIAS\Repository\ctrl(), and ilLinkButton\getInstance().

Referenced by view().

195  : void
196  {
197  if (!$current_node) {
198  $this->ctrl->saveParameterByClass('ilobjstudyprogrammesettingsgui', 'ref_id');
199  $heading_button = ilLinkButton::getInstance();
200  $heading_button->setCaption('prg_open_node');
201  $heading_button->setUrl(
202  $this->ctrl->getLinkTargetByClass(
203  'ilobjstudyprogrammetreegui',
204  'view'
205  )
206  );
207 
208  $heading =
209  "<div class=''>" .
210  $label .
211  "<div class='pull-right'>" .
212  $heading_button->render() .
213  "</div></div>"
214  ;
215  $this->tmp_heading = $heading;
216  } else {
217  $this->tmp_heading = "<div class=''>" . $label . "</div>";
218  }
219  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjStudyProgrammeSettingsGUI::executeCommand ( )

Definition at line 101 of file class.ilObjStudyProgrammeSettingsGUI.php.

References ILIAS\Repository\ctrl(), getObject(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and view().

101  : void
102  {
103  $next_class = $this->ctrl->getNextClass();
104  switch ($next_class) {
105  case 'ilstudyprogrammecommonsettingsgui':
106  $this->tabs->activateSubTab(self::TAB_COMMON_SETTINGS);
107  $this->common_settings_gui->setObject($this->getObject());
108  $content = $this->ctrl->forwardCommand($this->common_settings_gui);
109  break;
110  default:
111  $cmd = $this->ctrl->getCmd();
112  if ($cmd === "" || $cmd === null) {
113  $cmd = "view";
114  }
115  switch ($cmd) {
116  case "view":
117  $content = $this->view();
118  break;
119  case "update":
120  $content = $this->$cmd();
121  break;
122  default:
123  throw new ilException(
124  "ilObjStudyProgrammeSettingsGUI: Command not supported: $cmd"
125  );
126  }
127  }
128 
129  if (!$this->ctrl->isAsynch()) {
130  $this->tpl->setContent($content);
131  } else {
132  $output_handler = new ilAsyncOutputHandler();
133  $heading = $this->tmp_heading ?? $this->lng->txt("prg_async_" . $this->ctrl->getCmd());
134  $output_handler->setHeading($heading);
135  $output_handler->setContent($content);
136  $output_handler->terminate();
137  }
138  }
Class ilAsyncOutputHandler Handles the output for async-requests.
+ Here is the call graph for this function:

◆ getEditSection()

ilObjStudyProgrammeSettingsGUI::getEditSection ( InputFieldFactory  $ff,
ilObjectTranslation  $trans 
)
protected

Definition at line 292 of file class.ilObjStudyProgrammeSettingsGUI.php.

References $lang, ilMDLanguageItem\_getLanguages(), ILIAS\Repository\ctrl(), ilObjectTranslation\getDefaultDescription(), ilObjectTranslation\getDefaultLanguage(), ilObjectTranslation\getDefaultTitle(), txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by buildFormElements().

296  $languages = ilMDLanguageItem::_getLanguages();
297  $lang = array_key_exists($trans->getDefaultLanguage(), $languages) ? $languages[$trans->getDefaultLanguage()] : '?';
298  return $ff->section(
299  [
300  self::PROP_TITLE =>
301  $ff->text($this->txt("title"))
302  ->withValue($trans->getDefaultTitle())
303  ->withRequired(true),
304  self::PROP_DESC =>
305  $ff->textarea($this->txt("description"))
306  ->withValue($trans->getDefaultDescription() ?? "")
307  ],
308  $this->txt("prg_edit"),
309  $this->txt("language") . ": " . $lang .
310  ' <a href="' . $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "") .
311  '">&raquo; ' . $this->txt("obj_more_translations") . '</a>'
312  );
313  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

ilObjStudyProgrammeSettingsGUI::getObject ( )
protected

Definition at line 315 of file class.ilObjStudyProgrammeSettingsGUI.php.

References $object, and ilObjStudyProgramme\getInstanceByRefId().

Referenced by executeCommand(), update(), and view().

316  {
317  if ($this->object === null) {
318  $this->object = ilObjStudyProgramme::getInstanceByRefId($this->ref_id);
319  }
320  return $this->object;
321  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRefId()

ilObjStudyProgrammeSettingsGUI::setRefId ( int  $ref_id)

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

References $ref_id.

96  : void
97  {
98  $this->ref_id = $ref_id;
99  }

◆ txt()

ilObjStudyProgrammeSettingsGUI::txt ( string  $code)
protected

Definition at line 323 of file class.ilObjStudyProgrammeSettingsGUI.php.

References ILIAS\Repository\lng().

Referenced by getEditSection().

323  : string
324  {
325  return $this->lng->txt($code);
326  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjStudyProgrammeSettingsGUI::update ( )
protected
Returns
string|void

Definition at line 154 of file class.ilObjStudyProgrammeSettingsGUI.php.

References $response, ILIAS\Repository\ctrl(), ilAsyncOutputHandler\encodeAsyncResponse(), getObject(), ilAsyncOutputHandler\handleAsyncOutput(), and ILIAS\Repository\lng().

155  {
156  $form = $this
157  ->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "update"))
158  ->withRequest($this->request);
159 
160  $result = $form->getInputGroup()->getContent();
161 
162  // This could further be improved by providing a new container for async-forms in the
163  // UI-Framework.
164 
165  if ($result->isOK()) {
166  $result->value()->update();
167  $this->tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
168 
169  if ($this->ctrl->isAsynch()) {
171  array(
172  "success" => true,
173  "message" => $this->lng->txt("msg_obj_modified"))
174  );
175  return ilAsyncOutputHandler::handleAsyncOutput($this->renderer->render($form), $response, false);
176  }
177 
178  $this->ctrl->redirect($this);
179  } else {
180  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("msg_form_save_error"));
181 
182  if ($this->ctrl->isAsynch()) {
184  array(
185  "success" => false,
186  "errors" => $form->getError())
187  );
188  return ilAsyncOutputHandler::handleAsyncOutput($this->renderer->render($form), $response, false);
189  }
190 
191  return $this->renderer->render($form);
192  }
193  }
static handleAsyncOutput(string $normal_content, string $async_content=null, bool $apply_to_tpl=true)
Handles async output.
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
$response
+ Here is the call graph for this function:

◆ view()

ilObjStudyProgrammeSettingsGUI::view ( )
protected

Definition at line 140 of file class.ilObjStudyProgrammeSettingsGUI.php.

References buildForm(), buildModalHeading(), ILIAS\Repository\ctrl(), getObject(), and ILIAS\Repository\lng().

Referenced by executeCommand().

140  : string
141  {
142  $this->buildModalHeading(
143  $this->lng->txt('prg_async_settings'),
144  $this->request_wrapper->has("currentNode")
145  );
146 
147  $form = $this->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "update"));
148  return $this->renderer->render($form);
149  }
buildForm(ilObjStudyProgramme $prg, string $submit_action)
buildModalHeading(string $label, bool $current_node)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $common_settings_gui

ilStudyProgrammeCommonSettingsGUI ilObjStudyProgrammeSettingsGUI::$common_settings_gui
protected

Definition at line 56 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilObjStudyProgrammeSettingsGUI::$ctrl
protected

Definition at line 48 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ $data_factory

ILIAS Data Factory ilObjStudyProgrammeSettingsGUI::$data_factory
protected

Definition at line 54 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $input_factory

ILIAS UI Component Input Factory ilObjStudyProgrammeSettingsGUI::$input_factory
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilObjStudyProgrammeSettingsGUI::$lng
protected

Definition at line 49 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $object

ilObjStudyProgramme ilObjStudyProgrammeSettingsGUI::$object
protected

Definition at line 60 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by getObject().

◆ $ref_id

int ilObjStudyProgrammeSettingsGUI::$ref_id
protected

Definition at line 62 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by setRefId().

◆ $refinery_factory

ILIAS Refinery Factory ilObjStudyProgrammeSettingsGUI::$refinery_factory
protected

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

Referenced by __construct().

◆ $renderer

ILIAS UI Renderer ilObjStudyProgrammeSettingsGUI::$renderer
protected

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

Referenced by __construct().

◆ $request

Psr Http Message ServerRequestInterface ilObjStudyProgrammeSettingsGUI::$request
protected

Definition at line 52 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $request_wrapper

ILIAS HTTP Wrapper RequestWrapper ilObjStudyProgrammeSettingsGUI::$request_wrapper
protected

Definition at line 58 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilObjStudyProgrammeSettingsGUI::$tabs
protected

Definition at line 57 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ $tmp_heading

string ilObjStudyProgrammeSettingsGUI::$tmp_heading
protected

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

◆ $tpl

ilGlobalTemplateInterface ilObjStudyProgrammeSettingsGUI::$tpl
protected

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

Referenced by __construct().

◆ $type_repository

ilStudyProgrammeTypeRepository ilObjStudyProgrammeSettingsGUI::$type_repository
protected

Definition at line 55 of file class.ilObjStudyProgrammeSettingsGUI.php.

Referenced by __construct().

◆ OPT_DEADLINE_DATE

const ilObjStudyProgrammeSettingsGUI::OPT_DEADLINE_DATE = "opt_deadline_date"

◆ OPT_DEADLINE_PERIOD

const ilObjStudyProgrammeSettingsGUI::OPT_DEADLINE_PERIOD = "opt_deadline_period"

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

◆ OPT_NO_DEADLINE

const ilObjStudyProgrammeSettingsGUI::OPT_NO_DEADLINE = 'opt_no_deadline'

◆ OPT_NO_VALIDITY_OF_QUALIFICATION

const ilObjStudyProgrammeSettingsGUI::OPT_NO_VALIDITY_OF_QUALIFICATION = 'opt_no_validity_qualification'

◆ OPT_VALIDITY_OF_QUALIFICATION_DATE

const ilObjStudyProgrammeSettingsGUI::OPT_VALIDITY_OF_QUALIFICATION_DATE = "opt_validity_qualification_date"

◆ OPT_VALIDITY_OF_QUALIFICATION_PERIOD

const ilObjStudyProgrammeSettingsGUI::OPT_VALIDITY_OF_QUALIFICATION_PERIOD = "opt_validity_qualification_period"

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

◆ PROP_DEADLINE

const ilObjStudyProgrammeSettingsGUI::PROP_DEADLINE = "deadline"

◆ PROP_DESC

const ilObjStudyProgrammeSettingsGUI::PROP_DESC = "desc"

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

◆ PROP_TITLE

const ilObjStudyProgrammeSettingsGUI::PROP_TITLE = "title"

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

◆ PROP_VALIDITY_OF_QUALIFICATION

const ilObjStudyProgrammeSettingsGUI::PROP_VALIDITY_OF_QUALIFICATION = "validity_qualification"

◆ TAB_COMMON_SETTINGS

const ilObjStudyProgrammeSettingsGUI::TAB_COMMON_SETTINGS = 'commonSettings'
private

Definition at line 32 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ TAB_SETTINGS

const ilObjStudyProgrammeSettingsGUI::TAB_SETTINGS = 'settings'
private

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


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