ILIAS  release_7 Revision v7.30-3-g800a261c036
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, ServerRequest $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)
 

Data Fields

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

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

 $gui
 
 $ctrl
 
 $tpl
 
 $lng
 
 $access
 
 $user
 
 $back_target
 
 $input_factory
 
 $renderer
 
 $request
 
 $refinery_factory
 
 $data_factory
 
 $progress_ids
 
 $ref_id
 
 $object
 
 $messages
 

Detailed Description

Definition at line 13 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,
ServerRequest  $request,
\ILIAS\Refinery\Factory  $refinery_factory,
\ILIAS\Data\Factory  $data_factory,
ilPRGMessagePrinter  $messages 
)

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

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

111  {
112  $this->ctrl = $ctrl;
113  $this->tpl = $tpl;
114  $this->lng = $lng;
115  $this->access = $access;
116  $this->user = $user;
117  $this->input_factory = $input_factory;
118  $this->renderer = $renderer;
119  $this->request = $request;
120  $this->refinery_factory = $refinery_factory;
121  $this->data_factory = $data_factory;
122  $this->messages = $messages;
123  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

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

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

References $txt, and buildFormElements().

Referenced by showDeadlineConfig().

165  : Standard
166  {
167  $ff = $this->input_factory->field();
168  $txt = function ($id) {
169  return $this->lng->txt($id);
170  };
171 
172  return $this->input_factory->container()->form()->standard(
173  $submit_action,
174  $this->buildFormElements(
175  $ff,
176  $txt,
177  $prg
178  )
179  );
180  }
buildFormElements( $ff, Closure $txt, ilObjStudyProgramme $prg)
$txt
Definition: error.php:13
This describes a standard form.
Definition: Standard.php:10
+ 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 217 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

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

Referenced by buildForm().

221  : array {
222  $return = [
223  $ff->section(
224  [
226  ],
227  $txt("prg_deadline_settings"),
228  ""
229  )
230  ];
231 
232  return $return;
233  }
$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 235 of file class.ilStudyProgrammeChangeDeadlineGUI.php.

References $result, getObject(), getProgressIds(), ilObjStudyProgrammeSettingsGUI\OPT_DEADLINE_DATE, ilUtil\sendFailure(), and user().

Referenced by executeCommand().

235  : void
236  {
237  $form = $this
238  ->buildForm($this->getObject(), $this->ctrl->getFormAction($this, "changeDeadline"))
239  ->withRequest($this->request);
240 
241  $result = $form->getInputGroup()->getContent();
242 
243  $msg_collection = $this->messages->getMessageCollection('msg_change_deadline_date');
244 
245  if ($result->isOK()) {
246  $values = $result->value();
247  $programme = $this->getObject();
248  $acting_usr_id = $this->user->getId();
249 
250  $deadline_data = $values[0][self::PROP_DEADLINE];
251  $deadline_type = $deadline_data[0];
252  $deadline = null;
253  if ($deadline_type === ilObjStudyProgrammeSettingsGUI::OPT_DEADLINE_DATE) {
254  $deadline = DateTimeImmutable::createFromFormat(
255  'd.m.Y',
256  array_shift($deadline_data[1])
257  );
258 
259  if (!$deadline) {
260  ilUtil::sendFailure($this->lng->txt('error_updating_deadline'), true);
261  $this->ctrl->redirectByClass(self::class, self::CMD_SHOW_DEADLINE_CONFIG);
262  }
263  }
264 
265  foreach ($this->getProgressIds() as $progress_id) {
266  $programme->changeProgressDeadline($progress_id, $acting_usr_id, $msg_collection, $deadline);
267  }
268 
269  $this->messages->showMessages($msg_collection);
270  $this->ctrl->redirectByClass('ilObjStudyProgrammeMembersGUI', 'view');
271  }
272 
273  ilUtil::sendFailure($this->lng->txt('error_updating_deadline'), true);
274  $this->ctrl->redirectByClass(self::class, self::CMD_SHOW_DEADLINE_CONFIG);
275  }
$result
user()
Definition: user.php:4
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeChangeDeadlineGUI::executeCommand ( )

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

References changeDeadline(), redirectToParent(), and showDeadlineConfig().

125  : void
126  {
127  $next_class = $this->ctrl->getNextClass($this);
128  $cmd = $this->ctrl->getCmd();
129 
130  switch ($next_class) {
131  default:
132  switch ($cmd) {
133  case self::CMD_SHOW_DEADLINE_CONFIG:
134  $this->showDeadlineConfig();
135  break;
136  case self::CMD_CHANGE_DEADLINE:
137  $this->changeDeadline();
138  break;
139  case 'cancel':
140  $this->redirectToParent();
141  break;
142  default:
143  throw new Exception('Unknown command ' . $cmd);
144  break;
145  }
146  break;
147  }
148  }
+ Here is the call graph for this function:

◆ getBackTarget()

ilStudyProgrammeChangeDeadlineGUI::getBackTarget ( )
protected

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

References $back_target.

Referenced by redirectToParent().

+ Here is the caller graph for this function:

◆ getDeadlineSubForm()

ilStudyProgrammeChangeDeadlineGUI::getDeadlineSubForm ( ilObjStudyProgramme  $prg)
protected

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

References $format, $txt, ilObjStudyProgramme\getSettings(), ilObjStudyProgrammeSettingsGUI\OPT_DEADLINE_DATE, and ilObjStudyProgrammeSettingsGUI\OPT_NO_DEADLINE.

Referenced by buildFormElements().

182  : Input
183  {
184  $ff = $this->input_factory->field();
185  $txt = function ($id) {
186  return $this->lng->txt($id);
187  };
188 
190  $deadline_date = $prg->getSettings()->getDeadlineSettings()->getDeadlineDate();
191  $format = $this->data_factory->dateFormat()->germanShort();
192  $deadline_date_sub_form = $ff
193  ->dateTime('', $txt('prg_deadline_date_desc'))
194  ->withFormat($format)
195  ;
196 
197  if ($deadline_date !== null) {
198  $deadline_date_sub_form = $deadline_date_sub_form->withValue(
199  $deadline_date->format($format->toString())
200  );
202  }
203 
204  $sg = $ff->switchableGroup(
205  [
207  $ff->group([], $txt('prg_no_deadline')),
209  $ff->group([$deadline_date_sub_form], $txt('prg_deadline_date'))
210  ],
211  ''
212  );
213 
214  return $sg->withValue($option);
215  }
$format
Definition: metadata.php:218
$txt
Definition: error.php:13
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

ilStudyProgrammeChangeDeadlineGUI::getObject ( )
protected

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

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

Referenced by changeDeadline(), and showDeadlineConfig().

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

◆ getProgressIds()

ilStudyProgrammeChangeDeadlineGUI::getProgressIds ( )
protected

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

References $progress_ids.

Referenced by changeDeadline(), and showDeadlineConfig().

+ Here is the caller graph for this function:

◆ getRefId()

ilStudyProgrammeChangeDeadlineGUI::getRefId ( )
protected

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

References $ref_id.

Referenced by getObject().

+ Here is the caller graph for this function:

◆ redirectToParent()

ilStudyProgrammeChangeDeadlineGUI::redirectToParent ( )
protected

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

References getBackTarget(), and ilUtil\redirect().

Referenced by executeCommand().

315  : void
316  {
318  }
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBackTarget()

ilStudyProgrammeChangeDeadlineGUI::setBackTarget ( string  $target)

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

282  : void
283  {
284  $this->back_target = $target;
285  }

◆ setProgressIds()

ilStudyProgrammeChangeDeadlineGUI::setProgressIds ( array  $progress_ids)

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

292  : void
293  {
294  $this->progress_ids = array_map('intval', $progress_ids);
295  }

◆ setRefId()

ilStudyProgrammeChangeDeadlineGUI::setRefId ( int  $ref_id)

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

References $ref_id.

302  : void
303  {
304  $this->ref_id = $ref_id;
305  }

◆ showDeadlineConfig()

ilStudyProgrammeChangeDeadlineGUI::showDeadlineConfig ( )
protected

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

References buildForm(), getObject(), and getProgressIds().

Referenced by executeCommand().

150  : void
151  {
152  $this->tpl->loadStandardTemplate();
153  $this->ctrl->setParameter($this, 'prgrs_ids', implode(',', $this->getProgressIds()));
154  $action = $this->ctrl->getFormAction(
155  $this,
156  self::CMD_CHANGE_DEADLINE
157  );
158  $this->ctrl->clearParameters($this);
159 
160  $form = $this->buildForm($this->getObject(), $action);
161 
162  $this->tpl->setContent($this->renderer->render($form));
163  }
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

ilStudyProgrammeChangeDeadlineGUI::$access
protected

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

Referenced by __construct().

◆ $back_target

ilStudyProgrammeChangeDeadlineGUI::$back_target
protected

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

Referenced by getBackTarget().

◆ $ctrl

ilStudyProgrammeChangeDeadlineGUI::$ctrl
protected

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

Referenced by __construct().

◆ $data_factory

ilStudyProgrammeChangeDeadlineGUI::$data_factory
protected

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

Referenced by __construct().

◆ $gui

ilStudyProgrammeChangeDeadlineGUI::$gui
protected

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

◆ $input_factory

ilStudyProgrammeChangeDeadlineGUI::$input_factory
protected

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

Referenced by __construct().

◆ $lng

ilStudyProgrammeChangeDeadlineGUI::$lng
protected

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

Referenced by __construct().

◆ $messages

ilStudyProgrammeChangeDeadlineGUI::$messages
protected

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

Referenced by __construct().

◆ $object

ilStudyProgrammeChangeDeadlineGUI::$object
protected

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

Referenced by getObject().

◆ $progress_ids

ilStudyProgrammeChangeDeadlineGUI::$progress_ids
protected

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

Referenced by getProgressIds().

◆ $ref_id

ilStudyProgrammeChangeDeadlineGUI::$ref_id
protected

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

Referenced by getRefId(), and setRefId().

◆ $refinery_factory

ilStudyProgrammeChangeDeadlineGUI::$refinery_factory
protected

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

Referenced by __construct().

◆ $renderer

ilStudyProgrammeChangeDeadlineGUI::$renderer
protected

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

Referenced by __construct().

◆ $request

ilStudyProgrammeChangeDeadlineGUI::$request
protected

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

Referenced by __construct().

◆ $tpl

ilStudyProgrammeChangeDeadlineGUI::$tpl
protected

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

Referenced by __construct().

◆ $user

ilStudyProgrammeChangeDeadlineGUI::$user
protected

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

Referenced by __construct().

◆ CMD_CHANGE_DEADLINE

const ilStudyProgrammeChangeDeadlineGUI::CMD_CHANGE_DEADLINE = "changeDeadline"

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

◆ CMD_SHOW_DEADLINE_CONFIG

const ilStudyProgrammeChangeDeadlineGUI::CMD_SHOW_DEADLINE_CONFIG = "showDeadlineConfig"

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

◆ PROP_DEADLINE

const ilStudyProgrammeChangeDeadlineGUI::PROP_DEADLINE = "deadline"

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


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