ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCalendarInboxSharedTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
26 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
27 
37 {
38  protected $cal_data = array();
39 
48  public function __construct($a_parent_obj, $a_parent_cmd)
49  {
50  global $ilCtrl;
51 
52  parent::__construct($a_parent_obj, $a_parent_cmd);
53 
54  $this->setRowTemplate('tpl.calendar_inbox_shared_row.html', 'Services/Calendar');
55 
56  $this->addColumn('', 'cal_ids', '1px');
57  $this->addColumn($this->lng->txt('name'), 'title', '50%');
58  $this->addColumn($this->lng->txt('cal_apps'), 'apps', '20%');
59  $this->addColumn($this->lng->txt('create_date'), 'create_date', '20%');
60  $this->addColumn($this->lng->txt('cal_accepted'), 'accepted', '5%');
61 
62  $this->addMultiCommand('acceptShared', $this->lng->txt('cal_share_accept'));
63  $this->addMultiCommand('declineShared', $this->lng->txt('cal_share_decline'));
64  $this->setSelectAllCheckbox('cal_ids');
65  $this->setPrefix('shared');
66 
67  $this->setFormAction($ilCtrl->getFormActionByClass(get_class($this->getParentObject())));
68  $this->setTitle($this->lng->txt('cal_shared_calendars'));
69  $this->parse();
70  }
71 
79  public function fillRow($a_set)
80  {
81  $this->tpl->setVariable('VAL_ID', $a_set['cal_id']);
82  $this->tpl->setVariable('CALENDAR_NAME', $a_set['name']);
83  $this->tpl->setVariable('TXT_FROM', $this->lng->txt('owner'));
84 
85  $name = ilObjUser::_lookupName($a_set['owner']);
86  $this->tpl->setVariable('LASTNAME', $name['lastname']);
87  $this->tpl->setVariable('FIRSTNAME', $name['firstname']);
88 
89  $this->tpl->setVariable('APPS_COUNT', $a_set['apps']);
90  $this->tpl->setVariable('CREATE_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['create_date'], IL_CAL_DATETIME)));
91 
92  if ($a_set['accepted']) {
93  $this->tpl->setVariable('ACC_IMG', ilUtil::getImagePath('icon_ok.svg'));
94  $this->tpl->setVariable('ALT_ACC', $this->lng->txt('cal_accepted'));
95  }
96  if ($a_set['declined']) {
97  $this->tpl->setVariable('DEC_IMG', ilUtil::getImagePath('icon_ok.svg'));
98  $this->tpl->setVariable('ALT_DEC', $this->lng->txt('cal_declined'));
99  }
100  }
101 
102 
110  public function setCalendars($a_calendars)
111  {
112  $this->cal_data = $a_calendars ? $a_calendars : array();
113  }
114 
122  public function parse()
123  {
124  global $ilUser;
125 
126  $status = new ilCalendarSharedStatus($ilUser->getId());
127  $calendars = $status->getOpenInvitations();
128 
129  $this->setData($calendars);
130 
131  return count($calendars) ? true : false;
132  }
133 }
static _lookupName($a_user_id)
lookup user name
const IL_CAL_DATETIME
Stores status (accepted/declined) of shared calendars.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
getParentObject()
Get parent object.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
if($format !==null) $name
Definition: metadata.php:146
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
Show shared calendars for a specific user.
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setPrefix($a_prefix)
Date and time handling
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
getOpenInvitations()
Get open invitations.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.