ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeChangeDeadlineGUI Class Reference
+ Collaboration diagram for ilStudyProgrammeChangeDeadlineGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilAccess $access, ilObjUser $user, Factory $input_factory, Renderer $renderer, Psr\Http\Message\ServerRequestInterface $request, ILIAS\Refinery\Factory $refinery_factory, ILIAS\Data\Factory $data_factory, ilPRGMessagePrinter $messages)
 
 executeCommand ()
 
 setBackTarget (string $target)
 
 setProgressIds (array $progress_ids)
 
 setRefId (int $ref_id)
 

Protected Member Functions

 showDeadlineConfig ()
 
 buildForm (ilObjStudyProgramme $prg, string $submit_action)
 
 getDeadlineSubForm (ilObjStudyProgramme $prg)
 
 buildFormElements ( $ff, Closure $txt, ilObjStudyProgramme $prg)
 
 changeDeadline ()
 
 getBackTarget ()
 
 getProgressIds ()
 
 getRefId ()
 
 getObject ()
 
 redirectToParent ()
 

Protected Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccess $access
 
ilObjUser $user
 
Factory $input_factory
 
Renderer $renderer
 
Psr Http Message ServerRequestInterface $request
 
ILIAS Refinery Factory $refinery_factory
 
ILIAS Data Factory $data_factory
 
ilPRGMessagePrinter $messages
 
string $back_target = null
 
array $progress_ids = []
 
int $ref_id = null
 
ilObjStudyProgramme $object = null
 

Private Attributes

const CMD_SHOW_DEADLINE_CONFIG = "showDeadlineConfig"
 
const CMD_CHANGE_DEADLINE = "changeDeadline"
 
const PROP_DEADLINE = "deadline"
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeChangeDeadlineGUI::__construct ( ilCtrl  $ctrl,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilAccess  $access,
ilObjUser  $user,
Factory  $input_factory,
Renderer  $renderer,
Psr\Http\Message\ServerRequestInterface  $request,
ILIAS\Refinery\Factory  $refinery_factory,
ILIAS\Data\Factory  $data_factory,
ilPRGMessagePrinter  $messages 
)

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

References $access, $ctrl, $data_factory, $input_factory, $lng, $messages, $refinery_factory, $renderer, $request, $tpl, $user, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

61  {
62  $this->ctrl = $ctrl;
63  $this->tpl = $tpl;
64  $this->lng = $lng;
65  $this->access = $access;
66  $this->user = $user;
67  $this->input_factory = $input_factory;
68  $this->renderer = $renderer;
69  $this->request = $request;
70  $this->refinery_factory = $refinery_factory;
71  $this->data_factory = $data_factory;
72  $this->messages = $messages;
73  }
Psr Http Message ServerRequestInterface $request
+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

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

Definition at line 109 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $id, $txt, buildFormElements(), and ILIAS\Repository\lng().

Referenced by showDeadlineConfig().

109  : Standard
110  {
111  $ff = $this->input_factory->field();
112  $txt = function ($id) {
113  return $this->lng->txt($id);
114  };
115 
116  return $this->input_factory->container()->form()->standard(
117  $submit_action,
118  $this->buildFormElements(
119  $ff,
120  $txt,
121  $prg
122  )
123  );
124  }
buildFormElements( $ff, Closure $txt, ilObjStudyProgramme $prg)
$txt
Definition: error.php:13
This describes a standard form.
Definition: Standard.php:26
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFormElements()

ilStudyProgrammeChangeDeadlineGUI::buildFormElements (   $ff,
Closure  $txt,
ilObjStudyProgramme  $prg 
)
protected

Definition at line 161 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $txt, getDeadlineSubForm(), and ilObjStudyProgrammeSettingsGUI\PROP_DEADLINE.

Referenced by buildForm().

165  : array {
166  return [
167  $ff->section(
168  [
170  ],
171  $txt("prg_deadline_settings"),
172  ""
173  )
174  ];
175 
176  return $return;
177  }
$txt
Definition: error.php:13
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeDeadline()

ilStudyProgrammeChangeDeadlineGUI::changeDeadline ( )
protected

Definition at line 179 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References ILIAS\Repository\ctrl(), getObject(), getProgressIds(), ILIAS\Repository\lng(), ilObjStudyProgrammeSettingsGUI\OPT_DEADLINE_DATE, and ILIAS\Repository\user().

Referenced by executeCommand().

