3 declare(strict_types=1);
58 ->retrieve(
"ref_id", $this->container->refinery()->kindlyTo()->int());
61 $this->container->language()->loadLanguageModule(
'mst');
62 $this->container->language()->loadLanguageModule(
'trac');
63 $this->container->language()->loadLanguageModule(
'etal');
64 $this->container->language()->loadLanguageModule(
'dateplaner');
68 $this->
setReturnLocation(
"save", strtolower(ilEmployeeTalkMyStaffListGUI::class));
69 $wrapper = $this->container->http()->wrapper()->query();
71 if ($wrapper->has(
'usr_id')) {
72 $this->userId = $wrapper->retrieve(
'usr_id', $this->container->refinery()->kindlyTo()->int());
81 if (!$talkAccess->canCreate()) {
82 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
83 $this->
ctrl->redirectByClass(ilDashboardGUI::class,
"");
92 $next_class = $this->container->ctrl()->getNextClass($this);
94 switch ($next_class) {
95 case strtolower(ilRepositorySearchGUI::class):
97 $repo->addUserAccessFilterCallable(
function ($user_ids) {
120 $this->container->ctrl()->forwardCommand($repo);
123 parent::executeCommand();
133 $this->tpl->resetHeaderBlock();
146 protected function checkPermissionBool(
string $a_perm,
string $a_cmd =
"",
string $a_type =
"", ?
int $a_ref_id = null): bool
148 if ($a_perm ===
'create') {
156 if ($this->post_wrapper->has(
"mref_id")) {
157 $mref_id = $this->post_wrapper->retrieve(
161 $saved_post = array_unique(array_merge(
ilSession::get(
'saved_post'), $mref_id));
166 $ru->deleteObjects($this->requested_ref_id,
ilSession::get(
"saved_post"));
169 $this->
ctrl->redirectByClass(strtolower(ilEmployeeTalkMyStaffListGUI::class), ControlFlowCommand::DEFAULT,
"",
false);
176 $this->
ctrl->redirectByClass(strtolower(ilEmployeeTalkMyStaffListGUI::class), ControlFlowCommand::DEFAULT,
"",
false);
181 $this->
ctrl->redirectByClass(strtolower(ilEmployeeTalkMyStaffListGUI::class), ControlFlowCommand::DEFAULT,
"",
false);
194 $newObject = $a_new_object;
199 $this->createRecurringTalks($newObject, $event);
201 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
202 $this->
ctrl->redirectByClass(strtolower(ilEmployeeTalkMyStaffListGUI::class), ControlFlowCommand::DEFAULT,
"",
false);
207 $this->
ctrl->setParameter($this,
"new_type", $this->requested_new_type);
211 $userName = (string) $form->
getInput(
'etal_employee');
216 !$talkAccess->canCreate(
new ilObjUser($userId))
219 ->setAlert($this->
lng->txt(
'etal_invalid_user'));
220 $this->tpl->setOnScreenMessage(
222 $this->
lng->txt(
'form_input_not_valid')
225 $this->tpl->setContent($form->
getHTML());
229 $this->
ctrl->setParameter($this,
"new_type",
"");
231 $class_name =
"ilObj" . $this->obj_definition->getClassName($this->requested_new_type);
232 $newObj =
new $class_name();
233 $newObj->setType($this->requested_new_type);
234 $newObj->setTitle($form->
getInput(
"title"));
235 $newObj->setDescription($form->
getInput(
"desc"));
244 $this->tpl->setContent($form->
getHTML());
252 $form->
setTitle($this->
lng->txt($new_type .
"_new"));
258 $ti->setRequired(
true);
270 $dur->enableToggleFullTime(
271 $this->
lng->txt(
'cal_fullday_title'),
274 $dur->setShowTime(
true);
282 $cal->allowUnlimitedRecurrences(
false);
283 $cal->setRecurrence($event);
293 $login->setRequired(
true);
294 $login->setDataSource($this->
ctrl->getLinkTargetByClass([
295 strtolower(self::class),
296 strtolower(ilRepositorySearchGUI::class)
297 ],
'doUserAutoComplete',
'',
true));
299 if ($this->userId !== -1) {
325 self::_goto((
string) $this->ref_id);
341 if (count($talks) === 0) {
345 $firstTalk = $talks[0];
346 $talk_title = $firstTalk->getTitle();
347 $superior =
new ilObjUser($firstTalk->getOwner());
348 $employee =
new ilObjUser($firstTalk->getData()->getEmployee());
349 $superiorName = $superior->getFullname();
361 return $a < $b ? -1 : 1;
364 $add_time = $firstTalk->getData()->isAllDay() ? 0 : 1;
372 $firstTalk->getRefId(),
374 $firstTalk->getDescription(),
375 $firstTalk->getData()->getLocation(),
376 'notification_talks_subject',
377 'notification_talks_created',
387 VCalendarFactory::getInstanceFromTalks($firstTalk->getParent())
403 switch ($this->
form->getInput(
'frequence')) {
405 $rec->setFrequenceType($this->
form->getInput(
'frequence'));
406 $rec->setInterval((
int) $this->
form->getInput(
'count_DAILY'));
410 $rec->setFrequenceType($this->
form->getInput(
'frequence'));
411 $rec->setInterval((
int) $this->
form->getInput(
'count_WEEKLY'));
412 if (is_array($this->
form->getInput(
'byday_WEEKLY'))) {
418 $rec->setFrequenceType($this->
form->getInput(
'frequence'));
419 $rec->setInterval((
int) $this->
form->getInput(
'count_MONTHLY'));
420 switch ((
int) $this->
form->getInput(
'subtype_MONTHLY')) {
426 switch ((
int) $this->
form->getInput(
'monthly_byday_day')) {
429 $rec->setBYSETPOS($this->
form->getInput(
'monthly_byday_num'));
430 $rec->setBYDAY(
'MO,TU,WE,TH,FR');
435 $rec->setBYMONTHDAY($this->
form->getInput(
'monthly_byday_num'));
439 $rec->setBYDAY(($this->
form->getInput(
'monthly_byday_num') . $this->
form->getInput(
'monthly_byday_day')));
445 $rec->setBYMONTHDAY($this->
form->getInput(
'monthly_bymonthday'));
451 $rec->setFrequenceType($this->
form->getInput(
'frequence'));
452 $rec->setInterval((
int) $this->
form->getInput(
'count_YEARLY'));
453 switch ((
int) $this->
form->getInput(
'subtype_YEARLY')) {
459 $rec->setBYMONTH($this->
form->getInput(
'yearly_bymonth_byday'));
460 $rec->setBYDAY(($this->
form->getInput(
'yearly_byday_num') . $this->
form->getInput(
'yearly_byday')));
464 $rec->setBYMONTH($this->
form->getInput(
'yearly_bymonth_by_monthday'));
465 $rec->setBYMONTHDAY($this->
form->getInput(
'yearly_bymonthday'));
472 switch ((
int) $this->
form->getInput(
'until_type')) {
474 $rec->setFrequenceUntilDate(null);
479 $rec->setFrequenceUntilDate(null);
480 $rec->setFrequenceUntilCount((
int) $this->
form->getInput(
'count'));
484 $frequence = $this->
form->getItemByPostVar(
'frequence');
485 $end = $frequence->getRecurrence()->getFrequenceUntilDate();
486 $rec->setFrequenceUntilCount(0);
487 $rec->setFrequenceUntilDate($end);
499 $employee = $this->
form->getInput(
'etal_employee');
500 [
'fullday' => $tgl] = $this->
form->getInput(
'etal_event');
505 $dateTimeInput = $this->
form->getItemByPostVar(
'etal_event');
506 [
'start' => $start,
'end' => $end] = $dateTimeInput->getValue();
519 boolval(intval($tgl)),
542 $template->getType(),
547 if (!$rec->isAssignedObjectType($talk->
getType(),
'etal')) {
548 $rec->appendAssignedObjectType(
580 $data = $this->loadEtalkData();
583 $data->getStartDate(),
589 $periodStart = clone
$data->getStartDate();
591 $periodEnd = clone
$data->getStartDate();
593 $dateIterator = $calc->calculateDateList($periodStart, $periodEnd);
599 $talkSession->setTitle($this->
form->getInput(
'title'));
600 $talkSession->setDescription($this->
form->getInput(
'desc'));
602 $talkSession->create();
604 $talkSession->createReference();
605 $talkSession->putInTree($talk->
getRefId());
607 $data->setObjectId($talkSession->getId());
608 $talkSession->setData(
$data);
609 $talkSession->update();
611 $talks[] = $talkSession;
619 $dateIterator->removeByDAY($periodStart);
620 $dateIterator->rewind();
625 foreach ($dateIterator as $date) {
626 $cloneObject = $talkSession->cloneObject($talk->
getRefId());
627 $cloneData = $cloneObject->getData();
629 $cloneData->setStartDate($date);
631 if ($cloneData->isAllDay()) {
636 $cloneObject->setData($cloneData);
637 $cloneObject->update();
638 $talks[] = $cloneObject;
650 $children = $DIC->repositoryTree()->getChildIds((
int) $refId);
657 if (empty($children)) {
658 $DIC->ui()->mainTemplate()->setOnScreenMessage(
660 $DIC->language()->txt(
"permission_denied"),
663 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class,
"");
665 ilObjEmployeeTalkGUI::_goto((
string) $children[0]);
671 if ($this->container->http()->wrapper()->query()->has(
'template')) {
672 $refId = $this->container->http()->wrapper()->query()->retrieve(
674 $this->container->refinery()->kindlyTo()->int()
681 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'etal_create_invalid_template_ref'),
true);
682 $this->
ctrl->redirectByClass([
683 strtolower(ilDashboardGUI::class),
684 strtolower(ilMyStaffGUI::class),
685 strtolower(ilEmployeeTalkMyStaffListGUI::class)
686 ], ControlFlowCommand::INDEX);
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
static get(string $a_var)
omitLocator(bool $omit=true)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
static _lookupId($a_user_str)
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
ILIAS DI Container $container
static getUserDateFormat(int $a_add_time=0, bool $a_for_parsing=false)
Parse current user setting into date/time format.
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
getFrequenceType()
Get Frequence type of recurrence.
static getUserIdByLogin(string $a_login)
setDescription(string $desc)
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
checkPermissionBool(string $a_perm, string $a_cmd="", string $a_type="", ?int $a_ref_id=null)
Talk Series does not use RBAC and therefore does not require the usual permission checks...
static _exists(int $id, bool $reference=false, ?string $type=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initDidacticTemplate(ilPropertyFormGUI $form)
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
loadRecurrenceSettings()
load recurrence settings
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Repository GUI Utilities.
static _lookupObjectId(int $ref_id)
afterSave(ilObject $new_object)
Post (successful) object creation hook.
initCreationForms($new_type)
form( $class_path, string $cmd)
static _goto(string $refId)
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
static _cloneValues(int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
Clone Advanced Meta Data.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
setReturnLocation(string $cmd, string $location)
set specific return location for command
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
setTitleAndDescription()
This GUI is only called when creating a talk (series).
sendNotification(array $talks)
initCreateForm(string $new_type)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
copyTemplateValues(ilObjEmployeeTalkSeries $talk)
Copy the template values, into the talk series object.
Class ilObjEmployeeTalkGUI.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d