5 include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
27 parent::__construct();
28 $lng->loadLanguageModule(
'pd');
29 $lng->loadLanguageModule(
'dateplaner');
32 $this->allow_moving =
false;
33 $this->seed = $a_seed;
35 $this->
setTitle($lng->txt(
'cal_table_categories'));
37 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
40 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'seed',$this->seed->get(
IL_CAL_DATE));
42 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
43 $lng->txt(
'pd_my_offers'),
"",
"",
false,
47 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'seed',$this->seed->get(
IL_CAL_DATE));
49 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'switchCalendarMode'),
50 $lng->txt(
'pd_my_memberships'),
"",
"",
false,
54 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'calendar_mode',
"");
56 $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'add'),
57 $lng->txt(
'cal_add_calendar')
78 return self::$block_type;
98 $next_class = $ilCtrl->getNextClass();
99 $cmd = $ilCtrl->getCmd(
"getHTML");
104 return $this->
$cmd();
115 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
116 include_once(
'./Services/Calendar/classes/class.ilCalendarHidden.php');
119 $hidden = $hidden_obj->getHidden();
122 $all = $cats->getCategoriesInfo();
123 $tmp_title_counter =
array();
124 $categories =
array();
125 foreach($all as $category)
127 $tmp_arr[
'obj_id'] = $category[
'obj_id'];
128 $tmp_arr[
'id'] = $category[
'cat_id'];
129 $tmp_arr[
'hidden'] = (bool) in_array($category[
'cat_id'],$hidden);
130 $tmp_arr[
'title'] = $category[
'title'];
131 $tmp_arr[
'type'] = $category[
'type'];
137 $tmp_arr[
'type_sortable'] .= (
'_'.ilObject::_lookupType($category[
'obj_id']));
140 $tmp_arr[
'color'] = $category[
'color'];
141 $tmp_arr[
'editable'] = $category[
'editable'];
143 $categories[] = $tmp_arr;
146 $tmp_title_counter[$category[
'type'].
'_'.$category[
'title']]++;
150 $path_categories =
array();
151 foreach($categories as $cat)
155 if($tmp_title_counter[$cat[
'type'].
'_'.$cat[
'title']] > 1)
159 $cat[
'path'] = $this->
buildPath($ref_id);
164 $path_categories[] = $cat;
168 $this->calendars = $path_categories;
180 $path_arr = $tree->getPathFull($a_ref_id,ROOT_FOLDER_ID);
182 unset($path_arr[count($path_arr) - 1]);
184 foreach($path_arr as
$data)
190 $path .= $data[
'title'];
192 if(strlen(
$path) > 30)
194 return '...'.substr(
$path,-30);
207 $tpl =
new ilTemplate(
"tpl.cal_selection_block_content.html",
true,
true,
"Services/Calendar");
209 foreach ($this->calendars as $c)
214 $tpl->setVariable(
"TXT_SHOW", $lng->txt(
"select"));
215 $tpl->setVariable(
"CMD_SHOW",
"saveSelection");
216 $tpl->setVariable(
"TXT_ACTION", $lng->txt(
"select"));
218 $tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormActionByClass(
"ilcalendarcategorygui"));
219 $tpl->setVariable(
"TXT_SELECT_ALL", $lng->txt(
"select_all"));
233 if(strlen($a_set[
'path']))
235 $a_tpl->setCurrentBlock(
'calendar_path');
236 $a_tpl->setVariable(
'ADD_PATH_INFO',$a_set[
'path']);
237 $a_tpl->parseCurrentBlock();
240 $a_tpl->setCurrentBlock(
"item");
242 $a_tpl->setVariable(
'VAL_ID',$a_set[
'id']);
243 if(!$a_set[
'hidden'])
245 $a_tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
247 $a_tpl->setVariable(
'VAL_TITLE',$a_set[
'title']);
248 $a_tpl->setVariable(
'BGCOLOR',$a_set[
'color']);
250 $ilCtrl->setParameterByClass(
"ilcalendarcategorygui",
'category_id',$a_set[
'id']);
251 $a_tpl->setVariable(
'EDIT_LINK',$ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui",
'details'));
252 $a_tpl->setVariable(
'TXT_EDIT',$this->lng->txt(
'edit'));
254 switch($a_set[
'type'])
258 $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_system'));
263 $a_tpl->setVariable(
'IMG_ALT',$this->lng->txt(
'cal_type_personal'));
269 $a_tpl->setVariable(
'IMG_ALT',$this->lng->txt(
'cal_type_'.$type));
274 $a_tpl->setVariable(
'IMG_ALT',$this->lng->txt(
'cal_type_'.$type));
279 $a_tpl->setVariable(
'IMG_ALT',$this->lng->txt(
'cal_ch_ch'));
283 $a_tpl->parseCurrentBlock();
295 return parent::getHTML();
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
getCalendars()
Get calendars.
__construct($a_seed)
Constructor.
executeCommand()
execute command
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
renderItem($a_set, $a_tpl)
Render item.
static getBlockType()
Get block type.
const CAL_SELECTION_MEMBERSHIP
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
fillDataSection()
Fill data section.
BlockGUI class calendar selection.
getHTML()
Get block HTML code.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _getAllReferences($a_id)
get all reference ids of object
static _getInstanceByUserId($a_user_id)
get instance by user id
setTitle($a_title)
Set Title.
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
special template class to simplify handling of ITX/PEAR
buildPath($a_ref_id)
Build path for ref id.
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static isRepositoryObject()
Is this a repository object.
setLimit($a_limit)
Set Limit.
This class represents a block method of a block.
static getScreenMode()
Get Screen Mode for current command.