ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCalendarSelectionBlockGUI Class Reference

BlockGUI class calendar selection. More...

+ Inheritance diagram for ilCalendarSelectionBlockGUI:
+ Collaboration diagram for ilCalendarSelectionBlockGUI:

Public Member Functions

 __construct (ilDate $a_seed, int $a_ref_id=0)
 Constructor. More...
 
 getBlockType ()
 @inheritDoc More...
 
 executeCommand ()
 
 getCalendars ()
 Get calendars. More...
 
 getHTML ()
 @inheritDoc More...
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 @inheritDoc More...
 
static getScreenMode ()
 

Static Public Attributes

static string $block_type = "cal_sel"
 

Protected Member Functions

 isRepositoryObject ()
 @inheritDoc More...
 
 buildPath ($a_ref_id)
 Build path for ref id. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 renderItem (array $a_set, ilTemplate $a_tpl)
 
 getListItemForData (array $data)
 Get list item for data array.
Parameters
array$data
Returns
null|\ILIAS\UI\Component\Item\Item
More...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

const CAL_GRP_CURRENT_CONT_CONS = "curr_cont_cons"
 
const CAL_GRP_CURRENT_CONT = "curr_cont"
 
const CAL_GRP_PERSONAL = "personal"
 
const CAL_GRP_OTHERS = "others"
 
ilTree $tree
 
RefineryFactory $refinery
 
HttpServices $http
 
ilDate $seed
 
array $calendar_groups = array()
 
array $calendars = array()
 
int $ref_id = 0
 
int $obj_id = 0
 
int $category_id = 0
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Container Block StandardGUIRequest $request
 
ILIAS Container Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Additional Inherited Members

- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Detailed Description

BlockGUI class calendar selection.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarSelectionBlockGUI::__construct ( ilDate  $a_seed,
int  $a_ref_id = 0 
)

Constructor.

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

63 {
64 global $DIC;
65
67 $this->tree = $DIC->repositoryTree();
68 $this->lng->loadLanguageModule('dash');
69 $this->lng->loadLanguageModule('dateplaner');
70 $this->http = $DIC->http();
71 $this->refinery = $DIC->refinery();
72
73 $this->ref_id = $a_ref_id;
74 $this->obj_id = ilObject::_lookupObjId($this->ref_id);
75 $this->category_id = 0;
76 if ($this->http->wrapper()->query()->has('category_id')) {
77 $this->category_id = $this->http->wrapper()->query()->retrieve(
78 'category_id',
79 $this->refinery->kindlyTo()->int()
80 );
81 }
82
83 $this->setLimit(5);
84 $this->allow_moving = false;
85 $this->seed = $a_seed;
86 $this->setTitle($this->lng->txt('cal_table_categories'));
87
88 $sel_type = ilCalendarUserSettings::_getInstance()->getCalendarSelectionType();
89 $this->ctrl->setParameterByClass(
90 "ilcalendarcategorygui",
91 'calendar_mode',
93 );
94 $this->ctrl->setParameterByClass("ilcalendarcategorygui", 'seed', $this->seed->get(IL_CAL_DATE));
95 // @todo: set checked if ($sel_type == ilCalendarUserSettings::CAL_SELECTION_ITEMS)
96 $this->addBlockCommand(
97 $this->ctrl->getLinkTargetByClass("ilcalendarcategorygui", 'switchCalendarMode'),
98 $this->lng->txt('dash_favourites')
99 );
100 $this->ctrl->setParameterByClass(
101 "ilcalendarcategorygui",
102 'calendar_mode',
104 );
105 $this->ctrl->setParameterByClass("ilcalendarcategorygui", 'seed', $this->seed->get(IL_CAL_DATE));
106
107 // @todo: set checked if ($sel_type == ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP)
108 $this->addBlockCommand(
109 $this->ctrl->getLinkTargetByClass("ilcalendarcategorygui", 'switchCalendarMode'),
110 $this->lng->txt('dash_memberships')
111 );
112
113 $this->ctrl->setParameterByClass("ilcalendarcategorygui", 'calendar_mode', "");
114 $this->addBlockCommand(
115 $this->ctrl->getLinkTargetByClass("ilcalendarcategorygui", 'add'),
116 $this->lng->txt('cal_add_calendar')
117 );
118
119 $this->calendar_groups = array(
120 self::CAL_GRP_CURRENT_CONT_CONS => $this->lng->txt("cal_grp_" . self::CAL_GRP_CURRENT_CONT_CONS),
121 self::CAL_GRP_CURRENT_CONT => $this->lng->txt("cal_grp_" . self::CAL_GRP_CURRENT_CONT),
122 self::CAL_GRP_PERSONAL => $this->lng->txt("cal_grp_" . self::CAL_GRP_PERSONAL),
123 self::CAL_GRP_OTHERS => $this->lng->txt("cal_grp_" . self::CAL_GRP_OTHERS)
124 );
125
126 $this->setPresentation(self::PRES_SEC_LEG);
127 }
const IL_CAL_DATE
setTitle(string $a_title)
setPresentation(int $type)
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
setLimit(int $a_limit)
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilCalendarUserSettings\_getInstance(), ilObject\_lookupObjId(), ilBlockGUI\addBlockCommand(), ilCalendarUserSettings\CAL_SELECTION_ITEMS, ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), IL_CAL_DATE, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), and ilBlockGUI\setTitle().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildPath()

