ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCalendarSelectionBlockGUI Class Reference

BlockGUI class calendar selection. More...

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

Public Member Functions

 ilCalendarSelectionBlockGUI ($a_seed)
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 getCalendars ()
 Get calendars. More...
 
 fillDataSection ()
 Fill data section. More...
 
 getHTML ()
 Get block HTML code. More...
 
- Public Member Functions inherited from ilBlockGUI
 ilBlockGUI ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($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 ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static isRepositoryObject ()
 Is this a repository object. More...
 
static getBlockType ()
 Get block type. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

static $block_type = "cal_sel"
 

Protected Member Functions

 buildPath ($a_ref_id)
 Build path for ref id. More...
 
 renderItem ($a_set, $a_tpl)
 Render item. More...
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 

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

Member Function Documentation

◆ buildPath()

ilCalendarSelectionBlockGUI::buildPath (   $a_ref_id)
protected

Build path for ref id.

Parameters
int$a_ref_idref id

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

177 {
178 global $tree;
179
180 $path_arr = $tree->getPathFull($a_ref_id,ROOT_FOLDER_ID);
181 $counter = 0;
182 unset($path_arr[count($path_arr) - 1]);
183
184 foreach($path_arr as $data)
185 {
186 if($counter++)
187 {
188 $path .= " -> ";
189 }
190 $path .= $data['title'];
191 }
192 if(strlen($path) > 30)
193 {
194 return '...'.substr($path,-30);
195 }
196 return $path;
197 }
$path
Definition: index.php:22

References ilBlockGUI\$data, and $path.

Referenced by getCalendars().

+ Here is the caller graph for this function:

◆ executeCommand()

& ilCalendarSelectionBlockGUI::executeCommand ( )

execute command

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

95 {
96 global $ilCtrl;
97
98 $next_class = $ilCtrl->getNextClass();
99 $cmd = $ilCtrl->getCmd("getHTML");
100
101 switch ($next_class)
102 {
103 default:
104 return $this->$cmd();
105 }
106 }
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilCtrl.

◆ fillDataSection()

ilCalendarSelectionBlockGUI::fillDataSection ( )

Fill data section.

Reimplemented from ilBlockGUI.

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

204 {
205 global $lng, $ilCtrl;
206
207 $tpl = new ilTemplate("tpl.cal_selection_block_content.html", true, true, "Services/Calendar");
208
209 foreach ($this->calendars as $c)
210 {
211 $this->renderItem($c, $tpl);
212 }
213
214 $tpl->setVariable("TXT_SHOW", $lng->txt("select"));
215 $tpl->setVariable("CMD_SHOW", "saveSelection");
216 $tpl->setVariable("TXT_ACTION", $lng->txt("select"));
217 $tpl->setVariable("SRC_ACTION", ilUtil::getImagePath("arrow_downright.svg"));
218 $tpl->setVariable("FORM_ACTION", $ilCtrl->getFormActionByClass("ilcalendarcategorygui"));
219 $tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all"));
220
221 $this->setDataSection($tpl->get());
222 }
global $tpl
Definition: ilias.php:8
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $lng
Definition: privfeed.php:40

References $ilCtrl, $lng, $tpl, ilUtil\getImagePath(), renderItem(), and ilBlockGUI\setDataSection().

+ Here is the call graph for this function:

◆ getBlockType()

static ilCalendarSelectionBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

Reimplemented from ilBlockGUI.

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

References $block_type.

◆ getCalendars()

ilCalendarSelectionBlockGUI::getCalendars ( )

Get calendars.

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

112 {
113 global $ilUser,$tree;
114
115 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
116 include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
117
118 $hidden_obj = ilCalendarHidden::_getInstanceByUserId($ilUser->getId());
119 $hidden = $hidden_obj->getHidden();
120
122 $all = $cats->getCategoriesInfo();
123 $tmp_title_counter = array();
124 $categories = array();
125 foreach($all as $category)
126 {
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'];
132
133 // Append object type to make type sortable
134 $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']);
135 if($category['type'] == ilCalendarCategory::TYPE_OBJ)
136 {
137 $tmp_arr['type_sortable'] .= ('_'.ilObject::_lookupType($category['obj_id']));
138 }
139
140 $tmp_arr['color'] = $category['color'];
141 $tmp_arr['editable'] = $category['editable'];
142
143 $categories[] = $tmp_arr;
144
145 // count title for appending the parent container if there is more than one entry.
146 $tmp_title_counter[$category['type'].'_'.$category['title']]++;
147
148 }
149
150 $path_categories = array();
151 foreach($categories as $cat)
152 {
153 if($cat['type'] == ilCalendarCategory::TYPE_OBJ)
154 {
155 if($tmp_title_counter[$cat['type'].'_'.$cat['title']] > 1)
156 {
157 foreach(ilObject::_getAllReferences($cat['obj_id']) as $ref_id)
158 {
159 $cat['path'] = $this->buildPath($ref_id);
160 break;
161 }
162 }
163 }
164 $path_categories[] = $cat;
165 }
166 $path_categories = ilUtil::sortArray($path_categories, 'title', "asc");
167
168 $this->calendars = $path_categories;
169 }
static _getInstance($a_usr_id=0)
get singleton instance
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
static _getInstanceByUserId($a_user_id)
get instance by user id
buildPath($a_ref_id)
Build path for ref id.
static _getAllReferences($a_id)
get all reference ids of object
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
$ref_id
Definition: sahs_server.php:39
global $ilUser
Definition: imgupload.php:15

References $ilUser, $ref_id, ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilCalendarHidden\_getInstanceByUserId(), buildPath(), ilCalendarCategory\lookupCategorySortIndex(), ilUtil\sortArray(), and ilCalendarCategory\TYPE_OBJ.

Referenced by getHTML().

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

◆ getHTML()

ilCalendarSelectionBlockGUI::getHTML ( )

Get block HTML code.

Reimplemented from ilBlockGUI.

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

285 {
286 global $ilCtrl, $lng, $ilUser, $ilAccess, $ilSetting;
287
288 $this->getCalendars();
289
290 return parent::getHTML();
291 }
global $ilSetting
Definition: privfeed.php:40

References $ilCtrl, $ilSetting, $ilUser, $lng, and getCalendars().

+ Here is the call graph for this function:

◆ getScreenMode()

static ilCalendarSelectionBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

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

85 {
86 global $ilCtrl;
87
88 return IL_SCREEN_SIDE;
89 }
const IL_SCREEN_SIDE

References $ilCtrl, and IL_SCREEN_SIDE.

◆ ilCalendarSelectionBlockGUI()

ilCalendarSelectionBlockGUI::ilCalendarSelectionBlockGUI (   $a_seed)

Constructor.

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

23 {
24 global $ilCtrl, $lng;
25
26 $this->lng = $lng;
27 parent::__construct();
28 $lng->loadLanguageModule('pd');
29 $lng->loadLanguageModule('dateplaner');
30
31 $this->setLimit(5);
32 $this->allow_moving = false;
33 $this->seed = $a_seed;
34
35 $this->setTitle($lng->txt('cal_table_categories'));
36
37 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
38 $sel_type = ilCalendarUserSettings::_getInstance()->getCalendarSelectionType();
39 $ilCtrl->setParameterByClass("ilcalendarcategorygui",'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_ITEMS);
40 $ilCtrl->setParameterByClass("ilcalendarcategorygui",'seed',$this->seed->get(IL_CAL_DATE));
41 $this->addBlockCommand(
42 $ilCtrl->getLinkTargetByClass("ilcalendarcategorygui",'switchCalendarMode'),
43 $lng->txt('pd_my_offers'), "", "", false,
45 );
46 $ilCtrl->setParameterByClass("ilcalendarcategorygui",'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
47 $ilCtrl->setParameterByClass("ilcalendarcategorygui",'seed',$this->seed->get(IL_CAL_DATE));
48 $this->addBlockCommand(
49 $ilCtrl->getLinkTargetByClass("ilcalendarcategorygui",'switchCalendarMode'),
50 $lng->txt('pd_my_memberships'), "", "", false,
52 );
53
54 $ilCtrl->setParameterByClass("ilcalendarcategorygui",'calendar_mode',"");
55 $this->addBlockCommand(
56 $ilCtrl->getLinkTargetByClass("ilcalendarcategorygui", 'add'),
57 $lng->txt('cal_add_calendar')
58 );
59 }
const IL_CAL_DATE
setLimit($a_limit)
Set Limit.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setTitle($a_title)
Set Title.
static _getInstance()
get instance for logged in user

References $ilCtrl, $lng, ilCalendarUserSettings\_getInstance(), ilBlockGUI\addBlockCommand(), ilCalendarUserSettings\CAL_SELECTION_ITEMS, ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, IL_CAL_DATE, ilBlockGUI\setLimit(), and ilBlockGUI\setTitle().

+ Here is the call graph for this function:

◆ isRepositoryObject()

static ilCalendarSelectionBlockGUI::isRepositoryObject ( )
static

Is this a repository object.

Returns
string Block type.

Reimplemented from ilBlockGUI.

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

67 {
68 return false;
69 }

◆ renderItem()

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

Render item.

Parameters
array$a_setitem datat

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

230 {
231 global $ilCtrl;
232
233 if(strlen($a_set['path']))
234 {
235 $a_tpl->setCurrentBlock('calendar_path');
236 $a_tpl->setVariable('ADD_PATH_INFO',$a_set['path']);
237 $a_tpl->parseCurrentBlock();
238 }
239
240 $a_tpl->setCurrentBlock("item");
241
242 $a_tpl->setVariable('VAL_ID',$a_set['id']);
243 if(!$a_set['hidden'])
244 {
245 $a_tpl->setVariable('VAL_CHECKED','checked="checked"');
246 }
247 $a_tpl->setVariable('VAL_TITLE',$a_set['title']);
248 $a_tpl->setVariable('BGCOLOR',$a_set['color']);
249
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'));
253
254 switch($a_set['type'])
255 {
257 $a_tpl->setVariable('IMG_SRC',ilUtil::getImagePath('icon_calg.svg'));
258 $a_tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_system'));
259 break;
260
262 $a_tpl->setVariable('IMG_SRC',ilUtil::getImagePath('icon_usr.svg'));
263 $a_tpl->setVariable('IMG_ALT',$this->lng->txt('cal_type_personal'));
264 break;
265
267 $type = ilObject::_lookupType($a_set['obj_id']);
268 $a_tpl->setVariable('IMG_SRC',ilUtil::getImagePath('icon_'.$type.'.svg'));
269 $a_tpl->setVariable('IMG_ALT',$this->lng->txt('cal_type_'.$type));
270 break;
271
273 $a_tpl->setVariable('IMG_SRC',ilUtil::getImagePath('icon_book.svg'));
274 $a_tpl->setVariable('IMG_ALT',$this->lng->txt('cal_type_'.$type));
275 break;
276 }
277
278 $a_tpl->parseCurrentBlock();
279 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References $ilCtrl, ilObject\_lookupType(), ilUtil\getImagePath(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by fillDataSection().

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

Field Documentation

◆ $block_type

ilCalendarSelectionBlockGUI::$block_type = "cal_sel"
static

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

Referenced by getBlockType().


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