179  : void
180  {
181  $form = $this
182  ->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "changeDeadline"))
183  ->withRequest($this->request);
184 
185  $result = $form->getInputGroup()->getContent();
186 
187  $msg_collection = $this->messages->getMessageCollection('msg_change_deadline_date');
188 
189  if ($result->isOK()) {
190  $values = $result->value();
191  $programme = $this->getObject();
192  $acting_usr_id = $this->user->getId();
193 
194  $deadline_data = $values[0][self::PROP_DEADLINE];
195  $deadline_type = $deadline_data[0];
196  $deadline = null;
197  if ($deadline_type === ilObjStudyProgrammeSettingsGUI::OPT_DEADLINE_DATE) {
198  $deadline = array_shift($deadline_data[1]);
199 
200  if (!$deadline) {
201  $this->tpl->setOnScreenMessage("failure", $this->lng->txt('error_updating_deadline'), true);
202  $this->ctrl->setParameter($this, 'prgrs_ids', implode(',', $this->getProgressIds()));
203  $this->ctrl->redirectByClass(self::class, self::CMD_SHOW_DEADLINE_CONFIG);
204  }
205  }
206 
207  foreach ($this->getProgressIds() as $progress_id) {
208  $assignment_id = $progress_id->getAssignmentId();
209  $programme->changeProgressDeadline($assignment_id, $acting_usr_id, $msg_collection, $deadline);
210  }
211 
212  $this->messages->showMessages($msg_collection);
213  $this->ctrl->redirectByClass('ilObjStudyProgrammeMembersGUI', 'view');
214  }
215 
216  $this->tpl->setOnScreenMessage("failure", $this->lng->txt('error_updating_deadline'), true);
217  $this->ctrl->setParameter($this, 'prgrs_ids', implode(',', $this->getProgressIds()));
218  $this->ctrl->redirectByClass(self::class, self::CMD_SHOW_DEADLINE_CONFIG);
219  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeChangeDeadlineGUI::executeCommand ( )

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

References changeDeadline(), ILIAS\Repository\ctrl(), redirectToParent(), and showDeadlineConfig().

75  : void
76  {
77  $cmd = $this->ctrl->getCmd();
78 
79  switch ($cmd) {
80  case self::CMD_SHOW_DEADLINE_CONFIG:
81  $this->showDeadlineConfig();
82  break;
83  case self::CMD_CHANGE_DEADLINE:
84  $this->changeDeadline();
85  break;
86  case 'cancel':
87  $this->redirectToParent();
88  break;
89  default:
90  throw new Exception('Unknown command ' . $cmd);
91  }
92  }
+ Here is the call graph for this function:

◆ getBackTarget()

ilStudyProgrammeChangeDeadlineGUI::getBackTarget ( )
protected

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

References $back_target.

Referenced by redirectToParent().

221  : ?string
222  {
223  return $this->back_target;
224  }
+ Here is the caller graph for this function:

◆ getDeadlineSubForm()

ilStudyProgrammeChangeDeadlineGUI::getDeadlineSubForm ( ilObjStudyProgramme  $prg)
protected

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

References $format, $id, $txt, ilObjStudyProgramme\getSettings(), ILIAS\Repository\lng(), ilObjStudyProgrammeSettingsGUI\OPT_DEADLINE_DATE, and ilObjStudyProgrammeSettingsGUI\OPT_NO_DEADLINE.

Referenced by buildFormElements().

126  : Input
127  {
128  $ff = $this->input_factory->field();
129  $txt = function ($id) {
130  return $this->lng->txt($id);
131  };
132 
134  $deadline_date = $prg->getSettings()->getDeadlineSettings()->getDeadlineDate();
135  $format = $this->data_factory->dateFormat()->germanShort();
136  $deadline_date_sub_form = $ff
137  ->dateTime('', $txt('prg_deadline_date_desc'))
138  ->withFormat($format)
139  ;
140 
141  if ($deadline_date !== null) {
142  $deadline_date_sub_form = $deadline_date_sub_form->withValue(
143  $deadline_date->format($format->toString())
144  );
146  }
147 
148  $sg = $ff->switchableGroup(
149  [
151  $ff->group([], $txt('prg_no_deadline')),
153  $ff->group([$deadline_date_sub_form], $txt('prg_deadline_date'))
154  ],
155  ''
156  );
157 
158  return $sg->withValue($option);
159  }
$format
Definition: metadata.php:235
$txt
Definition: error.php:13
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

ilStudyProgrammeChangeDeadlineGUI::getObject ( )
protected

Definition at line 251 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $object, ilObjStudyProgramme\getInstanceByRefId(), and getRefId().

Referenced by changeDeadline(), and showDeadlineConfig().