ilCalendarSelectionBlockGUI::buildPath (   $a_ref_id)
protected

Build path for ref id.

Definition at line 275 of file class.ilCalendarSelectionBlockGUI.php.

275 : string
276 {
277 $obj_type = ilObject::_lookupType($a_ref_id, true);
278 if (!$this->obj_def->isAllowedInRepository($obj_type)) {
279 return '';
280 }
281
282 $path_arr = $this->tree->getPathFull($a_ref_id, ROOT_FOLDER_ID);
283 $counter = 0;
284 unset($path_arr[count($path_arr) - 1]);
285
286 $path = '';
287 foreach ($path_arr as $data) {
288 if ($counter++) {
289 $path .= " -> ";
290 }
291 $path .= $data['title'];
292 }
293 if (strlen($path) > 30) {
294 return '...' . substr($path, -30);
295 }
296 return $path;
297 }
static _lookupType(int $id, bool $reference=false)
const ROOT_FOLDER_ID
Definition: constants.php:32
$path
Definition: ltiservices.php:30
$counter

References $counter, ilBlockGUI\$data, $path, ilObject\_lookupType(), and ROOT_FOLDER_ID.

Referenced by getCalendars().

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

◆ executeCommand()

ilCalendarSelectionBlockGUI::executeCommand ( )

Definition at line 157 of file class.ilCalendarSelectionBlockGUI.php.

