5include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
 
   46        parent::__construct();
 
   47        $lng->loadLanguageModule(
'pd');
 
   48        $lng->loadLanguageModule(
'dateplaner');
 
   49        $this->ref_id = $a_ref_id;
 
   53        $this->allow_moving = 
false;
 
   54        $this->seed = $a_seed;
 
   56        $this->
setTitle($lng->txt(
'cal_table_categories'));
 
   58        include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
 
   61        $ilCtrl->setParameterByClass(
"ilcalendarcategorygui", 
'seed', $this->seed->get(
IL_CAL_DATE));
 
   63            $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui", 
'switchCalendarMode'),
 
   64            $lng->txt(
'pd_my_offers'),
 
   71        $ilCtrl->setParameterByClass(
"ilcalendarcategorygui", 
'seed', $this->seed->get(
IL_CAL_DATE));
 
   73            $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui", 
'switchCalendarMode'),
 
   74            $lng->txt(
'pd_my_memberships'),
 
   81        $ilCtrl->setParameterByClass(
"ilcalendarcategorygui", 
'calendar_mode', 
"");
 
   83            $ilCtrl->getLinkTargetByClass(
"ilcalendarcategorygui", 
'add'),
 
   84            $lng->txt(
'cal_add_calendar')
 
   87        $this->calendar_groups = array(
 
   88            self::CAL_GRP_CURRENT_CONT_CONS => 
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT_CONS),
 
   89            self::CAL_GRP_CURRENT_CONT => 
$lng->txt(
"cal_grp_" . self::CAL_GRP_CURRENT_CONT),
 
   90            self::CAL_GRP_PERSONAL => 
$lng->txt(
"cal_grp_" . self::CAL_GRP_PERSONAL),
 
   91            self::CAL_GRP_OTHERS => 
$lng->txt(
"cal_grp_" . self::CAL_GRP_OTHERS)
 
  132        $next_class = 
$ilCtrl->getNextClass();
 
  133        $cmd = 