252  {
253  $ref_id = $this->getRefId();
254  if (is_null($ref_id)) {
255  throw new LogicException("Can't create object. No ref_id given.");
256  }
257 
258  if ($this->object === null) {
260  }
261  return $this->object;
262  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProgressIds()

ilStudyProgrammeChangeDeadlineGUI::getProgressIds ( )
protected

Definition at line 231 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $progress_ids.

Referenced by changeDeadline(), and showDeadlineConfig().

231  : array
232  {
233  return $this->progress_ids;
234  }
+ Here is the caller graph for this function:

◆ getRefId()

ilStudyProgrammeChangeDeadlineGUI::getRefId ( )
protected

Definition at line 241 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $ref_id.

Referenced by getObject().

241  : ?int
242  {
243  return $this->ref_id;
244  }
+ Here is the caller graph for this function:

◆ redirectToParent()

ilStudyProgrammeChangeDeadlineGUI::redirectToParent ( )
protected

Definition at line 264 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References ILIAS\Repository\ctrl(), and getBackTarget().

Referenced by executeCommand().

264  : void
265  {
266  $back_target = $this->getBackTarget();
267  if (is_null($back_target)) {
268  throw new LogicException("Can't redirect. No back target given.");
269  }
270 
271  $this->ctrl->redirectToURL($back_target);
272  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBackTarget()

ilStudyProgrammeChangeDeadlineGUI::setBackTarget ( string  $target)

Definition at line 226 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

226  : void
227  {
228  $this->back_target = $target;
229  }

◆ setProgressIds()

ilStudyProgrammeChangeDeadlineGUI::setProgressIds ( array  $progress_ids)

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

References $progress_ids.

236  : void
237  {
238  $this->progress_ids = $progress_ids;
239  }

◆ setRefId()

ilStudyProgrammeChangeDeadlineGUI::setRefId ( int  $ref_id)

Definition at line 246 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $ref_id.

246  : void
247  {
248  $this->ref_id = $ref_id;
249  }

◆ showDeadlineConfig()

ilStudyProgrammeChangeDeadlineGUI::showDeadlineConfig ( )
protected

Definition at line 94 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

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

Referenced by executeCommand().

94  : void
95  {
96  $this->tpl->loadStandardTemplate();
97  $this->ctrl->setParameter($this, 'prgrs_ids', implode(',', $this->getProgressIds()));
98  $action = $this->ctrl->getFormAction(
99  $this,
100  self::CMD_CHANGE_DEADLINE
101  );
102  $this->ctrl->clearParameters($this);
103 
104  $form = $this->buildForm($this->getObject(), $action);
105 
106  $this->tpl->setContent($this->renderer->render($form));
107  }
buildForm(ilObjStudyProgramme $prg, string $submit_action)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccess ilStudyProgrammeChangeDeadlineGUI::$access
protected

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

Referenced by __construct().

◆ $back_target

string ilStudyProgrammeChangeDeadlineGUI::$back_target = null
protected

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

Referenced by getBackTarget().

◆ $ctrl

ilCtrl ilStudyProgrammeChangeDeadlineGUI::$ctrl
protected

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

Referenced by __construct().

◆ $data_factory

ILIAS Data Factory ilStudyProgrammeChangeDeadlineGUI::$data_factory
protected

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

Referenced by __construct().

◆ $input_factory

Factory ilStudyProgrammeChangeDeadlineGUI::$input_factory
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilStudyProgrammeChangeDeadlineGUI::$lng
protected

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

Referenced by __construct().

◆ $messages

ilPRGMessagePrinter ilStudyProgrammeChangeDeadlineGUI::$messages
protected

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

Referenced by __construct().

◆ $object

ilObjStudyProgramme ilStudyProgrammeChangeDeadlineGUI::$object = null
protected

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

Referenced by getObject().

◆ $progress_ids

array ilStudyProgrammeChangeDeadlineGUI::$progress_ids = []
protected

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

Referenced by getProgressIds(), and setProgressIds().

◆ $ref_id

int ilStudyProgrammeChangeDeadlineGUI::$ref_id = null
protected

Definition at line 46 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

Referenced by getRefId(), and setRefId().

◆ $refinery_factory

ILIAS Refinery Factory ilStudyProgrammeChangeDeadlineGUI::$refinery_factory
protected

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

Referenced by __construct().

◆ $renderer

Renderer ilStudyProgrammeChangeDeadlineGUI::$renderer
protected

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

Referenced by __construct().

◆ $request

Psr Http Message ServerRequestInterface ilStudyProgrammeChangeDeadlineGUI::$request
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilStudyProgrammeChangeDeadlineGUI::$tpl
protected

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

Referenced by __construct().

◆ $user

ilObjUser ilStudyProgrammeChangeDeadlineGUI::$user
protected

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

Referenced by __construct().

◆ CMD_CHANGE_DEADLINE

const ilStudyProgrammeChangeDeadlineGUI::CMD_CHANGE_DEADLINE = "changeDeadline"
private

Definition at line 29 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

◆ CMD_SHOW_DEADLINE_CONFIG

const ilStudyProgrammeChangeDeadlineGUI::CMD_SHOW_DEADLINE_CONFIG = "showDeadlineConfig"
private

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

◆ PROP_DEADLINE

const ilStudyProgrammeChangeDeadlineGUI::PROP_DEADLINE = "deadline"
private

Definition at line 30 of file class.ilStudyProgrammeChangeDeadlineGUI.php.


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