157 : string
158 {
159 $next_class = $this->ctrl->getNextClass();
160 $cmd = $this->ctrl->getCmd("getHTML");
161 switch ($next_class) {
162 default:
163 return $this->$cmd();
164 }
165 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getBlockType()

ilCalendarSelectionBlockGUI::getBlockType ( )

@inheritDoc

Reimplemented from ilBlockGUI.

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

140 : string
141 {
142 return self::$block_type;
143 }

References $block_type.

◆ getCalendars()

ilCalendarSelectionBlockGUI::getCalendars ( )

Get calendars.

Definition at line 170 of file class.ilCalendarSelectionBlockGUI.php.

170 : void
171 {
172 $hidden_obj = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $this->ref_id);
173 $hidden = $hidden_obj->getHidden();
174 $visible = $hidden_obj->getVisible();
175
176 $cats = new ilCalendarCategories($this->user->getId());
177 if ($this->ref_id > 0) {
178 $cats->initialize(ilCalendarCategories::MODE_REPOSITORY, $this->ref_id, true);
181 } else {
183 }
184
185 $all = $cats->getCategoriesInfo();
186 $tmp_title_counter = [];
187 $categories = array();
188 foreach ($all as $category) {
189 //if ($category["obj_id"] == 255)
190 //{var_dump($category); exit;}
191 $tmp_arr['obj_id'] = (int) $category['obj_id'];
192 $tmp_arr['id'] = (int) $category['cat_id'];
193 $tmp_arr['hidden'] = in_array($category['cat_id'], $hidden);
194 $tmp_arr['visible'] = in_array($category['cat_id'], $visible);
195 $tmp_arr['title'] = (string) $category['title'];
196 $tmp_arr['type'] = (string) $category['type'];
197 $tmp_arr['source_ref_id'] = (int) ($category['source_ref_id'] ?? 0);
198 $tmp_arr['default_selected'] = true;
199 if ($this->category_id) {
200 if ($this->category_id == $category['cat_id']) {
201 $tmp_arr['default_selected'] = true;
202 } else {
203 $tmp_arr['default_selected'] = false;
204 }
205 }
206
207 // Append object type to make type sortable
208 $tmp_arr['type_sortable'] = (string) ilCalendarCategory::lookupCategorySortIndex($category['type']);
209 if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
210 $tmp_arr['type_sortable'] .= ('_' . ilObject::_lookupType($category['obj_id']));
211 }
212 $tmp_arr['color'] = (string) $category['color'];
213 $tmp_arr['editable'] = (bool) ($category['editable'] ?? false);
214
215 // reference
216 if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
217 foreach (ilObject::_getAllReferences($category['obj_id']) as $ref_id => $tmp_ref) {
218 if ($this->access->checkAccess('read', '', $ref_id)) {
219 $tmp_arr['ref_id'] = (int) $ref_id;
220 }
221 }
222 }
223
224 $categories[] = $tmp_arr;
225
226 // count title for appending the parent container if there is more than one entry.
227 if (isset($tmp_title_counter[$category['type'] . '_' . $category['title']])) {
228 $tmp_title_counter[$category['type'] . '_' . $category['title']]++;
229 } else {
230 $tmp_title_counter[$category['type'] . '_' . $category['title']] = 1;
231 }
232 }
233
234 $path_categories = array();
235 foreach ($categories as $cat) {
236 $cat['path'] = '';
237 if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) {
238 if (
239 isset($tmp_title_counter[$category['type'] . '_' . $category['title']]) &&
240 $tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1
241 ) {
242 foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) {
243 $cat['path'] = $this->buildPath($ref_id);
244 break;
245 }
246 }
247 }
248 $path_categories[] = $cat;
249 }
250 $path_categories = ilArrayUtil::sortArray($path_categories, 'title', "asc");
251
252 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS] = array();
253 $this->calendars[self::CAL_GRP_CURRENT_CONT] = array();
254 $this->calendars[self::CAL_GRP_PERSONAL] = array();
255 $this->calendars[self::CAL_GRP_OTHERS] = array();
256
257 foreach ($path_categories as $cal) {
258 if ($cal["type"] == ilCalendarCategory::TYPE_CH && $this->obj_id > 0) {
259 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS][] = $cal;
260 } elseif ($cal["type"] == ilCalendarCategory::TYPE_OBJ && ($this->obj_id > 0 && ($cal["obj_id"] == $this->obj_id
261 || $this->ref_id == $cal["source_ref_id"]))) {
262 $this->calendars[self::CAL_GRP_CURRENT_CONT][] = $cal;
263 } elseif ($cal["type"] == ilCalendarCategory::TYPE_USR || $cal["type"] == ilCalendarCategory::TYPE_BOOK ||
264 ($cal["type"] == ilCalendarCategory::TYPE_CH && $this->user->getId() == $cal["obj_id"])) {
265 $this->calendars[self::CAL_GRP_PERSONAL][] = $cal;
266 } else {
267 $this->calendars[self::CAL_GRP_OTHERS][] = $cal;
268 }
269 }
270 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
class for calendar categories
static lookupCategorySortIndex(int $a_type_id)
Lookup sort index of calendar type.
buildPath($a_ref_id)
Build path for ref id.
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
static _getAllReferences(int $id)
get all reference ids for object ID

