ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjStudyProgrammeSettingsGUI Class Reference

@ilCtrl_Calls ilObjStudyProgrammeSettingsGUI: ilStudyProgrammeCommonSettingsGUI More...

+ Collaboration diagram for ilObjStudyProgrammeSettingsGUI:

Public Member Functions

 __construct (\ilGlobalTemplateInterface $tpl, \ilCtrl $ilCtrl, \ilLanguage $lng, Factory $input_factory, Renderer $renderer, ServerRequest $request, \ILIAS\Refinery\Factory $refinery_factory, \ILIAS\Data\Factory $data_factory, ilStudyProgrammeTypeRepository $type_repository, ilStudyProgrammeCommonSettingsGUI $common_settings_gui, ilTabsGUI $tabs)
 
 setRefId ($a_ref_id)
 
 executeCommand ()
 

Data Fields

const TAB_SETTINGS = 'settings'
 
const TAB_COMMON_SETTINGS = 'commonSettings'
 
const PROP_TITLE = "title"
 
const PROP_DESC = "desc"
 
const PROP_DEADLINE = "deadline"
 
const PROP_VALIDITY_OF_QUALIFICATION = "validity_qualification"
 
const PROP_ACCESS_CONTROL_BY_ORGU_POSITION = "access_ctr_by_orgu_position"
 
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"
 
 $ctrl
 
 $tpl
 
 $object
 
 $lng
 

Protected Member Functions

 view ()
 
 update ()
 
 buildModalHeading ($label, $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

 $tmp_heading
 
 $input_factory
 
 $renderer
 
 $request
 
 $refinery_factory
 
 $ref_id
 
 $data_factory
 
 $type_repository
 
 $common_settings_gui
 
 $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeSettingsGUI::__construct ( \ilGlobalTemplateInterface  $tpl,
\ilCtrl  $ilCtrl,
\ilLanguage  $lng,
Factory  $input_factory,
Renderer  $renderer,
ServerRequest  $request,
\ILIAS\Refinery\Factory  $refinery_factory,
\ILIAS\Data\Factory  $data_factory,
ilStudyProgrammeTypeRepository  $type_repository,
ilStudyProgrammeCommonSettingsGUI  $common_settings_gui,
ilTabsGUI  $tabs 
)

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

119 {
120 $this->tpl = $tpl;
121 $this->ctrl = $ilCtrl;
122 $this->lng = $lng;
123 $this->input_factory = $input_factory;
124 $this->renderer = $renderer;
125 $this->request = $request;
126 $this->refinery_factory = $refinery_factory;
127 $this->data_factory = $data_factory;
128 $this->type_repository = $type_repository;
129 $this->object = null;
130 $this->common_settings_gui = $common_settings_gui;
131 $this->tabs = $tabs;
132
133 $lng->loadLanguageModule("prg");
134 }

References $common_settings_gui, $data_factory, $input_factory, $lng, $refinery_factory, $renderer, $request, $tabs, $tpl, and $type_repository.

Member Function Documentation

◆ buildForm()

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

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

262 $trans = $prg->getObjectTranslation();
263 $ff = $this->input_factory->field();
264 $sp_types = $this->type_repository->getAllTypesArray();
265 $settings = $prg->getSettings();
266
267 return $this->input_factory->container()->form()->standard(
268 $submit_action,
269 $this->buildFormElements(
270 $ff,
271 $trans,
272 $sp_types,
273 $settings
274 )
276 $this->refinery_factory->custom()->transformation(
277 function ($values) use ($prg) {
278 $object_data = $values[0];
279 $prg->setTitle($object_data[self::PROP_TITLE]);
280 $prg->setDescription($object_data[self::PROP_DESC]);
281
282 $settings = $prg->getSettings()
283 ->withAssessmentSettings($values['prg_assessment'])
284 ->withDeadlineSettings($values['prg_deadline'])
285 ->withValidityOfQualificationSettings($values['prg_validity_of_qualification'])
286 ->withAutoMailSettings($values['automail_settings'])
287 ->withTypeSettings($values['prg_type']);
288
289 $prg->updateSettings($settings);
290 $prg->updateCustomIcon();
291 return $prg;
292 }
293 )
294 );
295 }
buildFormElements(InputFieldFactory $ff, ilObjectTranslation $trans, array $sp_types, ilStudyProgrammeSettings $settings)
This describes commonalities between all forms.
Definition: Form.php:16
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the data of the form.

References ilObjStudyProgramme\getSettings(), ilObject\setDescription(), ilObject\setTitle(), ilObjStudyProgramme\updateCustomIcon(), and ilObjStudyProgramme\updateSettings().

Referenced by view().

+ 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 297 of file class.ilObjStudyProgrammeSettingsGUI.php.

