ILIAS  release_8 Revision v8.24
ilCalendarSelectionBlockGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 correctOffset ()
 
 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="")
 
 getBlockCommands ()
 
 getHTML ()
 
 fillHeaderCommands ()
 
 fillHeaderTitleBlock ()
 
 setDataSection (string $a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow (array $a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 
 setPreviousNextLinks ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 
 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 ()
 
 fillRowColor (string $a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getViewControls ()
 Get view controls. 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...
 
 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"
 
bool $new_rendering = true
 
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
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS 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
 
bool $new_rendering = false
 

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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 31 of file class.ilCalendarSelectionBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

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

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 281 of file class.ilCalendarSelectionBlockGUI.php.

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

References 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 163 of file class.ilCalendarSelectionBlockGUI.php.

163 : string
164 {
165 $next_class = $this->ctrl->getNextClass();
166 $cmd = $this->ctrl->getCmd("getHTML");
167 switch ($next_class) {
168 default:
169 return $this->$cmd();
170 }
171 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getBlockType()

ilCalendarSelectionBlockGUI::getBlockType ( )

@inheritDoc

Reimplemented from ilBlockGUI.

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

146 : string
147 {
148 return self::$block_type;
149 }

References $block_type.

◆ getCalendars()

ilCalendarSelectionBlockGUI::getCalendars ( )

Get calendars.

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

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

456 : string
457 {
458 $this->getCalendars();
459 return parent::getHTML();
460 }

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 305 of file class.ilCalendarSelectionBlockGUI.php.

305 : string
306 {
307 $tpl = new ilTemplate("tpl.cal_selection_block_content.html", true, true, "Services/Calendar");
308
309 foreach ($this->calendar_groups as $type => $txt) {
310 foreach ($this->calendars[$type] as $c) {
311 $this->renderItem($c, $tpl);
312 }
313 if (count($this->calendars[$type]) > 0) {
314 if ($type == self::CAL_GRP_CURRENT_CONT) {
315 $txt = $this->lng->txt("cal_grp_curr_" . ilObject::_lookupType($this->obj_id));
316 }
317 if ($type == self::CAL_GRP_CURRENT_CONT_CONS) {
318 $txt = $this->lng->txt("cal_grp_curr_crs_cons");
319 }
320 $tpl->setCurrentBlock("item_grp");
321 $tpl->setVariable("GRP_HEAD", $txt);
323 }
324 }
325
326 $tpl->setVariable("TXT_SHOW", $this->lng->txt("refresh"));
327 $tpl->setVariable("CMD_SHOW", "saveSelection");
328 $tpl->setVariable("TXT_ACTION", $this->lng->txt("select"));
329 $tpl->setVariable("SRC_ACTION", ilUtil::getImagePath("arrow_downright.svg"));
330 $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormActionByClass("ilcalendarcategorygui"));
331 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
332
333 return $tpl->get();
334 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$c
Definition: cli.php:38
$txt
Definition: error.php:13
$type

References $c, ilBlockGUI\$tpl, $txt, $type, 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 465 of file class.ilCalendarSelectionBlockGUI.php.

466 {
467 $factory = $this->ui->factory();
468 if (isset($data["shy_button"])) {
469 return $factory->item()->standard($data["shy_button"])->withDescription($data["date"]);
470 } else {
471 return $factory->item()->standard($data["date"]);
472 }
473 }
Common interface to all items.
Definition: Item.php:32
$factory
Definition: metadata.php:75

References ilBlockGUI\$data, $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 154 of file class.ilCalendarSelectionBlockGUI.php.

154 : string
155 {
156 global $DIC;
157
158 $ilCtrl = $DIC['ilCtrl'];
159
160 return IL_SCREEN_SIDE;
161 }
const IL_SCREEN_SIDE

References $DIC, and IL_SCREEN_SIDE.

◆ isRepositoryObject()

ilCalendarSelectionBlockGUI::isRepositoryObject ( )
protected

@inheritDoc

Reimplemented from ilBlockGUI.

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

138 : bool
139 {
140 return false;
141 }

◆ renderItem()

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

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

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

References ilLink\_getLink(), 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 33 of file class.ilCalendarSelectionBlockGUI.php.

Referenced by getBlockType().

◆ $calendar_groups

array ilCalendarSelectionBlockGUI::$calendar_groups = array()
protected

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

◆ $calendars

array ilCalendarSelectionBlockGUI::$calendars = array()
protected

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

◆ $category_id

int ilCalendarSelectionBlockGUI::$category_id = 0
protected

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

◆ $http

HttpServices ilCalendarSelectionBlockGUI::$http
protected

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

◆ $new_rendering

bool ilCalendarSelectionBlockGUI::$new_rendering = true
protected
Todo:
fix in base class

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

◆ $obj_id

int ilCalendarSelectionBlockGUI::$obj_id = 0
protected

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

◆ $ref_id

int ilCalendarSelectionBlockGUI::$ref_id = 0
protected

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

Referenced by getCalendars().

◆ $refinery

RefineryFactory ilCalendarSelectionBlockGUI::$refinery
protected

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

◆ $seed

ilDate ilCalendarSelectionBlockGUI::$seed
protected

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

◆ $tree

ilTree ilCalendarSelectionBlockGUI::$tree
protected

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

◆ CAL_GRP_CURRENT_CONT

const ilCalendarSelectionBlockGUI::CAL_GRP_CURRENT_CONT = "curr_cont"
protected

Definition at line 36 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 35 of file class.ilCalendarSelectionBlockGUI.php.

Referenced by getCalendars().

◆ CAL_GRP_OTHERS

const ilCalendarSelectionBlockGUI::CAL_GRP_OTHERS = "others"
protected

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

Referenced by getCalendars().

◆ CAL_GRP_PERSONAL

const ilCalendarSelectionBlockGUI::CAL_GRP_PERSONAL = "personal"
protected

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

Referenced by getCalendars().


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