ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarCategoryGUI Class Reference

Administration, Side-Block presentation of calendar categories. More...

+ Collaboration diagram for ilCalendarCategoryGUI:

Public Member Functions

 __construct ($a_user_id, $seed)
 Constructor.
 executeCommand ()
 Execute command.
 saveSelection ()
 save selection of categories
 showCategories ()
 public
 shareSearch ()
 share calendar
 sharePerformSearch ()
 share perform search
 shareAssign ()
 share assign
 shareAssignRoles ()
 share assign roles
 shareDeassign ()
 desassign users/roles from calendar
 getHTML ()

Data Fields

const SEARCH_USER = 1
const SEARCH_ROLE = 2

Protected Member Functions

 cancel ()
 cancel
 add ()
 add new calendar
 save ()
 save new calendar
 edit ()
 edit category
 update ()
 update
 confirmDelete ()
 confirm delete
 delete ()
 Delete.
 showUserList ($a_ids=array())
 show user list
 showRoleList ($a_ids=array())
 show role list
 initFormSearch ()
 init form search
 initFormCategory ($a_mode)
 init edit/create category form
 showAssignedAppointments ()
 show assigned aapointments
 askDeleteAppointments ()
 ask delete appointments
 deleteAppointments ()
 delete appointments
 appendCalendarSelection ()
 switchCalendarMode ()
 Switch calendar selection nmode.
 checkVisible ()
 addReferenceLinks ($a_obj_id)
 Show links to references.

Protected Attributes

 $user_id
 $tpl
 $ctrl
 $lng
 $editable = false
 $visible = false

Private Member Functions

 readPermissions ()
 read permissions
 isEditable ()
 check if calendar is editable private

Detailed Description

Administration, Side-Block presentation of calendar categories.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilCalendarCategoryGUI: ilCalendarAppointmentGUI

Definition at line 35 of file class.ilCalendarCategoryGUI.php.

Constructor & Destructor Documentation

ilCalendarCategoryGUI::__construct (   $a_user_id,
  $seed 
)

Constructor.

public

Parameters
intuser id
Returns

Definition at line 55 of file class.ilCalendarCategoryGUI.php.

References $ilCtrl, and $lng.

{
global $lng,$ilCtrl;
$this->user_id = $a_user_id;
$this->seed = $seed;
$this->lng = $lng;
$this->lng->loadLanguageModule('dateplaner');
$this->ctrl = $ilCtrl;
}

Member Function Documentation

ilCalendarCategoryGUI::add ( )
protected

add new calendar

protected

Returns

Definition at line 114 of file class.ilCalendarCategoryGUI.php.

References $tpl, and initFormCategory().

Referenced by save().