302 : array {
303 global $DIC;
304 $ilLng = $DIC->language();
305 $refinery = $DIC["refinery"];
306
307 $return = [
308 $this->getEditSection($ff, $trans),
309 "prg_type" => $settings
311 ->toFormInput($ff, $ilLng, $refinery, $sp_types)
312 ,
313 "prg_assessment" => $settings
315 ->toFormInput($ff, $ilLng, $refinery)
316 ,
317 "prg_deadline" => $settings
319 ->toFormInput($ff, $ilLng, $refinery, $this->data_factory)
320 ,
321 "prg_validity_of_qualification" => $settings
323 ->toFormInput($ff, $ilLng, $refinery, $this->data_factory)
324 ,
325 "automail_settings" => $settings
327 ->toFormInput($ff, $ilLng, $refinery)
328 ];
329
330 return $return;
331 }
getEditSection(InputFieldFactory $ff, ilObjectTranslation $trans)
global $DIC
Definition: goto.php:24

◆ buildModalHeading()

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

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

233 {
234 if (!$current_node) {
235 $this->ctrl->saveParameterByClass('ilobjstudyprogrammesettingsgui', 'ref_id');
236 $heading_button = ilLinkButton::getInstance();
237 $heading_button->setCaption('prg_open_node');
238 $heading_button->setUrl(
239 $this->ctrl->getLinkTargetByClass(
240 'ilobjstudyprogrammetreegui',
241 'view'
242 )
243 );
244
245 $heading =
246 "<div class=''>" .
247 $label .
248 "<div class='pull-right'>" .
249 $heading_button->render() .
250 "</div></div>"
251 ;
252 $this->tmp_heading = $heading;
253 } else {
254 $this->tmp_heading = "<div class=''>" . $label . "</div>";
255 }
256 }
static getInstance()
Factory.

References ilLinkButton\getInstance().

Referenced by view().

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

◆ executeCommand()

ilObjStudyProgrammeSettingsGUI::executeCommand ( )

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

142 {
143 $next_class = $this->ctrl->getNextClass();
144 switch ($next_class) {
145 case 'ilstudyprogrammecommonsettingsgui':
146 $this->tabs->activateSubTab(self::TAB_COMMON_SETTINGS);
147 $this->common_settings_gui->setObject($this->getObject());
148 $content = $this->ctrl->forwardCommand($this->common_settings_gui);
149 break;
150 default:
151 $cmd = $this->ctrl->getCmd();
152 if ($cmd == "") {
153 $cmd = "view";
154 }
155 switch ($cmd) {
156 case "view":
157 $content = $this->view();
158 break;
159 case "update":
160 $content = $this->$cmd();
161 break;
162 default:
163 throw new ilException(
164 "ilObjStudyProgrammeSettingsGUI: " . "Command not supported: $cmd"
165 );
166 }
167 }
168
169 if (!$this->ctrl->isAsynch()) {
170 $this->tpl->setContent($content);
171 } else {
172 $output_handler = new ilAsyncOutputHandler();
173 $heading = $this->lng->txt("prg_async_" . $this->ctrl->getCmd());
174 if (isset($this->tmp_heading)) {
175 $heading = $this->tmp_heading;
176 }
177 $output_handler->setHeading($heading);
178 $output_handler->setContent($content);
179 $output_handler->terminate();
180 }
181 }
Class ilAsyncOutputHandler Handles the output for async-requests.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $tmp_heading, getObject(), and view().

+ Here is the call graph for this function:

◆ getEditSection()

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

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

336 {
337 $languages = ilMDLanguageItem::_getLanguages();
338 return $ff->section(
339 [
340 self::PROP_TITLE =>
341 $ff->text($this->txt("title"))
342 ->withValue($trans->getDefaultTitle())
343 ->withRequired(true),
344 self::PROP_DESC =>
345 $ff->textarea($this->txt("description"))
346 ->withValue($trans->getDefaultDescription() ?? "")
347 ],
348 $this->txt("prg_edit"),
349 $this->txt("language") . ": " . $languages[$trans->getDefaultLanguage()] .
350 ' <a href="' . $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "") .
351 '">&raquo; ' . $this->txt("obj_more_translations") . '</a>'
352 );
353 }
getDefaultTitle()
Get default title.
getDefaultDescription()
Get default description.
getDefaultLanguage()
Get default language.

References ilMDLanguageItem\_getLanguages(), ilObjectTranslation\getDefaultDescription(), ilObjectTranslation\getDefaultLanguage(), and ilObjectTranslation\getDefaultTitle().

+ Here is the call graph for this function:

◆ getObject()

ilObjStudyProgrammeSettingsGUI::getObject ( )
protected

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

356 {
357 if ($this->object === null) {
358 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->ref_id);
359 }
360 return $this->object;
361 }
static getInstanceByRefId($a_ref_id)

References ilObjStudyProgramme\getInstanceByRefId().

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

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

◆ setRefId()

ilObjStudyProgrammeSettingsGUI::setRefId (   $a_ref_id)

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

137 {
138 $this->ref_id = $a_ref_id;
139 }

◆ txt()