$ilCtrl->getCmd(
"getHTML");
 
  135        switch ($next_class) {
 
  137                return $this->$cmd();
 
  148        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  149        include_once(
'./Services/Calendar/classes/class.ilCalendarVisibility.php');
 
  152        $hidden = $hidden_obj->getHidden();
 
  153        $visible = $hidden_obj->getVisible();
 
  156        $all = $cats->getCategoriesInfo();
 
  157        $tmp_title_counter = array();
 
  158        $categories = array();
 
  159        foreach ($all as $category) {
 
  162            $tmp_arr[
'obj_id'] = $category[
'obj_id'];
 
  163            $tmp_arr[
'id'] = $category[
'cat_id'];
 
  164            $tmp_arr[
'hidden'] = (bool) in_array($category[
'cat_id'], $hidden);
 
  165            $tmp_arr[
'visible'] = (bool) in_array($category[
'cat_id'], $visible);
 
  166            $tmp_arr[
'title'] = $category[
'title'];
 
  167            $tmp_arr[
'type'] = $category[
'type'];
 
  168            $tmp_arr[
'source_ref_id'] = $category[
'source_ref_id'];
 
  176            $tmp_arr[
'color'] = $category[
'color'];
 
  177            $tmp_arr[
'editable'] = $category[
'editable'];
 
  179            $categories[] = $tmp_arr;
 
  182            $tmp_title_counter[$category[
'type'] . 
'_' . $category[
'title']]++;
 
  185        $path_categories = array();
 
  186        foreach ($categories as $cat) {
 
  188                if ($tmp_title_counter[$cat[
'type'] . 
'_' . $cat[
'title']] > 1) {
 
  190                        $cat[
'path'] = $this->
buildPath($ref_id);
 
  195            $path_categories[] = $cat;
 
  205        foreach ($path_categories as $cal) {
 
  209                || $this->ref_id == $cal[
"source_ref_id"]))) {
 
  229        $path_arr = $tree->getPathFull($a_ref_id, ROOT_FOLDER_ID);
 
  231        unset($path_arr[count($path_arr) - 1]);
 
  233        foreach ($path_arr as 
$data) {
 
  239        if (strlen(
$path) > 30) {
 
  240            return '...' . substr(
$path, -30);
 
  253        $tpl = 
new ilTemplate(
"tpl.cal_selection_block_content.html", 
true, 
true, 
"Services/Calendar");
 
  255        foreach ($this->calendar_groups as 
$type => 
$txt) {
 
  256            foreach ($this->calendars[
$type] as $c) {
 
  259            if (count($this->calendars[
$type]) > 0) {
 
  260                if (
$type == self::CAL_GRP_CURRENT_CONT) {
 
  263                if (
$type == self::CAL_GRP_CURRENT_CONT_CONS) {
 
  264                    $txt = 
$lng->txt(
"cal_grp_curr_crs_cons");
 
  266                $tpl->setCurrentBlock(
"item_grp");
 
  267                $tpl->setVariable(
"GRP_HEAD", 
$txt);
 
  268                $tpl->parseCurrentBlock();
 
  272        $tpl->setVariable(
"TXT_SHOW", 
$lng->txt(
"refresh"));
 
  273        $tpl->setVariable(
"CMD_SHOW", 
"saveSelection");
 
  274        $tpl->setVariable(
"TXT_ACTION", 
$lng->txt(
"select"));
 
  276        $tpl->setVariable(
"FORM_ACTION", 
$ilCtrl->getFormActionByClass(
"ilcalendarcategorygui"));
 
  277        $tpl->setVariable(
"TXT_SELECT_ALL", 
$lng->txt(
"select_all"));
 
  291        if (strlen($a_set[
'path'])) {
 
  292            $a_tpl->setCurrentBlock(
'calendar_path');
 
  293            $a_tpl->setVariable(
'ADD_PATH_INFO', $a_set[
'path']);
 
  294            $a_tpl->parseCurrentBlock();
 
  297        $a_tpl->setCurrentBlock(
"item");
 
  299        $a_tpl->setVariable(
'VAL_ID', $a_set[
'id']);
 
  300        if ($this->obj_id == 0) {
 
  301            if (!$a_set[
'hidden']) {
 
  302                $a_tpl->setVariable(
'VAL_CHECKED', 
'checked="checked"');
 
  305            if ($a_set[
"obj_id"] == $this->obj_id) {
 
  306                $a_tpl->setVariable(
'VAL_CHECKED', 
'checked="checked"');
 
  307                $a_tpl->setVariable(
'VAL_DISABLED', 
'disabled');
 
  308            } elseif ($a_set[
'visible']) {
 
  309                $a_tpl->setVariable(
'VAL_CHECKED', 
'checked="checked"');
 
  312        $a_tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
 
  313        $a_tpl->setVariable(
'BGCOLOR', $a_set[
'color']);
 
  315        $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui", 
'category_id', $a_set[
'id']);
 
  316        $a_tpl->setVariable(
'EDIT_LINK', 
$ilCtrl->getLinkTargetByClass(
"ilcalendarpresentationgui", 
''));
 
  317        $ilCtrl->setParameterByClass(
"ilcalendarpresentationgui", 
'category_id', 
$_GET[
"category_id"]);
 
  318        $a_tpl->setVariable(
'TXT_EDIT', $this->lng->txt(
'edit'));
 
  320        switch ($a_set[
'type']) {
 
  323                $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_system'));
 
  328                $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_personal'));
 
  334                $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' . 
$type));
 
  339                $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_type_' . 
$type));
 
  344                $a_tpl->setVariable(
'IMG_ALT', $this->lng->txt(
'cal_ch_ch'));
 
  348        $a_tpl->parseCurrentBlock();
 
  360        return parent::getHTML();
 
An exception for terminatinating execution or to throw for unit testing.
This class represents a block method of a block.
setLimit($a_limit)
Set Limit.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle($a_title)
Set Title.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
static _getInstance($a_usr_id=0)
get singleton instance
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
BlockGUI class calendar selection.
static getScreenMode()
Get Screen Mode for current command.
renderItem($a_set, $a_tpl)
Render item.
static isRepositoryObject()
Is this a repository object.
fillDataSection()
Fill data section.
const CAL_GRP_CURRENT_CONT
getCalendars()
Get calendars.
executeCommand()
execute command
buildPath($a_ref_id)
Build path for ref id.
getHTML()
Get block HTML code.
const CAL_GRP_CURRENT_CONT_CONS
static getBlockType()
Get block type.
__construct($a_seed, $a_ref_id=0)
Constructor.
const CAL_SELECTION_ITEMS
static _getInstance()
get instance for logged in user
const CAL_SELECTION_MEMBERSHIP
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)