ILIAS  Release_4_2_x_branch Revision 61807
 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
 details ()
 show calendar details
 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
 unshare ()
 Stop calendar sharing.
 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.
 manage ()

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 117 of file class.ilCalendarCategoryGUI.php.

References $tpl, and initFormCategory().

Referenced by save().

{
global $tpl, $ilTabs;
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
$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 1224 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 details().

{
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 1080 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 986 of file class.ilCalendarCategoryGUI.php.

References $_GET, $_POST, $tpl, details(), and ilUtil\sendFailure().

{
global $tpl;
if(!count($_POST['appointments']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->details();
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'),'details');
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 106 of file class.ilCalendarCategoryGUI.php.

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

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

References $ilErr.

Referenced by details(), edit(), and unshare().

{
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 302 of file class.ilCalendarCategoryGUI.php.

References $_POST, $tpl, manage(), and ilUtil\sendFailure().

{
global $tpl;
if(!$_POST['selected_cat_ids'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->manage();
}
/*
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->manage();
return false;
}
*/
include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
$confirmation_gui = new ilConfirmationGUI();
$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'),'manage');
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
foreach($_POST['selected_cat_ids'] as $cat_id)
{
$category = new ilCalendarCategory((int)$cat_id);
$confirmation_gui->addItem('category_id[]',$cat_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 347 of file class.ilCalendarCategoryGUI.php.

References $_POST, $ilCtrl, manage(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilCtrl;
if(!$_POST['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->manage();
}
/*
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->edit();
return false;
}
*/
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
foreach($_POST['category_id'] as $cat_id)
{
$category = new ilCalendarCategory((int)$cat_id);
$category->delete();
}
ilUtil::sendSuccess($this->lng->txt('cal_cal_deleted'), true);
$ilCtrl->redirect($this, 'manage');
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::deleteAppointments ( )
protected

delete appointments

protected

Returns

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

References $_POST, ilCalendarCategoryAssignments\_deleteByAppointmentId(), details(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!count($_POST['appointments']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->details();
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::sendSuccess($this->lng->txt('settings_saved'));
$this->details();
return true;
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::details ( )
protected

show calendar details

protected

Returns

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

References $_GET, $tpl, addReferenceLinks(), checkVisible(), readPermissions(), ilUtil\sendFailure(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by askDeleteAppointments(), and deleteAppointments().

{
global $tpl;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
$this->checkVisible();
$category = new ilCalendarCategory((int) $_GET['category_id']);
if(!in_array($category->getType(), array(ilCalendarCategory::TYPE_CH, ilCalendarCategory::TYPE_BOOK)))
{
include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
$toolbar = new ilToolbarGui();
$toolbar->addButton($this->lng->txt("cal_add_appointment"), $this->ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add"));
$toolbar = $toolbar->getHTML();
}
// 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;
// nothing to do
break;
}
$tpl->setContent($toolbar.$info->getHTML().$this->showAssignedAppointments());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::edit ( )
protected

edit category

protected

Returns

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

References $_GET, $tpl, checkVisible(), initFormCategory(), isEditable(), manage(), readPermissions(), and ilUtil\sendFailure().

Referenced by update().

{
global $tpl, $ilTabs;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
$this->checkVisible();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->manage();
return false;
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
$this->initFormCategory('edit');
$tpl->setContent($this->form->getHTML());
}

+ 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,'details');
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
$app = new ilCalendarAppointmentGUI($this->seed,$this->seed, (int) $_GET['app_id']);
$this->ctrl->forwardCommand($app);
break;
default:
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
if(!in_array($cmd, array("details", "askDeleteAppointments", "deleteAppointments")))
{
return true;
}
}
return false;
}
ilCalendarCategoryGUI::getHTML ( )

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

References $title, and appendCalendarSelection().

{
global $ilUser;
/*
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
$hidden_cats = ilCalendarHidden::_getInstanceByUserId($ilUser->getId());
$visible_cats = ilCalendarCategories::_getInstance($ilUser->getId());
$visible_cat_ids = implode(',',array_diff($visible_cats->getCategories(),$hidden_cats->getHidden()));
*/
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 843 of file class.ilCalendarCategoryGUI.php.

References $_GET, $title, ilCalendarCategories\_getInstance(), ilCalendarSettings\_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('manage',$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('manage',$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 799 of file class.ilCalendarCategoryGUI.php.

References $_POST, $lng, 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('manage',$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 1214 of file class.ilCalendarCategoryGUI.php.

References $editable.

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

{
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::manage ( )
protected

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

References $ilCtrl, $lng, and $tpl.

Referenced by confirmDelete(), delete(), edit(), save(), shareSearch(), and update().

{
global $lng, $ilCtrl, $tpl;
include_once('./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
$table_gui = new ilCalendarManageTableGUI($this);
$table_gui->parse();
include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
$toolbar = new ilToolbarGui();
$toolbar->addButton($lng->txt("add"), $ilCtrl->getLinkTarget($this, "add"));
$tpl->setContent($toolbar->getHTML().$table_gui->getHTML());
}

+ Here is the caller graph for this function:

ilCalendarCategoryGUI::readPermissions ( )
private

read permissions

private

Parameters
@return

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

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

Referenced by details(), edit(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), unshare(), 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;
$this->editable = $ilUser->getId() == $cat->getCategoryID();
$this->visible = true;
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 135 of file class.ilCalendarCategoryGUI.php.

References $_POST, add(), manage(), ilUtil\sendFailure(), ilUtil\sendSuccess(), 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::sendFailure($this->lng->txt('fill_out_all_required_fields'));
$this->add();
return false;
}
$category->add();
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
// $this->ctrl->returnToParent($this);
$this->manage();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::saveSelection ( )

save selection of categories

public

Parameters
@return

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

References $_POST, ilCalendarCategories\_getInstance(), ilCalendarHidden\_getInstanceByUserId(), and ilUtil\sendSuccess().

{
global $ilUser;
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
$selected_cat_ids = $_POST['selected_cat_ids'] ? $_POST['selected_cat_ids'] : array();
$shown_cat_ids = $_POST['shown_cat_ids'] ? $_POST['shown_cat_ids'] : array();
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
$cat_ids = $cats->getCategories();
$hidden_cats = ilCalendarHidden::_getInstanceByUserId($ilUser->getId());
$hidden_cat_ids = $hidden_cats->getHidden();
$hidden = array();
foreach($hidden_cat_ids as $hidden_cat_id)
{
if( !in_array($hidden_cat_id,$shown_cat_ids) )
{
$hidden[] = $hidden_cat_id;
}
}
foreach($shown_cat_ids as $shown_cat_id)
{
$shown_cat_id = (int)$shown_cat_id;
if( !in_array($shown_cat_id, $selected_cat_ids) )
{
$hidden[] = $shown_cat_id;
}
}
$hidden_categories = ilCalendarHidden::_getInstanceByUserId($this->user_id);
$hidden_categories->hideSelected($hidden);
$hidden_categories->save();
ilUtil::sendSuccess($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 618 of file class.ilCalendarCategoryGUI.php.

References $_GET, $_POST, $user_id, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sharePerformSearch(), shareSearch(), and ilCalendarShared\TYPE_USR.

{
global $ilUser;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['user_ids']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->shareSearch();
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::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
$this->shareSearch();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::shareAssignRoles ( )

share assign roles

public

Parameters
@return

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

References $_GET, $_POST, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sharePerformSearch(), shareSearch(), and ilCalendarShared\TYPE_ROLE.

{
global $ilUser;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['role_ids']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->shareSearch();
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::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
$this->shareSearch();
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::shareDeassign ( )

desassign users/roles from calendar

public

Parameters
@return

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

References $_GET, $_POST, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and shareSearch().

{
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
if(!count($_POST['obj_ids']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->shareSearch();
return false;
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->shareSearch();
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::sendSuccess($this->lng->txt('cal_unshared_selected_usr'));
$this->shareSearch();
return true;
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::sharePerformSearch ( )

share perform search

public

Returns

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

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

Referenced by shareAssign(), and shareAssignRoles().

{
global $ilTabs;
$this->lng->loadLanguageModule('search');
if(!$_GET['category_id'])
{
ilUtil::sendFailure($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::sendFailure($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::sendFailure($this->lng->txt('search_no_match'));
$this->shareSearch();
return true;
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt("cal_back_to_search"), $this->ctrl->getLinkTarget($this, "shareSearch"));
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 471 of file class.ilCalendarCategoryGUI.php.

References $_GET, $_SESSION, $tpl, initFormSearch(), isEditable(), manage(), readPermissions(), and ilUtil\sendFailure().

Referenced by shareAssign(), shareAssignRoles(), shareDeassign(), and sharePerformSearch().

{
global $tpl, $ilTabs;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->manage();
return false;
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
$_SESSION['cal_query'] = '';
$this->ctrl->saveParameter($this,'category_id');
$this->initFormSearch();
include_once('./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
$table = new ilCalendarSharedListTableGUI($this,'shareSearch');
$table->setTitle($this->lng->txt('cal_shared_header'));
$table->setCalendarId((int) $_GET['category_id']);
$table->parse();
$tpl->setContent($this->form->getHTML().$table->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 966 of file class.ilCalendarCategoryGUI.php.

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

{
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, 'details', (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:

ilCalendarCategoryGUI::showCategories ( )

public

Parameters
@return

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

References $_GET, $_POST, and $_SESSION.

{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
$table_gui = new ilCalendarCategoryTableGUI($this);
$nav_parameter = $table_gui->getNavParameter();
if($_POST[$nav_parameter] != "")
{
if($_POST[$nav_parameter."1"] != $_POST[$nav_parameter])
{
$nav_value = $_POST[$nav_parameter."1"];
}
elseif($_POST[$nav_parameter."2"] != $_POST[$nav_parameter])
{
$nav_value = $_POST[$nav_parameter."2"];
}
}
else
{
$nav_value = $_GET[$nav_parameter];
}
$_SESSION[$nav_parameter] = $nav_value;
$this->ctrl->returnToParent($this);
}
ilCalendarCategoryGUI::showRoleList (   $a_ids = array())
protected

show role list

protected

Parameters
arrayarray of role ids
Returns

Definition at line 774 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('manage',$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 749 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('manage',$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 1123 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::unshare ( )
protected

Stop calendar sharing.

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

References $_GET, checkVisible(), ilCalendarShared\isSharedWithUser(), readPermissions(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilUser;
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
$this->checkVisible();
include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
$status = new ilCalendarSharedStatus($ilUser->getId());
include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
if(!ilCalendarShared::isSharedWithUser($ilUser->getId(), $_GET['category_id']))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'));
$this->inbox();
return false;
}
$status->decline($_GET['category_id']);
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this, 'manage');
}

+ Here is the call graph for this function:

ilCalendarCategoryGUI::update ( )
protected

update

protected

Returns

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

References $_GET, $_POST, edit(), isEditable(), manage(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

{
if(!$_GET['category_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->returnToParent($this);
}
$this->readPermissions();
if(!$this->isEditable())
{
ilUtil::sendFailure($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::sendSuccess($this->lng->txt('settings_saved'),true);
// $this->ctrl->returnToParent($this);
$this->manage();
}

+ 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(), initFormSearch(), and manage().

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: