5 include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
51 parent::__construct();
52 $lng->loadLanguageModule(
'pd');
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));
70 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
71 $lng->txt(
'pd_my_offers'),
78 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'seed', $this->seed->get(
IL_CAL_DATE));
80 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
81 $lng->txt(
'pd_my_memberships'),
88 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'calendar_mode',
"");
90 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'add'),
91 $lng->txt(
'cal_add_calendar')
94 $this->calendar_groups = array(
95 self::CAL_GRP_CURRENT_CONT_CONS =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT_CONS),
96 self::CAL_GRP_CURRENT_CONT =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT),
97 self::CAL_GRP_PERSONAL =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_PERSONAL),
98 self::CAL_GRP_OTHERS =>
$lng->txt(
"cal_grp_" . self::CAL_GRP_OTHERS)
115 return self::$block_type;
139 $next_class =
$ilCtrl->getNextClass();
140 $cmd =
$ilCtrl->getCmd(
"getHTML");
142 switch ($next_class) {
144 return $this->$cmd();
156 $tree = $DIC[
'tree'];
159 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
160 include_once(
'./Services/Calendar/classes/class.ilCalendarVisibility.php');
164 $hidden = $hidden_obj->getHidden();
165 $visible = $hidden_obj->getVisible();
168 if ($this->ref_id > 0) {
178 $all = $cats->getCategoriesInfo();
179 $tmp_title_counter = array();
180 $categories = array();
181 foreach ($all as $category) {
184 $tmp_arr[
'obj_id'] = $category[
'obj_id'];
185 $tmp_arr[
'id'] = $category[
'cat_id'];
186 $tmp_arr[
'hidden'] = (bool) in_array($category[
'cat_id'], $hidden);
187 $tmp_arr[
'visible'] = (bool) in_array($category[
'cat_id'], $visible);
188 $tmp_arr[
'title'] = $category[
'title'];
189 $tmp_arr[
'type'] = $category[
'type'];
190 $tmp_arr[
'source_ref_id'] = $category[
'source_ref_id'];
192 $tmp_arr[
'default_selected'] =
true;
193 if ($this->category_id) {
194 if ($this->category_id == $category[
'cat_id']) {
195 $tmp_arr[
'default_selected'] =
true;
197 $tmp_arr[
'default_selected'] =
false;
206 $tmp_arr[
'color'] = $category[
'color'];
207 $tmp_arr[
'editable'] = $category[
'editable'];
212 if (
$access->checkAccess(
'read',
'', $ref_id)) {
218 $categories[] = $tmp_arr;
221 $tmp_title_counter[$category[
'type'] .
'_' . $category[
'title']]++;
224 $path_categories = array();
225 foreach ($categories as $cat) {
227 if ($tmp_title_counter[$cat[
'type'] .
'_' . $cat[
'title']] > 1) {
229 $cat[
'path'] = $this->
buildPath($ref_id);
234 $path_categories[] = $cat;
239 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS] = array();
240 $this->calendars[self::CAL_GRP_CURRENT_CONT] = array();
241 $this->calendars[self::CAL_GRP_PERSONAL] = array();
242 $this->calendars[self::CAL_GRP_OTHERS] = array();
244 foreach ($path_categories as $cal) {
246 $this->calendars[self::CAL_GRP_CURRENT_CONT_CONS][] = $cal;
248 || $this->ref_id == $cal[
"source_ref_id"]))) {
249 $this->calendars[self::CAL_GRP_CURRENT_CONT][] = $cal;
252 $this->calendars[self::CAL_GRP_PERSONAL][] = $cal;
254 $this->calendars[self::CAL_GRP_OTHERS][] = $cal;
268 $tree = $DIC[
'tree'];
270 $path_arr =
$tree->getPathFull($a_ref_id, ROOT_FOLDER_ID);
272 unset($path_arr[count($path_arr) - 1]);
274 foreach ($path_arr as
$data) {
278 $path .= $data[
'title'];
280 if (strlen(
$path) > 30) {
281 return '...' . substr(
$path, -30);
297 $tpl =
new ilTemplate(
"tpl.cal_selection_block_content.html",
true,
true,
"Services/Calendar");
299 foreach ($this->calendar_groups as
$type =>
$txt) {
300 foreach ($this->calendars[
$type] as
$c) {
303 if (count($this->calendars[
$type]) > 0) {
304 if ($type == self::CAL_GRP_CURRENT_CONT) {
307 if ($type == self::CAL_GRP_CURRENT_CONT_CONS) {
308 $txt =
$lng->txt(
"cal_grp_curr_crs_cons");
310 $tpl->setCurrentBlock(
"item_grp");
311 $tpl->setVariable(
"GRP_HEAD",
$txt);
312 $tpl->parseCurrentBlock();
316 $tpl->setVariable(
"TXT_SHOW",
$lng->txt(
"refresh"));
317 $tpl->setVariable(
"CMD_SHOW",
"saveSelection");
318 $tpl->setVariable(
"TXT_ACTION",
$lng->txt(
"select"));
320 $tpl->setVariable(
"FORM_ACTION",
$ilCtrl->getFormActionByClass(
"ilcalendarcategorygui"));
321 $tpl->setVariable(
"TXT_SELECT_ALL",
$lng->txt(
"select_all"));
338 if (strlen($a_set[
'path'])) {
339 $a_tpl->setCurrentBlock(
'calendar_path');
340 $a_tpl->setVariable(
'ADD_PATH_INFO', $a_set[
'path']);
341 $a_tpl->parseCurrentBlock();
344 $a_tpl->setCurrentBlock(
"item");
346 $a_tpl->setVariable(
'VAL_ID', $a_set[
'id']);
347 if ($this->obj_id == 0) {
348 if (!$a_set[
'hidden'] && $a_set[
'default_selected']) {
349 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
352 if ($a_set[
"obj_id"] == $this->obj_id) {
353 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
354 $a_tpl->setVariable(
'VAL_DISABLED',
'disabled');
355 } elseif ($a_set[
'visible']) {
356 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
359 $a_tpl->setVariable(
'BGCOLOR', $a_set[
'color']);
367 # ilCalendarCategories::_getInstance($ilUser->getId())->getMode() == ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP || 368 # ilCalendarCategories::_getInstance($ilUser->getId())->getMode() == ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS 370 if (!$this->ref_id) {
371 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'backpd', 1);
373 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'ref_id', $a_set[
'ref_id']);
376 $link =
$ilCtrl->getLinkTargetByClass(
378 ilRepositoryGUI::class,
379 ilObjCourseGUI::class,
380 ilCalendarPresentationGUI::class
387 $link =
$ilCtrl->getLinkTargetByClass(
389 ilRepositoryGUI::class,
390 ilObjGroupGUI::class,
391 ilCalendarPresentationGUI::class
402 $ilCtrl->clearParameterByClass(ilCalendarPresentationGUI::class,
'ref_id');
404 $a_tpl->setVariable(
'EDIT_LINK', $link);
405 $a_tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
407 $a_tpl->setVariable(
'PLAIN_TITLE', $a_set[
'title']);
409 $a_tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
410 $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui",
'category_id', $a_set[
'id']);
411 $a_tpl->setVariable(
'EDIT_LINK',
$ilCtrl->getLinkTargetByClass(
"ilcalendarpresentationgui",
''));
412 $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui",
'category_id',
$_GET[
"category_id"]);
413 $a_tpl->setVariable(
'TXT_EDIT', $this->lng->txt(
'edit'));
416 switch ($a_set[
'type']) {
419 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_system'));
424 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_personal'));
430 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' .
$type));
435 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' .
$type));
440 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_ch_ch'));
444 $a_tpl->parseCurrentBlock();
457 $ilAccess = $DIC[
'ilAccess'];
462 return parent::getHTML();
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
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
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
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
special template class to simplify handling of ITX/PEAR
buildPath($a_ref_id)
Build path for ref id.
static _lookupType($a_id, $a_reference=false)
lookup object type
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setLimit($a_limit)
Set Limit.
const CAL_GRP_CURRENT_CONT_CONS
This class represents a block method of a block.
static getScreenMode()
Get Screen Mode for current command.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
const CAL_GRP_CURRENT_CONT
const MODE_PERSONAL_DESKTOP_ITEMS