ilObjStudyProgrammeSettingsGUI::txt ( string  $code)
protected

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

363 : string
364 {
365 return $this->lng->txt($code);
366 }

◆ update()

ilObjStudyProgrammeSettingsGUI::update ( )
protected

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

192 {
193 $form = $this
194 ->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "update"))
195 ->withRequest($this->request);
196
197 $result = $form->getInputGroup()->getContent();
198
199 // This could further improved by providing a new container for asynch-forms in the
200 // UI-Framework.
201
202 if ($result->isOK()) {
203 $result->value()->update();
204 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
205
206 if ($this->ctrl->isAsynch()) {
208 array(
209 "success" => true,
210 "message" => $this->lng->txt("msg_obj_modified"))
211 );
212 return ilAsyncOutputHandler::handleAsyncOutput($form->getHTML(), $response, false);
213 } else {
214 $this->ctrl->redirect($this);
215 }
216 } else {
217 ilUtil::sendFailure($this->lng->txt("msg_form_save_error"));
218
219 if ($this->ctrl->isAsynch()) {
221 array(
222 "success" => false,
223 "errors" => $form->getErrors())
224 );
225 return ilAsyncOutputHandler::handleAsyncOutput($form->getHTML(), $response, false);
226 } else {
227 return $this->renderer->render($form);
228 }
229 }
230 }
$result
static handleAsyncOutput($normal_content, $async_content=null, $apply_to_tpl=true)
Handles async output.
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$response

References $response, $result, ilAsyncOutputHandler\encodeAsyncResponse(), getObject(), ilAsyncOutputHandler\handleAsyncOutput(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ view()

ilObjStudyProgrammeSettingsGUI::view ( )
protected

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

184 {
185 $this->buildModalHeading($this->lng->txt('prg_async_settings'), isset($_GET["currentNode"]));
186
187 $form = $this->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "update"));
188 return $this->renderer->render($form);
189 }
$_GET["client_id"]
buildForm(\ilObjStudyProgramme $prg, string $submit_action)

References $_GET, buildForm(), buildModalHeading(), and getObject().

Referenced by executeCommand().

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

Field Documentation

◆ $common_settings_gui

ilObjStudyProgrammeSettingsGUI::$common_settings_gui
protected

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

Referenced by __construct().

◆ $ctrl

ilObjStudyProgrammeSettingsGUI::$ctrl

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

◆ $data_factory

ilObjStudyProgrammeSettingsGUI::$data_factory
protected

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

Referenced by __construct().

◆ $input_factory

ilObjStudyProgrammeSettingsGUI::$input_factory
protected

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

Referenced by __construct().

◆ $lng

ilObjStudyProgrammeSettingsGUI::$lng

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

Referenced by __construct().

◆ $object

ilObjStudyProgrammeSettingsGUI::$object

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

◆ $ref_id

ilObjStudyProgrammeSettingsGUI::$ref_id
protected

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

◆ $refinery_factory

ilObjStudyProgrammeSettingsGUI::$refinery_factory
protected

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

Referenced by __construct().

◆ $renderer

ilObjStudyProgrammeSettingsGUI::$renderer
protected

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

Referenced by __construct().

◆ $request

ilObjStudyProgrammeSettingsGUI::$request
protected

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

Referenced by __construct().

◆ $tabs

ilObjStudyProgrammeSettingsGUI::$tabs
protected

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

Referenced by __construct().

◆ $tmp_heading

ilObjStudyProgrammeSettingsGUI::$tmp_heading
protected

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

Referenced by executeCommand().

◆ $tpl

ilObjStudyProgrammeSettingsGUI::$tpl

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

Referenced by __construct().

◆ $type_repository

ilObjStudyProgrammeSettingsGUI::$type_repository
protected

Definition at line 95 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 29 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 33 of file class.ilObjStudyProgrammeSettingsGUI.php.

◆ PROP_ACCESS_CONTROL_BY_ORGU_POSITION

const ilObjStudyProgrammeSettingsGUI::PROP_ACCESS_CONTROL_BY_ORGU_POSITION = "access_ctr_by_orgu_position"

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

◆ PROP_DEADLINE

const ilObjStudyProgrammeSettingsGUI::PROP_DEADLINE = "deadline"

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

◆ PROP_DESC

const ilObjStudyProgrammeSettingsGUI::PROP_DESC = "desc"

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

◆ PROP_TITLE

const ilObjStudyProgrammeSettingsGUI::PROP_TITLE = "title"

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

◆ PROP_VALIDITY_OF_QUALIFICATION

const ilObjStudyProgrammeSettingsGUI::PROP_VALIDITY_OF_QUALIFICATION = "validity_qualification"

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

◆ TAB_COMMON_SETTINGS

const ilObjStudyProgrammeSettingsGUI::TAB_COMMON_SETTINGS = 'commonSettings'

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

◆ TAB_SETTINGS

const ilObjStudyProgrammeSettingsGUI::TAB_SETTINGS = 'settings'

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


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