{
global $tpl;
$this->tpl = new ilTemplate('tpl.edit_category.html',true,true,'Services/Calendar');
$this->initFormCategory('create');
$this->tpl->setVariable('EDIT_CAT',$this->form->getHTML());
$tpl->setContent($this->tpl->get());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::addReferenceLinks (   $a_obj_id)
protected

Show links to references.

Parameters
int$a_obj_id$obj_id
Returns

Definition at line 1098 of file class.ilCalendarCategoryGUI.php.

References $ref_id, $title, $tpl, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ilUtil\getTypeIconPath().

Referenced by edit().

{
global $tree;
$tpl = new ilTemplate('tpl.cal_reference_links.html',true,true,'Services/Calendar');
foreach(ilObject::_getAllReferences($a_obj_id) as $ref_id => $ref_id)
{
include_once('./classes/class.ilLink.php');
$parent_ref_id = $tree->getParentId($ref_id);
$parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
$parent_type = ilObject::_lookupType($parent_obj_id);
$parent_title = ilObject::_lookupTitle($parent_obj_id);
$type = ilObject::_lookupType($a_obj_id);
$tpl->setCurrentBlock('reference');
$tpl->setVariable('PIMG_SRC',ilUtil::getTypeIconPath($parent_type,$parent_obj_id,'tiny'));
$tpl->setVariable('PIMG_ALT',$this->lng->txt('obj_'.$parent_type));
$tpl->setVariable('PARENT_TITLE',$parent_title);
$tpl->setVariable('PARENT_HREF',ilLink::_getLink($parent_ref_id));
$tpl->setVariable('SRC',ilUtil::getTypeIconPath($type,$a_obj_id,'tiny'));
$tpl->setVariable('ALT',$this->lng->txt('obj_'.$type));
$tpl->setVariable('TITLE',$title);
$tpl->setVariable('HREF',ilLink::_getLink($ref_id));
$tpl->parseCurrentBlock();
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::appendCalendarSelection ( )
protected
Parameters
@return

Definition at line 960 of file class.ilCalendarCategoryGUI.php.

References $tpl, ilCalendarUserSettings\_getInstance(), ilCalendarUserSettings\CAL_SELECTION_ITEMS, and ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP.

Referenced by getHTML().

{
global $ilUser;
$this->lng->loadLanguageModule('pd');
$tpl = new ilTemplate('tpl.calendar_selection.html',true,true,'Services/Calendar');
include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
switch(ilCalendarUserSettings::_getInstance()->getCalendarSelectionType())
{
$tpl->setVariable('HTEXT',$this->lng->txt('pd_my_memberships'));
$tpl->touchBlock('head_item');
$tpl->touchBlock('head_delim');
$tpl->touchBlock('head_item');
$this->ctrl->setParameter($this,'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_ITEMS);
$tpl->setVariable('HHREF',$this->ctrl->getLinkTarget($this,'switchCalendarMode'));
$tpl->setVariable('HLINK',$this->lng->txt('pd_my_offers'));
$tpl->touchBlock('head_item');
break;
$this->ctrl->setParameter($this,'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
$tpl->setVariable('HHREF',$this->ctrl->getLinkTarget($this,'switchCalendarMode'));
$tpl->setVariable('HLINK',$this->lng->txt('pd_my_memberships'));
$tpl->touchBlock('head_item');
$tpl->touchBlock('head_delim');
$tpl->touchBlock('head_item');
$tpl->setVariable('HTEXT',$this->lng->txt('pd_my_offers'));
$tpl->touchBlock('head_item');
break;
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::askDeleteAppointments ( )
protected

ask delete appointments

protected

Returns

Definition at line 877 of file class.ilCalendarCategoryGUI.php.

References $_GET, $tpl, edit(), and ilUtil\sendInfo().

{
global $tpl;
if(!count($_POST['appointments']))
{
ilUtil::sendInfo($this->lng->txt('select_one'));
$this->edit();
return true;
}
include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
$confirmation_gui = new ilConfirmationGUI();
$this->ctrl->setParameter($this,'category_id',(int) $_GET['category_id']);
$confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
$confirmation_gui->setHeaderText($this->lng->txt('cal_del_app_sure'));
$confirmation_gui->setConfirm($this->lng->txt('delete'),'deleteAppointments');
$confirmation_gui->setCancel($this->lng->txt('cancel'),'edit');
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
foreach($_POST['appointments'] as $app_id)
{
$app = new ilCalendarEntry($app_id);
$confirmation_gui->addItem('appointments[]',(int) $app_id,$app->getTitle());
}
$tpl->setContent($confirmation_gui->getHTML());
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::cancel ( )
protected

cancel

protected

Returns

Definition at line 103 of file class.ilCalendarCategoryGUI.php.

{
$this->ctrl->returnToParent($this);
}
ilCalendarCategoryGUI::checkVisible ( )
protected
Parameters
@return

Definition at line 1073 of file class.ilCalendarCategoryGUI.php.

References $ilErr.

Referenced by edit().

{
global $ilErr;
if(!$this->visible)
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->FATAL);
}
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::confirmDelete ( )
protected

confirm delete

protected

Returns

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

References $_GET, $tpl, edit(), isEditable(), readPermissions(), and ilUtil\sendInfo().

{
global $tpl;
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$category = new ilCalendarCategory((int) $_GET['category_id']);
include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
$confirmation_gui = new ilConfirmationGUI();
$this->ctrl->setParameter($this,'category_id',(int) $_GET['category_id']);
$confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
$confirmation_gui->setHeaderText($this->lng->txt('cal_del_cal_sure'));
$confirmation_gui->setConfirm($this->lng->txt('delete'),'delete');
$confirmation_gui->setCancel($this->lng->txt('cancel'),'cancel');
$confirmation_gui->addItem('category_id',(int) $_GET['category_id'],$category->getTitle());
$tpl->setContent($confirmation_gui->getHTML());
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::delete ( )
protected

Delete.

protected

Parameters
@return

Definition at line 324 of file class.ilCalendarCategoryGUI.php.

References $_GET, edit(), isEditable(), readPermissions(), and ilUtil\sendInfo().

{
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$category = new ilCalendarCategory((int) $_GET['category_id']);
$category->delete();
ilUtil::sendInfo($this->lng->txt('cal_cal_deleted'));
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::deleteAppointments ( )
protected

delete appointments

protected

Returns

Definition at line 913 of file class.ilCalendarCategoryGUI.php.

References ilCalendarCategoryAssignments\_deleteByAppointmentId(), edit(), and ilUtil\sendInfo().

{
if(!count($_POST['appointments']))
{
ilUtil::sendInfo($this->lng->txt('select_one'));
$this->edit();
return true;
}
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
foreach($_POST['appointments'] as $app_id)
{
$app = new ilCalendarEntry($app_id);
$app->delete();
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
}
ilUtil::sendInfo($this->lng->txt('settings_saved'));
$this->edit();
return true;
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::edit ( )
protected

edit category

protected

Returns

Definition at line 168 of file class.ilCalendarCategoryGUI.php.

References $_GET, $tpl, addReferenceLinks(), checkVisible(), ilYuiUtil\initButtonControl(), initFormCategory(), isEditable(), readPermissions(), ilUtil\sendInfo(), showAssignedAppointments(), ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by askDeleteAppointments(), confirmDelete(), delete(), deleteAppointments(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), and update().

{
global $tpl;
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
$this->checkVisible();
$this->tpl = new ilTemplate('tpl.edit_category.html',true,true,'Services/Calendar');
if($this->isEditable())
{
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
$shared = new ilCalendarShared((int) $_GET['category_id']);
if($shared->getShared() and $this->isEditable())
{
include_once('./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
$table = new ilCalendarSharedListTableGUI($this,'edit');
$table->setTitle($this->lng->txt('cal_shared_header'));
$table->setCalendarId((int) $_GET['category_id']);
$table->parse();
$this->tpl->setVariable('SHARED_TABLE',$table->getHTML());
}
$this->initFormCategory('edit');
$this->tpl->setVariable('EDIT_CAT',$this->form->getHTML());
}
{
$category = new ilCalendarCategory((int) $_GET['category_id']);
// Non editable category
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
$info->setFormAction($this->ctrl->getFormAction($this));
$info->addSection($this->lng->txt('cal_cal_details'));
// Calendar Name
$info->addProperty($this->lng->txt('cal_calendar_name'),$category->getTitle());
switch($category->getType())
{
$info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_personal'));
break;
$info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_system'));
break;
$info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_'.$category->getObjType()));
$info->addSection($this->lng->txt('additional_info'));
$info->addProperty($this->lng->txt('perma_link'),$this->addReferenceLinks($category->getObjId()));
break;
}
$this->tpl->setVariable('INFO_CAT',$info->getHTML());
}
$this->tpl->setVariable('CAT_APPOINTMENTS',$this->showAssignedAppointments());
include_once('./Services/YUI/classes/class.ilYuiUtil.php');
$tpl->setContent($this->tpl->get());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::executeCommand ( )

Execute command.

public

Parameters

Definition at line 73 of file class.ilCalendarCategoryGUI.php.

References $_GET, $cmd, $ilSetting, and $tpl.

{
global $ilUser, $ilSetting,$tpl;
$next_class = $this->ctrl->getNextClass($this);
$this->ctrl->saveParameter($this,'category_id');
switch($next_class)
{
case 'ilcalendarappointmentgui':
$this->ctrl->setReturn($this,'edit');
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
$app = new ilCalendarAppointmentGUI($this->seed,(int) $_GET['app_id']);
$this->ctrl->forwardCommand($app);
break;
default:
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
break;
}
return true;
}
ilCalendarCategoryGUI::getHTML ( )

Definition at line 937 of file class.ilCalendarCategoryGUI.php.

References $title, and appendCalendarSelection().

{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
$table_gui = new ilCalendarCategoryTableGUI($this);
$title = $this->lng->txt('cal_table_categories');
$table_gui->setTitle($title);
$table_gui->addMultiCommand('saveSelection',$this->lng->txt('show'));
$table_gui->addCommandButton('add',$this->lng->txt('add'));
$table_gui->parse();
return $table_gui->getHTML();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::initFormCategory (   $a_mode)
protected

init edit/create category form

protected

Returns

Definition at line 765 of file class.ilCalendarCategoryGUI.php.

References $_GET, $title, ilCalendarSettings\_getInstance(), ilCalendarCategories\_getInstance(), isEditable(), ilRadioOption\setInfo(), ilColorPickerInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

Referenced by add(), and edit().

{
global $rbacsystem,$ilUser;
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo((int) $_GET['category_id']);
$this->form = new ilPropertyFormGUI();
$this->form->setTableWidth('40%');
switch($a_mode)
{
case 'edit':
$category = new ilCalendarCategory((int) $_GET['category_id']);
$this->form->setTitle($this->lng->txt('cal_edit_category'));
$this->ctrl->saveParameter($this,array('seed','category_id'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
if($this->isEditable())
{
$this->form->addCommandButton('update',$this->lng->txt('save'));
if($cat_info['type'] == ilCalendarCategory::TYPE_USR)
{
$this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share'));
}
$this->form->addCommandButton('confirmDelete',$this->lng->txt('delete'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
break;
case 'create':
$this->editable = true;
$category = new ilCalendarCategory(0);
$this->ctrl->saveParameter($this,array('category_id'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
$this->form->setTitle($this->lng->txt('cal_add_category'));
$this->form->addCommandButton('save',$this->lng->txt('save'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
break;
}
// Calendar name
$title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'),'title');
if($a_mode == 'edit')
{
$title->setDisabled(!$this->isEditable());
}
$title->setRequired(true);
$title->setMaxLength(64);
$title->setSize(32);
$title->setValue($category->getTitle());
$this->form->addItem($title);
include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
if($a_mode == 'create' and $rbacsystem->checkAccess('edit_event',ilCalendarSettings::_getInstance()->getCalendarSettingsId()))
{
$type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'),'type');
$type->setValue($category->getType());
$type->setRequired(true);
$opt = new ilRadioOption($this->lng->txt('cal_type_personal'),ilCalendarCategory::TYPE_USR);
$type->addOption($opt);
$opt = new ilRadioOption($this->lng->txt('cal_type_system'),ilCalendarCategory::TYPE_GLOBAL);
$type->addOption($opt);
$type->setInfo($this->lng->txt('cal_type_info'));
$this->form->addItem($type);
}
$color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'),'color');
$color->setValue($category->getColor());
if(!$this->isEditable())
{
$color->setDisabled(true);
}
$color->setRequired(true);
$this->form->addItem($color);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::initFormSearch ( )
protected

init form search

protected

Parameters
@return

Definition at line 720 of file class.ilCalendarCategoryGUI.php.

References $lng, $user, SEARCH_ROLE, SEARCH_USER, ilTextInputGUI\setValue(), and ilRadioGroupInputGUI\setValue().

Referenced by shareSearch().

{
global $lng;
$lng->loadLanguageModule('search');
if(!is_object($this->form))
{
include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
$this->form->setTitle($this->lng->txt('cal_share_search_header'));
}
$type = new ilRadioGroupInputGUI($this->lng->txt('search_type'),'query_type');
$type->setValue($_POST['query_type'] ? $_POST['query_type'] : self::SEARCH_USER);
$type->setRequired(true);
$user = new ilRadioOption($this->lng->txt('obj_user'),self::SEARCH_USER);
$type->addOption($user);
$role = new ilRadioOption($this->lng->txt('obj_role'),self::SEARCH_ROLE);
$type->addOption($role);
$this->form->addItem($type);
$search = new ilTextInputGUI($this->lng->txt('cal_search'),'query');
$search->setValue($_POST['query']);
$search->setSize(16);
$search->setMaxLength(128);
$search->setRequired(true);
$search->setInfo($this->lng->txt('cal_search_info_share'));
$this->form->addItem($search);
$this->form->addCommandButton('sharePerformSearch',$this->lng->txt('search'));
$this->form->addCommandButton('edit',$this->lng->txt('cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::isEditable ( )
private

check if calendar is editable private

Returns

Definition at line 1088 of file class.ilCalendarCategoryGUI.php.

References $editable.

Referenced by confirmDelete(), delete(), edit(), initFormCategory(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::readPermissions ( )
private

read permissions

private

Parameters
@return

Definition at line 1021 of file class.ilCalendarCategoryGUI.php.

References $_GET, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilCalendarShared\getSharedCalendarsForUser(), ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by confirmDelete(), delete(), edit(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), and update().

{
global $ilUser,$rbacsystem,$ilAccess;
$this->editable = false;
$this->visible = false;
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
$shared = ilCalendarShared::getSharedCalendarsForUser($ilUser->getId());
$cat = new ilCalendarCategory((int) $_GET['category_id']);
switch($cat->getType())
{
if($cat->getObjId() == $ilUser->getId())
{
$this->visible = true;
$this->editable = true;
}
elseif(isset($shared[$cat->getCategoryID()]))
{
$this->visible = true;
}
break;
$this->editable = $rbacsystem->checkAccess('edit_event',ilCalendarSettings::_getInstance()->getCalendarSettingsId());
$this->visible = true;
break;
$this->editable = false;
$refs = ilObject::_getAllReferences($cat->getObjId());
foreach($refs as $ref)
{
if($ilAccess->checkAccess('read','',$ref))
{
$this->visible = true;
break;
}
}
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::save ( )
protected

save new calendar

protected

Definition at line 129 of file class.ilCalendarCategoryGUI.php.

References add(), ilUtil\sendInfo(), ilUtil\stripSlashes(), ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

{
global $ilUser;
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$category = new ilCalendarCategory(0);
$category->setTitle(ilUtil::stripSlashes($_POST['title']));
$category->setColor('#'.ilUtil::stripSlashes($_POST['color']));
if(isset($_POST['type']) and $_POST['type'] == ilCalendarCategory::TYPE_GLOBAL)
{
$category->setType((int) $_POST['type']);
$category->setObjId(0);
}
else
{
$category->setType(ilCalendarCategory::TYPE_USR);
$category->setObjId($ilUser->getId());
}
if(!$category->validate())
{
ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields'));
$this->add();
return false;
}
$category->add();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::saveSelection ( )

save selection of categories

public

Parameters
@return

Definition at line 357 of file class.ilCalendarCategoryGUI.php.

References ilCalendarCategories\_getInstance(), ilCalendarHidden\_getInstanceByUserId(), and ilUtil\sendInfo().

{
global $ilUser;
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
$selection = $_POST['cat_ids'] ? $_POST['cat_ids'] : array();
$hidden = array();
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
foreach($cats->getCategories() as $category_id)
{
if(!in_array($category_id,$selection))
{
$hidden[] = $category_id;
}
}
include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
$hidden_categories = ilCalendarHidden::_getInstanceByUserId($this->user_id);
$hidden_categories->hideSelected($hidden);
$hidden_categories->save();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::shareAssign ( )

share assign

public

Returns

Definition at line 537 of file class.ilCalendarCategoryGUI.php.

References $_GET, $user_id, edit(), isEditable(), readPermissions(), ilUtil\sendInfo(), sharePerformSearch(), and ilCalendarShared\TYPE_USR.

{
global $ilUser;
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['user_ids']))
{
ilUtil::sendInfo($this->lng->txt('select_one'));
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
$shared = new ilCalendarShared((int) $_GET['category_id']);
foreach($_POST['user_ids'] as $user_id)
{
if($ilUser->getId() != $user_id)
{
$shared->share($user_id,ilCalendarShared::TYPE_USR);
}
}
ilUtil::sendInfo($this->lng->txt('cal_shared_selected_usr'));
$this->edit();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::shareAssignRoles ( )

share assign roles

public

Parameters
@return

Definition at line 583 of file class.ilCalendarCategoryGUI.php.

References $_GET, edit(), isEditable(), readPermissions(), ilUtil\sendInfo(), sharePerformSearch(), and ilCalendarShared\TYPE_ROLE.

{
global $ilUser;
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['role_ids']))
{
ilUtil::sendInfo($this->lng->txt('select_one'));
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
$shared = new ilCalendarShared((int) $_GET['category_id']);
foreach($_POST['role_ids'] as $role_id)
{
$shared->share($role_id,ilCalendarShared::TYPE_ROLE);
}
ilUtil::sendInfo($this->lng->txt('cal_shared_selected_usr'));
$this->edit();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::shareDeassign ( )

desassign users/roles from calendar

public

Parameters
@return

Definition at line 625 of file class.ilCalendarCategoryGUI.php.

References $_GET, edit(), isEditable(), readPermissions(), and ilUtil\sendInfo().

{
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['obj_ids']))
{
ilUtil::sendInfo($this->lng->txt('select_one'));
$this->edit();
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
$shared = new ilCalendarShared((int) $_GET['category_id']);
foreach($_POST['obj_ids'] as $obj_id)
{
$shared->stopSharing($obj_id);
}
ilUtil::sendInfo($this->lng->txt('cal_unshared_selected_usr'));
$this->edit();
return true;
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::sharePerformSearch ( )

share perform search

public

Returns

Definition at line 435 of file class.ilCalendarCategoryGUI.php.

References $_GET, $_SESSION, $res, ilObjectSearchFactory\_getUserSearchInstance(), QP_COMBINATION_OR, ilUtil\sendInfo(), shareSearch(), showRoleList(), showUserList(), and ilUtil\stripSlashes().

Referenced by shareAssign(), and shareAssignRoles().

{
$this->lng->loadLanguageModule('search');
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->ctrl->saveParameter($this,'category_id');
if(!isset($_POST['query']))
{
$query = $_SESSION['cal_query'];
$type = $_SESSION['cal_type'];
}
elseif($_POST['query'])
{
$query = $_SESSION['cal_query'] = $_POST['query'];
$type = $_SESSION['cal_type'] = $_POST['query_type'];
}
if(!$query)
{
ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
$this->shareSearch();
return false;
}
include_once 'Services/Search/classes/class.ilQueryParser.php';
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
include_once 'Services/Search/classes/class.ilSearchResult.php';
$res_sum = new ilSearchResult();
$query_parser = new ilQueryParser(ilUtil::stripSlashes($query));
$query_parser->setCombination(QP_COMBINATION_OR);
$query_parser->setMinWordLength(3);
$query_parser->parse();
switch($type)
{
case self::SEARCH_USER:
$search->enableActiveCheck(true);
$search->setFields(array('login'));
$res = $search->performSearch();
$res_sum->mergeEntries($res);
$search->setFields(array('firstname'));
$res = $search->performSearch();
$res_sum->mergeEntries($res);
$search->setFields(array('lastname'));
$res = $search->performSearch();
$res_sum->mergeEntries($res);
$res_sum->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
break;
case self::SEARCH_ROLE:
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$search = new ilLikeObjectSearch($query_parser);
$search->setFilter(array('role'));
$res = $search->performSearch();
$res_sum->mergeEntries($res);
$res_sum->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
break;
}
if(!count($res_sum->getResults()))
{
ilUtil::sendInfo($this->lng->txt('search_no_match'));
$this->shareSearch();
return true;
}
switch($type)
{
case self::SEARCH_USER:
$this->showUserList($res_sum->getResultIds());
break;
case self::SEARCH_ROLE:
$this->showRoleList($res_sum->getResultIds());
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::shareSearch ( )

share calendar

public

Parameters
@return

Definition at line 403 of file class.ilCalendarCategoryGUI.php.

References $_GET, $_SESSION, $tpl, edit(), initFormSearch(), isEditable(), readPermissions(), and ilUtil\sendInfo().

Referenced by sharePerformSearch().

{
global $tpl;
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
$_SESSION['cal_query'] = '';
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->ctrl->saveParameter($this,'category_id');
$this->initFormSearch();
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::showAssignedAppointments ( )
protected

show assigned aapointments

protected

Returns

Definition at line 857 of file class.ilCalendarCategoryGUI.php.

References $_GET, ilCalendarCategoryAssignments\_getAssignedAppointments(), and ilCalendarCategories\_getInstance().

Referenced by edit().

{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
$table_gui = new ilCalendarAppointmentsTableGUI($this,(int) $_GET['category_id']);
$table_gui->setTitle($this->lng->txt('cal_assigned_appointments'));
$table_gui->setAppointments(
ilCalendarCategories::_getInstance()->getSubitemCategories((int) $_GET['category_id'])));
return $table_gui->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::showCategories ( )

public

Parameters
@return

Definition at line 391 of file class.ilCalendarCategoryGUI.php.

{
$this->ctrl->returnToParent($this);
}
ilCalendarCategoryGUI::showRoleList (   $a_ids = array())
protected

show role list

protected

Parameters
arrayarray of role ids
Returns

Definition at line 693 of file class.ilCalendarCategoryGUI.php.

References $tpl.

Referenced by sharePerformSearch().

{
global $tpl;
include_once('./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
$table = new ilCalendarSharedRoleListTableGUI($this,'sharePerformSearch');
$table->setTitle($this->lng->txt('cal_share_search_role_header'));
$table->setFormAction($this->ctrl->getFormAction($this));
$table->setRoles($a_ids);
$table->parse();
$table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
$table->addCommandButton('edit',$this->lng->txt('cancel'));
$tpl->setContent($table->getHTML());
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::showUserList (   $a_ids = array())
protected

show user list

protected

Parameters
arrayarray of user ids
Returns

Definition at line 668 of file class.ilCalendarCategoryGUI.php.

References $tpl.

Referenced by sharePerformSearch().

{
global $tpl;
include_once('./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
$table = new ilCalendarSharedUserListTableGUI($this,'sharePerformSearch');
$table->setTitle($this->lng->txt('cal_share_search_usr_header'));
$table->setFormAction($this->ctrl->getFormAction($this));
$table->setUsers($a_ids);
$table->parse();
$table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
$table->addCommandButton('edit',$this->lng->txt('cancel'));
$tpl->setContent($table->getHTML());
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::switchCalendarMode ( )
protected

Switch calendar selection nmode.

Returns

Definition at line 1003 of file class.ilCalendarCategoryGUI.php.

References $_GET, and ilCalendarUserSettings\_getInstance().

{
include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
ilCalendarUserSettings::_getInstance()->setCalendarSelectionType((int) $_GET['calendar_mode']);
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::update ( )
protected

update

protected

Returns

Definition at line 252 of file class.ilCalendarCategoryGUI.php.

References $_GET, edit(), isEditable(), readPermissions(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

{
if(!$_GET['category_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendInfo($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$category = new ilCalendarCategory((int) $_GET['category_id']);
$category->setTitle(ilUtil::stripSlashes($_POST['title']));
$category->setColor('#'.ilUtil::stripSlashes($_POST['color']));
$category->update();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarCategoryGUI::$ctrl
protected

Definition at line 42 of file class.ilCalendarCategoryGUI.php.

ilCalendarCategoryGUI::$editable = false
protected

Definition at line 45 of file class.ilCalendarCategoryGUI.php.

Referenced by isEditable().

ilCalendarCategoryGUI::$lng
protected

Definition at line 43 of file class.ilCalendarCategoryGUI.php.

Referenced by __construct(), and initFormSearch().

ilCalendarCategoryGUI::$user_id
protected

Definition at line 40 of file class.ilCalendarCategoryGUI.php.

Referenced by shareAssign().

ilCalendarCategoryGUI::$visible = false
protected

Definition at line 46 of file class.ilCalendarCategoryGUI.php.

const ilCalendarCategoryGUI::SEARCH_ROLE = 2

Definition at line 38 of file class.ilCalendarCategoryGUI.php.

Referenced by initFormSearch().

const ilCalendarCategoryGUI::SEARCH_USER = 1

Definition at line 37 of file class.ilCalendarCategoryGUI.php.

Referenced by initFormSearch().


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