5 include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
47 $ilCtrl = $DIC[
'ilCtrl'];
52 $lng->loadLanguageModule(
'dash');
53 $lng->loadLanguageModule(
'dateplaner');
54 $this->ref_id = $a_ref_id;
57 $this->category_id =
$_GET[
'category_id'];
60 $this->allow_moving =
false;
61 $this->seed = $a_seed;
65 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
68 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'seed', $this->seed->get(
IL_CAL_DATE));
71 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
72 $lng->txt(
'dash_favourites')
75 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'seed', $this->seed->get(
IL_CAL_DATE));
79 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
80 $lng->txt(
'dash_memberships')
83 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'calendar_mode',
"");
85 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'add'),
86 $lng->txt(
'cal_add_calendar')
89 $this->calendar_groups = array(
90 self::CAL_GRP_CURRENT_CONT_CONS =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT_CONS),
91 self::CAL_GRP_CURRENT_CONT =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT),
92 self::CAL_GRP_PERSONAL =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_PERSONAL),
93 self::CAL_GRP_OTHERS =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_OTHERS)
112 return self::$block_type;
122 $ilCtrl = $DIC[
'ilCtrl'];
134 $ilCtrl = $DIC[
'ilCtrl'];
136 $next_class = $ilCtrl->getNextClass();
137 $cmd = $ilCtrl->getCmd(
"getHTML");
139 switch ($next_class) {
141 return $this->$cmd();
153 $tree = $DIC[
'tree'];
156 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
157 include_once(
'./Services/Calendar/classes/class.ilCalendarVisibility.php');
161 $hidden = $hidden_obj->getHidden();
162 $visible = $hidden_obj->getVisible();
165 if ($this->ref_id > 0) {
175 $all = $cats->getCategoriesInfo();
176 $tmp_title_counter = array();
177 $categories = array();
178 foreach ($all as $category) {
181 $tmp_arr[
'obj_id'] = $category[
'obj_id'];
182 $tmp_arr[
'id'] = $category[
'cat_id'];
183 $tmp_arr[
'hidden'] = (bool) in_array($category[
'cat_id'], $hidden);
184 $tmp_arr[
'visible'] = (bool) in_array($category[
'cat_id'], $visible);
185 $tmp_arr[
'title'] = $category[
'title'];
186 $tmp_arr[
'type'] = $category[
'type'];
187 $tmp_arr[
'source_ref_id'] = $category[
'source_ref_id'];
189 $tmp_arr[
'default_selected'] =
true;
190 if ($this->category_id) {
191 if ($this->category_id == $category[
'cat_id']) {
192 $tmp_arr[
'default_selected'] =
true;
194 $tmp_arr[
'default_selected'] =
false;
203 $tmp_arr[
'color'] = $category[
'color'];
204 $tmp_arr[
'editable'] = $category[
'editable'];
209 if (
$access->checkAccess(
'read',
'', $ref_id)) {
215 $categories[] = $tmp_arr;
218 $tmp_title_counter[$category[
'type'] .
'_' . $category[
'title']]++;
221 $path_categories = array();
222 foreach ($categories as $cat) {
224 if ($tmp_title_counter[$cat[
'type'] .
'_' . $cat[
'title']] > 1) {
226 $cat[
'path'] = $this->
buildPath($ref_id);
231 $path_categories[] = $cat;
236 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS] = array();
237 $this->calendars[self::CAL_GRP_CURRENT_CONT] = array();
238 $this->calendars[self::CAL_GRP_PERSONAL] = array();
239 $this->calendars[self::CAL_GRP_OTHERS] = array();
241 foreach ($path_categories as $cal) {
243 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS][] = $cal;
245 || $this->ref_id == $cal[
"source_ref_id"]))) {
246 $this->calendars[self::CAL_GRP_CURRENT_CONT][] = $cal;
249 $this->calendars[self::CAL_GRP_PERSONAL][] = $cal;
251 $this->calendars[self::CAL_GRP_OTHERS][] = $cal;
265 $tree = $DIC[
'tree'];
269 unset($path_arr[count($path_arr) - 1]);
271 foreach ($path_arr as
$data) {
275 $path .= $data[
'title'];
277 if (strlen($path) > 30) {
278 return '...' . substr($path, -30);
292 $ilCtrl = $DIC[
'ilCtrl'];
294 $tpl =
new ilTemplate(
"tpl.cal_selection_block_content.html",
true,
true,
"Services/Calendar");
296 foreach ($this->calendar_groups as
$type =>
$txt) {
297 foreach ($this->calendars[
$type] as
$c) {
300 if (count($this->calendars[
$type]) > 0) {
301 if ($type == self::CAL_GRP_CURRENT_CONT) {
304 if ($type == self::CAL_GRP_CURRENT_CONT_CONS) {
305 $txt =
$lng->txt(
"cal_grp_curr_crs_cons");
307 $tpl->setCurrentBlock(
"item_grp");
308 $tpl->setVariable(
"GRP_HEAD",
$txt);
309 $tpl->parseCurrentBlock();
313 $tpl->setVariable(
"TXT_SHOW",
$lng->txt(
"refresh"));
314 $tpl->setVariable(
"CMD_SHOW",
"saveSelection");
315 $tpl->setVariable(
"TXT_ACTION",
$lng->txt(
"select"));
317 $tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormActionByClass(
"ilcalendarcategorygui"));
318 $tpl->setVariable(
"TXT_SELECT_ALL",
$lng->txt(
"select_all"));
332 $ilCtrl = $DIC->ctrl();
335 if (strlen($a_set[
'path'])) {
336 $a_tpl->setCurrentBlock(
'calendar_path');
337 $a_tpl->setVariable(
'ADD_PATH_INFO', $a_set[
'path']);
338 $a_tpl->parseCurrentBlock();
341 $a_tpl->setCurrentBlock(
"item");
343 $a_tpl->setVariable(
'VAL_ID', $a_set[
'id']);
344 if ($this->obj_id == 0) {
345 if (!$a_set[
'hidden'] && $a_set[
'default_selected']) {
346 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
349 if ($a_set[
"obj_id"] == $this->obj_id) {
350 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
351 $a_tpl->setVariable(
'VAL_DISABLED',
'disabled');
352 } elseif ($a_set[
'visible']) {
353 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
356 $a_tpl->setVariable(
'BGCOLOR', $a_set[
'color']);
364 # ilCalendarCategories::_getInstance($ilUser->getId())->getMode() == ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP || 365 # ilCalendarCategories::_getInstance($ilUser->getId())->getMode() == ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS 367 if (!$this->ref_id) {
368 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'backpd', 1);
370 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'ref_id', $a_set[
'ref_id']);
373 $link = $ilCtrl->getLinkTargetByClass(
375 ilRepositoryGUI::class,
376 ilObjCourseGUI::class,
377 ilCalendarPresentationGUI::class
384 $link = $ilCtrl->getLinkTargetByClass(
386 ilRepositoryGUI::class,
387 ilObjGroupGUI::class,
388 ilCalendarPresentationGUI::class
399 $ilCtrl->clearParameterByClass(ilCalendarPresentationGUI::class,
'ref_id');
401 $a_tpl->setVariable(
'EDIT_LINK', $link);
402 $a_tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
404 $a_tpl->setVariable(
'PLAIN_TITLE', $a_set[
'title']);
406 $a_tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
407 $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui",
'category_id', $a_set[
'id']);
408 $a_tpl->setVariable(
'EDIT_LINK', $ilCtrl->getLinkTargetByClass(
"ilcalendarpresentationgui",
''));
409 $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui",
'category_id',
$_GET[
"category_id"]);
410 $a_tpl->setVariable(
'TXT_EDIT', $this->lng->txt(
'edit'));
413 switch ($a_set[
'type']) {
416 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_system'));
421 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_personal'));
427 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' .
$type));
432 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' .
$type));
437 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_ch_ch'));
441 $a_tpl->parseCurrentBlock();
450 return parent::getHTML();
473 if (isset($data[
"shy_button"])) {
474 return $factory->item()->standard($data[
"shy_button"])->withDescription($data[
"date"]);
476 return $factory->item()->standard($data[
"date"]);
class for calendar categories
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
getCalendars()
Get calendars.
executeCommand()
execute command
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
Class ChatMainBarProvider .
renderItem($a_set, $a_tpl)
Render item.
const CAL_SELECTION_MEMBERSHIP
fillDataSection()
Fill data section.
BlockGUI class calendar selection.
getHTML()
Get block HTML code.
static _getAllReferences($a_id)
get all reference ids of object
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
setTitle($a_title)
Set Title.
__construct($a_seed, $a_ref_id=0)
Constructor.
const CAL_SELECTION_ITEMS
getListItemForData(array $data)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getInstance()
get instance for logged in user
static _lookupObjId($a_id)
initialize($a_mode, $a_source_ref_id=0, $a_use_cache=false, $a_cat_id=0)
initialize visible categories
buildPath($a_ref_id)
Build path for ref id.
static _lookupType($a_id, $a_reference=false)
lookup object type
setLimit($a_limit)
Set Limit.
__construct(Container $dic, ilPlugin $plugin)
const CAL_GRP_CURRENT_CONT_CONS
This class represents a block method of a block.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
static getScreenMode()
Get Screen Mode for current command.
setPresentation(int $type)
Set presentation.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
const CAL_GRP_CURRENT_CONT
const MODE_PERSONAL_DESKTOP_ITEMS