References $ref_id, ilObject\_getAllReferences(), ilCalendarUserSettings\_getInstance(), ilCalendarVisibility\_getInstanceByUserId(), ilObject\_lookupType(), ILIAS\Repository\access(), buildPath(), CAL_GRP_CURRENT_CONT, CAL_GRP_CURRENT_CONT_CONS, CAL_GRP_OTHERS, CAL_GRP_PERSONAL, ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\int(), ilCalendarCategory\lookupCategorySortIndex(), ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP, ilCalendarCategories\MODE_REPOSITORY, ilArrayUtil\sortArray(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_OBJ, ilCalendarCategory\TYPE_USR, and ILIAS\Repository\user().

Referenced by getHTML().

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

◆ getHTML()

ilCalendarSelectionBlockGUI::getHTML ( )

@inheritDoc

Reimplemented from ilBlockGUI.

Definition at line 450 of file class.ilCalendarSelectionBlockGUI.php.

450 : string
451 {
452 $this->getCalendars();
453 return parent::getHTML();
454 }

References getCalendars().

+ Here is the call graph for this function:

◆ getLegacyContent()

ilCalendarSelectionBlockGUI::getLegacyContent ( )
protected

Get legacy content.

Returns
string

Reimplemented from ilBlockGUI.

Definition at line 299 of file class.ilCalendarSelectionBlockGUI.php.

299 : string
300 {
301 $tpl = new ilTemplate("tpl.cal_selection_block_content.html", true, true, "components/ILIAS/Calendar");
302
303 foreach ($this->calendar_groups as $type => $txt) {
304 foreach ($this->calendars[$type] as $c) {
305 $this->renderItem($c, $tpl);
306 }
307 if (count($this->calendars[$type]) > 0) {
308 if ($type == self::CAL_GRP_CURRENT_CONT) {
309 $txt = $this->lng->txt("cal_grp_curr_" . ilObject::_lookupType($this->obj_id));
310 }
311 if ($type == self::CAL_GRP_CURRENT_CONT_CONS) {
312 $txt = $this->lng->txt("cal_grp_curr_crs_cons");
313 }
314 $tpl->setCurrentBlock("item_grp");
315 $tpl->setVariable("GRP_HEAD", $txt);
317 }
318 }
319
320 $tpl->setVariable("TXT_SHOW", $this->lng->txt("refresh"));
321 $tpl->setVariable("CMD_SHOW", "saveSelection");
322 $tpl->setVariable("TXT_ACTION", $this->lng->txt("select"));
323 $tpl->setVariable("SRC_ACTION", ilUtil::getImagePath("nav/arrow_downright.svg"));
324 $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormActionByClass("ilcalendarcategorygui"));
325 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
326
327 return $tpl->get();
328 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
ilTemplate $tpl
renderItem(array $a_set, ilTemplate $a_tpl)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Returns a block with all replacements done.
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$c
Definition: deliver.php:25
$txt
Definition: error.php:31

References $c, ilBlockGUI\$tpl, $txt, ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilTemplate\get(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), renderItem(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ getListItemForData()

ilCalendarSelectionBlockGUI::getListItemForData ( array  $data)
protected

Get list item for data array.

Parameters
array$data
Returns
null|\ILIAS\UI\Component\Item\Item

Reimplemented from ilBlockGUI.

Definition at line 459 of file class.ilCalendarSelectionBlockGUI.php.

460 {
461 $factory = $this->ui->factory();
462 if (isset($data["shy_button"])) {
463 return $factory->item()->standard($data["shy_button"])->withDescription($data["date"]);
464 } else {
465 return $factory->item()->standard($data["date"]);
466 }
467 }
Factory $factory
Common interface to all items.
Definition: Item.php:32

References ilBlockGUI\$data, ilBlockGUI\$factory, and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getScreenMode()

static ilCalendarSelectionBlockGUI::getScreenMode ( )
static

@inheritDoc

Reimplemented from ilBlockGUI.

Definition at line 148 of file class.ilCalendarSelectionBlockGUI.php.

148 : string
149 {
150 global $DIC;
151
152 $ilCtrl = $DIC['ilCtrl'];
153
154 return IL_SCREEN_SIDE;
155 }
const IL_SCREEN_SIDE

References $DIC, and IL_SCREEN_SIDE.

◆ isRepositoryObject()

ilCalendarSelectionBlockGUI::isRepositoryObject ( )
protected

@inheritDoc

Reimplemented from ilBlockGUI.

Definition at line 132 of file class.ilCalendarSelectionBlockGUI.php.

132 : bool
133 {
134 return false;
135 }

◆ renderItem()

ilCalendarSelectionBlockGUI::renderItem ( array  $a_set,
ilTemplate  $a_tpl 
)
protected

Definition at line 330 of file class.ilCalendarSelectionBlockGUI.php.

330 : void
331 {
332 if (strlen((string) $a_set['path'])) {
333 $a_tpl->setCurrentBlock('calendar_path');
334 $a_tpl->setVariable('ADD_PATH_INFO', $a_set['path']);
335 $a_tpl->parseCurrentBlock();
336 }
337
338 $a_tpl->setCurrentBlock("item");
339
340 $a_tpl->setVariable('VAL_ID', $a_set['id']);
341 if ($this->obj_id === 0 && $this->category_id === 0) {
342 if (!$a_set['hidden'] && $a_set['default_selected']) {
343 $a_tpl->setVariable('VAL_CHECKED', 'checked="checked"');
344 }
345 } elseif ($this->obj_id === 0 && $this->category_id > 0) {
346 if (!$a_set['hidden'] && $a_set['default_selected']) {
347 $a_tpl->setVariable('VAL_CHECKED', 'checked="checked"');
348 }
349 $a_tpl->setVariable('VAL_DISABLED', 'disabled');
350 } elseif ($a_set["obj_id"] == $this->obj_id) {
351 // if calendar is shown and repo object id (course group given)
352 $a_tpl->setVariable('VAL_CHECKED', 'checked="checked"');
353 $a_tpl->setVariable('VAL_DISABLED', 'disabled');
354 } elseif ($a_set['visible']) {
355 $a_tpl->setVariable('VAL_CHECKED', 'checked="checked"');
356 }
357 $a_tpl->setVariable('BGCOLOR', $a_set['color']);
358
359 $obj_type = ilObject::_lookupType($a_set['obj_id']);
360 if (
361 ($a_set['type'] == ilCalendarCategory::TYPE_OBJ) &&
362 ($a_set['ref_id'] ?? false)
363 ) {
364 if (!$this->ref_id) {
365 $this->ctrl->setParameterByClass('ilcalendarpresentationgui', 'backpd', 1);
366 }
367 $this->ctrl->setParameterByClass('ilcalendarpresentationgui', 'ref_id', $a_set['ref_id']);
368 switch ($obj_type) {
369 case 'crs':
370 $link = $this->ctrl->getLinkTargetByClass(
371 [
372 ilRepositoryGUI::class,
373 ilObjCourseGUI::class,
374 ilCalendarPresentationGUI::class
375 ],
376 ''
377 );
378 break;
379
380 case 'grp':
381 $link = $this->ctrl->getLinkTargetByClass(
382 [
383 ilRepositoryGUI::class,
384 ilObjGroupGUI::class,
385 ilCalendarPresentationGUI::class
386 ],
387 ''
388 );
389 break;
390
391 case 'tals':
392 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $a_set['id']);
393 $link = $this->ctrl->getLinkTargetByClass("ilcalendarpresentationgui", '');
394 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $this->category_id);
395 break;
396
397 default:
398 $link = ilLink::_getLink($a_set['ref_id']);
399 break;
400 }
401
402 $this->ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'ref_id');
403
404 $a_tpl->setVariable('EDIT_LINK', $link);
405 $a_tpl->setVariable('VAL_TITLE', $a_set['title']);
406 } elseif ($a_set['type'] == ilCalendarCategory::TYPE_OBJ) {
407 $a_tpl->setVariable('PLAIN_TITLE', $a_set['title']);
408 } else {
409 $a_tpl->setVariable('VAL_TITLE', $a_set['title']);
410 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $a_set['id']);
411 $a_tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass("ilcalendarpresentationgui", ''));
412 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $this->category_id);
413 $a_tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
414 }
415
416 switch ($a_set['type']) {
418 $a_tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_calg.svg'));
419 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_system'));
420 break;
421
423 $a_tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_usr.svg'));
424 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_personal'));
425 break;
426
428 $img_type = $obj_type === 'tals' ? 'etal' : $obj_type;
429 $a_tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_' . $img_type . '.svg'));
430 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $obj_type));
431 break;
432
434 $a_tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_book.svg'));
435 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $obj_type));
436 break;
437
439 $a_tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_calch.svg'));
440 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_ch_ch'));
441 break;
442 }
443
444 $a_tpl->parseCurrentBlock();
445 }

References ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by getLegacyContent().

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

Field Documentation

◆ $block_type

string ilCalendarSelectionBlockGUI::$block_type = "cal_sel"
static

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

Referenced by getBlockType().

◆ $calendar_groups

array ilCalendarSelectionBlockGUI::$calendar_groups = array()
protected

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

◆ $calendars

array ilCalendarSelectionBlockGUI::$calendars = array()
protected

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

◆ $category_id

int ilCalendarSelectionBlockGUI::$category_id = 0
protected

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

◆ $http

HttpServices ilCalendarSelectionBlockGUI::$http
protected

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

◆ $obj_id

int ilCalendarSelectionBlockGUI::$obj_id = 0
protected

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

◆ $ref_id

int ilCalendarSelectionBlockGUI::$ref_id = 0
protected

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

Referenced by getCalendars().

◆ $refinery

RefineryFactory ilCalendarSelectionBlockGUI::$refinery
protected

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

◆ $seed

ilDate ilCalendarSelectionBlockGUI::$seed
protected

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

◆ $tree

ilTree ilCalendarSelectionBlockGUI::$tree
protected

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

◆ CAL_GRP_CURRENT_CONT

const ilCalendarSelectionBlockGUI::CAL_GRP_CURRENT_CONT = "curr_cont"
protected

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

Referenced by getCalendars().

◆ CAL_GRP_CURRENT_CONT_CONS

const ilCalendarSelectionBlockGUI::CAL_GRP_CURRENT_CONT_CONS = "curr_cont_cons"
protected

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

Referenced by getCalendars().

◆ CAL_GRP_OTHERS

const ilCalendarSelectionBlockGUI::CAL_GRP_OTHERS = "others"
protected

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

Referenced by getCalendars().

◆ CAL_GRP_PERSONAL

const ilCalendarSelectionBlockGUI::CAL_GRP_PERSONAL = "personal"
protected

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

Referenced by getCalendars().


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